@arcgis/core 4.33.0-next.20250522 → 4.33.0-next.20250524

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 (484) hide show
  1. package/Map.js +1 -1
  2. package/WebScene.js +1 -1
  3. package/analysis/DimensionAnalysis.js +1 -1
  4. package/analysis/LineOfSightAnalysis.js +1 -1
  5. package/analysis/ViewshedAnalysis.js +1 -1
  6. package/arcade/Voxel.js +1 -1
  7. package/arcade/functions/knowledgegraph.js +1 -1
  8. package/assets/esri/core/workers/RemoteClient.js +1 -1
  9. package/assets/esri/core/workers/chunks/{253bcc3cc7bc4c2dc6ea.js → 03db109e9b695528c35d.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{fc61d02286b6ff5447cc.js → 09da6b3085fc84cd69d5.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{bf3555f91492a1a3b613.js → 09f76ca9b47b465c934f.js} +1 -1
  12. package/assets/esri/core/workers/chunks/0b70b2ee62904318a12c.js +1 -0
  13. package/assets/esri/core/workers/chunks/{42d9989b2aad3ac28d4d.js → 0d78fc2c2bc1152f84db.js} +1 -1
  14. package/assets/esri/core/workers/chunks/0fd826e7f64a37aaaa1e.js +1 -0
  15. package/assets/esri/core/workers/chunks/{ead5d4e271effc04def3.js → 1415d4e2f5f3193be004.js} +1 -1
  16. package/assets/esri/core/workers/chunks/17e43a050fbf8dc87588.js +1 -0
  17. package/assets/esri/core/workers/chunks/1ee6e9a88f0676032e91.js +1 -0
  18. package/assets/esri/core/workers/chunks/{1c86aa3802d9ae0230ae.js → 28e31ac00dc95a1318e9.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{23f6e98ef22f099f846c.js → 330f1996cfc3e9c952cc.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{ece68a25651ef03fc95d.js → 342f61e784c9364a493b.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{0d23610475c85385fbff.js → 355e6bcdb401ada71f39.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{bba6d7615d8f3862fe70.js → 36f0046ff6b46adce7b7.js} +1 -1
  23. package/assets/esri/core/workers/chunks/3adcf78ed1e7cd82666d.js +1 -0
  24. package/assets/esri/core/workers/chunks/{b0522dffa5600345c07e.js → 3e85e63148b5e93d3074.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{14b3c18581b31c93af82.js → 41cbba9b286cf5558a9c.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{d2ebb72a43d995ed368a.js → 42bb9bb6fe44a47d9b81.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{6ee41e9c92ed8ba4c763.js → 4dd0a5f327fa5fc7249d.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{36b0d6b4089a96475201.js → 51ba7345c31e6eb79060.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{66e79aa02b3aa12b3778.js → 5200be8bce60fa831026.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{6b23ca6570357f9fb724.js → 52a57106a41b8c9483d7.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{fa63b0f7fa799cb2f81d.js → 562800b0af52a38a311b.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{585c7b485c42555ec554.js → 61f9747c960d959b571b.js} +2 -2
  33. package/assets/esri/core/workers/chunks/{9fc35ec8185beba96715.js → 632d1a1287dde980479e.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{1d043965dcdc11b3aeaa.js → 63852887b3f07d50f7c9.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{32ee2708edd307954125.js → 7174150bf7595c22f976.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{e77371ddbaf4b2d9be8d.js → 74c0db9e3a62e9839b23.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{6ecc3a3737ae8622dfa4.js → 7b12607633bbdc318936.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{06eb4832b6c86744e52e.js → 8008f5479f4d16964088.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{d839a237d5edc243d645.js → 8aa8f9986b966ccb64e2.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{12e99071f6582f6caeaf.js → 8b3d1973eb75b81b0fb4.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{67338948e470c1251d8a.js → 8d14e957219364a81d5f.js} +3 -3
  42. package/assets/esri/core/workers/chunks/92a5dccb328229a9336b.js +1 -0
  43. package/assets/esri/core/workers/chunks/{631205dc4d73d49ec9ed.js → 95507ff0a243e451b99e.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{1051a5a57b2fb843a555.js → 9cd55043f3d789f41815.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{40f54c4f8ae63c6f3df9.js → a32dcd5bc4680374d30c.js} +1 -1
  46. package/assets/esri/core/workers/chunks/ad4f65d764654c70a117.js +1 -0
  47. package/assets/esri/core/workers/chunks/b2a6afa0cd537805b4b8.js +1 -0
  48. package/assets/esri/core/workers/chunks/{ac2607f1e8cd2e99907c.js → b70f65ccee01d48a610e.js} +2 -2
  49. package/assets/esri/core/workers/chunks/{571252c9822d73cf7b01.js → b845586219f284a215b2.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{d7b640f7a181bd26c7c7.js → bac5e1d50b69f0d94694.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{9ca480eb8b2312381ccf.js → bcadcb709e622f2aaaf9.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{c16e0da7a19310c71e8b.js → c6cd8784a3e222eb2d4a.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{97c148adf0347c69a79c.js → c9604f8df909ec4fad46.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{b87fec1753f164c845c5.js → ca76950d81ab4ebb65e1.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{faa40ef04604c7cce706.js → cb63ea6a53d3c2fc3179.js} +1 -1
  56. package/assets/esri/core/workers/chunks/cc4fe89e4f604e3c52ae.js +1 -0
  57. package/assets/esri/core/workers/chunks/{54f4a1131f99468db076.js → d33a5d79f2163ad62b1d.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{55f087bca75c3f2a4515.js → d3c0d7799c92c6f0e7d3.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{ca60b34c3e1ed2ff5934.js → dd2b316baae02bbdddac.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{e3c1aea34ece8336dae1.js → e9aa1d9ded8a52a40c57.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{80b596496800e8d60eb8.js → ed75e0962358523f4439.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{0cf979a093e9744d1e80.js → ef7955a2509be0f03ca2.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{b5d68d8460b7c15001dd.js → f1c6df5cf2ccb6ac47a1.js} +1 -1
  64. package/assets/esri/core/workers/chunks/f2aa8090827086c62dde.js +1 -0
  65. package/assets/esri/core/workers/chunks/{523046e04679e301797d.js → f3d97a4c4f433adbdab5.js} +1 -1
  66. package/assets/esri/core/workers/chunks/fd4c020297badcb81947.js +1 -0
  67. package/assets/esri/core/workers/chunks/{9a06476b834584d00d5c.js → feaf79b69d2e2a1f2aa2.js} +1 -1
  68. package/assets/esri/themes/base/widgets/_Editor.scss +1 -0
  69. package/assets/esri/themes/dark/main.css +1 -1
  70. package/assets/esri/themes/light/main.css +1 -1
  71. package/assets/esri/themes/light/view.css +1 -1
  72. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_no.json +1 -1
  73. package/assets/esri/widgets/Directions/t9n/Directions_de.json +1 -1
  74. package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
  75. package/assets/esri/widgets/Editor/t9n/Editor_ar.json +1 -1
  76. package/assets/esri/widgets/Editor/t9n/Editor_bg.json +1 -1
  77. package/assets/esri/widgets/Editor/t9n/Editor_bs.json +1 -1
  78. package/assets/esri/widgets/Editor/t9n/Editor_ca.json +1 -1
  79. package/assets/esri/widgets/Editor/t9n/Editor_cs.json +1 -1
  80. package/assets/esri/widgets/Editor/t9n/Editor_da.json +1 -1
  81. package/assets/esri/widgets/Editor/t9n/Editor_de.json +1 -1
  82. package/assets/esri/widgets/Editor/t9n/Editor_el.json +1 -1
  83. package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
  84. package/assets/esri/widgets/Editor/t9n/Editor_es.json +1 -1
  85. package/assets/esri/widgets/Editor/t9n/Editor_et.json +1 -1
  86. package/assets/esri/widgets/Editor/t9n/Editor_fi.json +1 -1
  87. package/assets/esri/widgets/Editor/t9n/Editor_fr.json +1 -1
  88. package/assets/esri/widgets/Editor/t9n/Editor_he.json +1 -1
  89. package/assets/esri/widgets/Editor/t9n/Editor_hr.json +1 -1
  90. package/assets/esri/widgets/Editor/t9n/Editor_hu.json +1 -1
  91. package/assets/esri/widgets/Editor/t9n/Editor_id.json +1 -1
  92. package/assets/esri/widgets/Editor/t9n/Editor_it.json +1 -1
  93. package/assets/esri/widgets/Editor/t9n/Editor_ja.json +1 -1
  94. package/assets/esri/widgets/Editor/t9n/Editor_ko.json +1 -1
  95. package/assets/esri/widgets/Editor/t9n/Editor_lt.json +1 -1
  96. package/assets/esri/widgets/Editor/t9n/Editor_lv.json +1 -1
  97. package/assets/esri/widgets/Editor/t9n/Editor_nl.json +1 -1
  98. package/assets/esri/widgets/Editor/t9n/Editor_no.json +1 -1
  99. package/assets/esri/widgets/Editor/t9n/Editor_pl.json +1 -1
  100. package/assets/esri/widgets/Editor/t9n/Editor_pt-BR.json +1 -1
  101. package/assets/esri/widgets/Editor/t9n/Editor_pt-PT.json +1 -1
  102. package/assets/esri/widgets/Editor/t9n/Editor_ro.json +1 -1
  103. package/assets/esri/widgets/Editor/t9n/Editor_ru.json +1 -1
  104. package/assets/esri/widgets/Editor/t9n/Editor_sk.json +1 -1
  105. package/assets/esri/widgets/Editor/t9n/Editor_sl.json +1 -1
  106. package/assets/esri/widgets/Editor/t9n/Editor_sr.json +1 -1
  107. package/assets/esri/widgets/Editor/t9n/Editor_sv.json +1 -1
  108. package/assets/esri/widgets/Editor/t9n/Editor_th.json +1 -1
  109. package/assets/esri/widgets/Editor/t9n/Editor_tr.json +1 -1
  110. package/assets/esri/widgets/Editor/t9n/Editor_uk.json +1 -1
  111. package/assets/esri/widgets/Editor/t9n/Editor_vi.json +1 -1
  112. package/assets/esri/widgets/Editor/t9n/Editor_zh-CN.json +1 -1
  113. package/assets/esri/widgets/Editor/t9n/Editor_zh-HK.json +1 -1
  114. package/assets/esri/widgets/Editor/t9n/Editor_zh-TW.json +1 -1
  115. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ar.json +1 -1
  116. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_bg.json +1 -1
  117. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_bs.json +1 -1
  118. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ca.json +1 -1
  119. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_cs.json +1 -1
  120. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_da.json +1 -1
  121. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_de.json +1 -1
  122. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_el.json +1 -1
  123. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_es.json +1 -1
  124. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_et.json +1 -1
  125. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_fi.json +1 -1
  126. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_fr.json +1 -1
  127. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_he.json +1 -1
  128. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_hr.json +1 -1
  129. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_hu.json +1 -1
  130. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_id.json +1 -1
  131. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_it.json +1 -1
  132. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ja.json +1 -1
  133. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ko.json +1 -1
  134. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_lt.json +1 -1
  135. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_lv.json +1 -1
  136. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_nl.json +1 -1
  137. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_no.json +1 -1
  138. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_pl.json +1 -1
  139. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_pt-BR.json +1 -1
  140. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_pt-PT.json +1 -1
  141. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ro.json +1 -1
  142. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ru.json +1 -1
  143. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sk.json +1 -1
  144. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sl.json +1 -1
  145. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sr.json +1 -1
  146. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sv.json +1 -1
  147. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_th.json +1 -1
  148. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_tr.json +1 -1
  149. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_uk.json +1 -1
  150. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_vi.json +1 -1
  151. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_zh-CN.json +1 -1
  152. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_zh-HK.json +1 -1
  153. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_zh-TW.json +1 -1
  154. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable.json +1 -1
  155. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ar.json +1 -1
  156. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bg.json +1 -1
  157. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bs.json +1 -1
  158. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ca.json +1 -1
  159. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_cs.json +1 -1
  160. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_da.json +1 -1
  161. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_de.json +1 -1
  162. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_el.json +1 -1
  163. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_en.json +1 -1
  164. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_es.json +1 -1
  165. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_et.json +1 -1
  166. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fi.json +1 -1
  167. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fr.json +1 -1
  168. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_he.json +1 -1
  169. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hr.json +1 -1
  170. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hu.json +1 -1
  171. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_id.json +1 -1
  172. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_it.json +1 -1
  173. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ja.json +1 -1
  174. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ko.json +1 -1
  175. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lt.json +1 -1
  176. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lv.json +1 -1
  177. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nl.json +1 -1
  178. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_no.json +1 -1
  179. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pl.json +1 -1
  180. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-BR.json +1 -1
  181. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-PT.json +1 -1
  182. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ro.json +1 -1
  183. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ru.json +1 -1
  184. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sk.json +1 -1
  185. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sl.json +1 -1
  186. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sr.json +1 -1
  187. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sv.json +1 -1
  188. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_th.json +1 -1
  189. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_tr.json +1 -1
  190. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_uk.json +1 -1
  191. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_vi.json +1 -1
  192. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-CN.json +1 -1
  193. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-HK.json +1 -1
  194. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-TW.json +1 -1
  195. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
  196. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
  197. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
  198. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
  199. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
  200. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
  201. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
  202. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
  203. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
  204. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
  205. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
  206. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
  207. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
  208. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
  209. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
  210. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
  211. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
  212. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
  213. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
  214. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
  215. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
  216. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
  217. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
  218. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
  219. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_no.json +1 -1
  220. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
  221. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
  222. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
  223. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
  224. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
  225. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
  226. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
  227. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
  228. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
  229. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
  230. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
  231. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
  232. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
  233. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
  234. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
  235. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
  236. package/chunks/FocusAreaColor.glsl.js +10 -8
  237. package/chunks/Laserlines.glsl.js +2 -2
  238. package/chunks/aiServices.js +1 -1
  239. package/chunks/cameraUtilsSpherical.js +1 -1
  240. package/chunks/persistableUrlUtils.js +1 -1
  241. package/chunks/sphere.js +1 -1
  242. package/chunks/vec42.js +1 -1
  243. package/core/accessorSupport/decorators/persistable.js +1 -1
  244. package/core/accessorSupport/ensureType.js +1 -1
  245. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  246. package/core/libs/gl-matrix-2/math/vec4.js +1 -1
  247. package/effects/FocusArea.js +5 -0
  248. package/effects/FocusAreaOutline.js +5 -0
  249. package/effects/FocusAreas.js +5 -0
  250. package/geometry/projection/projectPointToVector.js +1 -1
  251. package/geometry/projection/projectVectorToPoint.js +1 -1
  252. package/geometry/projection/projectVectorToVector.js +1 -1
  253. package/geometry/projection.js +1 -1
  254. package/geometry/projectionUtils.js +5 -0
  255. package/geometry/support/frustum.js +1 -1
  256. package/geometry/support/meshUtils/elevation.js +1 -1
  257. package/geometry/support/meshUtils/extent.js +1 -1
  258. package/geometry/support/sphere.js +1 -1
  259. package/interfaces.d.ts +282 -133
  260. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  261. package/layers/IntegratedMeshLayer.js +1 -1
  262. package/layers/MapNotesLayer.js +1 -1
  263. package/layers/OrientedImageryLayer.js +1 -1
  264. package/layers/RouteLayer.js +1 -1
  265. package/layers/VideoLayer.js +1 -1
  266. package/layers/graphics/applyEditsUtils.js +1 -1
  267. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  268. package/layers/graphics/data/QueryEngine.js +1 -1
  269. package/layers/graphics/data/projectionSupport.js +1 -1
  270. package/layers/graphics/data/queryUtils.js +1 -1
  271. package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
  272. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  273. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  274. package/layers/ogc/wfsUtils.js +1 -1
  275. package/layers/orientedImagery/core/ExposurePoint.js +1 -1
  276. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  277. package/layers/orientedImagery/core/utils.js +1 -1
  278. package/layers/orientedImagery/queries.js +1 -1
  279. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  280. package/layers/orientedImagery/transformations/updateElevationUtils.js +1 -1
  281. package/layers/orientedImagery/transformations/utils.js +1 -1
  282. package/layers/support/ControlPointsGeoreference.js +1 -1
  283. package/layers/support/CornersGeoreference.js +1 -1
  284. package/layers/support/ElevationQuery.js +1 -1
  285. package/layers/support/ExtentAndRotationGeoreference.js +1 -1
  286. package/layers/support/GeoreferenceBase.js +1 -1
  287. package/layers/support/LocalMediaElementSource.js +1 -1
  288. package/layers/support/MediaElementView.js +1 -1
  289. package/layers/support/PolygonCollection.js +1 -1
  290. package/layers/support/SceneModification.js +1 -1
  291. package/layers/support/Sublayer.js +1 -1
  292. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  293. package/layers/video/VideoController.js +1 -1
  294. package/networks/support/UNTraceConfiguration.js +1 -1
  295. package/networks/support/typeUtils.js +1 -1
  296. package/package.json +1 -1
  297. package/portal/schemas/definitions.js +1 -1
  298. package/portal/schemas/webScene.js +1 -1
  299. package/portal/support/portalItemUtils.js +1 -1
  300. package/renderers/support/AuthoringInfoVisualVariable.js +1 -1
  301. package/rest/knowledgeGraph/GraphAddFieldIndexResult.js +5 -0
  302. package/rest/knowledgeGraph/GraphAddNamedTypesResult.js +1 -1
  303. package/rest/knowledgeGraph/GraphAddPropertyResult.js +1 -1
  304. package/rest/knowledgeGraph/GraphDataModelOperationResult.js +5 -0
  305. package/rest/knowledgeGraph/GraphDeleteFieldIndexResult.js +5 -0
  306. package/rest/knowledgeGraph/GraphDeleteNamedTypeResult.js +1 -1
  307. package/rest/knowledgeGraph/GraphDeletePropertyResult.js +1 -1
  308. package/rest/knowledgeGraph/GraphUpdateNamedTypesResult.js +1 -1
  309. package/rest/knowledgeGraph/GraphUpdatePropertyResult.js +1 -1
  310. package/rest/knowledgeGraph/GraphUpdateSearchIndexResult.js +1 -1
  311. package/rest/knowledgeGraph/wasmInterface/updateToWasmEncodedFactories.js +1 -1
  312. package/rest/knowledgeGraph/wasmInterface/wasmToDataModelChangeResponseFactories.js +1 -1
  313. package/rest/knowledgeGraphService.js +1 -1
  314. package/rest/networks/support/CircuitPath.js +5 -0
  315. package/rest/networks/support/CircuitPathConnectivityElement.js +5 -0
  316. package/rest/networks/support/TraceLocation.js +1 -1
  317. package/rest/networks/support/TraceResult.js +1 -1
  318. package/smartMapping/renderers/pieChart.js +1 -1
  319. package/smartMapping/renderers/predominance.js +1 -1
  320. package/smartMapping/renderers/size.js +1 -1
  321. package/smartMapping/renderers/support/rendererUtils.js +1 -1
  322. package/smartMapping/renderers/support/spikeUtils.d.ts +4 -0
  323. package/smartMapping/renderers/support/spikeUtils.js +1 -1
  324. package/smartMapping/statistics/histogram.js +1 -1
  325. package/smartMapping/statistics/summaryStatistics.js +1 -1
  326. package/support/persistableUrlUtils.js +1 -1
  327. package/support/revision.js +1 -1
  328. package/views/2d/ViewStateManager.js +1 -1
  329. package/views/2d/constraints/GeometryConstraint.js +1 -1
  330. package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
  331. package/views/2d/grid/GridView2D.js +1 -1
  332. package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
  333. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  334. package/views/2d/layers/KMLLayerView2D.js +1 -1
  335. package/views/2d/layers/VideoLayerView2D.js +1 -1
  336. package/views/2d/viewpointUtils.js +1 -1
  337. package/views/3d/FocusAreasView.js +1 -1
  338. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
  339. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  340. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  341. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  342. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  343. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  344. package/views/3d/analysis/support/projectionUtils.js +1 -1
  345. package/views/3d/camera/constraintUtils/distance.js +1 -1
  346. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  347. package/views/3d/environment/EnvironmentManager.js +1 -1
  348. package/views/3d/interactive/Manipulator3D.js +1 -1
  349. package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
  350. package/views/3d/interactive/editingTools/media/MediaElementControllerControlPoints.js +1 -1
  351. package/views/3d/interactive/editingTools/media/MediaElementControllerShape.js +1 -1
  352. package/views/3d/interactive/editingTools/reshape/edgeOffsetUtils.js +1 -1
  353. package/views/3d/interactive/visualElements/DrapedVisualElementResources.js +1 -1
  354. package/views/3d/interactive/visualElements/support/Segment.js +1 -1
  355. package/views/3d/layers/FeatureLayerView3D.js +1 -1
  356. package/views/3d/layers/FlowSubView3D.js +1 -1
  357. package/views/3d/layers/I3SMeshWorkerHandle.js +1 -1
  358. package/views/3d/layers/SceneLayerWorker.js +1 -1
  359. package/views/3d/layers/TileLayerView3D.js +1 -1
  360. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  361. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  362. package/views/3d/layers/graphics/Graphics3DFeatureStore.js +1 -1
  363. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  364. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  365. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  366. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  367. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  368. package/views/3d/layers/graphics/focusAreaStyle.js +1 -1
  369. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  370. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
  371. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  372. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  373. package/views/3d/layers/support/FeatureTile.js +1 -1
  374. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  375. package/views/3d/layers/support/FeatureTileFetcher3DDebugger.js +1 -1
  376. package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
  377. package/views/3d/state/NearFarHeuristic.js +1 -1
  378. package/views/3d/state/ViewStateManager.js +1 -1
  379. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  380. package/views/3d/state/utils/navigationUtils.js +1 -1
  381. package/views/3d/support/cameraUtils.js +1 -1
  382. package/views/3d/support/geometryUtils/sphere.js +1 -1
  383. package/views/3d/support/sunUtils.js +1 -1
  384. package/views/3d/support/viewpointUtils.js +1 -1
  385. package/views/3d/terrain/ExtentHelper.js +1 -1
  386. package/views/3d/terrain/OverlayManager.js +1 -1
  387. package/views/3d/terrain/OverlayRenderer.js +1 -1
  388. package/views/3d/terrain/TextureFader.js +1 -1
  389. package/views/3d/webgl/RenderCamera.js +1 -1
  390. package/views/3d/webgl/RenderNode.js +1 -1
  391. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  392. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
  393. package/views/3d/webgl-engine/effects/focusArea/FocusAreaEffect.js +5 -0
  394. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  395. package/views/3d/webgl-engine/effects/focusArea/FocusAreaOutlineItem.js +5 -0
  396. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  397. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechniqueConfiguration.js +1 -1
  398. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  399. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  400. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  401. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  402. package/views/3d/webgl-engine/shaders/CompositingTechniqueConfiguration.js +1 -1
  403. package/views/3d/webgl-engine/shaders/FocusAreaColor.glsl.js +1 -1
  404. package/views/SceneView.js +1 -1
  405. package/views/VideoView.js +1 -1
  406. package/views/View2D.js +1 -1
  407. package/views/interactive/GraphicManipulator.js +1 -1
  408. package/views/interactive/dragEventPipeline.js +1 -1
  409. package/views/interactive/snapping/GridSnappingEngine.js +1 -1
  410. package/views/interactive/snapping/SnappingManager.js +1 -1
  411. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  412. package/views/layers/SceneLayerView.js +1 -1
  413. package/views/support/geodesicAreaMeasurementUtils.js +1 -1
  414. package/views/support/projectionUtils.js +1 -1
  415. package/views/webgl/FramebufferObject.js +1 -1
  416. package/views/webgl/RenderingContext.js +1 -1
  417. package/views/webgl/Texture.js +1 -1
  418. package/webscene/Slide.js +1 -1
  419. package/webscene/support/analysisUtils.js +1 -1
  420. package/widgets/AreaMeasurement3D.js +1 -1
  421. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  422. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  423. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  424. package/widgets/CoordinateConversion/support/Format.js +1 -1
  425. package/widgets/Daylight/DaylightViewModel.js +1 -1
  426. package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
  427. package/widgets/DirectLineMeasurement3D.js +1 -1
  428. package/widgets/Editor/EditorViewModel.js +1 -1
  429. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  430. package/widgets/Editor/UpdateFeaturesWorkflowData.js +1 -1
  431. package/widgets/Editor/UpdateWorkflow.js +1 -1
  432. package/widgets/Editor/Upload.js +1 -1
  433. package/widgets/Editor/components/Notices.js +1 -1
  434. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  435. package/widgets/Editor/workflowUtils.js +1 -1
  436. package/widgets/Editor.js +1 -1
  437. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  438. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  439. package/widgets/FeatureTable/FieldColumn.js +1 -1
  440. package/widgets/FeatureTable/Grid/EditorColumn.js +1 -1
  441. package/widgets/FeatureTable/support/tableUtils.js +1 -1
  442. package/widgets/FeatureTable.js +1 -1
  443. package/widgets/Features/FeaturesViewModel.js +1 -1
  444. package/widgets/LineOfSight.js +1 -1
  445. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  446. package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.js +1 -1
  447. package/widgets/OrientedImageryViewer/adapters/sketch/DataCaptureAdapter.js +1 -1
  448. package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
  449. package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +1 -1
  450. package/widgets/OrientedImageryViewer/adapters/view/MapViewAdapter.js +1 -1
  451. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  452. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  453. package/widgets/OrientedImageryViewer/components/NavigationAction.js +5 -0
  454. package/widgets/OrientedImageryViewer/components/NavigationActions.js +1 -1
  455. package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +5 -0
  456. package/widgets/OrientedImageryViewer/constants.js +1 -1
  457. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  458. package/widgets/OrientedImageryViewer.js +1 -1
  459. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  460. package/widgets/Sketch/SketchViewModel.js +1 -1
  461. package/widgets/Sketch.js +1 -1
  462. package/widgets/Slice.js +1 -1
  463. package/widgets/UtilityNetworkTrace/support/GeometryHandler.js +1 -1
  464. package/widgets/support/AnalysisViewModel.js +1 -1
  465. package/widgets/support/AnchorElementViewModel.js +1 -1
  466. package/widgets/support/GridControls/GridControlsViewModel.js +1 -1
  467. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  468. package/widgets/support/SelectionToolbar.js +1 -1
  469. package/widgets/support/tests.js +1 -1
  470. package/assets/esri/core/workers/chunks/094e8aae6dada24c8115.js +0 -1
  471. package/assets/esri/core/workers/chunks/24327d01cb2c5c55a4b7.js +0 -1
  472. package/assets/esri/core/workers/chunks/2b1486a466760d2152f5.js +0 -1
  473. package/assets/esri/core/workers/chunks/3a743653b786b010a57f.js +0 -1
  474. package/assets/esri/core/workers/chunks/417293f00b2c21cc3175.js +0 -1
  475. package/assets/esri/core/workers/chunks/62b2d3720693c93a60f2.js +0 -1
  476. package/assets/esri/core/workers/chunks/6d1e1a4fcb90ea8b6848.js +0 -1
  477. package/assets/esri/core/workers/chunks/7e6141b5baae47682f97.js +0 -1
  478. package/assets/esri/core/workers/chunks/87fc7b6c3e2d4f7775e2.js +0 -1
  479. package/assets/esri/core/workers/chunks/b06cb23048c32940f5de.js +0 -1
  480. package/assets/esri/core/workers/chunks/d3d98ea5b5e56fc60a31.js +0 -1
  481. package/views/FocusArea.js +0 -5
  482. package/views/FocusAreaOutline.js +0 -5
  483. package/views/FocusAreaOutlineItem.js +0 -5
  484. package/views/FocusAreas.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import"../../../../core/has.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{releaseMaybe as r}from"../../../../core/maybe.js";import{isPromiseLike as o}from"../../../../core/promiseUtils.js";import{normalFromMat4 as a,fromMat4 as n}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as i,multiply as l,invert as c,getTranslation as u}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m,IDENTITY as f,clone as p}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as d,f as g,g as x,t as _,o as y,n as b,b as T,d as v,h as w,e as M}from"../../../../chunks/vec32.js";import{create as R,ONES as C,ZEROS as j}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as A,ZEROS as P}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{canProjectWithoutEngine as O}from"../../../../geometry/projection.js";import{computeTranslationToOriginAndRotation as E}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as N}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToPoint as I}from"../../../../geometry/projection/projectVectorToPoint.js";import{fromBuffer as S,create as U,intersectsClippingArea as B}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as F}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as V,getContinuousIndexArray as L}from"../../../../geometry/support/Indices.js";import D from"../../../../geometry/support/MeshComponent.js";import G from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import $ from"../../../../geometry/support/MeshTextureTransform.js";import{isRelativeVertexSpace as H,isAbsoluteVertexSpace as k}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as q,isPlateCarree as z}from"../../../../geometry/support/spatialReferenceUtils.js";import{t as W}from"../../../../chunks/vec3.js";import{transformNormal as Y,transformVectorENUPlateCarree as Z,VectorType as J,transformVectorWMPlateCarree as K,projectNormalToPCPF as Q,transformTangent as X,projectTangentToPCPF as ee}from"../../../../geometry/support/meshUtils/projection.js";import{projectMeshVertexPositions as te}from"../../../../geometry/support/meshUtils/projectMeshVertexPositions.js";import{makeDehydratedPoint as re}from"../../../../layers/graphics/dehydratedPoint.js";import{MeshTransformUpdateAction as oe}from"../../../../layers/graphics/sources/interfaces.js";import{getEmissiveMode as ae}from"../../../../symbols/support/materialUtils.js";import{ViewingMode as ne}from"../../../ViewingMode.js";import{isEncodedMeshTexture as se}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as ie}from"../../glTF/internal/TextureTransformUtils.js";import{defaultSymbolLayerMemoryComplexity as le}from"./defaultSymbolComplexity.js";import{perObjectElevationAligner as ce}from"./ElevationAligners.js";import{needsElevationUpdates3D as ue,evaluateElevationInfoAtPoint as me}from"./elevationAlignmentUtils.js";import{Graphics3DMeshObject3DGraphicLayer as fe}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as pe}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as he}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as de,MeshFastUpdateProcessor as ge}from"./MeshFastUpdateProcessor.js";import{SymbolComplexity as xe}from"./SymbolComplexity.js";import{hasEdges as _e,createMaterial as ye}from"../support/edgeUtils.js";import{parseColorMixMode as be,encodeSymbolColor as Te}from"../support/symbolColorUtils.js";import{debugFlags as ve}from"../../support/debugFlags.js";import{Attribute as we}from"../../webgl-engine/lib/Attribute.js";import{AlphaDiscardMode as Me,CullFaceOptions as Re}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as Ce}from"../../webgl-engine/lib/Geometry.js";import{Object3D as je}from"../../webgl-engine/lib/Object3D.js";import{Texture as Ae}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as Pe}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as Oe}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as Ee}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as Ne,advancedMRRFactors as Ie,schematicMRRFactors as Se}from"../../webgl-engine/materials/pbrUtils.js";import{TextureWrapMode as Ue}from"../../../webgl/enums.js";import{GeometryType as Be}from"../../webgl-engine/lib/IntersectableGeometry.js";const Fe=["mesh"];class Ve extends he{constructor(e,t,r,o){super(e,t,r,o,rt(t)),this._materialInfoCache=new de,this._fastUpdateProcessor=new ge,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){ve.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new Ee({color:[1,0,1,1]}),this._debugTangentNormalMaterial=new Ee({color:[1,.5,0,1]}),this._debugFaceNormalMaterial=new Ee({color:[0,1,1,1]})),this.updateComplexity()}destroy(){super.destroy(),this._textures.forEach((e=>e.unload())),this._context.stage.removeTextures(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy()}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Fe,"fill on mesh-3d"))return null;const r=this.setGraphicElevationContext(t),o=e.renderingInfo;return this._createAs3DShape(t,o,r,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._updateMaterialParameters((e=>{e.material.setParameters({layerOpacity:r});const t=e.material.parameters;this._setMaterialTextureAlphaMode(t,e)})),e?.forEach((e=>t(e)?.layerOpacityChanged(r,this._context.isAsync)))}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,ue)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters((({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),e?.forEach((e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync))),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._updateMaterialParameters((({material:t})=>t.setParameters({usePBR:e}))),!0}updateTransform(e,t,r,o){if(!e.fastTransformUpdatesAllowed)return!1;const a=e.fastTransformUpdatesEnabled;switch(o){case oe.EnableFastUpdates:if(a)return!0;break;case oe.DisableFastUpdates:if(!a)return!0;break;default:if(!a)return!!this.updateTransform(e,t,r,oe.EnableFastUpdates)&&(e.autoDisableFastTransformUpdates((()=>this.updateTransform(e,t,r,oe.DisableFastUpdates))),!0)}const n=this._context.renderCoordsHelper.spatialReference,s=ut,{origin:i,transform:l}=r;if(!E(t,d(nt,i.x,i.y,i.z??0),s,n))return!1;switch(o){case oe.EnableFastUpdates:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case oe.DisableFastUpdates:this._fastUpdateProcessor.disable(e,this._materialInfoCache);break;case oe.UpdateFastLocalOrigin:e.updateFastLocalOrigin(s,l,this._context.localOriginFactory)}const{elevationContext:c}=e;c.centerPointInElevationSR=this._getCenterPointInElevationSR(s);const{elevationProvider:u,renderCoordsHelper:m}=this._context,f=(e,t)=>me(e,u,c,m,t);return e.alignedSampledElevation=ce(e,c,u.spatialReference,f,m,s),e.updateTransform(s,l,this._context.isAsync),e.updateAutoDisableFastTransformUpdates((()=>this.updateTransform(e,t,r,oe.DisableFastUpdates))),!0}computeComplexity(){if(!this._textures||0===this._textures.size)return super.computeComplexity();let e=0;for(const o of this._textures.values())e+=o.usedMemory;const t={...le(this.symbol,this.symbolLayer),resourceBytes:e},r=_e(this.symbolLayer)?2:0;return new xe({drawCallsPerFeature:r,memory:t})}_requiresSymbolVertexColors(){return this._drivenProperties.color||this._drivenProperties.opacity}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),o=!!e.vertexAttributes.color,a=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:o,hasVertexTangents:a,uid:`vc:${o},vt:${a},vct${t},svc:${r}`}}_materialProperties(e,t,r){const o=this._materialPropertiesDefault(e,r);if(!t.material)return o;const{color:a,colorTexture:n,colorTextureTransform:s,normalTexture:i,normalTextureTransform:l,doubleSided:c,alphaCutoff:u,alphaMode:m}=t.material,f=Xe(a),p=Xe(n),h=et(s),d=Xe(i),g=et(l);if(o.color=a,o.colorTexture=n,o.normalTexture=i,o.uid=`${o.uid},cmuid:${f},ctmuid:${p},cttuid:${h},ntmuid:${d},nttuid:${g},ds:${c},ac:${u},am:${m}`,t.material instanceof G){const{metallic:e,roughness:r,metallicRoughnessTexture:a,metallicRoughnessTextureTransform:n,emissiveColor:i,emissiveTexture:c,emissiveTextureTransform:u,occlusionTexture:m,occlusionTextureTransform:f}=t.material,p=Xe(a),h=et(n),d=Xe(i),g=Xe(c),x=et(u),_=Xe(m),y=et(f);o.metallic=e,o.roughness=r,o.metallicRoughnessTexture=a,o.emissiveColor=i,o.emissiveTexture=c,o.occlusionTexture=m,o.colorTextureTransform=We(s),o.normalTextureTransform=We(l),o.emissiveTextureTransform=We(u),o.occlusionTextureTransform=We(f),o.metallicRoughnessTextureTransform=We(n),o.uid=`${o.uid},mrm:${e},mrr:${r},mrt:${p},mrtt:${h},emuid:${d},etmuid:${g},ett:${x},otmuid:${_},ott:${y}`}return o}_getInternalTexture(e,t=!1,a=Me.Opaque){const n=Qe(e);if(!n)return null;const s=`${e.contentHash}/${a}`;let i=this._textures.get(s);if(i){const e=this._context.stage.renderView.textures;let t=null;const a=e.acquire(i.id);return null==a||o(a)||(i.events.on("unloaded",(()=>t=r(t))),t=a),i}let l=null;const c=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,u={wrap:Ye(e.wrap),noUnpackFlip:!0,maxAnisotropy:c,mipmap:c>1};return se(n)?(l=n.data,u.preMultiplyAlpha=!1,u.encoding=n.encoding):(l=n,u.preMultiplyAlpha=a!==Me.Opaque,u.compressionHandle=t?this._context.compressionHandle:void 0,u.compressionCallback=t?()=>this.updateComplexity():void 0),i=new Ae(l,u),this._textures.set(s,i),i.events.on("loaded",(()=>this.updateComplexity())),i.load(this._context.stage.renderView.renderingContext),this._context.stage.addTexture(i),i.events.on("unloaded",(()=>{this._textures.delete(s)})),i}_setInternalMaterialTextureParameters(t,r){if(null!=t.colorTexture){const e=r.textureAlphaMode!==Me.Opaque,o=this._getInternalTexture(t.colorTexture,e,r.textureAlphaMode);o?(r.textureId=o.id,r.textureAlphaPremultiplied=!!o.parameters.preMultiplyAlpha):r.textureId=void 0}t.normalTexture&&(r.normalTextureId=this._getInternalTexture(t.normalTexture)?.id),t.emissiveColor&&(r.emissiveBaseColor=e.toUnitRGB(t.emissiveColor)),t.emissiveTexture&&(r.emissiveTextureId=this._getInternalTexture(t.emissiveTexture)?.id),t.occlusionTexture&&(r.occlusionTextureId=this._getInternalTexture(t.occlusionTexture,!0)?.id),t.metallicRoughnessTexture&&(r.metallicRoughnessTextureId=this._getInternalTexture(t.metallicRoughnessTexture,!0)?.id)}_setInternalMaterialParameters(e,t,r){null!=e.color&&Ke(e.color,t,r),this._setInternalMaterialTextureParameters(e,t),t.colorTextureTransformMatrix=ie(e.colorTextureTransform),t.normalTextureTransformMatrix=ie(e.normalTextureTransform);const o=null!=e.normalTextureTransform?.scale?e.normalTextureTransform?.scale:h;t.scale=[o[0],o[1]],t.occlusionTextureTransformMatrix=ie(e.occlusionTextureTransform),t.emissiveTextureTransformMatrix=ie(e.emissiveTextureTransform),t.metallicRoughnessTextureTransformMatrix=ie(e.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(t,r=this.symbolLayer?.material?.color){const o=this._drivenProperties.color,a=this._drivenProperties.opacity;let n=this.symbolLayer.material?.colorMixMode??null;if(o)t.externalColor=A;else{const o=r??null;if(o){const r=e.toUnitRGBA(o);a&&(r[3]=1),t.externalColor=r}else n=null,t.externalColor=A}n&&(t.colorMixMode=n),t.castShadows=!!this.symbolLayer.castShadows,t.emissiveStrength=this.symbolLayer?.material?.emissive?.strength??1,t.emissiveSource=ae(this.symbolLayer?.material?.emissive?.source??"emissive")}_getOrCreateMaterial(t,r){const o=r.material?.color,a=r.material?.colorTexture,n=r.material?.alphaMode,s="blend"===n,i=!("opaque"===n)&&(Je(t)||null!=o&&o.a<1||a?.transparent||s),l=this._materialProperties(t,r,i),c=this._materialInfoCache.byUid(l.uid);if(c)return this._setInternalMaterialTextureParameters(l,c.material.parameters),c.material;const u={uid:l.uid,material:null,isComponentTransparent:i,alphaMode:r.material?r.material.alphaMode:"opaque"},m=Ne({normalTexture:l.normalTexture,metallicRoughnessTexture:l.metallicRoughnessTexture,metallicFactor:l.metallic,roughnessFactor:l.roughness,emissiveTexture:l.emissiveTexture,emissiveFactor:e.toUnitRGB(l.emissiveColor),occlusionTexture:l.occlusionTexture}),f={usePBR:this._usePBR(),isSchematic:m,hasVertexColors:l.hasVertexColors,hasSymbolColors:l.hasSymbolVertexColors,hasVertexTangents:l.hasVertexTangents,ambient:j,diffuse:C,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:Re.None,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,drivenOpacity:this.needsDrivenTransparentPass||u.isComponentTransparent};f.mrrFactors=m?Se:[l.metallic,l.roughness,Ie[2]],r.material&&(f.doubleSided=r.material.doubleSided,f.cullFace=r.material.doubleSided?Re.None:Re.Back,f.textureAlphaCutoff=r.material.alphaCutoff),this._setExternalMaterialParameters(f),this._setMaterialTextureAlphaMode(f,u),this._setInternalMaterialParameters(l,f,u);const p=new Oe(f,this._context);return u.material=p,this._materialInfoCache.set(l.uid,u),p}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchColor(e,t)}_preparePatchColor(e,t){if(!t.material||"partial"!==t.material.type)return;const r=t.material.diff;if(!r.color||"complete"!==r.color.type||null==r.color.newValue||null==r.color.oldValue)return;const o=r.color.newValue;delete r.color,e.symbolLayerStatePatches.push((()=>{this._updateMaterialParameters((e=>{const t=e.material.parameters;this._setExternalMaterialParameters(t,o),this._setMaterialTextureAlphaMode(t,e),e.material.setParameters({externalColor:t.externalColor})}))}))}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTextureAlphaMode(e,t){if("auto"===t.alphaMode){const r=this.needsDrivenTransparentPass||t.isComponentTransparent||(e.layerOpacity??1)<1||(e.opacity??1)<1||(e.externalColor?.[3]??1)<1;e.textureAlphaMode=r?Me.MaskBlend:Me.Opaque}else e.textureAlphaMode="opaque"===t.alphaMode?Me.Opaque:"mask"===t.alphaMode?Me.Mask:Me.Blend}_createFaceDebugNormals(e,t){const r=t.length,o=e.spatialReference.isGeographic?20015077/180:1,n=.1*Math.max(e.extent.width*o,e.extent.height*o,e.extent.zmax-e.extent.zmin),i=[],l=[],c=t[0].transformation,u=a(s(),c);for(let a=0;a<r;a++){const e=t[a].attributes.get(Pe.POSITION);if(!e)continue;const r=e.data,o=e.indices;for(let t=0;t<o.length;t+=3)ze(r,o,t,lt),qe(r,o,t,nt,st,it),g(nt,nt,st),g(nt,nt,it),x(nt,nt,1/3),_(nt,nt,c),i.push(...nt),y(lt,lt,u),b(lt,lt),T(nt,nt,lt,n),i.push(...nt),l.push(l.length),l.push(l.length)}return i.length?new Ce(this._debugFaceNormalMaterial,[[Pe.POSITION,new we(i,l,3,!0)]],null,Be.Line):null}_createPerVertexDebugVectors(e,t,r,o,i){const l=t.length,c=e.spatialReference.isGeographic?20015077/180:1,u=.1*i*Math.max(e.extent.width*c,e.extent.height*c,e.extent.zmax-e.extent.zmin),m=[],f=[],p=t[0].transformation,h=a(s(),p);r===Pe.TANGENT&&n(h,p);for(let a=0;a<l;a++){const e=t[a],o=e.attributes.get(Pe.POSITION),n=e.attributes.get(r);if(!o||!n)continue;const s=o.data,i=o.indices,l=n.data,c=n.indices;for(let t=0;t<i.length;t++){const e=3*i[t],r=c[t]*n.stride;d(nt,s[e+0],s[e+1],s[e+2]),_(nt,nt,p),m.push(...nt),d(st,l[r+0],l[r+1],l[r+2]),y(st,st,h),b(st,st),T(nt,nt,st,u),m.push(...nt),f.push(f.length),f.push(f.length)}}return m.length?new Ce(o,[[Pe.POSITION,new we(m,f,3,!0)]],null,Be.Line):null}_createAs3DShape(e,t,r,o){const a=e.geometry;if("mesh"!==a.type)return null;const n=this._createGeometryInfo(a,t,o);if(null==n)return null;const{geometries:s,objectTransformation:i}=n;if(ve.DRAW_MESH_GEOMETRY_NORMALS){const e=this._createPerVertexDebugVectors(a,s,Pe.NORMAL,this._debugVertexNormalMaterial,1),t=this._createPerVertexDebugVectors(a,s,Pe.TANGENT,this._debugTangentNormalMaterial,.5),r=this._createFaceDebugNormals(a,s);e&&s.push(e),t&&s.push(t),r&&s.push(r)}const l=this._context.layerViewUid,c=new je({geometries:s,layerViewUid:l,graphicUid:o,isElevationSource:!0});c.transformation=i;const u=ye(this.symbolLayer,{opacity:this._getLayerOpacity()}),m=u?new pe(s[0].material,u,this._context.slicePlaneEnabled):null,f=new fe(this,c,null,ce,r,m);this._fastUpdateProcessor.onAddGraphic(),f.needsElevationUpdates=ue(r.mode),f.useObjectOriginAsAttachmentOrigin=!0,f.fastTransformUpdatesAllowed=this._fastTransformUpdatesAllowed(a),r.centerPointInElevationSR=this._getCenterPointInElevationSR(c.transformation);const{elevationProvider:p,renderCoordsHelper:h}=this._context,d=(e,t)=>me(e,p,r,h,t);return f.alignedSampledElevation=ce(f,r,p.spatialReference,d,h),f}_fastTransformUpdatesAllowed(e){const{vertexSpace:t,spatialReference:r}=e;if(!H(t))return!1;const{type:o}=t,{view:a}=this._context.graphicsCoreOwner,{viewingMode:n}=a.state,s=a.spatialReference;return n===ne.Global&&"local"===o||n===ne.Local&&q(s,r)&&"georeferenced"===o&&!r.isGeographic}_getCenterPointInElevationSR(e){const t=re(0,0,0,this._context.elevationProvider.spatialReference??null);return I([e[12],e[13],e[14]],this._context.renderCoordsHelper.spatialReference,t),t}_passthroughReprojectionInfo(e){return e.reprojection===pt.NONE&&!!e.objectTransformation}_createPositionBuffer(e,t){const r=e.vertexAttributes.position;let o,a=r;if(t.reprojection===pt.NONE)return{position:a,georeferencedPositionBuffer:o};const n=t.reprojection===pt.RENDER?t.transformBeforeProject:null;n&&(a=W(new Float64Array(a.length),a,n));const{normal:s,tangent:i}=e.vertexAttributes;this._passthroughReprojectionInfo(t)||!s&&!i||(o=a);const l=a===r||a===o?new Float64Array(a.length):a;return N(a,e.spatialReference,0,l,this._context.renderCoordsHelper.spatialReference,0),{position:l,georeferencedPositionBuffer:o}}_createNormalBuffer(e,t,r,o){const a=e.vertexAttributes.normal;if(null==a)return null;let n=a;const s=o.reprojection===pt.RENDER?o.transformBeforeProject:null;s&&(n=Y(n,new Float32Array(n.length),s));const i=this._context.graphicsCoreOwner.view.viewingMode;if(o.reprojection===pt.NONE)return n;if("local"===i){if(!z(this._context.renderCoordsHelper.spatialReference))return n;if(null==r)return null;if(e.spatialReference.isGeographic){const e=n===a?new Float32Array(n.length):n;return Z(n,J.NORMAL,r,e)}if(e.spatialReference.isWebMercator){const e=n===a?new Float32Array(n.length):n;return K(n,J.NORMAL,r,e)}return n}if(null==r)return null;const l=n===a?new Float32Array(n.length):n,c=this._context.renderCoordsHelper.spatialReference;return Q(n,r,e.spatialReference,t,c,l)}_createTangentBuffer(e,t,r,o){const a=e.vertexAttributes.tangent;if(null==a)return null;let n=a;const s=o.reprojection===pt.RENDER?o.transformBeforeProject:null;s&&(n=X(n,new Float32Array(n.length),s));const i=this._context.graphicsCoreOwner.view.viewingMode;if(o.reprojection===pt.NONE)return n;if("local"===i){if(!z(this._context.renderCoordsHelper.spatialReference))return n;if(null==r)return null;if(e.spatialReference.isGeographic){const e=n===a?new Float32Array(n.length):n;return Z(n,J.TANGENT,r,e)}if(e.spatialReference.isWebMercator){const e=n===a?new Float32Array(n.length):n;return K(n,J.TANGENT,r,e)}return n}if(null==r)return null;const l=n===a?new Float32Array(n.length):n,c=this._context.renderCoordsHelper.spatialReference;return ee(n,r,e.spatialReference,t,c,l)}_createSymbolColorBuffer(e){if(this._requiresSymbolVertexColors()){const t=this._getVertexOpacityAndColor(e,this._getFallbackOpacityAndColor()),r=be(this.symbolLayer?.material?.colorMixMode),o=new Uint8Array(4);return Te(t,r,o),o}return null}_createBuffers(e,t){const r=e.vertexAttributes&&e.vertexAttributes.position;if(!r)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,a=e.vertexAttributes.uv,n=e.vertexAttributes.tangent;if(o&&o.length!==r.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(n&&n.length/4!=r.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(a&&a.length/2!=r.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const s=this._computeReprojectionInfo(e),{position:i,georeferencedPositionBuffer:l}=this._createPositionBuffer(e,s),c=tt(e),u=this._createSymbolColorBuffer(t),f=this._createNormalBuffer(e,i,l,s),p=this._createTangentBuffer(e,i,l,s),h=a,{transformation:d,position:g,normal:x,tangent:_}=this._passthroughReprojectionInfo(s)?{transformation:s.objectTransformation,position:i,normal:f,tangent:p}:this._transformOriginLocal(e,i,f,p);return{positionBuffer:g,normalBuffer:x,tangentBuffer:_,uvBuffer:h,colorBuffer:c,symbolColorBuffer:u,objectTransformation:d,geometryTransformation:s.reprojection===pt.NONE&&s.geometryTransformation?s.geometryTransformation:m()}}_computeReprojectionInfo(e){const{vertexSpace:t}=e,r="georeferenced"===t.type?q(this._context.renderCoordsHelper.spatialReference,e.spatialReference)?pt.NONE:pt.RENDER:pt.NONE;if(k(t))return{reprojection:r};const o=t.origin,a=m(),n=e.transform?.localMatrix??f;if(r===pt.NONE){E(e.spatialReference,o,a,this._context.renderCoordsHelper.spatialReference);return{reprojection:r,objectTransformation:a,geometryTransformation:p(n)}}const s=i(m(),o);return l(s,s,n),{reprojection:r,transformBeforeProject:s}}_transformOriginLocal(e,t,r,o){const a=this._context.renderCoordsHelper.spatialReference,n=e.origin;at[0]=n.x,at[1]=n.y,at[2]=n.z??0;const s=m();E(e.spatialReference,at,s,a),c(ct,s);const{position:i,normal:l,tangent:u}=e.vertexAttributes,f=t===i?new Float64Array(t.length):t;W(f,t,ct);const p=r?r===l?new Float32Array(r.length):r:null,h=o?o===u?new Float32Array(o.length):o:null;return r&&p&&Y(r,p,ct),o&&h&&X(o,h,ct),{transformation:s,position:f,normal:p,tangent:h}}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,o=t.faces;if(o){let e=-1;for(let t=0;t<o.length;t++){const r=o[t];r>e&&(e=r)}if(r<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes?.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference,o=te(e,r??e.spatialReference);return!!o&&(S(o,mt),!B(mt,this._context.clippingExtent))}_createGeometryInfo(e,t,r){if(!O(e.spatialReference,this._context.renderCoordsHelper.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(!this._validateVertexSpace(e))return null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,t);if(null==o)return null;const{positionBuffer:a,uvBuffer:n,colorBuffer:s,symbolColorBuffer:i,normalBuffer:l,tangentBuffer:c,objectTransformation:m,geometryTransformation:f}=o,p=e.components??ft,h=new Array;let d=!1;const g=u(nt,m),x=this._context.localOriginFactory.getOrigin(g);for(const u of p){if(!this._validateFaces(e,u))return null;const t=De(e,u);if(0===t.length)continue;const o=Ge(a,l,u,t);o.didFlipNormals&&(d=!0);const m=[[Pe.POSITION,new we(a,t,3,!0)],[Pe.NORMAL,new we(o.normals,o.indices,3,!0)]];s&&m.push([Pe.COLOR,new we(s,t,4,!0)]),i&&m.push([Pe.SYMBOLCOLOR,new we(i,V(t.length),4,!0)]),n&&m.push([Pe.UV0,new we(n,t,2,!0)]),c&&m.push([Pe.TANGENT,new we(c,t,4,!0)]);const p=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:r,layerViewUid:this._context.layerViewUid}),g=this._getOrCreateMaterial(e,u),_=new Ce(g,m,null,Be.Mesh,p);_.transformation=f,_.localOrigin=x,h.push(_)}return d&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),{geometries:h,objectTransformation:m}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial(((e,t)=>{t.setParameters(e.parameters)}))}_validateVertexSpace(e){const{_context:{graphicsCoreOwner:{view:{state:{viewingMode:t}}}}}=this,{vertexSpace:r}=e;return t!==ne.Local||"local"!==r.type||(this.logger.warn("Displaying a mesh with a local vertex space in a view in local viewing mode is not supported."),!1)}test(){return{...super.test(),materials:this._materialInfoCache.materials}}_getFallbackOpacityAndColor(){const t=this.symbolLayer?.material?.color;return e.toUnitRGBA(t)??P}}class Le{constructor(e,t,r){this.normals=e,this.indices=t,this.didFlipNormals=r}}function De(e,t){return t.faces??L(e.vertexAttributes.position.length/3)}function Ge(e,t,r,o){switch(r.shading||"flat"){default:case"source":return He(e,t,r,o);case"flat":return $e(e,o);case"smooth":return ke(e,o)}}function $e(e,t){const r=F(t.length),o=new Array(3*t.length);for(let a=0;a<t.length;a+=3){const n=ze(e,t,a,lt);for(let e=0;e<3;e++)r[a+e]=n[e],o[a+e]=a/3}return new Le(r,o,!1)}function He(e,t,r,o){if(null==t)return $e(e,o);let a=!1;if(!r.trustSourceNormals)for(let n=0;n<o.length;n+=3){ze(e,o,n,lt);for(let e=0;e<3;e++){const r=3*o[n+e];nt[0]=t[r],nt[1]=t[r+1],nt[2]=t[r+2],M(lt,nt)<0&&(t[r]=-t[r],t[r+1]=-t[r+1],t[r+2]=-t[r+2],a=!0)}}return new Le(t,o,a)}function ke(e,t){const r={};for(let n=0;n<t.length;n+=3){const o=ze(e,t,n,lt);for(let e=0;e<3;e++){const a=t[n+e];let s=r[a];s||(s={normal:R(),count:0},r[a]=s),g(s.normal,s.normal,o),s.count++}}const o=F(3*t.length),a=new Array(3*t.length);for(let n=0;n<t.length;n++){const e=r[t[n]];1!==e.count&&(b(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)o[3*n+t]=e.normal[t];a[n]=n}return new Le(o,a,!1)}function qe(e,t,r,o,a,n){const s=3*t[r],i=3*t[r+1],l=3*t[r+2];o[0]=e[s],o[1]=e[s+1],o[2]=e[s+2],a[0]=e[i],a[1]=e[i+1],a[2]=e[i+2],n[0]=e[l],n[1]=e[l+1],n[2]=e[l+2]}function ze(e,t,r,o){return qe(e,t,r,nt,st,it),v(st,st,nt),v(it,it,nt),w(nt,st,it),b(o,nt),o}function We(e){if(!e)return null;const{scale:r,offset:o,rotation:a}=e;return{scale:r,offset:o,rotation:t(a)}}function Ye(e="repeat"){if("string"==typeof e){const t=Ze(e);return{s:t,t}}return{s:Ze(e.horizontal),t:Ze(e.vertical)}}function Ze(e){switch(e){case"clamp":return Ue.CLAMP_TO_EDGE;case"mirror":return Ue.MIRRORED_REPEAT;default:return Ue.REPEAT}}function Je(e){const t=e.vertexAttributes.color;if(null==t)return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}function Ke(t,r,o){r.diffuse=e.toUnitRGB(t),r.opacity="opaque"===o.alphaMode?1:t.a}function Qe(e){return e.data??e.url}function Xe(t){return null==t?"-":t instanceof e?t.toHex():t.contentHash}function et(e){const{offset:t,scale:r,rotation:o}=e??ot;return`${t[0]},${t[1]},${o},${r[0]},${r[1]}`}function tt(e){return e.vertexAttributes.color}function rt(e){return 1===(e.material?.color?.a??1)}const ot=new $,at=R(),nt=R(),st=R(),it=R(),lt=R(),ct=m(),ut=m(),mt=U(),ft=[new D];var pt;!function(e){e[e.NONE=0]="NONE",e[e.RENDER=1]="RENDER"}(pt||(pt={}));export{Ve as Graphics3DMeshFillSymbolLayer};
5
+ import e from"../../../../Color.js";import"../../../../core/has.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{releaseMaybe as r}from"../../../../core/maybe.js";import{isPromiseLike as o}from"../../../../core/promiseUtils.js";import{normalFromMat4 as a,fromMat4 as n}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as i,multiply as l,invert as c,getTranslation as u}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m,IDENTITY as f,clone as p}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as d,f as g,g as x,t as _,o as y,n as b,b as T,d as v,h as w,e as M}from"../../../../chunks/vec32.js";import{create as R,ONES as C,ZEROS as j}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as A,ZEROS as P}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{canProjectWithoutEngine as O}from"../../../../geometry/projectionUtils.js";import{computeTranslationToOriginAndRotation as E}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as N}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToPoint as I}from"../../../../geometry/projection/projectVectorToPoint.js";import{fromBuffer as S,create as U,intersectsClippingArea as B}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as F}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as V,getContinuousIndexArray as L}from"../../../../geometry/support/Indices.js";import D from"../../../../geometry/support/MeshComponent.js";import G from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import $ from"../../../../geometry/support/MeshTextureTransform.js";import{isRelativeVertexSpace as H,isAbsoluteVertexSpace as k}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as q,isPlateCarree as z}from"../../../../geometry/support/spatialReferenceUtils.js";import{t as W}from"../../../../chunks/vec3.js";import{transformNormal as Y,transformVectorENUPlateCarree as Z,VectorType as J,transformVectorWMPlateCarree as K,projectNormalToPCPF as Q,transformTangent as X,projectTangentToPCPF as ee}from"../../../../geometry/support/meshUtils/projection.js";import{projectMeshVertexPositions as te}from"../../../../geometry/support/meshUtils/projectMeshVertexPositions.js";import{makeDehydratedPoint as re}from"../../../../layers/graphics/dehydratedPoint.js";import{MeshTransformUpdateAction as oe}from"../../../../layers/graphics/sources/interfaces.js";import{getEmissiveMode as ae}from"../../../../symbols/support/materialUtils.js";import{ViewingMode as ne}from"../../../ViewingMode.js";import{isEncodedMeshTexture as se}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as ie}from"../../glTF/internal/TextureTransformUtils.js";import{defaultSymbolLayerMemoryComplexity as le}from"./defaultSymbolComplexity.js";import{perObjectElevationAligner as ce}from"./ElevationAligners.js";import{needsElevationUpdates3D as ue,evaluateElevationInfoAtPoint as me}from"./elevationAlignmentUtils.js";import{Graphics3DMeshObject3DGraphicLayer as fe}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as pe}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as he}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as de,MeshFastUpdateProcessor as ge}from"./MeshFastUpdateProcessor.js";import{SymbolComplexity as xe}from"./SymbolComplexity.js";import{hasEdges as _e,createMaterial as ye}from"../support/edgeUtils.js";import{parseColorMixMode as be,encodeSymbolColor as Te}from"../support/symbolColorUtils.js";import{debugFlags as ve}from"../../support/debugFlags.js";import{Attribute as we}from"../../webgl-engine/lib/Attribute.js";import{AlphaDiscardMode as Me,CullFaceOptions as Re}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as Ce}from"../../webgl-engine/lib/Geometry.js";import{Object3D as je}from"../../webgl-engine/lib/Object3D.js";import{Texture as Ae}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as Pe}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as Oe}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as Ee}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as Ne,advancedMRRFactors as Ie,schematicMRRFactors as Se}from"../../webgl-engine/materials/pbrUtils.js";import{TextureWrapMode as Ue}from"../../../webgl/enums.js";import{GeometryType as Be}from"../../webgl-engine/lib/IntersectableGeometry.js";const Fe=["mesh"];class Ve extends he{constructor(e,t,r,o){super(e,t,r,o,rt(t)),this._materialInfoCache=new de,this._fastUpdateProcessor=new ge,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){ve.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new Ee({color:[1,0,1,1]}),this._debugTangentNormalMaterial=new Ee({color:[1,.5,0,1]}),this._debugFaceNormalMaterial=new Ee({color:[0,1,1,1]})),this.updateComplexity()}destroy(){super.destroy(),this._textures.forEach((e=>e.unload())),this._context.stage.removeTextures(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy()}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Fe,"fill on mesh-3d"))return null;const r=this.setGraphicElevationContext(t),o=e.renderingInfo;return this._createAs3DShape(t,o,r,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._updateMaterialParameters((e=>{e.material.setParameters({layerOpacity:r});const t=e.material.parameters;this._setMaterialTextureAlphaMode(t,e)})),e?.forEach((e=>t(e)?.layerOpacityChanged(r,this._context.isAsync)))}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,ue)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters((({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),e?.forEach((e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync))),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._updateMaterialParameters((({material:t})=>t.setParameters({usePBR:e}))),!0}updateTransform(e,t,r,o){if(!e.fastTransformUpdatesAllowed)return!1;const a=e.fastTransformUpdatesEnabled;switch(o){case oe.EnableFastUpdates:if(a)return!0;break;case oe.DisableFastUpdates:if(!a)return!0;break;default:if(!a)return!!this.updateTransform(e,t,r,oe.EnableFastUpdates)&&(e.autoDisableFastTransformUpdates((()=>this.updateTransform(e,t,r,oe.DisableFastUpdates))),!0)}const n=this._context.renderCoordsHelper.spatialReference,s=ut,{origin:i,transform:l}=r;if(!E(t,d(nt,i.x,i.y,i.z??0),s,n))return!1;switch(o){case oe.EnableFastUpdates:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case oe.DisableFastUpdates:this._fastUpdateProcessor.disable(e,this._materialInfoCache);break;case oe.UpdateFastLocalOrigin:e.updateFastLocalOrigin(s,l,this._context.localOriginFactory)}const{elevationContext:c}=e;c.centerPointInElevationSR=this._getCenterPointInElevationSR(s);const{elevationProvider:u,renderCoordsHelper:m}=this._context,f=(e,t)=>me(e,u,c,m,t);return e.alignedSampledElevation=ce(e,c,u.spatialReference,f,m,s),e.updateTransform(s,l,this._context.isAsync),e.updateAutoDisableFastTransformUpdates((()=>this.updateTransform(e,t,r,oe.DisableFastUpdates))),!0}computeComplexity(){if(!this._textures||0===this._textures.size)return super.computeComplexity();let e=0;for(const o of this._textures.values())e+=o.usedMemory;const t={...le(this.symbol,this.symbolLayer),resourceBytes:e},r=_e(this.symbolLayer)?2:0;return new xe({drawCallsPerFeature:r,memory:t})}_requiresSymbolVertexColors(){return this._drivenProperties.color||this._drivenProperties.opacity}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),o=!!e.vertexAttributes.color,a=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:o,hasVertexTangents:a,uid:`vc:${o},vt:${a},vct${t},svc:${r}`}}_materialProperties(e,t,r){const o=this._materialPropertiesDefault(e,r);if(!t.material)return o;const{color:a,colorTexture:n,colorTextureTransform:s,normalTexture:i,normalTextureTransform:l,doubleSided:c,alphaCutoff:u,alphaMode:m}=t.material,f=Xe(a),p=Xe(n),h=et(s),d=Xe(i),g=et(l);if(o.color=a,o.colorTexture=n,o.normalTexture=i,o.uid=`${o.uid},cmuid:${f},ctmuid:${p},cttuid:${h},ntmuid:${d},nttuid:${g},ds:${c},ac:${u},am:${m}`,t.material instanceof G){const{metallic:e,roughness:r,metallicRoughnessTexture:a,metallicRoughnessTextureTransform:n,emissiveColor:i,emissiveTexture:c,emissiveTextureTransform:u,occlusionTexture:m,occlusionTextureTransform:f}=t.material,p=Xe(a),h=et(n),d=Xe(i),g=Xe(c),x=et(u),_=Xe(m),y=et(f);o.metallic=e,o.roughness=r,o.metallicRoughnessTexture=a,o.emissiveColor=i,o.emissiveTexture=c,o.occlusionTexture=m,o.colorTextureTransform=We(s),o.normalTextureTransform=We(l),o.emissiveTextureTransform=We(u),o.occlusionTextureTransform=We(f),o.metallicRoughnessTextureTransform=We(n),o.uid=`${o.uid},mrm:${e},mrr:${r},mrt:${p},mrtt:${h},emuid:${d},etmuid:${g},ett:${x},otmuid:${_},ott:${y}`}return o}_getInternalTexture(e,t=!1,a=Me.Opaque){const n=Qe(e);if(!n)return null;const s=`${e.contentHash}/${a}`;let i=this._textures.get(s);if(i){const e=this._context.stage.renderView.textures;let t=null;const a=e.acquire(i.id);return null==a||o(a)||(i.events.on("unloaded",(()=>t=r(t))),t=a),i}let l=null;const c=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,u={wrap:Ye(e.wrap),noUnpackFlip:!0,maxAnisotropy:c,mipmap:c>1};return se(n)?(l=n.data,u.preMultiplyAlpha=!1,u.encoding=n.encoding):(l=n,u.preMultiplyAlpha=a!==Me.Opaque,u.compressionHandle=t?this._context.compressionHandle:void 0,u.compressionCallback=t?()=>this.updateComplexity():void 0),i=new Ae(l,u),this._textures.set(s,i),i.events.on("loaded",(()=>this.updateComplexity())),i.load(this._context.stage.renderView.renderingContext),this._context.stage.addTexture(i),i.events.on("unloaded",(()=>{this._textures.delete(s)})),i}_setInternalMaterialTextureParameters(t,r){if(null!=t.colorTexture){const e=r.textureAlphaMode!==Me.Opaque,o=this._getInternalTexture(t.colorTexture,e,r.textureAlphaMode);o?(r.textureId=o.id,r.textureAlphaPremultiplied=!!o.parameters.preMultiplyAlpha):r.textureId=void 0}t.normalTexture&&(r.normalTextureId=this._getInternalTexture(t.normalTexture)?.id),t.emissiveColor&&(r.emissiveBaseColor=e.toUnitRGB(t.emissiveColor)),t.emissiveTexture&&(r.emissiveTextureId=this._getInternalTexture(t.emissiveTexture)?.id),t.occlusionTexture&&(r.occlusionTextureId=this._getInternalTexture(t.occlusionTexture,!0)?.id),t.metallicRoughnessTexture&&(r.metallicRoughnessTextureId=this._getInternalTexture(t.metallicRoughnessTexture,!0)?.id)}_setInternalMaterialParameters(e,t,r){null!=e.color&&Ke(e.color,t,r),this._setInternalMaterialTextureParameters(e,t),t.colorTextureTransformMatrix=ie(e.colorTextureTransform),t.normalTextureTransformMatrix=ie(e.normalTextureTransform);const o=null!=e.normalTextureTransform?.scale?e.normalTextureTransform?.scale:h;t.scale=[o[0],o[1]],t.occlusionTextureTransformMatrix=ie(e.occlusionTextureTransform),t.emissiveTextureTransformMatrix=ie(e.emissiveTextureTransform),t.metallicRoughnessTextureTransformMatrix=ie(e.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(t,r=this.symbolLayer?.material?.color){const o=this._drivenProperties.color,a=this._drivenProperties.opacity;let n=this.symbolLayer.material?.colorMixMode??null;if(o)t.externalColor=A;else{const o=r??null;if(o){const r=e.toUnitRGBA(o);a&&(r[3]=1),t.externalColor=r}else n=null,t.externalColor=A}n&&(t.colorMixMode=n),t.castShadows=!!this.symbolLayer.castShadows,t.emissiveStrength=this.symbolLayer?.material?.emissive?.strength??1,t.emissiveSource=ae(this.symbolLayer?.material?.emissive?.source??"emissive")}_getOrCreateMaterial(t,r){const o=r.material?.color,a=r.material?.colorTexture,n=r.material?.alphaMode,s="blend"===n,i=!("opaque"===n)&&(Je(t)||null!=o&&o.a<1||a?.transparent||s),l=this._materialProperties(t,r,i),c=this._materialInfoCache.byUid(l.uid);if(c)return this._setInternalMaterialTextureParameters(l,c.material.parameters),c.material;const u={uid:l.uid,material:null,isComponentTransparent:i,alphaMode:r.material?r.material.alphaMode:"opaque"},m=Ne({normalTexture:l.normalTexture,metallicRoughnessTexture:l.metallicRoughnessTexture,metallicFactor:l.metallic,roughnessFactor:l.roughness,emissiveTexture:l.emissiveTexture,emissiveFactor:e.toUnitRGB(l.emissiveColor),occlusionTexture:l.occlusionTexture}),f={usePBR:this._usePBR(),isSchematic:m,hasVertexColors:l.hasVertexColors,hasSymbolColors:l.hasSymbolVertexColors,hasVertexTangents:l.hasVertexTangents,ambient:j,diffuse:C,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:Re.None,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,drivenOpacity:this.needsDrivenTransparentPass||u.isComponentTransparent};f.mrrFactors=m?Se:[l.metallic,l.roughness,Ie[2]],r.material&&(f.doubleSided=r.material.doubleSided,f.cullFace=r.material.doubleSided?Re.None:Re.Back,f.textureAlphaCutoff=r.material.alphaCutoff),this._setExternalMaterialParameters(f),this._setMaterialTextureAlphaMode(f,u),this._setInternalMaterialParameters(l,f,u);const p=new Oe(f,this._context);return u.material=p,this._materialInfoCache.set(l.uid,u),p}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchColor(e,t)}_preparePatchColor(e,t){if(!t.material||"partial"!==t.material.type)return;const r=t.material.diff;if(!r.color||"complete"!==r.color.type||null==r.color.newValue||null==r.color.oldValue)return;const o=r.color.newValue;delete r.color,e.symbolLayerStatePatches.push((()=>{this._updateMaterialParameters((e=>{const t=e.material.parameters;this._setExternalMaterialParameters(t,o),this._setMaterialTextureAlphaMode(t,e),e.material.setParameters({externalColor:t.externalColor})}))}))}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTextureAlphaMode(e,t){if("auto"===t.alphaMode){const r=this.needsDrivenTransparentPass||t.isComponentTransparent||(e.layerOpacity??1)<1||(e.opacity??1)<1||(e.externalColor?.[3]??1)<1;e.textureAlphaMode=r?Me.MaskBlend:Me.Opaque}else e.textureAlphaMode="opaque"===t.alphaMode?Me.Opaque:"mask"===t.alphaMode?Me.Mask:Me.Blend}_createFaceDebugNormals(e,t){const r=t.length,o=e.spatialReference.isGeographic?20015077/180:1,n=.1*Math.max(e.extent.width*o,e.extent.height*o,e.extent.zmax-e.extent.zmin),i=[],l=[],c=t[0].transformation,u=a(s(),c);for(let a=0;a<r;a++){const e=t[a].attributes.get(Pe.POSITION);if(!e)continue;const r=e.data,o=e.indices;for(let t=0;t<o.length;t+=3)ze(r,o,t,lt),qe(r,o,t,nt,st,it),g(nt,nt,st),g(nt,nt,it),x(nt,nt,1/3),_(nt,nt,c),i.push(...nt),y(lt,lt,u),b(lt,lt),T(nt,nt,lt,n),i.push(...nt),l.push(l.length),l.push(l.length)}return i.length?new Ce(this._debugFaceNormalMaterial,[[Pe.POSITION,new we(i,l,3,!0)]],null,Be.Line):null}_createPerVertexDebugVectors(e,t,r,o,i){const l=t.length,c=e.spatialReference.isGeographic?20015077/180:1,u=.1*i*Math.max(e.extent.width*c,e.extent.height*c,e.extent.zmax-e.extent.zmin),m=[],f=[],p=t[0].transformation,h=a(s(),p);r===Pe.TANGENT&&n(h,p);for(let a=0;a<l;a++){const e=t[a],o=e.attributes.get(Pe.POSITION),n=e.attributes.get(r);if(!o||!n)continue;const s=o.data,i=o.indices,l=n.data,c=n.indices;for(let t=0;t<i.length;t++){const e=3*i[t],r=c[t]*n.stride;d(nt,s[e+0],s[e+1],s[e+2]),_(nt,nt,p),m.push(...nt),d(st,l[r+0],l[r+1],l[r+2]),y(st,st,h),b(st,st),T(nt,nt,st,u),m.push(...nt),f.push(f.length),f.push(f.length)}}return m.length?new Ce(o,[[Pe.POSITION,new we(m,f,3,!0)]],null,Be.Line):null}_createAs3DShape(e,t,r,o){const a=e.geometry;if("mesh"!==a.type)return null;const n=this._createGeometryInfo(a,t,o);if(null==n)return null;const{geometries:s,objectTransformation:i}=n;if(ve.DRAW_MESH_GEOMETRY_NORMALS){const e=this._createPerVertexDebugVectors(a,s,Pe.NORMAL,this._debugVertexNormalMaterial,1),t=this._createPerVertexDebugVectors(a,s,Pe.TANGENT,this._debugTangentNormalMaterial,.5),r=this._createFaceDebugNormals(a,s);e&&s.push(e),t&&s.push(t),r&&s.push(r)}const l=this._context.layerViewUid,c=new je({geometries:s,layerViewUid:l,graphicUid:o,isElevationSource:!0});c.transformation=i;const u=ye(this.symbolLayer,{opacity:this._getLayerOpacity()}),m=u?new pe(s[0].material,u,this._context.slicePlaneEnabled):null,f=new fe(this,c,null,ce,r,m);this._fastUpdateProcessor.onAddGraphic(),f.needsElevationUpdates=ue(r.mode),f.useObjectOriginAsAttachmentOrigin=!0,f.fastTransformUpdatesAllowed=this._fastTransformUpdatesAllowed(a),r.centerPointInElevationSR=this._getCenterPointInElevationSR(c.transformation);const{elevationProvider:p,renderCoordsHelper:h}=this._context,d=(e,t)=>me(e,p,r,h,t);return f.alignedSampledElevation=ce(f,r,p.spatialReference,d,h),f}_fastTransformUpdatesAllowed(e){const{vertexSpace:t,spatialReference:r}=e;if(!H(t))return!1;const{type:o}=t,{view:a}=this._context.graphicsCoreOwner,{viewingMode:n}=a.state,s=a.spatialReference;return n===ne.Global&&"local"===o||n===ne.Local&&q(s,r)&&"georeferenced"===o&&!r.isGeographic}_getCenterPointInElevationSR(e){const t=re(0,0,0,this._context.elevationProvider.spatialReference??null);return I([e[12],e[13],e[14]],this._context.renderCoordsHelper.spatialReference,t),t}_passthroughReprojectionInfo(e){return e.reprojection===pt.NONE&&!!e.objectTransformation}_createPositionBuffer(e,t){const r=e.vertexAttributes.position;let o,a=r;if(t.reprojection===pt.NONE)return{position:a,georeferencedPositionBuffer:o};const n=t.reprojection===pt.RENDER?t.transformBeforeProject:null;n&&(a=W(new Float64Array(a.length),a,n));const{normal:s,tangent:i}=e.vertexAttributes;this._passthroughReprojectionInfo(t)||!s&&!i||(o=a);const l=a===r||a===o?new Float64Array(a.length):a;return N(a,e.spatialReference,0,l,this._context.renderCoordsHelper.spatialReference,0),{position:l,georeferencedPositionBuffer:o}}_createNormalBuffer(e,t,r,o){const a=e.vertexAttributes.normal;if(null==a)return null;let n=a;const s=o.reprojection===pt.RENDER?o.transformBeforeProject:null;s&&(n=Y(n,new Float32Array(n.length),s));const i=this._context.graphicsCoreOwner.view.viewingMode;if(o.reprojection===pt.NONE)return n;if("local"===i){if(!z(this._context.renderCoordsHelper.spatialReference))return n;if(null==r)return null;if(e.spatialReference.isGeographic){const e=n===a?new Float32Array(n.length):n;return Z(n,J.NORMAL,r,e)}if(e.spatialReference.isWebMercator){const e=n===a?new Float32Array(n.length):n;return K(n,J.NORMAL,r,e)}return n}if(null==r)return null;const l=n===a?new Float32Array(n.length):n,c=this._context.renderCoordsHelper.spatialReference;return Q(n,r,e.spatialReference,t,c,l)}_createTangentBuffer(e,t,r,o){const a=e.vertexAttributes.tangent;if(null==a)return null;let n=a;const s=o.reprojection===pt.RENDER?o.transformBeforeProject:null;s&&(n=X(n,new Float32Array(n.length),s));const i=this._context.graphicsCoreOwner.view.viewingMode;if(o.reprojection===pt.NONE)return n;if("local"===i){if(!z(this._context.renderCoordsHelper.spatialReference))return n;if(null==r)return null;if(e.spatialReference.isGeographic){const e=n===a?new Float32Array(n.length):n;return Z(n,J.TANGENT,r,e)}if(e.spatialReference.isWebMercator){const e=n===a?new Float32Array(n.length):n;return K(n,J.TANGENT,r,e)}return n}if(null==r)return null;const l=n===a?new Float32Array(n.length):n,c=this._context.renderCoordsHelper.spatialReference;return ee(n,r,e.spatialReference,t,c,l)}_createSymbolColorBuffer(e){if(this._requiresSymbolVertexColors()){const t=this._getVertexOpacityAndColor(e,this._getFallbackOpacityAndColor()),r=be(this.symbolLayer?.material?.colorMixMode),o=new Uint8Array(4);return Te(t,r,o),o}return null}_createBuffers(e,t){const r=e.vertexAttributes&&e.vertexAttributes.position;if(!r)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,a=e.vertexAttributes.uv,n=e.vertexAttributes.tangent;if(o&&o.length!==r.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(n&&n.length/4!=r.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(a&&a.length/2!=r.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const s=this._computeReprojectionInfo(e),{position:i,georeferencedPositionBuffer:l}=this._createPositionBuffer(e,s),c=tt(e),u=this._createSymbolColorBuffer(t),f=this._createNormalBuffer(e,i,l,s),p=this._createTangentBuffer(e,i,l,s),h=a,{transformation:d,position:g,normal:x,tangent:_}=this._passthroughReprojectionInfo(s)?{transformation:s.objectTransformation,position:i,normal:f,tangent:p}:this._transformOriginLocal(e,i,f,p);return{positionBuffer:g,normalBuffer:x,tangentBuffer:_,uvBuffer:h,colorBuffer:c,symbolColorBuffer:u,objectTransformation:d,geometryTransformation:s.reprojection===pt.NONE&&s.geometryTransformation?s.geometryTransformation:m()}}_computeReprojectionInfo(e){const{vertexSpace:t}=e,r="georeferenced"===t.type?q(this._context.renderCoordsHelper.spatialReference,e.spatialReference)?pt.NONE:pt.RENDER:pt.NONE;if(k(t))return{reprojection:r};const o=t.origin,a=m(),n=e.transform?.localMatrix??f;if(r===pt.NONE){E(e.spatialReference,o,a,this._context.renderCoordsHelper.spatialReference);return{reprojection:r,objectTransformation:a,geometryTransformation:p(n)}}const s=i(m(),o);return l(s,s,n),{reprojection:r,transformBeforeProject:s}}_transformOriginLocal(e,t,r,o){const a=this._context.renderCoordsHelper.spatialReference,n=e.origin;at[0]=n.x,at[1]=n.y,at[2]=n.z??0;const s=m();E(e.spatialReference,at,s,a),c(ct,s);const{position:i,normal:l,tangent:u}=e.vertexAttributes,f=t===i?new Float64Array(t.length):t;W(f,t,ct);const p=r?r===l?new Float32Array(r.length):r:null,h=o?o===u?new Float32Array(o.length):o:null;return r&&p&&Y(r,p,ct),o&&h&&X(o,h,ct),{transformation:s,position:f,normal:p,tangent:h}}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,o=t.faces;if(o){let e=-1;for(let t=0;t<o.length;t++){const r=o[t];r>e&&(e=r)}if(r<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes?.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference,o=te(e,r??e.spatialReference);return!!o&&(S(o,mt),!B(mt,this._context.clippingExtent))}_createGeometryInfo(e,t,r){if(!O(e.spatialReference,this._context.renderCoordsHelper.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(!this._validateVertexSpace(e))return null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,t);if(null==o)return null;const{positionBuffer:a,uvBuffer:n,colorBuffer:s,symbolColorBuffer:i,normalBuffer:l,tangentBuffer:c,objectTransformation:m,geometryTransformation:f}=o,p=e.components??ft,h=new Array;let d=!1;const g=u(nt,m),x=this._context.localOriginFactory.getOrigin(g);for(const u of p){if(!this._validateFaces(e,u))return null;const t=De(e,u);if(0===t.length)continue;const o=Ge(a,l,u,t);o.didFlipNormals&&(d=!0);const m=[[Pe.POSITION,new we(a,t,3,!0)],[Pe.NORMAL,new we(o.normals,o.indices,3,!0)]];s&&m.push([Pe.COLOR,new we(s,t,4,!0)]),i&&m.push([Pe.SYMBOLCOLOR,new we(i,V(t.length),4,!0)]),n&&m.push([Pe.UV0,new we(n,t,2,!0)]),c&&m.push([Pe.TANGENT,new we(c,t,4,!0)]);const p=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:r,layerViewUid:this._context.layerViewUid}),g=this._getOrCreateMaterial(e,u),_=new Ce(g,m,null,Be.Mesh,p);_.transformation=f,_.localOrigin=x,h.push(_)}return d&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),{geometries:h,objectTransformation:m}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial(((e,t)=>{t.setParameters(e.parameters)}))}_validateVertexSpace(e){const{_context:{graphicsCoreOwner:{view:{state:{viewingMode:t}}}}}=this,{vertexSpace:r}=e;return t!==ne.Local||"local"!==r.type||(this.logger.warn("Displaying a mesh with a local vertex space in a view in local viewing mode is not supported."),!1)}test(){return{...super.test(),materials:this._materialInfoCache.materials}}_getFallbackOpacityAndColor(){const t=this.symbolLayer?.material?.color;return e.toUnitRGBA(t)??P}}class Le{constructor(e,t,r){this.normals=e,this.indices=t,this.didFlipNormals=r}}function De(e,t){return t.faces??L(e.vertexAttributes.position.length/3)}function Ge(e,t,r,o){switch(r.shading||"flat"){default:case"source":return He(e,t,r,o);case"flat":return $e(e,o);case"smooth":return ke(e,o)}}function $e(e,t){const r=F(t.length),o=new Array(3*t.length);for(let a=0;a<t.length;a+=3){const n=ze(e,t,a,lt);for(let e=0;e<3;e++)r[a+e]=n[e],o[a+e]=a/3}return new Le(r,o,!1)}function He(e,t,r,o){if(null==t)return $e(e,o);let a=!1;if(!r.trustSourceNormals)for(let n=0;n<o.length;n+=3){ze(e,o,n,lt);for(let e=0;e<3;e++){const r=3*o[n+e];nt[0]=t[r],nt[1]=t[r+1],nt[2]=t[r+2],M(lt,nt)<0&&(t[r]=-t[r],t[r+1]=-t[r+1],t[r+2]=-t[r+2],a=!0)}}return new Le(t,o,a)}function ke(e,t){const r={};for(let n=0;n<t.length;n+=3){const o=ze(e,t,n,lt);for(let e=0;e<3;e++){const a=t[n+e];let s=r[a];s||(s={normal:R(),count:0},r[a]=s),g(s.normal,s.normal,o),s.count++}}const o=F(3*t.length),a=new Array(3*t.length);for(let n=0;n<t.length;n++){const e=r[t[n]];1!==e.count&&(b(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)o[3*n+t]=e.normal[t];a[n]=n}return new Le(o,a,!1)}function qe(e,t,r,o,a,n){const s=3*t[r],i=3*t[r+1],l=3*t[r+2];o[0]=e[s],o[1]=e[s+1],o[2]=e[s+2],a[0]=e[i],a[1]=e[i+1],a[2]=e[i+2],n[0]=e[l],n[1]=e[l+1],n[2]=e[l+2]}function ze(e,t,r,o){return qe(e,t,r,nt,st,it),v(st,st,nt),v(it,it,nt),w(nt,st,it),b(o,nt),o}function We(e){if(!e)return null;const{scale:r,offset:o,rotation:a}=e;return{scale:r,offset:o,rotation:t(a)}}function Ye(e="repeat"){if("string"==typeof e){const t=Ze(e);return{s:t,t}}return{s:Ze(e.horizontal),t:Ze(e.vertical)}}function Ze(e){switch(e){case"clamp":return Ue.CLAMP_TO_EDGE;case"mirror":return Ue.MIRRORED_REPEAT;default:return Ue.REPEAT}}function Je(e){const t=e.vertexAttributes.color;if(null==t)return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}function Ke(t,r,o){r.diffuse=e.toUnitRGB(t),r.opacity="opaque"===o.alphaMode?1:t.a}function Qe(e){return e.data??e.url}function Xe(t){return null==t?"-":t instanceof e?t.toHex():t.contentHash}function et(e){const{offset:t,scale:r,rotation:o}=e??ot;return`${t[0]},${t[1]},${o},${r[0]},${r[1]}`}function tt(e){return e.vertexAttributes.color}function rt(e){return 1===(e.material?.color?.a??1)}const ot=new $,at=R(),nt=R(),st=R(),it=R(),lt=R(),ct=m(),ut=m(),mt=U(),ft=[new D];var pt;!function(e){e[e.NONE=0]="NONE",e[e.RENDER=1]="RENDER"}(pt||(pt={}));export{Ve as Graphics3DMeshFillSymbolLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import{releaseMaybe as t}from"../../../../core/maybe.js";import{isPromiseLike as s}from"../../../../core/promiseUtils.js";import{pt2px as r}from"../../../../core/screenUtils.js";import{fromValues as o,ZEROS as i,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{freeze as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasCalloutSupport as c,textSymbolLayerSupportsVerticalOffset as m}from"../../../../symbols/callouts/calloutUtils.js";import{perObjectElevationAligner as f}from"./ElevationAligners.js";import{SymbolUpdateType as h,needsElevationUpdates2D as u}from"./elevationAlignmentUtils.js";import{ElevationContext as p}from"./ElevationContext.js";import{focusAreaHUDColor as d}from"./focusAreaStyle.js";import{Graphics3DObject3DGraphicLayer as g}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DObjectMetadata as y}from"./Graphics3DObjectMetadata.js";import{Graphics3DSymbolLayer as v}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as x}from"./graphicUtils.js";import{LabelPlacement as b,LabelParameters as O}from"./LabelParameters.js";import{verticalScreenOffsetFromAlignment as w,verticalPlacementFromAlignment as P,textRenderAlignmentFromHorizontalPlacement as j,horizontalPlacementToAnchorX as E,anchorFromPlacements as _,namedAnchorToHUDMaterialAnchorPos as S}from"./placementUtils.js";import{placePointOnGeometry as L,updateStageObjectGeometry as G,getLocalOriginForPoint as A,extendPointGraphicElevationContext as C,createStageObject as z}from"./pointUtils.js";import{getFontMetrics as U}from"../../webgl-engine/lib/FontMetrics.js";import{createPointGeometry as F}from"../../webgl-engine/lib/GeometryUtil.js";import{TextRenderParameters as D}from"../../webgl-engine/lib/TextRenderParameters.js";import R from"../../webgl-engine/lib/TextTextureFactory.js";import{HUDMaterial as T}from"../../webgl-engine/materials/HUDMaterial.js";const V=a(0,0,1);class H extends v{constructor(e,t,s,r){super(e,t,s,r),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=x(this.symbolLayer.size);if(t)throw new e("graphics3dtextsymbollayer:invalid-size",t)}await this._createTextRenderParameters()}async _createTextRenderParameters(){const e=this._context.graphicsCoreOwner.view.state.rasterPixelRatio;this._textRenderParameters=await D.fromSymbol(this.symbolLayer,e)}destroy(){super.destroy()}createGraphics3DGraphic(e){const t=e.graphic,s=L(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;const r=this.view.focusAreasView?.containsGeometry(s)??!0,o=this.symbolLayer.text;if(null==o||""===o)return null;const i=c(this.symbol)&&this.symbol.hasVisibleVerticalOffset()?this.symbol.verticalOffset:null;if(null!=i&&!m(this.symbolLayer))return this.logger.errorOncePerTick(`Callouts and vertical offset on text symbols are currently only supported with 'center' horizontal alignment (not with '${this.symbolLayer.horizontalAlignment}' alignment)`),null;const{verticalAlignment:n}=this.symbolLayer,a=new b(i);w(n,a.screenOffset);const l=new O(a,this.symbolLayer.horizontalAlignment,P(n));return l.isFocused=r??l.isFocused,this._createAs3DShape(t,s,o,l)}updateFocus(e,t){t.forEach((t=>{const s=L(t.graphic.geometry);if(null==s)return void this.logger.warn(`unsupported geometry type for text symbol: ${t.graphic.geometry.type}`);const r=this.view.focusAreasView?.containsGeometry(s)??!0;t.layers.forEach((s=>{if(s?.graphics3DSymbolLayer===this){s.stageObject.geometries.some((e=>e.material.parameters.isFocused!==r))&&e(t)}}))}))}createLabel(e,t,s,r,o){const i=e.graphic,n=L(i.geometry);if(null==n)return this.logger.warn(`unsupported geometry type for label: ${i.geometry.type}`),null;const a=this.view.focusAreasView?.containsGeometry(n)??!0,l=t.text;return!l||/^\s+$/.test(l)?null:(t.isFocused=a??t.isFocused,this._createAs3DShape(i,n,l,t,s,r,o))}setGraphicElevationContext(e,t=new p,s=0){return super.setGraphicElevationContext(e,t),t.addOffsetRenderUnits(s),t}layerOpacityChanged(){return this.logger.warn("layer opacity change not yet implemented in Graphics3DTextSymbolLayer"),!1}layerElevationInfoChanged(e,t){return W(e,t,((e,t)=>{this.updateGraphicElevationContext(t,e)})),h.UPDATE}slicePlaneEnabledChanged(e,t){return W(e,t,(e=>{for(const t of e.stageObject.geometries)t.material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return!1}updateGraphicElevationContext(e,t){const{elevationContext:s,metadata:r}=t;this.setGraphicElevationContext(e,s,r?.elevationOffset??0),t.needsElevationUpdates=u(s.mode)||"absolute-height"===s.mode}updateGeometry(e,t){if(this.draped||!this._validateGeometry(t))return!1;const{elevationContext:s,stageObject:r}=e;if(s.mode!==this.getGeometryElevationMode(t))return!1;const o=L(t);if(!o)return!1;const i=G(r,this._context,o,s);if(null==i)return!1;const n=A(this._context,o);return r.geometries[0].localOrigin===n&&(e.alignedSampledElevation=i,C(e,o,this._context.elevationProvider),!0)}_defaultElevationInfoNoZ(){return I}_createAs3DShape(e,a,c,m,h,v=null,x=()=>m.placement.elevationOffset){const b=this.setGraphicElevationContext(e,new p,m.placement.elevationOffset),O="polyline"===e.geometry?.type,w=e.uid;let P=null,E=null;if(null==v){const e=j(m.horizontalPlacement);P=new R(c,e,this._textRenderParameters);let r=null;if(null!=this._context.sharedResources.textures){E=this._context.sharedResources.textures.fromData(P.key,(()=>P.create())),E.texture.events.on("unloaded",(()=>r=t(r)));const e=this._context.stage.renderView.textures.acquire(E.texture.id);if(null==e||s(e))return E.release(),null;r=e}}const _=!has("disable-feature:non-occluded-hud"),S=$(P,m),L={occlusionTest:!_,occludedFragmentFade:_,horizonCullingEnabled:_&&this._context.spherical,screenOffset:m.placement.screenOffset,anchorPosition:S,polygonOffset:!0,color:[1,1,1,1],centerOffsetUnits:m.placement.centerOffsetUnits,depthEnabled:!1,drawAsLabel:!0,isLabel:!0,isFocused:m.isFocused};if(O&&(L.shaderPolygonOffset=1e-4),v?L.textureId=v.id:E&&(L.textureId=E.texture.id),null!=m.placement.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:s}=m.placement.verticalOffset;L.verticalOffset={screenLength:r(e),minWorldLength:t||0,maxWorldLength:null!=s?s:1/0}}const G=this._context.graphicsCoreOwner.view.focusAreasView?.polygons.length,A={screenOffset:L.screenOffset,anchorPosition:S,centerOffsetUnits:L.centerOffsetUnits,verticalOffset:L.verticalOffset,shaderPolygonOffset:L.shaderPolygonOffset,occlusionTest:L.occlusionTest,isFocused:m.isFocused,focusStyle:this.view.map?.focusAreas.style??"none"};if(this._context.screenSizePerspectiveEnabled){const{screenSizePerspectiveSettings:e,screenSizePerspectiveSettingsLabels:t}=this._context.sharedResources,s=U(this._textRenderParameters);L.screenSizePerspective=t.overrideFontHeight(s.maxHeight),L.screenSizePerspectiveAlignment=e,A.fontHeight=s.maxHeight}L.hasSlicePlane=this._context.slicePlaneEnabled;const D=this._context.spherical,H=h?JSON.stringify(A):"";let W=h?.get(H);if(null==W){if(!m.isFocused&&G){const e=this.view.map?.focusAreas.style;L.color=d(L.color,e),L.outlineColor=d(L.outlineColor,e)}W=new T(L,D),h?.set(H,W)}const I=m.placement.translation,M=P?o(P.displayWidth,P.displayHeight):i,k=m.placement.centerOffset,N=V,q=v?l(0,0,0,0):null,B=F(W,{normal:N,position:I,size:M,centerOffsetAndDistance:k,uvi:q}),J=z(this._context,a,B,b,w);if(null==J)return null;const Y=(t,s,r,o,i,n)=>{const a=x()||m.placement.elevationOffset,l=this.setGraphicElevationContext(e,s,a);return f(t,l,r,o,i,n)},Z=new g(this,J.object,E,Y,b);Z.alignedSampledElevation=J.sampledElevation,Z.needsElevationUpdates=u(b.mode)||"absolute-height"===b.mode,Z.getScreenSize=(e=n())=>(e[0]=P?P.displayWidth:m.displaySize[0],e[1]=P?P.displayHeight:m.displaySize[1],e);const K=new y(m.placement.elevationOffset,c);return Z.metadata=K,C(Z,a,this._context.elevationProvider),Z}}function W(e,t,s){e?.forEach((e=>{const r=t(e);null!=r&&s(r,e.graphic)}))}function $(e,t){if("baseline"===t.verticalPlacement){const s=E[t.horizontalPlacement],r=null!=e?e.baselineAnchorY:0;return o(s,r)}const s=_(t.horizontalPlacement,t.verticalPlacement);return S[s]}const I={mode:"relative-to-ground",offset:0};export{H as Graphics3DTextSymbolLayer};
5
+ import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import{releaseMaybe as t}from"../../../../core/maybe.js";import{isPromiseLike as s}from"../../../../core/promiseUtils.js";import{pt2px as r}from"../../../../core/screenUtils.js";import{fromValues as o,ZEROS as n,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{freeze as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasCalloutSupport as c,textSymbolLayerSupportsVerticalOffset as m}from"../../../../symbols/callouts/calloutUtils.js";import{perObjectElevationAligner as f}from"./ElevationAligners.js";import{SymbolUpdateType as h,needsElevationUpdates2D as u}from"./elevationAlignmentUtils.js";import{ElevationContext as p}from"./ElevationContext.js";import{focusAreaHUDColor as d}from"./focusAreaStyle.js";import{Graphics3DObject3DGraphicLayer as g}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DObjectMetadata as y}from"./Graphics3DObjectMetadata.js";import{Graphics3DSymbolLayer as v}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as x}from"./graphicUtils.js";import{LabelPlacement as b,LabelParameters as O}from"./LabelParameters.js";import{verticalScreenOffsetFromAlignment as w,verticalPlacementFromAlignment as P,textRenderAlignmentFromHorizontalPlacement as j,horizontalPlacementToAnchorX as E,anchorFromPlacements as _,namedAnchorToHUDMaterialAnchorPos as S}from"./placementUtils.js";import{placePointOnGeometry as L,updateStageObjectGeometry as G,getLocalOriginForPoint as A,extendPointGraphicElevationContext as C,createStageObject as z}from"./pointUtils.js";import{getFontMetrics as U}from"../../webgl-engine/lib/FontMetrics.js";import{createPointGeometry as F}from"../../webgl-engine/lib/GeometryUtil.js";import{TextRenderParameters as D}from"../../webgl-engine/lib/TextRenderParameters.js";import R from"../../webgl-engine/lib/TextTextureFactory.js";import{HUDMaterial as T}from"../../webgl-engine/materials/HUDMaterial.js";const V=a(0,0,1);class H extends v{constructor(e,t,s,r){super(e,t,s,r),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=x(this.symbolLayer.size);if(t)throw new e("graphics3dtextsymbollayer:invalid-size",t)}await this._createTextRenderParameters()}async _createTextRenderParameters(){const e=this._context.graphicsCoreOwner.view.state.rasterPixelRatio;this._textRenderParameters=await D.fromSymbol(this.symbolLayer,e)}destroy(){super.destroy()}createGraphics3DGraphic(e){const t=e.graphic,s=L(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;const r=this.view.focusAreasView?.containsGeometry(s)??!0,o=this.symbolLayer.text;if(null==o||""===o)return null;const n=c(this.symbol)&&this.symbol.hasVisibleVerticalOffset()?this.symbol.verticalOffset:null;if(null!=n&&!m(this.symbolLayer))return this.logger.errorOncePerTick(`Callouts and vertical offset on text symbols are currently only supported with 'center' horizontal alignment (not with '${this.symbolLayer.horizontalAlignment}' alignment)`),null;const{verticalAlignment:i}=this.symbolLayer,a=new b(n);w(i,a.screenOffset);const l=new O(a,this.symbolLayer.horizontalAlignment,P(i));return l.isFocused=r??l.isFocused,this._createAs3DShape(t,s,o,l)}updateFocus(e,t){t.forEach((t=>{const s=L(t.graphic.geometry);if(null==s)return void this.logger.warn(`unsupported geometry type for text symbol: ${t.graphic.geometry.type}`);const r=this.view.focusAreasView?.containsGeometry(s)??!0;t.layers.forEach((s=>{if(s?.graphics3DSymbolLayer===this){s.stageObject.geometries.some((e=>e.material.parameters.isFocused!==r))&&e(t)}}))}))}createLabel(e,t,s,r,o){const n=e.graphic,i=L(n.geometry);if(null==i)return this.logger.warn(`unsupported geometry type for label: ${n.geometry.type}`),null;const a=this.view.focusAreasView?.containsGeometry(i)??!0,l=t.text;return!l||/^\s+$/.test(l)?null:(t.isFocused=a??t.isFocused,this._createAs3DShape(n,i,l,t,s,r,o))}setGraphicElevationContext(e,t=new p,s=0){return super.setGraphicElevationContext(e,t),t.addOffsetRenderUnits(s),t}layerOpacityChanged(){return this.logger.warn("layer opacity change not yet implemented in Graphics3DTextSymbolLayer"),!1}layerElevationInfoChanged(e,t){return W(e,t,((e,t)=>{this.updateGraphicElevationContext(t,e)})),h.UPDATE}slicePlaneEnabledChanged(e,t){return W(e,t,(e=>{for(const t of e.stageObject.geometries)t.material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return!1}updateGraphicElevationContext(e,t){const{elevationContext:s,metadata:r}=t;this.setGraphicElevationContext(e,s,r?.elevationOffset??0),t.needsElevationUpdates=u(s.mode)||"absolute-height"===s.mode}updateGeometry(e,t){if(this.draped||!this._validateGeometry(t))return!1;const{elevationContext:s,stageObject:r}=e;if(s.mode!==this.getGeometryElevationMode(t))return!1;const o=L(t);if(!o)return!1;const n=G(r,this._context,o,s);if(null==n)return!1;const i=A(this._context,o);return r.geometries[0].localOrigin===i&&(e.alignedSampledElevation=n,C(e,o,this._context.elevationProvider),!0)}_defaultElevationInfoNoZ(){return I}_createAs3DShape(e,a,c,m,h,v=null,x=()=>m.placement.elevationOffset){const b=this.setGraphicElevationContext(e,new p,m.placement.elevationOffset),O="polyline"===e.geometry?.type,w=e.uid;let P=null,E=null;if(null==v){const e=j(m.horizontalPlacement);P=new R(c,e,this._textRenderParameters);let r=null;if(null!=this._context.sharedResources.textures){E=this._context.sharedResources.textures.fromData(P.key,(()=>P.create())),E.texture.events.on("unloaded",(()=>r=t(r)));const e=this._context.stage.renderView.textures.acquire(E.texture.id);if(null==e||s(e))return E.release(),null;r=e}}const _=!!has("enable-feature:non-occluded-hud"),S=$(P,m),L={occlusionTest:!_,occludedFragmentFade:_,horizonCullingEnabled:_&&this._context.spherical,screenOffset:m.placement.screenOffset,anchorPosition:S,polygonOffset:!0,color:[1,1,1,1],centerOffsetUnits:m.placement.centerOffsetUnits,depthEnabled:!1,drawAsLabel:!0,isLabel:!0,isFocused:m.isFocused};if(O&&(L.shaderPolygonOffset=1e-4),v?L.textureId=v.id:E&&(L.textureId=E.texture.id),null!=m.placement.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:s}=m.placement.verticalOffset;L.verticalOffset={screenLength:r(e),minWorldLength:t||0,maxWorldLength:null!=s?s:1/0}}const G=this._context.graphicsCoreOwner.view.focusAreasView?.polygons.length,A={screenOffset:L.screenOffset,anchorPosition:S,centerOffsetUnits:L.centerOffsetUnits,verticalOffset:L.verticalOffset,shaderPolygonOffset:L.shaderPolygonOffset,occlusionTest:L.occlusionTest,isFocused:m.isFocused,focusStyle:this.view.map?.focusAreas.style??"none"};if(this._context.screenSizePerspectiveEnabled){const{screenSizePerspectiveSettings:e,screenSizePerspectiveSettingsLabels:t}=this._context.sharedResources,s=U(this._textRenderParameters);L.screenSizePerspective=t.overrideFontHeight(s.maxHeight),L.screenSizePerspectiveAlignment=e,A.fontHeight=s.maxHeight}L.hasSlicePlane=this._context.slicePlaneEnabled;const D=this._context.spherical,H=h?JSON.stringify(A):"";let W=h?.get(H);if(null==W){if(!m.isFocused&&G){const e=this.view.map?.focusAreas.style;L.color=d(L.color,e),L.outlineColor=d(L.outlineColor,e)}W=new T(L,D),h?.set(H,W)}const I=m.placement.translation,M=P?o(P.displayWidth,P.displayHeight):n,k=m.placement.centerOffset,N=V,q=v?l(0,0,0,0):null,B=F(W,{normal:N,position:I,size:M,centerOffsetAndDistance:k,uvi:q}),J=z(this._context,a,B,b,w);if(null==J)return null;const Y=(t,s,r,o,n,i)=>{const a=x()||m.placement.elevationOffset,l=this.setGraphicElevationContext(e,s,a);return f(t,l,r,o,n,i)},Z=new g(this,J.object,E,Y,b);Z.alignedSampledElevation=J.sampledElevation,Z.needsElevationUpdates=u(b.mode)||"absolute-height"===b.mode,Z.getScreenSize=(e=i())=>(e[0]=P?P.displayWidth:m.displaySize[0],e[1]=P?P.displayHeight:m.displaySize[1],e);const K=new y(m.placement.elevationOffset,c);return Z.metadata=K,C(Z,a,this._context.elevationProvider),Z}}function W(e,t,s){e?.forEach((e=>{const r=t(e);null!=r&&s(r,e.graphic)}))}function $(e,t){if("baseline"===t.verticalPlacement){const s=E[t.horizontalPlacement],r=null!=e?e.baselineAnchorY:0;return o(s,r)}const s=_(t.horizontalPlacement,t.verticalPlacement);return S[s]}const I={mode:"relative-to-ground",offset:0};export{H as Graphics3DTextSymbolLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as i,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{b as s}from"../../../../chunks/vec42.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as l,create as c,intersectsClippingArea as h,empty as m,expandWithAABB as p}from"../../../../geometry/support/aaBoundingBox.js";import{empty as u,create as d,expandPointInPlace as g}from"../../../../geometry/support/aaBoundingRect.js";import{newHalfFloatArray as y,halfFloatSubArray as f}from"../../../../geometry/support/HalfFloatArray.js";import{perVertexElevationAligner as x}from"./ElevationAligners.js";import{SymbolUpdateType as v,elevationModeChangeUpdateType as _,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as w}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as C}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as D}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as j,createWaterGeometry as S,PolygonCreationDataBase as G}from"./polygonUtils.js";import{geometryToRenderInfo as E,geometryToRenderInfoDraped as A}from"../../support/renderInfoUtils/polygon.js";import{Object3D as L}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as O}from"../../webgl-engine/lib/RenderGeometry.js";import{Parameters as P,WaterMaterial as T}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as R}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const U=["polyline","polygon","extent"];class I extends D{static{this.unitSizeOfTexture=100}static{this.elevationModeChangeTypes={definedChanged:v.RECREATE,staysOnTheGround:v.NONE,onTheGroundChanged:v.RECREATE}}constructor(e,t,r,o){super(e,t,r,o)}async doLoad(){}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,U,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,r,t.uid)}ensureMaterial(){if(this._materials[0])return;const t=new P,r=this.symbolLayer.color;null!=r&&(t.color=e.toUnitRGBA(r));const o=this._getCombinedOpacity(r,{hasIntrinsicColor:!0});t.color=[t.color[0],t.color[1],t.color[2],o],t.transparent=o<1||this.needsDrivenTransparentPass,t.waveDirection=null!=this.symbolLayer.waveDirection?B(this.symbolLayer.waveDirection):i(0,0);const n=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,s=R[n];t.waveStrength=s.waveStrength,t.waveTextureRepeat=s.textureRepeat,t.waveVelocity=s.waveVelocity,t.flowStrength=s.perturbationStrength,t.hasSlicePlane=this._context.slicePlaneEnabled,t.draped=this.draped,this._materials[0]=new T(t,this._context)}layerOpacityChanged(){if(null==this._materials[0])return;const e=this._materials[0].parameters.color,t=this._getCombinedOpacity(this.symbolLayer.color,{hasIntrinsicColor:!0}),r=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:r})}layerElevationInfoChanged(e,t,r){const o=this._elevationContext.mode,i=_(I.elevationModeChangeTypes,r,o);if(i!==v.UPDATE)return i;const n=b(o);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>n))}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r){const o=j(e.geometry);if(null==o)return null;const i=E(o,this._context.elevationProvider,this._context.renderCoordsHelper,t),n=i.position.length/3,s=y(2*n);M(s,i.mapPositions,n,this._context.elevationProvider.spatialReference);const a=new H(i,s,this._context.layerViewUid,e.uid);if(a.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,o.rings,"rings","WaterSymbol3DLayer"),0===a.outGeometries.length)return null;const l=new L({geometries:a.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:r}),c=new C(this,l,null,x,t);return c.alignedSampledElevation=a.renderData.sampledElevation,c.needsElevationUpdates=b(t.mode),c}_create3DShapeGeometries(e){const t=e.renderData.polygons,o=e.uvCoords;for(const{count:i,index:n,position:s,mapPositions:a,holeIndices:c}of t){if(null!=this._context.clippingExtent&&(l(a,k),!h(k,this._context.clippingExtent)))continue;const t=r(a,c,3);if(0===t.length)continue;const m=f(o,2*n,2*i),p=S({material:this._materials[0],indices:t,mapPositions:a,attributeData:{position:s,uv0:m}},e.objectAndLayerIdColor);e.outGeometries.push(p)}}_createAsOverlay(e){const t=j(e.geometry);if(null==t)return null;this._materials[0].renderPriority=this._renderPriority;const r=A(t,this._context.overlaySR),o=r.position.length/3,i=y(2*o);M(i,r.position,o,this._context.overlaySR);const n=new N(r,i,this._context.layerViewUid,e.uid);return n.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),n.outBoundingBox=m(),this._createAsOverlayWater(n),this._logGeometryCreationWarnings(n.renderData,t.rings,"rings","WaterSymbol3DLayer"),0===n.outGeometries.length?null:new w(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayWater(e){const t=e.uvCoords,o=e.renderData.polygons;for(const{position:i,holeIndices:n,index:s,count:a}of o){if(l(i,k),!h(k,this._context.clippingExtent))continue;p(e.outBoundingBox,k);const o=r(i,n,3);if(0===o.length)continue;const c=f(t,2*s,2*a),m=S({material:this._materials[0],indices:o,attributeData:{position:i,uv0:c}},e.objectAndLayerIdColor);e.outGeometries.push(new O(m,e))}}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function B(e){const t=n(),r=a(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function M(e,r,i,n){const a=t(n);u(W);for(let t=0;t<i;t++)o(z,r[3*t],r[3*t+1]),g(W,z);s(W,W,a);const l=W[0]%I.unitSizeOfTexture,c=W[1]%I.unitSizeOfTexture;V[0]=W[0]-l,V[1]=W[1]-c;for(let t=0;t<i;t++)e[2*t]=(r[3*t]*a-V[0])/I.unitSizeOfTexture,e[2*t+1]=(r[3*t+1]*a-V[1])/I.unitSizeOfTexture}const V=n(),W=d(),z=n(),k=c();class H extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}class N extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}export{I as Graphics3DWaterSymbolLayer,B as headingVectorFromAngle};
5
+ import e from"../../../../Color.js";import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as i,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{d as s}from"../../../../chunks/vec42.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as l,create as c,intersectsClippingArea as h,empty as m,expandWithAABB as p}from"../../../../geometry/support/aaBoundingBox.js";import{empty as d,create as u,expandPointInPlace as g}from"../../../../geometry/support/aaBoundingRect.js";import{newHalfFloatArray as y,halfFloatSubArray as f}from"../../../../geometry/support/HalfFloatArray.js";import{perVertexElevationAligner as x}from"./ElevationAligners.js";import{SymbolUpdateType as v,elevationModeChangeUpdateType as _,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as w}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as C}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as D}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as j,createWaterGeometry as S,PolygonCreationDataBase as G}from"./polygonUtils.js";import{geometryToRenderInfo as E,geometryToRenderInfoDraped as A}from"../../support/renderInfoUtils/polygon.js";import{Object3D as L}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as O}from"../../webgl-engine/lib/RenderGeometry.js";import{Parameters as P,WaterMaterial as T}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as R}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const U=["polyline","polygon","extent"];class I extends D{static{this.unitSizeOfTexture=100}static{this.elevationModeChangeTypes={definedChanged:v.RECREATE,staysOnTheGround:v.NONE,onTheGroundChanged:v.RECREATE}}constructor(e,t,r,o){super(e,t,r,o)}async doLoad(){}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,U,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,r,t.uid)}ensureMaterial(){if(this._materials[0])return;const t=new P,r=this.symbolLayer.color;null!=r&&(t.color=e.toUnitRGBA(r));const o=this._getCombinedOpacity(r,{hasIntrinsicColor:!0});t.color=[t.color[0],t.color[1],t.color[2],o],t.transparent=o<1||this.needsDrivenTransparentPass,t.waveDirection=null!=this.symbolLayer.waveDirection?B(this.symbolLayer.waveDirection):i(0,0);const n=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,s=R[n];t.waveStrength=s.waveStrength,t.waveTextureRepeat=s.textureRepeat,t.waveVelocity=s.waveVelocity,t.flowStrength=s.perturbationStrength,t.hasSlicePlane=this._context.slicePlaneEnabled,t.draped=this.draped,this._materials[0]=new T(t,this._context)}layerOpacityChanged(){if(null==this._materials[0])return;const e=this._materials[0].parameters.color,t=this._getCombinedOpacity(this.symbolLayer.color,{hasIntrinsicColor:!0}),r=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:r})}layerElevationInfoChanged(e,t,r){const o=this._elevationContext.mode,i=_(I.elevationModeChangeTypes,r,o);if(i!==v.UPDATE)return i;const n=b(o);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>n))}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r){const o=j(e.geometry);if(null==o)return null;const i=E(o,this._context.elevationProvider,this._context.renderCoordsHelper,t),n=i.position.length/3,s=y(2*n);M(s,i.mapPositions,n,this._context.elevationProvider.spatialReference);const a=new H(i,s,this._context.layerViewUid,e.uid);if(a.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,o.rings,"rings","WaterSymbol3DLayer"),0===a.outGeometries.length)return null;const l=new L({geometries:a.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:r}),c=new C(this,l,null,x,t);return c.alignedSampledElevation=a.renderData.sampledElevation,c.needsElevationUpdates=b(t.mode),c}_create3DShapeGeometries(e){const t=e.renderData.polygons,o=e.uvCoords;for(const{count:i,index:n,position:s,mapPositions:a,holeIndices:c}of t){if(null!=this._context.clippingExtent&&(l(a,k),!h(k,this._context.clippingExtent)))continue;const t=r(a,c,3);if(0===t.length)continue;const m=f(o,2*n,2*i),p=S({material:this._materials[0],indices:t,mapPositions:a,attributeData:{position:s,uv0:m}},e.objectAndLayerIdColor);e.outGeometries.push(p)}}_createAsOverlay(e){const t=j(e.geometry);if(null==t)return null;this._materials[0].renderPriority=this._renderPriority;const r=A(t,this._context.overlaySR),o=r.position.length/3,i=y(2*o);M(i,r.position,o,this._context.overlaySR);const n=new N(r,i,this._context.layerViewUid,e.uid);return n.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),n.outBoundingBox=m(),this._createAsOverlayWater(n),this._logGeometryCreationWarnings(n.renderData,t.rings,"rings","WaterSymbol3DLayer"),0===n.outGeometries.length?null:new w(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayWater(e){const t=e.uvCoords,o=e.renderData.polygons;for(const{position:i,holeIndices:n,index:s,count:a}of o){if(l(i,k),!h(k,this._context.clippingExtent))continue;p(e.outBoundingBox,k);const o=r(i,n,3);if(0===o.length)continue;const c=f(t,2*s,2*a),m=S({material:this._materials[0],indices:o,attributeData:{position:i,uv0:c}},e.objectAndLayerIdColor);e.outGeometries.push(new O(m,e))}}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function B(e){const t=n(),r=a(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function M(e,r,i,n){const a=t(n);d(W);for(let t=0;t<i;t++)o(z,r[3*t],r[3*t+1]),g(W,z);s(W,W,a);const l=W[0]%I.unitSizeOfTexture,c=W[1]%I.unitSizeOfTexture;V[0]=W[0]-l,V[1]=W[1]-c;for(let t=0;t<i;t++)e[2*t]=(r[3*t]*a-V[0])/I.unitSizeOfTexture,e[2*t+1]=(r[3*t+1]*a-V[1])/I.unitSizeOfTexture}const V=n(),W=u(),z=n(),k=c();class H extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}class N extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}export{I as Graphics3DWaterSymbolLayer,B as headingVectorFromAngle};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- const e=.42,n=.32;function r(r,t){if(r)switch(t){case"bright":{const e=(r[0]+r[1]+r[2])/3;return[e*n+(1-n),e*n+(1-n),e*n+(1-n),r[3]*n]}case"dark":return[r[0]*e,r[1]*e,r[2]*e,r[3]*e];case void 0:case"none":return r}}export{r as focusAreaHUDColor};
5
+ const t=.42,r=.32;function c(c,n){if(c)switch(n){case"bright":{const t=(c[0]+c[1]+c[2])/3;return[t*r+(1-r),t*r+(1-r),t*r+(1-r),c[3]*r]}case"dark":return[c[0]*t,c[1]*t,c[2]*t,c[3]*t]}}export{c as focusAreaHUDColor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.js";import{rotateZ as e,rotateX as r,rotateY as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as o,fromArray as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as l}from"../../../../chunks/vec42.js";import{clone as u,ONES as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectPoint as c}from"../../../../geometry/projection.js";import{width as m,depth as p,height as f}from"../../../../geometry/support/aaBoundingBox.js";import{create as h}from"../../../../geometry/support/aaBoundingRect.js";import{ringsCentroid as y}from"../../../../geometry/support/centroid.js";import{getPointOnPath as x,getPathLength as g}from"../../../../geometry/support/coordsUtils.js";import{vertexSpaceOriginToPoint as d}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{makeDehydratedPoint as j}from"../../../../layers/graphics/dehydratedPoint.js";import{isHydratedGeometry as v,clonePoint as z}from"../../../../layers/graphics/hydratedFeatures.js";function b(t,e){if("point"===t.type)return P(t,e,!1);if(v(t))switch(t.type){case"extent":return P(t.center,e,!1);case"polygon":return P(t.centroid,e,!1);case"polyline":return P(w(t),e,!0);case"mesh":return P(d(t.vertexSpace,t.spatialReference)??t.extent.center,e,!1);case"multipoint":return}else switch(t.type){case"extent":return P(M(t),e,!0);case"polygon":return P(R(t),e,!0);case"polyline":return P(w(t),e,!0);case"multipoint":return}}function w(t){const e=t.paths[0];if(!e||0===e.length)return null;const r=x(e,g(e)/2);return j(r[0],r[1],r[2],t.spatialReference)}function M(t){return j(.5*(t.xmax+t.xmin),.5*(t.ymax+t.ymin),null!=t.zmin&&null!=t.zmax&&isFinite(t.zmin)&&isFinite(t.zmax)?.5*(t.zmax+t.zmin):void 0,t.spatialReference)}function R(t){const e=t.rings[0];if(!e||0===e.length)return null;const r=y(t.rings,!!t.hasZ);return j(r[0],r[1],r[2],t.spatialReference)}function P(t,e,r){const n=r?t:z(t);return e&&t?c(t,n,e)?n:null:n}function F(t){if(!t)return 0;switch(t.type){case"point":return t.z;case"extent":return t.zmax;case"polygon":return t.hasZ?t.rings.reduce(((t,e)=>e.reduce(((t,e)=>Math.max(t,e[2])),t)),-1/0):void 0;case"polyline":return t.hasZ?t.paths.reduce(((t,e)=>e.reduce(((t,e)=>Math.max(t,e[2])),t)),-1/0):void 0;case"mesh":return t.extent.zmax;case"multipoint":return}}function S(t,e,r,n=0){if(t){e||(e=h());const i=t;let o=.5*i.width*(r-1),s=.5*i.height*(r-1);return i.width<1e-7*i.height?o+=s/20:i.height<1e-7*i.width&&(s+=o/20),l(e,i.xmin-o-n,i.ymin-s-n,i.xmax+o+n,i.ymax+s+n),e}return null}function A(t,e,r=null){const n=u(a);return null!=t&&(n[0]=t[0],n[1]=t[1],n[2]=t[2]),null!=e?n[3]=e:null!=t&&t.length>3&&(n[3]=t[3]),r&&(n[0]*=r,n[1]*=r,n[2]*=r,n[3]*=r),n}function B(t,e,r,n,i,o){for(let s=0;s<3;++s)o[s]=null!=t?.[s]?t[s]:null!=r?.[s]?r[s]:i[s];return o[3]=null!=e?e:null!=n?n:i[3],o}function D(t=o,e,r,n=1){const i=new Array(3);if(null==e||null==r)i[0]=1,i[1]=1,i[2]=1;else{let n,o=0;for(let s=2;s>=0;s--){const l=t[s],u=null!=l,a=0===s&&!n&&!u,c=r[s];let m;"symbol-value"===l||a?m=0!==c?e[s]/c:1:u&&"proportional"!==l&&isFinite(l)&&(m=0!==c?l/c:1),null!=m&&(i[s]=m,n=m,o=Math.max(o,Math.abs(m)))}for(let t=2;t>=0;t--)null==i[t]?i[t]=n:0===i[t]&&(i[t]=.001*o)}for(let o=2;o>=0;o--)i[o]/=n;return s(i)}function I(t){return null!=t.isPrimitive}function U(t){return Z(I(t)?[t.width,t.depth,t.height]:t)?null:"Symbol sizes may not be negative values"}function Z(t){const e=t=>null==t||t>=0;return Array.isArray(t)?t.every(e):e(t)}function k(t,o,s,l=i()){return t&&e(l,l,-t/180*Math.PI),o&&r(l,l,o/180*Math.PI),s&&n(l,l,s/180*Math.PI),l}function E(e,r,n){if(null!=n.minDemResolution)return n.minDemResolution;const i=t(r),o=m(e)*i,s=p(e)*i,l=f(e)*(r.isGeographic?1:i);return 0===o&&0===s&&0===l?n.minDemResolutionForPoints:.01*Math.max(o,s,l)}export{b as computeCentroid,F as computeMaxZ,k as computeObjectRotation,D as computeObjectScale,E as demResolutionForBoundingBox,S as enlargeExtent,Z as isValidSize,A as mixinColorAndOpacity,B as overrideColor,U as validateSymbolLayerSize};
5
+ import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.js";import{rotateZ as e,rotateX as r,rotateY as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as o,fromArray as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as l}from"../../../../chunks/vec42.js";import{clone as u,ONES as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectPoint as c}from"../../../../geometry/projectionUtils.js";import{width as m,depth as p,height as f}from"../../../../geometry/support/aaBoundingBox.js";import{create as h}from"../../../../geometry/support/aaBoundingRect.js";import{ringsCentroid as y}from"../../../../geometry/support/centroid.js";import{getPointOnPath as x,getPathLength as g}from"../../../../geometry/support/coordsUtils.js";import{vertexSpaceOriginToPoint as d}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{makeDehydratedPoint as j}from"../../../../layers/graphics/dehydratedPoint.js";import{isHydratedGeometry as v,clonePoint as z}from"../../../../layers/graphics/hydratedFeatures.js";function b(t,e){if("point"===t.type)return P(t,e,!1);if(v(t))switch(t.type){case"extent":return P(t.center,e,!1);case"polygon":return P(t.centroid,e,!1);case"polyline":return P(w(t),e,!0);case"mesh":return P(d(t.vertexSpace,t.spatialReference)??t.extent.center,e,!1);case"multipoint":return}else switch(t.type){case"extent":return P(M(t),e,!0);case"polygon":return P(R(t),e,!0);case"polyline":return P(w(t),e,!0);case"multipoint":return}}function w(t){const e=t.paths[0];if(!e||0===e.length)return null;const r=x(e,g(e)/2);return j(r[0],r[1],r[2],t.spatialReference)}function M(t){return j(.5*(t.xmax+t.xmin),.5*(t.ymax+t.ymin),null!=t.zmin&&null!=t.zmax&&isFinite(t.zmin)&&isFinite(t.zmax)?.5*(t.zmax+t.zmin):void 0,t.spatialReference)}function R(t){const e=t.rings[0];if(!e||0===e.length)return null;const r=y(t.rings,!!t.hasZ);return j(r[0],r[1],r[2],t.spatialReference)}function P(t,e,r){const n=r?t:z(t);return e&&t?c(t,n,e)?n:null:n}function F(t){if(!t)return 0;switch(t.type){case"point":return t.z;case"extent":return t.zmax;case"polygon":return t.hasZ?t.rings.reduce(((t,e)=>e.reduce(((t,e)=>Math.max(t,e[2])),t)),-1/0):void 0;case"polyline":return t.hasZ?t.paths.reduce(((t,e)=>e.reduce(((t,e)=>Math.max(t,e[2])),t)),-1/0):void 0;case"mesh":return t.extent.zmax;case"multipoint":return}}function S(t,e,r,n=0){if(t){e||(e=h());const i=t;let o=.5*i.width*(r-1),s=.5*i.height*(r-1);return i.width<1e-7*i.height?o+=s/20:i.height<1e-7*i.width&&(s+=o/20),l(e,i.xmin-o-n,i.ymin-s-n,i.xmax+o+n,i.ymax+s+n),e}return null}function U(t,e,r=null){const n=u(a);return null!=t&&(n[0]=t[0],n[1]=t[1],n[2]=t[2]),null!=e?n[3]=e:null!=t&&t.length>3&&(n[3]=t[3]),r&&(n[0]*=r,n[1]*=r,n[2]*=r,n[3]*=r),n}function A(t,e,r,n,i,o){for(let s=0;s<3;++s)o[s]=null!=t?.[s]?t[s]:null!=r?.[s]?r[s]:i[s];return o[3]=null!=e?e:null!=n?n:i[3],o}function B(t=o,e,r,n=1){const i=new Array(3);if(null==e||null==r)i[0]=1,i[1]=1,i[2]=1;else{let n,o=0;for(let s=2;s>=0;s--){const l=t[s],u=null!=l,a=0===s&&!n&&!u,c=r[s];let m;"symbol-value"===l||a?m=0!==c?e[s]/c:1:u&&"proportional"!==l&&isFinite(l)&&(m=0!==c?l/c:1),null!=m&&(i[s]=m,n=m,o=Math.max(o,Math.abs(m)))}for(let t=2;t>=0;t--)null==i[t]?i[t]=n:0===i[t]&&(i[t]=.001*o)}for(let o=2;o>=0;o--)i[o]/=n;return s(i)}function D(t){return null!=t.isPrimitive}function I(t){return Z(D(t)?[t.width,t.depth,t.height]:t)?null:"Symbol sizes may not be negative values"}function Z(t){const e=t=>null==t||t>=0;return Array.isArray(t)?t.every(e):e(t)}function k(t,o,s,l=i()){return t&&e(l,l,-t/180*Math.PI),o&&r(l,l,o/180*Math.PI),s&&n(l,l,s/180*Math.PI),l}function E(e,r,n){if(null!=n.minDemResolution)return n.minDemResolution;const i=t(r),o=m(e)*i,s=p(e)*i,l=f(e)*(r.isGeographic?1:i);return 0===o&&0===s&&0===l?n.minDemResolutionForPoints:.01*Math.max(o,s,l)}export{b as computeCentroid,F as computeMaxZ,k as computeObjectRotation,B as computeObjectScale,E as demResolutionForBoundingBox,S as enlargeExtent,Z as isValidSize,U as mixinColorAndOpacity,A as overrideColor,I as validateSymbolLayerSize};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{b as e,c as t,_ as r}from"../../../../../chunks/tslib.es6.js";import a from"../../../../../core/Evented.js";import{throwIfAborted as n}from"../../../../../core/promiseUtils.js";import{watch as i,initial as o}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import c from"../../../../../geometry/Extent.js";import{initializeProjection as d,project as m}from"../../../../../geometry/projection.js";import u from"../../../../../geometry/SpatialReference.js";import{QueryEngine as h}from"../../../../../layers/graphics/data/QueryEngine.js";import y from"../../../../../rest/support/Query.js";import{FeatureProcessingContext as p}from"./FeatureProcessingContext.js";import{PipelineCommand as f}from"./PipelineCommand.js";import{Tile3DManager as _}from"./Tile3DManager.js";import{TileLocks as C}from"./TileLocks.js";import{TiledFeatureStore as w}from"./featureSet/TiledFeatureStore.js";import{Tile3DFetcher as g}from"./fetching/Tile3DFetcher.js";import{RenderCommandContext as x}from"./rendering/RenderCommandContext.js";import{RenderCoordsHelper as v}from"../../../support/RenderCoordsHelper.js";let R=class extends a.EventedAccessor{constructor(){super(...arguments),this.remoteClient=null,this._featureStore=new w,this._tileLocks=new C,this._tileManager=null,this._renderer=null,this._fetcher=null,this._queryEngine=null,this._defaultQueryJSON=null,this._mainThreadDelegate=null,this._viewSpatialReference=null,this._renderCommandContext=null,this._context=null}get updating(){return this._tileManager.updating}destroy(){this._featureStore.clear(),this._tileManager?.destroy()}async setup({viewSpatialReference:e,renderSpatialReference:t,viewingMode:r,layerInfo:a,layerViewInfo:n}){const s=u.fromJSON(e);this._viewSpatialReference=s;const l=u.fromJSON(t);this._fetcher=new g(this._viewSpatialReference,y.fromJSON(a.baseQuery),a.url,a.objectIdField,a.capabilities),this._queryEngine=new h({hasZ:!0,hasM:!1,geometryType:"esriGeometryPoint",featureIdInfo:{type:"object-id",fieldName:a.objectIdField},fieldsIndex:a.fieldIndex,availableFields:[a.objectIdField],spatialReference:e,featureStore:this._featureStore,timeInfo:a.timeInfo}),this._mainThreadDelegate={createTexture:async(e,t)=>{const r={data:e,parameters:t};return await this.remoteClient.invoke("createTexture",r,{transferList:[e.buffer]})},releaseTexture:async e=>{const t={uid:e};await this.remoteClient.invoke("releaseTexture",t)},createMaterial:async e=>{const t={materialJSON:e};await this.remoteClient.invoke("createMaterial",t)},destroyMaterial:async e=>{const t={materialId:e};await this.remoteClient.invoke("destroyMaterial",t)},createDirectRenderer:async e=>{const t={materialId:e};await this.remoteClient.invoke("createDirectRenderer",t)},destroyDirectRenderer:async e=>{const t={materialId:e};await this.remoteClient.invoke("destroyDirectRenderer",t)},createLodRenderer:async(e,t,r)=>{const a={rendererId:e,lodRenderGeometry:t};await this.remoteClient.invoke("createLoDRenderer",a,{transferList:r})},destroyLodRenderer:async e=>{const t={rendererId:e};await this.remoteClient.invoke("destroyLoDRenderer",t)},executeRenderCommands:async e=>{const t={commands:e.commands};await this.remoteClient.invoke("dispatchRenderCommands",t,{transferList:e.transferList})},applyElevationAlignmentTo:async e=>{const t={mapPoints:e};return await this.remoteClient.invoke("applyElevationAlignment",t,{transferList:[e.buffer]})}};const f=v.create(r,l),C=new x(r,this._mainThreadDelegate);this._renderCommandContext=C;const w=new p(s,l,this._mainThreadDelegate,f,C,a,n);this._context=w,this._renderer=w.symbolRendererFactory.createSymbolRendererFromJSON(a.renderer),this._defaultQueryJSON=new y({outSpatialReference:s}).toJSON();let R=null;if(null!=a.fullExtent){const e=c.fromJSON(a.fullExtent);await d(e.spatialReference,s),R=m(e,s)}return this._tileManager=new _({loadTile:(e,t)=>this._fetcher.fetch(e,t),createAddCommand:(e,t)=>this._createAddFeatureDataCommand(e,t),createRemoveCommand:e=>this._createRemoveFeatureDataCommand(e),createUpdateCommand:(e,t)=>this._createUpdateFeatureDataVisibilityCommand(e,t),tileLocks:this._tileLocks,extent:R}),this.addHandles(i((()=>this.updating),(e=>{this.emit("notify-updating",{updating:e})})),o),null!=this._renderer&&await this._renderer.load(),j}async executeQuery(e,t){return{result:await this._queryEngine.executeQuery(this._ensureQuery(e),t)}}async executeQueryForIds(e,t){const r=await this._queryEngine.executeQueryForIdSet(this._ensureQuery(e),t);return{result:Array.from(r)}}async executeQueryForCount(e,t){return{result:await this._queryEngine.executeQueryForCount(this._ensureQuery(e),t)}}async executeQueryForExtent(e,t){return{result:await this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t)}}async executeQueryForLatestObservations(e,t){return{result:await this._queryEngine.executeQueryForLatestObservations(this._ensureQuery(e),t)}}onTileTreeChange(e){return this._tileManager.onTileTreeChange(e),Promise.resolve(j)}async onElevationChange(e){return j}async onLayerViewOpacityChange(e){const{_context:t,_renderer:r}=this;if(t.layerViewInfo.fullOpacity=e,null==r)return j;const a=await r.createUpdateLayerViewOpacityCommand(e);return await a.execute(),j}async onRendererChange(r){const{_context:a}=this,n=a.symbolRendererFactory.createSymbolRendererFromJSON(r);await n.load();const i=this._renderer;this._renderer=n;const o=[...this._tileManager.loadedTiles()],s=o.map((e=>e.tileId));{const r={stack:[],error:void 0,hasError:!1};try{e(r,await this._tileLocks.lock(s),!1);const t=o.flatMap((e=>[i.createRemoveCommand(e.id),n.createAddCommand(e)])),l=await Promise.all(t),c=a.joinPipelineCommands(l);await c.execute()}catch(c){r.error=c,r.hasError=!0}finally{t(r)}}const l=await i.createDestroyCommand();return await l.execute(),j}async _createAddFeatureDataCommand(e,t){const r=this._featureStore,a=this._renderer;let i;return i=null!=a?await a.createAddCommand(e):f.create(this._renderCommandContext),n(t),i.appendPipelineStateCommand((()=>{r.addTile(e)})),i}async _createRemoveFeatureDataCommand(e){const t=this._featureStore,r=this._renderer;let a;return a=null!=r?await r.createRemoveCommand(e):f.create(this._renderCommandContext),a.appendPipelineStateCommand((()=>{t.removeTile(e)})),a}async _createUpdateFeatureDataVisibilityCommand(e,t){const r=this._renderer;let a;return a=null!=r?await r.createUpdateVisibilityCommand(e):f.create(this._renderCommandContext),n(t),a}_ensureQuery(e){return e??this._defaultQueryJSON}};r([s()],R.prototype,"updating",null),R=r([l("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorker")],R);const S=R,j={result:void 0};export{S as default};
5
+ import{b as e,c as t,_ as r}from"../../../../../chunks/tslib.es6.js";import a from"../../../../../core/Evented.js";import{throwIfAborted as n}from"../../../../../core/promiseUtils.js";import{watch as i,initial as o}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import c from"../../../../../geometry/Extent.js";import{initializeProjection as d,project as m}from"../../../../../geometry/projectionUtils.js";import u from"../../../../../geometry/SpatialReference.js";import{QueryEngine as h}from"../../../../../layers/graphics/data/QueryEngine.js";import y from"../../../../../rest/support/Query.js";import{FeatureProcessingContext as p}from"./FeatureProcessingContext.js";import{PipelineCommand as f}from"./PipelineCommand.js";import{Tile3DManager as _}from"./Tile3DManager.js";import{TileLocks as C}from"./TileLocks.js";import{TiledFeatureStore as w}from"./featureSet/TiledFeatureStore.js";import{Tile3DFetcher as g}from"./fetching/Tile3DFetcher.js";import{RenderCommandContext as x}from"./rendering/RenderCommandContext.js";import{RenderCoordsHelper as v}from"../../../support/RenderCoordsHelper.js";let R=class extends a.EventedAccessor{constructor(){super(...arguments),this.remoteClient=null,this._featureStore=new w,this._tileLocks=new C,this._tileManager=null,this._renderer=null,this._fetcher=null,this._queryEngine=null,this._defaultQueryJSON=null,this._mainThreadDelegate=null,this._viewSpatialReference=null,this._renderCommandContext=null,this._context=null}get updating(){return this._tileManager.updating}destroy(){this._featureStore.clear(),this._tileManager?.destroy()}async setup({viewSpatialReference:e,renderSpatialReference:t,viewingMode:r,layerInfo:a,layerViewInfo:n}){const s=u.fromJSON(e);this._viewSpatialReference=s;const l=u.fromJSON(t);this._fetcher=new g(this._viewSpatialReference,y.fromJSON(a.baseQuery),a.url,a.objectIdField,a.capabilities),this._queryEngine=new h({hasZ:!0,hasM:!1,geometryType:"esriGeometryPoint",featureIdInfo:{type:"object-id",fieldName:a.objectIdField},fieldsIndex:a.fieldIndex,availableFields:[a.objectIdField],spatialReference:e,featureStore:this._featureStore,timeInfo:a.timeInfo}),this._mainThreadDelegate={createTexture:async(e,t)=>{const r={data:e,parameters:t};return await this.remoteClient.invoke("createTexture",r,{transferList:[e.buffer]})},releaseTexture:async e=>{const t={uid:e};await this.remoteClient.invoke("releaseTexture",t)},createMaterial:async e=>{const t={materialJSON:e};await this.remoteClient.invoke("createMaterial",t)},destroyMaterial:async e=>{const t={materialId:e};await this.remoteClient.invoke("destroyMaterial",t)},createDirectRenderer:async e=>{const t={materialId:e};await this.remoteClient.invoke("createDirectRenderer",t)},destroyDirectRenderer:async e=>{const t={materialId:e};await this.remoteClient.invoke("destroyDirectRenderer",t)},createLodRenderer:async(e,t,r)=>{const a={rendererId:e,lodRenderGeometry:t};await this.remoteClient.invoke("createLoDRenderer",a,{transferList:r})},destroyLodRenderer:async e=>{const t={rendererId:e};await this.remoteClient.invoke("destroyLoDRenderer",t)},executeRenderCommands:async e=>{const t={commands:e.commands};await this.remoteClient.invoke("dispatchRenderCommands",t,{transferList:e.transferList})},applyElevationAlignmentTo:async e=>{const t={mapPoints:e};return await this.remoteClient.invoke("applyElevationAlignment",t,{transferList:[e.buffer]})}};const f=v.create(r,l),C=new x(r,this._mainThreadDelegate);this._renderCommandContext=C;const w=new p(s,l,this._mainThreadDelegate,f,C,a,n);this._context=w,this._renderer=w.symbolRendererFactory.createSymbolRendererFromJSON(a.renderer),this._defaultQueryJSON=new y({outSpatialReference:s}).toJSON();let R=null;if(null!=a.fullExtent){const e=c.fromJSON(a.fullExtent);await d(e.spatialReference,s),R=m(e,s)}return this._tileManager=new _({loadTile:(e,t)=>this._fetcher.fetch(e,t),createAddCommand:(e,t)=>this._createAddFeatureDataCommand(e,t),createRemoveCommand:e=>this._createRemoveFeatureDataCommand(e),createUpdateCommand:(e,t)=>this._createUpdateFeatureDataVisibilityCommand(e,t),tileLocks:this._tileLocks,extent:R}),this.addHandles(i((()=>this.updating),(e=>{this.emit("notify-updating",{updating:e})})),o),null!=this._renderer&&await this._renderer.load(),j}async executeQuery(e,t){return{result:await this._queryEngine.executeQuery(this._ensureQuery(e),t)}}async executeQueryForIds(e,t){const r=await this._queryEngine.executeQueryForIdSet(this._ensureQuery(e),t);return{result:Array.from(r)}}async executeQueryForCount(e,t){return{result:await this._queryEngine.executeQueryForCount(this._ensureQuery(e),t)}}async executeQueryForExtent(e,t){return{result:await this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t)}}async executeQueryForLatestObservations(e,t){return{result:await this._queryEngine.executeQueryForLatestObservations(this._ensureQuery(e),t)}}onTileTreeChange(e){return this._tileManager.onTileTreeChange(e),Promise.resolve(j)}async onElevationChange(e){return j}async onLayerViewOpacityChange(e){const{_context:t,_renderer:r}=this;if(t.layerViewInfo.fullOpacity=e,null==r)return j;const a=await r.createUpdateLayerViewOpacityCommand(e);return await a.execute(),j}async onRendererChange(r){const{_context:a}=this,n=a.symbolRendererFactory.createSymbolRendererFromJSON(r);await n.load();const i=this._renderer;this._renderer=n;const o=[...this._tileManager.loadedTiles()],s=o.map((e=>e.tileId));{const r={stack:[],error:void 0,hasError:!1};try{e(r,await this._tileLocks.lock(s),!1);const t=o.flatMap((e=>[i.createRemoveCommand(e.id),n.createAddCommand(e)])),l=await Promise.all(t),c=a.joinPipelineCommands(l);await c.execute()}catch(c){r.error=c,r.hasError=!0}finally{t(r)}}const l=await i.createDestroyCommand();return await l.execute(),j}async _createAddFeatureDataCommand(e,t){const r=this._featureStore,a=this._renderer;let i;return i=null!=a?await a.createAddCommand(e):f.create(this._renderCommandContext),n(t),i.appendPipelineStateCommand((()=>{r.addTile(e)})),i}async _createRemoveFeatureDataCommand(e){const t=this._featureStore,r=this._renderer;let a;return a=null!=r?await r.createRemoveCommand(e):f.create(this._renderCommandContext),a.appendPipelineStateCommand((()=>{t.removeTile(e)})),a}async _createUpdateFeatureDataVisibilityCommand(e,t){const r=this._renderer;let a;return a=null!=r?await r.createUpdateVisibilityCommand(e):f.create(this._renderCommandContext),n(t),a}_ensureQuery(e){return e??this._defaultQueryJSON}};r([s()],R.prototype,"updating",null),R=r([l("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorker")],R);const S=R,j={result:void 0};export{S as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{indexOf as r,PositionHint as i}from"../../../../core/arrayUtils.js";import s from"../../../../core/Logger.js";import{clamp as o}from"../../../../core/mathUtils.js";import{unwrapUpdating as n,updating as a,isUpdating as l}from"../../../../core/maybeUpdating.js";import{whenOnce as c}from"../../../../core/reactiveUtils.js";import{getUnitString as p}from"../../../../core/unitUtils.js";import{property as u}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import{subclass as g}from"../../../../core/accessorSupport/decorators/subclass.js";import{o as m,f as d,i as f}from"../../../../chunks/vec32.js";import{fromValues as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import h from"../../../../core/sql/WhereClause.js";import{getReferenceEllipsoid as j}from"../../../../geometry/ellipsoidUtils.js";import{load as R,project as S}from"../../../../geometry/projection.js";import w from"../../../../geometry/SpatialReference.js";import{projectBoundingSphere as E}from"../../../../geometry/projection/projectBoundingSphere.js";import{projectVectorToVector as v}from"../../../../geometry/projection/projectVectorToVector.js";import{create as b}from"../../../../geometry/support/aaBoundingBox.js";import{fromValues as F,expandWithNestedArray as I,expand as _}from"../../../../geometry/support/aaBoundingRect.js";import{doubleArrayFrom as k}from"../../../../geometry/support/DoubleArray.js";import{earth as M}from"../../../../geometry/support/Ellipsoid.js";import{isWGS84 as T,isWebMercator as D}from"../../../../geometry/support/spatialReferenceUtils.js";import{f as G}from"../../../../chunks/sphere.js";import{project as C}from"../../../../geometry/support/webMercatorUtils.js";import A from"../../../../layers/support/FeatureFilter.js";import{objectIdFilter as x,filterInPlace as L}from"./I3SUtil.js";let O=class extends t{constructor(e){super(e),this._projectionEngineLoaded=!1}initialize(){c((()=>this.viewFilter?.geometry||null!=this.layerFilter)).then((()=>this.loadAsyncModule(import("../../../../geometry/geometryEngine.js").then((e=>{this.destroyed||(this._geometryEngine=e)})))))}get sortedObjectIds(){if(null==this.viewFilter?.objectIds)return null;const e=k(this.viewFilter.objectIds);return e.sort(),e}get parsedWhereClause(){const e=this.viewFilter?.where;if(null==e||!e)return null;try{return h.create(e,{fieldsIndex:this.layerFieldsIndex})}catch(t){s.getLogger(this).error(`Failed to parse filter where clause: ${t}`)}return null}addFilters(e,t,r,i){const o=this.sortedObjectIds;null!=o&&e.push((e=>x(o,!0,e))),this.addSqlFilter(e,this.parsedWhereClause),this.addTimeFilter(e,this.viewFilter?.timeExtent);const a=n(this._layerMaskGeometries),l=this._geometryEngine,c=()=>s.getLogger(this);if(null!=a&&null!=this.layerFilter&&null!=l){const s=this.layerFilter.spatialRelationship;e.push(((e,o)=>W(c,l,e,o,i,t,r,a,s)))}const p=n(this._viewMaskGeometries);if(null!=p&&null!=this.viewFilter&&null!=l){const s=this.viewFilter.spatialRelationship;e.push(((e,o)=>W(c,l,e,o,i,t,r,p,s)))}}isMBSGeometryVisible(e,t,r){const i=n(this._layerMaskGeometries),o=this._geometryEngine;if(null!=i&&null!=this.layerFilter&&null!=o){const n=this.layerFilter.spatialRelationship,a=i[0].spatialReference||t;if(!E(e,r,q,a))return s.getLogger(this).warnOnce("SceneLayer.mask geometry is using unsupported SpatialReference, skipping geometry filter for MBS"),!0;return V(o,q,i,a,n)}const a=n(this._viewMaskGeometries);if(null!=a&&null!=this.viewFilter&&null!=o){const i=this.viewFilter.spatialRelationship,n=a[0].spatialReference||t;if(!E(e,r,q,n))return s.getLogger(this).warnOnce("SceneLayerView.filter.geometry is using unsupported SpatialReference, skipping geometry filter for MBS"),!0;return V(o,q,a,n,i)}return!0}get parsedGeometry(){const e=n(this._viewMaskGeometries),t=n(this._layerMaskGeometries);return null==e||null==t?e||t:t.concat(e)}get _layerMaskGeometries(){const e=this.layerFilter;return null==e?null:null==this._geometryEngine?a:"disjoint"===e.spatialRelationship?e.geometries.map((e=>({type:"polygon",rings:e.rings,spatialReference:e.spatialReference,cache:{}}))):[e.geometries.reduce(((e,t)=>(e.rings=[...e.rings,...t.rings],e)),{type:"polygon",rings:[],spatialReference:e.geometries[0].spatialReference,cache:{}})]}get _viewMaskGeometries(){if(null==this.viewFilter)return null;const{geometry:e}=this.viewFilter;if(null==e)return null;if(null==this.viewFilter||null==this._geometryEngine)return a;const{distance:t,units:r}=this.viewFilter,i=this.viewFilter.spatialRelationship,o="mesh"===e.type?e.extent:e;if(null==t||0===t)return K(this._geometryEngine,o,i);const n=r||p(o.spatialReference);if(o.spatialReference.isWGS84){const e=this._geometryEngine.geodesicBuffer(o,t,n);return K(this._geometryEngine,e,i)}const l=C(o,w.WGS84);if(null!=l){const e=C(this._geometryEngine.geodesicBuffer(l,t,n),o.spatialReference);return K(this._geometryEngine,e,i)}if(!this._projectionEngineLoaded&&(this.loadAsyncModule(R().then((()=>this._projectionEngineLoaded=!0))),!this._projectionEngineLoaded))return null;let c=null;try{c=S(o,w.WGS84)}catch(u){}if(c)try{c=S(this._geometryEngine.geodesicBuffer(c,t,n),o.spatialReference)}catch(u){c=null}return c||s.getLogger(this).error(`Filter by geodesic buffer (distance) unsupported, failed to project input geometry (${o.spatialReference.wkid}) to WGS84.`),K(this._geometryEngine,c,i)}get updating(){return l(this._layerMaskGeometries)||l(this._viewMaskGeometries)}static checkSupport(e){return null!=e&&(!!P(e.spatialRelationship)||(s.getLogger(this.prototype).warn(`Filters with spatialRelationship other than ${B.join(", ")} are not supported for mesh scene layers`),!1))}};e([u()],O.prototype,"layerFilter",void 0),e([u({type:A})],O.prototype,"viewFilter",void 0),e([u()],O.prototype,"layerFieldsIndex",void 0),e([u()],O.prototype,"loadAsyncModule",void 0),e([u()],O.prototype,"addSqlFilter",void 0),e([u()],O.prototype,"addTimeFilter",void 0),e([u({readOnly:!0})],O.prototype,"sortedObjectIds",null),e([u({readOnly:!0})],O.prototype,"parsedWhereClause",null),e([u({readOnly:!0})],O.prototype,"parsedGeometry",null),e([u({readOnly:!0})],O.prototype,"_layerMaskGeometries",null),e([u({readOnly:!0})],O.prototype,"_viewMaskGeometries",null),e([u()],O.prototype,"updating",null),e([u()],O.prototype,"_projectionEngineLoaded",void 0),e([u()],O.prototype,"_geometryEngine",void 0),O=e([g("esri.views.3d.layers.i3s.I3SMeshViewFilter")],O);const B=(e=>e)(["contains","intersects","disjoint"]);function P(e){return null!=e&&B.includes(e)}var U;function K(e,t,s){if(null==t)return null;if("disjoint"===s&&"polygon"===t.type){const s=t.rings.length,o=t.spatialReference,n=new Array(s);for(let e=0;e<s;++e){const r=F(1/0,1/0,-1/0,-1/0);I(r,t.rings[e]),n[e]={type:"polygon",rings:[t.rings[e]],spatialReference:o,cache:{},aabr:r}}n.sort(((e,t)=>e.aabr[0]-t.aabr[0]));const a=new Set,l=new i;for(let t=0;t<n.length;++t){const i=n[t],s=i.aabr[0];a.forEach((t=>{if(s>=t.aabr[2])return void a.delete(t);if(i.aabr[1]>t.aabr[3]||i.aabr[3]<t.aabr[1]||!e.intersects(i,t))return;i.rings=i.rings.concat(t.rings),_(i.aabr,t.aabr,i.aabr),i.cache={},a.delete(t);const o=r(n,t,n.length,l);n.splice(o,1)})),a.add(i)}for(const e of n)e.aabr=void 0;return n}return[t]}function V(e,t,r,i,s){if(t[3]>=.5*(t[2]+j(i).radius))return!0;const o=$(e,t,i);return r.every((t=>z(e,t,o,s)!==U.DISCARD))}function W(e,t,r,i,s,o,n,a,l){const c=a[0].spatialReference||o.spatialReference;if(!E(i.node.serviceMbsInIndexSR,n,q,c))return void e().warnOnce("SceneLayerView.filter.geometry is using unsupported SpatialReference, skipping geometry filter");const p=$(t,q,c),u=N(l,o,c,s,i.objectHandle),g="intersects"===l;let m=null;for(const d of a){if(0===r.length)return;switch(z(t,d,p,l)){case U.DISCARD:return g&&(i.weaklyRemovedIds=i.weaklyRemovedIds?.concat(r)??r.slice()),void(r.length=0);case U.KEEP:continue}L(r,i.featureIds,(e=>!!J(t,d,e,u)||(g&&(m||=[],m.push(i.featureIds[e])),!1)))}m&&(i.weaklyRemovedIds=i.weaklyRemovedIds?.concat(m)??m)}!function(e){e[e.KEEP=0]="KEEP",e[e.DISCARD=1]="DISCARD",e[e.TEST=2]="TEST"}(U||(U={}));const q=G(0,0,0,0);function N(e,t,r,i,s){const o=t.renderSpatialReference,n=new Map,a={type:"polygon",rings:[[[0,0,0],[0,0,0],[0,0,0],[0,0,0]]],spatialReference:r};a.rings[0][3]=a.rings[0][0];const l={indices:null,data:null,stride:0,startIndex:0,endIndex:0};let c,p;switch(e){case"intersects":c=(e,t,r)=>e.intersects(t,r)?U.KEEP:U.TEST,p=H;break;case"contains":c=(e,t,r)=>e.contains(t,r)?U.TEST:U.DISCARD,p=H;break;default:c=(e,t,r)=>e.disjoint(t,r)?U.TEST:U.DISCARD,p=Z}return{collection:i,object:s,type:e,maskSR:r,renderSR:o,aabbCache:n,triangle:a,positions:l,triangleTest:c,geometryTest:p}}function $(e,t,r){const i={type:"point",x:t[0],y:t[1],hasZ:!1,hasM:!1,spatialReference:r},s=!T(r)&&!D(r),n=Number.isNaN(t[3])?0:o(t[3],0,2*M.radius),a=s?e.buffer(i,n,1):e.geodesicBuffer(i,n,1);return a.type="polygon",a}function z(e,t,r,i){switch(i){case"intersects":case"contains":return H(e,t,r);case"disjoint":return Z(e,t,r)}}function H(e,t,r){return e.intersects(t,r)?e.contains(t,r)?U.KEEP:U.TEST:U.DISCARD}function Z(e,t,r){return e.intersects(t,r)?e.contains(t,r)?U.DISCARD:U.TEST:U.KEEP}function J(e,t,r,i){const{collection:s,object:o,renderSR:n,maskSR:a,geometryTest:l,aabbCache:c}=i;let p=c.get(r);if(!p){const e=s.getObjectTransform(o);s.getComponentAabb(o,r,Q);const t=[y(Q[0],Q[1],0),y(Q[0],Q[4],0),y(Q[3],Q[4],0),y(Q[3],Q[1],0)];for(let r=0;r<4;++r)m(t[r],t[r],e.rotationScale),d(t[r],t[r],e.position),v(t[r],n,t[r],a);p={type:"polygon",rings:[t],spatialReference:a,cache:{}},p.rings[0][4]=p.rings[0][0],c.set(r,p)}switch(l(e,t,p)){case U.DISCARD:return!1;case U.KEEP:return!0}const{triangle:u,triangleTest:g,positions:h}=i,j=u.rings[0][0],R=u.rings[0][1],S=u.rings[0][2],w=s.getObjectTransform(o);s.getComponentPositions(o,r,h);const{indices:E,data:b,stride:F,startIndex:I,endIndex:_}=h;for(let y=I;y<_;y+=3){const r=F*E[y],i=F*E[y+1],s=F*E[y+2];switch(f(j,b[r],b[r+1],b[r+2]),f(R,b[i],b[i+1],b[i+2]),f(S,b[s],b[s+1],b[s+2]),m(j,j,w.rotationScale),m(R,R,w.rotationScale),m(S,S,w.rotationScale),d(j,j,w.position),d(R,R,w.position),d(S,S,w.position),v(j,n,j,a),v(R,n,R,a),v(S,n,S,a),g(e,t,u)){case U.DISCARD:return!1;case U.KEEP:return!0}}return"intersects"!==i.type}const Q=b();export{O as I3SMeshViewFilter};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{indexOf as r,PositionHint as i}from"../../../../core/arrayUtils.js";import s from"../../../../core/Logger.js";import{clamp as o}from"../../../../core/mathUtils.js";import{unwrapUpdating as n,updating as a,isUpdating as l}from"../../../../core/maybeUpdating.js";import{whenOnce as c}from"../../../../core/reactiveUtils.js";import{getUnitString as p}from"../../../../core/unitUtils.js";import{property as u}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import{subclass as g}from"../../../../core/accessorSupport/decorators/subclass.js";import{o as m,f as d,i as f}from"../../../../chunks/vec32.js";import{fromValues as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import h from"../../../../core/sql/WhereClause.js";import{getReferenceEllipsoid as j}from"../../../../geometry/ellipsoidUtils.js";import{load as R,project as S}from"../../../../geometry/projectionUtils.js";import w from"../../../../geometry/SpatialReference.js";import{projectBoundingSphere as E}from"../../../../geometry/projection/projectBoundingSphere.js";import{projectVectorToVector as v}from"../../../../geometry/projection/projectVectorToVector.js";import{create as b}from"../../../../geometry/support/aaBoundingBox.js";import{fromValues as F,expandWithNestedArray as I,expand as _}from"../../../../geometry/support/aaBoundingRect.js";import{doubleArrayFrom as k}from"../../../../geometry/support/DoubleArray.js";import{earth as M}from"../../../../geometry/support/Ellipsoid.js";import{isWGS84 as T,isWebMercator as D}from"../../../../geometry/support/spatialReferenceUtils.js";import{f as G}from"../../../../chunks/sphere.js";import{project as C}from"../../../../geometry/support/webMercatorUtils.js";import A from"../../../../layers/support/FeatureFilter.js";import{objectIdFilter as x,filterInPlace as L}from"./I3SUtil.js";let O=class extends t{constructor(e){super(e),this._projectionEngineLoaded=!1}initialize(){c((()=>this.viewFilter?.geometry||null!=this.layerFilter)).then((()=>this.loadAsyncModule(import("../../../../geometry/geometryEngine.js").then((e=>{this.destroyed||(this._geometryEngine=e)})))))}get sortedObjectIds(){if(null==this.viewFilter?.objectIds)return null;const e=k(this.viewFilter.objectIds);return e.sort(),e}get parsedWhereClause(){const e=this.viewFilter?.where;if(null==e||!e)return null;try{return h.create(e,{fieldsIndex:this.layerFieldsIndex})}catch(t){s.getLogger(this).error(`Failed to parse filter where clause: ${t}`)}return null}addFilters(e,t,r,i){const o=this.sortedObjectIds;null!=o&&e.push((e=>x(o,!0,e))),this.addSqlFilter(e,this.parsedWhereClause),this.addTimeFilter(e,this.viewFilter?.timeExtent);const a=n(this._layerMaskGeometries),l=this._geometryEngine,c=()=>s.getLogger(this);if(null!=a&&null!=this.layerFilter&&null!=l){const s=this.layerFilter.spatialRelationship;e.push(((e,o)=>W(c,l,e,o,i,t,r,a,s)))}const p=n(this._viewMaskGeometries);if(null!=p&&null!=this.viewFilter&&null!=l){const s=this.viewFilter.spatialRelationship;e.push(((e,o)=>W(c,l,e,o,i,t,r,p,s)))}}isMBSGeometryVisible(e,t,r){const i=n(this._layerMaskGeometries),o=this._geometryEngine;if(null!=i&&null!=this.layerFilter&&null!=o){const n=this.layerFilter.spatialRelationship,a=i[0].spatialReference||t;if(!E(e,r,q,a))return s.getLogger(this).warnOnce("SceneLayer.mask geometry is using unsupported SpatialReference, skipping geometry filter for MBS"),!0;return V(o,q,i,a,n)}const a=n(this._viewMaskGeometries);if(null!=a&&null!=this.viewFilter&&null!=o){const i=this.viewFilter.spatialRelationship,n=a[0].spatialReference||t;if(!E(e,r,q,n))return s.getLogger(this).warnOnce("SceneLayerView.filter.geometry is using unsupported SpatialReference, skipping geometry filter for MBS"),!0;return V(o,q,a,n,i)}return!0}get parsedGeometry(){const e=n(this._viewMaskGeometries),t=n(this._layerMaskGeometries);return null==e||null==t?e||t:t.concat(e)}get _layerMaskGeometries(){const e=this.layerFilter;return null==e?null:null==this._geometryEngine?a:"disjoint"===e.spatialRelationship?e.geometries.map((e=>({type:"polygon",rings:e.rings,spatialReference:e.spatialReference,cache:{}}))):[e.geometries.reduce(((e,t)=>(e.rings=[...e.rings,...t.rings],e)),{type:"polygon",rings:[],spatialReference:e.geometries[0].spatialReference,cache:{}})]}get _viewMaskGeometries(){if(null==this.viewFilter)return null;const{geometry:e}=this.viewFilter;if(null==e)return null;if(null==this.viewFilter||null==this._geometryEngine)return a;const{distance:t,units:r}=this.viewFilter,i=this.viewFilter.spatialRelationship,o="mesh"===e.type?e.extent:e;if(null==t||0===t)return K(this._geometryEngine,o,i);const n=r||p(o.spatialReference);if(o.spatialReference.isWGS84){const e=this._geometryEngine.geodesicBuffer(o,t,n);return K(this._geometryEngine,e,i)}const l=C(o,w.WGS84);if(null!=l){const e=C(this._geometryEngine.geodesicBuffer(l,t,n),o.spatialReference);return K(this._geometryEngine,e,i)}if(!this._projectionEngineLoaded&&(this.loadAsyncModule(R().then((()=>this._projectionEngineLoaded=!0))),!this._projectionEngineLoaded))return null;let c=null;try{c=S(o,w.WGS84)}catch(u){}if(c)try{c=S(this._geometryEngine.geodesicBuffer(c,t,n),o.spatialReference)}catch(u){c=null}return c||s.getLogger(this).error(`Filter by geodesic buffer (distance) unsupported, failed to project input geometry (${o.spatialReference.wkid}) to WGS84.`),K(this._geometryEngine,c,i)}get updating(){return l(this._layerMaskGeometries)||l(this._viewMaskGeometries)}static checkSupport(e){return null!=e&&(!!U(e.spatialRelationship)||(s.getLogger(this.prototype).warn(`Filters with spatialRelationship other than ${B.join(", ")} are not supported for mesh scene layers`),!1))}};e([u()],O.prototype,"layerFilter",void 0),e([u({type:A})],O.prototype,"viewFilter",void 0),e([u()],O.prototype,"layerFieldsIndex",void 0),e([u()],O.prototype,"loadAsyncModule",void 0),e([u()],O.prototype,"addSqlFilter",void 0),e([u()],O.prototype,"addTimeFilter",void 0),e([u({readOnly:!0})],O.prototype,"sortedObjectIds",null),e([u({readOnly:!0})],O.prototype,"parsedWhereClause",null),e([u({readOnly:!0})],O.prototype,"parsedGeometry",null),e([u({readOnly:!0})],O.prototype,"_layerMaskGeometries",null),e([u({readOnly:!0})],O.prototype,"_viewMaskGeometries",null),e([u()],O.prototype,"updating",null),e([u()],O.prototype,"_projectionEngineLoaded",void 0),e([u()],O.prototype,"_geometryEngine",void 0),O=e([g("esri.views.3d.layers.i3s.I3SMeshViewFilter")],O);const B=(e=>e)(["contains","intersects","disjoint"]);function U(e){return null!=e&&B.includes(e)}var P;function K(e,t,s){if(null==t)return null;if("disjoint"===s&&"polygon"===t.type){const s=t.rings.length,o=t.spatialReference,n=new Array(s);for(let e=0;e<s;++e){const r=F(1/0,1/0,-1/0,-1/0);I(r,t.rings[e]),n[e]={type:"polygon",rings:[t.rings[e]],spatialReference:o,cache:{},aabr:r}}n.sort(((e,t)=>e.aabr[0]-t.aabr[0]));const a=new Set,l=new i;for(let t=0;t<n.length;++t){const i=n[t],s=i.aabr[0];a.forEach((t=>{if(s>=t.aabr[2])return void a.delete(t);if(i.aabr[1]>t.aabr[3]||i.aabr[3]<t.aabr[1]||!e.intersects(i,t))return;i.rings=i.rings.concat(t.rings),_(i.aabr,t.aabr,i.aabr),i.cache={},a.delete(t);const o=r(n,t,n.length,l);n.splice(o,1)})),a.add(i)}for(const e of n)e.aabr=void 0;return n}return[t]}function V(e,t,r,i,s){if(t[3]>=.5*(t[2]+j(i).radius))return!0;const o=$(e,t,i);return r.every((t=>z(e,t,o,s)!==P.DISCARD))}function W(e,t,r,i,s,o,n,a,l){const c=a[0].spatialReference||o.spatialReference;if(!E(i.node.serviceMbsInIndexSR,n,q,c))return void e().warnOnce("SceneLayerView.filter.geometry is using unsupported SpatialReference, skipping geometry filter");const p=$(t,q,c),u=N(l,o,c,s,i.objectHandle),g="intersects"===l;let m=null;for(const d of a){if(0===r.length)return;switch(z(t,d,p,l)){case P.DISCARD:return g&&(i.weaklyRemovedIds=i.weaklyRemovedIds?.concat(r)??r.slice()),void(r.length=0);case P.KEEP:continue}L(r,i.featureIds,(e=>!!J(t,d,e,u)||(g&&(m||=[],m.push(i.featureIds[e])),!1)))}m&&(i.weaklyRemovedIds=i.weaklyRemovedIds?.concat(m)??m)}!function(e){e[e.KEEP=0]="KEEP",e[e.DISCARD=1]="DISCARD",e[e.TEST=2]="TEST"}(P||(P={}));const q=G(0,0,0,0);function N(e,t,r,i,s){const o=t.renderSpatialReference,n=new Map,a={type:"polygon",rings:[[[0,0,0],[0,0,0],[0,0,0],[0,0,0]]],spatialReference:r};a.rings[0][3]=a.rings[0][0];const l={indices:null,data:null,stride:0,startIndex:0,endIndex:0};let c,p;switch(e){case"intersects":c=(e,t,r)=>e.intersects(t,r)?P.KEEP:P.TEST,p=H;break;case"contains":c=(e,t,r)=>e.contains(t,r)?P.TEST:P.DISCARD,p=H;break;default:c=(e,t,r)=>e.disjoint(t,r)?P.TEST:P.DISCARD,p=Z}return{collection:i,object:s,type:e,maskSR:r,renderSR:o,aabbCache:n,triangle:a,positions:l,triangleTest:c,geometryTest:p}}function $(e,t,r){const i={type:"point",x:t[0],y:t[1],hasZ:!1,hasM:!1,spatialReference:r},s=!T(r)&&!D(r),n=Number.isNaN(t[3])?0:o(t[3],0,2*M.radius),a=s?e.buffer(i,n,1):e.geodesicBuffer(i,n,1);return a.type="polygon",a}function z(e,t,r,i){switch(i){case"intersects":case"contains":return H(e,t,r);case"disjoint":return Z(e,t,r)}}function H(e,t,r){return e.intersects(t,r)?e.contains(t,r)?P.KEEP:P.TEST:P.DISCARD}function Z(e,t,r){return e.intersects(t,r)?e.contains(t,r)?P.DISCARD:P.TEST:P.KEEP}function J(e,t,r,i){const{collection:s,object:o,renderSR:n,maskSR:a,geometryTest:l,aabbCache:c}=i;let p=c.get(r);if(!p){const e=s.getObjectTransform(o);s.getComponentAabb(o,r,Q);const t=[y(Q[0],Q[1],0),y(Q[0],Q[4],0),y(Q[3],Q[4],0),y(Q[3],Q[1],0)];for(let r=0;r<4;++r)m(t[r],t[r],e.rotationScale),d(t[r],t[r],e.position),v(t[r],n,t[r],a);p={type:"polygon",rings:[t],spatialReference:a,cache:{}},p.rings[0][4]=p.rings[0][0],c.set(r,p)}switch(l(e,t,p)){case P.DISCARD:return!1;case P.KEEP:return!0}const{triangle:u,triangleTest:g,positions:h}=i,j=u.rings[0][0],R=u.rings[0][1],S=u.rings[0][2],w=s.getObjectTransform(o);s.getComponentPositions(o,r,h);const{indices:E,data:b,stride:F,startIndex:I,endIndex:_}=h;for(let y=I;y<_;y+=3){const r=F*E[y],i=F*E[y+1],s=F*E[y+2];switch(f(j,b[r],b[r+1],b[r+2]),f(R,b[i],b[i+1],b[i+2]),f(S,b[s],b[s+1],b[s+2]),m(j,j,w.rotationScale),m(R,R,w.rotationScale),m(S,S,w.rotationScale),d(j,j,w.position),d(R,R,w.position),d(S,S,w.position),v(j,n,j,a),v(R,n,R,a),v(S,n,S,a),g(e,t,u)){case P.DISCARD:return!1;case P.KEEP:return!0}}return"intersects"!==i.type}const Q=b();export{O as I3SMeshViewFilter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../request.js";import{binaryIndexOf as t,splitIntoChunks as r}from"../../../../core/arrayUtils.js";import o from"../../../../core/Error.js";import has from"../../../../core/has.js";import{invert as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as s,t as i,c as l}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as u}from"../../../../geometry/projection.js";import f from"../../../../geometry/SpatialReference.js";import{projectVectorToVector as p}from"../../../../geometry/projection/projectVectorToVector.js";import{create as d,empty as m,expandPointInPlace as y,intersects as h}from"../../../../geometry/support/aaBoundingRect.js";import{a as g}from"../../../../chunks/sphere.js";import S from"../../../../rest/support/Query.js";import{readBinaryAttribute as b,getCachedAttributeValue as w}from"./I3SBinaryReader.js";import{computeGlobalTransformation as I}from"./I3SProjectionUtil.js";import{createSolidEdgeMaterial as T,createMaterialFromEdges as E}from"../support/edgeUtils.js";import{parseColorMixMode as R,ColorMixModeEnum as v}from"../support/symbolColorUtils.js";import{Obb as x,compute as M}from"../../support/orientedBoundingBox.js";import{spatialReferenceIncompatibleError as j}from"../../../support/layerViewUtils.js";function C(e){return e?parseInt(e.slice(e.lastIndexOf("/")+1),10):void 0}function k(e){if(has("disable-feature:i3s-draco")||!e)return!1;for(const t of e)for(const e of t.geometryBuffers)if("draco"===e.compressedAttributes?.encoding)return!0;return!1}function N(e,t,r,o){r.traverse(t,(t=>{const r=t.serviceMbsInIndexSR;return(null!=r&&q(e,r))!==O.OUTSIDE&&(o(t),!0)}))}function U(e,t,r){let o=0,n=0;for(let a=0;a<t.length&&o<e.length;a++)e[o]===t[a]&&(r(a)&&(e[n]=e[o],n++),o++);e.length=n}function D(e,r,o){let n=0,a=0;for(;n<o.length;){t(e,o[n])>=0===r&&(o[a]=o[n],a++),n++}o.length=a}function W(e,t){if(0===t.rotationScale[1]&&0===t.rotationScale[2]&&0===t.rotationScale[3]&&0===t.rotationScale[5]&&0===t.rotationScale[6]&&0===t.rotationScale[7])return _[0]=(e[0]-t.position[0])/t.rotationScale[0],_[1]=(e[1]-t.position[1])/t.rotationScale[4],_[2]=(e[2]-t.position[0])/t.rotationScale[0],_[3]=(e[3]-t.position[1])/t.rotationScale[4],_}const _=d();var O;function q(e,t){const r=t[0],o=t[1],n=t[3],a=e[0]-r,s=r-e[2],i=e[1]-o,l=o-e[3],c=Math.max(a,s,0),u=Math.max(i,l,0),f=c*c+u*u;if(f>n*n)return O.OUTSIDE;if(f>0)return O.INTERSECTS_CENTER_OUTSIDE;return-Math.max(a,s,i,l)>n?O.INSIDE:O.INTERSECTS_CENTER_INSIDE}function F(e,t,r){const o=[],n=r?.missingFields,a=r?.originalFields;for(const s of e){const e=s.toLowerCase();let r=!1;for(const n of t)if(e===n.name.toLowerCase()){o.push(n.name),r=!0,a&&a.push(s);break}!r&&n&&n.push(s)}return o}async function L(e,t,r,n,a,s){if(0===t.length)return[];const i=e.attributeStorageInfo;if(null!=e.associatedLayer)try{return await A(e.associatedLayer,t,r,n,s)}catch(l){if(e.associatedLayer.loaded)throw l}if(i){const l=K(t,r,a);if(null==l)throw new o("scenelayer:features-not-loaded","Tried to query attributes for unloaded features");const c=e.parsedUrl.path;return(await Promise.all(l.map((t=>B(c,i,t.node,t.indices,n,e.apiKey,e.customParameters,s).then((e=>{for(let r=0;r<t.graphics.length;r++){const o=t.graphics[r],n=e[r];if(o.attributes)for(const e in o.attributes)e in n||(n[e]=o.attributes[e]);o.attributes=n}return t.graphics})))))).flat()}throw new o("scenelayer:no-attribute-source","This scene layer does not have a source for attributes available")}function K(e,t,r){const o=new Map,n=[],a=r();for(const s of e){const e=s.attributes[t];for(let t=0;t<a.length;t++){const r=a[t],i=r.featureIds.indexOf(e);if(i>=0){let e=o.get(r.node);e||(e={node:r.node,indices:[],graphics:[]},n.push(e),o.set(r.node,e)),e.indices.push(i),e.graphics.push(s);for(let r=t;r>0;r--)a[r]=a[r-1];a[0]=r;break}}}return n}async function A(e,t,r,o,n){t.sort(((e,t)=>e.attributes[r]-t.attributes[r]));const a=t.map((e=>e.attributes[r])),s=[],i=F(o,e.fields,{originalFields:s}),l=await P(e,a,i,n);for(let c=0;c<t.length;c++){const e=t[c],r=l[c],o={};if(e.attributes)for(const t in e.attributes)o[t]=e.attributes[t];for(let t=0;t<s.length;t++)o[s[t]]=r[i[t]];e.attributes=o}return t}function P(e,t,n,a){const s=e.capabilities.query.maxRecordCount;if(null!=s&&t.length>s){const o=r(t,s);return Promise.all(o.map((t=>P(e,t,n,a)))).then((e=>e.flat()))}const i=new S({objectIds:t,outFields:n,orderByFields:[e.objectIdField]});return e.queryFeatures(i,a).then((e=>{if(e&&e.features&&e.features.length===t.length)return e.features.map((e=>e.attributes));throw new o("scenelayer:feature-not-in-associated-layer","Feature not found in associated feature layer")}))}function B(e,t,r,o,n,a,s,i){return G(e,t,r.resources.attributes,o,n,a,s,i)}async function G(t,r,o,n,a,s,i,l){const c=[];for(const e of r)if(e&&a.includes(e.name)){const r=`${t}/nodes/${o}/attributes/${e.key}/0`;c.push({url:r,storageInfo:e})}const u=await Promise.allSettled(c.map((t=>e(t.url,{responseType:"array-buffer",query:{...i,token:s},signal:l?.signal}).then((e=>b(t.storageInfo,e.data)))))),f=[];for(const e of n){const t={};for(let r=0;r<u.length;r++){const o=u[r];if("fulfilled"===o.status){const n=o.value;t[c[r].storageInfo.name]=w(n,e)}}f.push(t)}return f}function V(e){const t=e.store,r=t.indexCRS||t.geographicCRS,n=void 0===r?t.indexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference","Found indexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-index-incompatible","The indexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const a=r?new f(C(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function $(e){const t=e.store,r=t.vertexCRS||t.projectedCRS,n=void 0===r?t.vertexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference","Found vertexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-vertex-incompatible","The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const a=r?new f(C(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function z(e,t,r){if(!u(e,t))throw j("scene layer",e?.wkid,t?.wkid);if("local"===r&&!Z(e,t))throw j("scene layer",e?.wkid,t?.wkid)}function Q(e,t,r){if(e.serviceUpdateTimeStamp?.lastUpdate!==t.serviceUpdateTimeStamp?.lastUpdate||!r.isEmpty||e.associatedLayer?.url!==t.associatedLayer?.url)throw new o("layerview:recycle-failed","Could not recycle layerview")}function Z(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function H(e,t,r){const o=V(e),n=$(e);z(o,t,r),z(n,t,r)}function J(e){return(null==e.geometryType||"triangles"===e.geometryType)&&((null==e.topology||"PerAttributeArray"===e.topology)&&null!=e.vertexAttributes?.position)}function X(e){if(null==e.store?.defaultGeometrySchema||!J(e.store.defaultGeometrySchema))throw new o("scenelayer:unsupported-geometry-schema","The geometry schema of this scene layer is not supported.",{url:e.parsedUrl.path})}function Y(e,t){H(e,t.spatialReference,t.viewingMode)}function ee(e){return null!=e.geometryType&&"points"===e.geometryType&&((null==e.topology||"PerAttributeArray"===e.topology)&&((null==e.encoding||""===e.encoding||"lepcc-xyz"===e.encoding)&&null!=e.vertexAttributes?.position))}function te(e){if(null==e.store?.defaultGeometrySchema||!ee(e.store.defaultGeometrySchema))throw new o("pointcloud:unsupported-geometry-schema","The geometry schema of this point cloud scene layer is not supported.",{})}function re(e,t){z(e.spatialReference,t.spatialReference,t.viewingMode)}function oe(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type}function ne(e){return"mesh-3d"===e.type}function ae(e){if(null==e||!oe(e))return!0;if(("unique-value"===e.type||"class-breaks"===e.type)&&null==e.defaultSymbol)return!0;const t=e.symbols;if(0===t.length)return!0;for(const r of t){if(!ne(r)||0===r.symbolLayers.length)return!0;for(const e of r.symbolLayers.items)if("fill"!==e.type||null==e.material?.color||"replace"!==e.material.colorMixMode)return!0}return!1}!function(e){e[e.OUTSIDE=0]="OUTSIDE",e[e.INTERSECTS_CENTER_OUTSIDE=1]="INTERSECTS_CENTER_OUTSIDE",e[e.INTERSECTS_CENTER_INSIDE=2]="INTERSECTS_CENTER_INSIDE",e[e.INSIDE=3]="INSIDE"}(O||(O={}));const se=T({color:[0,0,0,0],opacity:0});class ie{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function le(e){const t=new ie;let r=!1,o=!1;for(const n of e.symbolLayers.items)if("fill"===n.type&&n.enabled){const e=n.material,a=n.edges;if(null!=e&&!r){const o=e.color,a=R(e.colorMixMode);t.material=null!=o?{color:[o.r/255,o.g/255,o.b/255],alpha:o.a,colorMixMode:a}:{color:[1,1,1],alpha:1,colorMixMode:v.Multiply},t.castShadows=n.castShadows,r=!0}null==a||o||(t.edgeMaterial=E(a,{}),o=!0)}return t.material||(t.material={color:[1,1,1],alpha:1,colorMixMode:v.Multiply}),t}function ce(e,t){return(0|e)+(0|t)|0}function ue(e,t,r,o,a,c,u){if(!c||0===c.length||null==t||!e.serviceMbsInIndexSR)return null;const f=I(e.serviceMbsInIndexSR,a,"none",r,t);n(be,f);let d=null;const S=()=>{if(!d)if(d=de,m(ye),null!=e.serviceObbInIndexSR){e.serviceObbInIndexSR.transform(he,r,t,a,u),he.getCorners(d);for(const e of d)i(e,e,be),y(ye,e)}else{const o=e.serviceMbsInIndexSR;if(!o)return;const n=o[3];p(g(o),r,ge,t),i(ge,ge,be),ge[2]+=a;for(let e=0;e<8;++e){const t=1&e?n:-n,r=2&e?n:-n,o=4&e?n:-n,a=d[e];l(a,[ge[0]+t,ge[1]+r,ge[2]+o]),y(ye,a)}}};let b=1/0,w=-1/0;const T=e=>{if("replace"!==e.type)return;const r=e.geometry;if(!r?.hasZ)return;m(me);const n=r.spatialReference||o,a=r.rings.reduce(((e,r)=>r.reduce(((e,r)=>(s(ge,r[0],r[1],r[2]),p(ge,n,ge,t),i(ge,ge,be),y(me,ge),Math.min(ge[2],e))),e)),1/0);S(),h(ye,me)&&(b=Math.min(b,a),w=Math.max(w,a))};if(c.forEach((e=>T(e))),b===1/0)return null;const E=(e,t,r)=>{i(ge,r,f),e[t]=ge[0],e[t+1]=ge[1],e[t+2]=ge[2],t+=24,r[2]=b,i(ge,r,f),e[t]=ge[0],e[t+1]=ge[1],e[t+2]=ge[2],t+=24,r[2]=w,i(ge,r,f),e[t]=ge[0],e[t+1]=ge[1],e[t+2]=ge[2]};for(let n=0;n<8;++n)E(Se.data,3*n,d[n]);return M(Se)}function fe(e){return e[3]>=0}function pe(e){null!=e&&(e[3]=-1)}const de=[c(),c(),c(),c(),c(),c(),c(),c()],me=d(),ye=d(),he=new x,ge=c(),Se={data:new Array(72),size:3,exclusive:!0,stride:3},be=a();export{O as MbsIntersectResult,ie as SymbolInfo,ce as addWraparound,re as checkPointCloudLayerCompatibleWithView,te as checkPointCloudLayerValid,Q as checkRecyclable,Y as checkSceneLayerCompatibleWithView,X as checkSceneLayerValid,z as checkSpatialReference,H as checkSpatialReferences,ue as computeVisibilityObb,k as containsDraco,C as extractWkid,U as filterInPlace,F as findFieldsCaseInsensitive,N as findIntersectingNodes,W as getClipRect,V as getIndexCrs,le as getSymbolInfo,$ as getVertexCrs,q as intersectBoundingRectWithMbs,pe as invalidateMbs,Z as isSupportedLocalModeProjection,fe as isValidMbs,D as objectIdFilter,G as queryAttributesFromCachedAttributesId,ae as rendererNeedsTextures,se as transparentEdgeMaterial,L as whenGraphicAttributes};
5
+ import e from"../../../../request.js";import{binaryIndexOf as t,splitIntoChunks as r}from"../../../../core/arrayUtils.js";import o from"../../../../core/Error.js";import has from"../../../../core/has.js";import{invert as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as s,t as i,c as l}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as u}from"../../../../geometry/projectionUtils.js";import f from"../../../../geometry/SpatialReference.js";import{projectVectorToVector as p}from"../../../../geometry/projection/projectVectorToVector.js";import{create as d,empty as m,expandPointInPlace as y,intersects as h}from"../../../../geometry/support/aaBoundingRect.js";import{a as g}from"../../../../chunks/sphere.js";import S from"../../../../rest/support/Query.js";import{readBinaryAttribute as b,getCachedAttributeValue as w}from"./I3SBinaryReader.js";import{computeGlobalTransformation as I}from"./I3SProjectionUtil.js";import{createSolidEdgeMaterial as T,createMaterialFromEdges as E}from"../support/edgeUtils.js";import{parseColorMixMode as R,ColorMixModeEnum as v}from"../support/symbolColorUtils.js";import{Obb as x,compute as M}from"../../support/orientedBoundingBox.js";import{spatialReferenceIncompatibleError as j}from"../../../support/layerViewUtils.js";function C(e){return e?parseInt(e.slice(e.lastIndexOf("/")+1),10):void 0}function U(e){if(has("disable-feature:i3s-draco")||!e)return!1;for(const t of e)for(const e of t.geometryBuffers)if("draco"===e.compressedAttributes?.encoding)return!0;return!1}function k(e,t,r,o){r.traverse(t,(t=>{const r=t.serviceMbsInIndexSR;return(null!=r&&q(e,r))!==O.OUTSIDE&&(o(t),!0)}))}function N(e,t,r){let o=0,n=0;for(let a=0;a<t.length&&o<e.length;a++)e[o]===t[a]&&(r(a)&&(e[n]=e[o],n++),o++);e.length=n}function D(e,r,o){let n=0,a=0;for(;n<o.length;){t(e,o[n])>=0===r&&(o[a]=o[n],a++),n++}o.length=a}function W(e,t){if(0===t.rotationScale[1]&&0===t.rotationScale[2]&&0===t.rotationScale[3]&&0===t.rotationScale[5]&&0===t.rotationScale[6]&&0===t.rotationScale[7])return _[0]=(e[0]-t.position[0])/t.rotationScale[0],_[1]=(e[1]-t.position[1])/t.rotationScale[4],_[2]=(e[2]-t.position[0])/t.rotationScale[0],_[3]=(e[3]-t.position[1])/t.rotationScale[4],_}const _=d();var O;function q(e,t){const r=t[0],o=t[1],n=t[3],a=e[0]-r,s=r-e[2],i=e[1]-o,l=o-e[3],c=Math.max(a,s,0),u=Math.max(i,l,0),f=c*c+u*u;if(f>n*n)return O.OUTSIDE;if(f>0)return O.INTERSECTS_CENTER_OUTSIDE;return-Math.max(a,s,i,l)>n?O.INSIDE:O.INTERSECTS_CENTER_INSIDE}function F(e,t,r){const o=[],n=r?.missingFields,a=r?.originalFields;for(const s of e){const e=s.toLowerCase();let r=!1;for(const n of t)if(e===n.name.toLowerCase()){o.push(n.name),r=!0,a&&a.push(s);break}!r&&n&&n.push(s)}return o}async function L(e,t,r,n,a,s){if(0===t.length)return[];const i=e.attributeStorageInfo;if(null!=e.associatedLayer)try{return await A(e.associatedLayer,t,r,n,s)}catch(l){if(e.associatedLayer.loaded)throw l}if(i){const l=K(t,r,a);if(null==l)throw new o("scenelayer:features-not-loaded","Tried to query attributes for unloaded features");const c=e.parsedUrl.path;return(await Promise.all(l.map((t=>B(c,i,t.node,t.indices,n,e.apiKey,e.customParameters,s).then((e=>{for(let r=0;r<t.graphics.length;r++){const o=t.graphics[r],n=e[r];if(o.attributes)for(const e in o.attributes)e in n||(n[e]=o.attributes[e]);o.attributes=n}return t.graphics})))))).flat()}throw new o("scenelayer:no-attribute-source","This scene layer does not have a source for attributes available")}function K(e,t,r){const o=new Map,n=[],a=r();for(const s of e){const e=s.attributes[t];for(let t=0;t<a.length;t++){const r=a[t],i=r.featureIds.indexOf(e);if(i>=0){let e=o.get(r.node);e||(e={node:r.node,indices:[],graphics:[]},n.push(e),o.set(r.node,e)),e.indices.push(i),e.graphics.push(s);for(let r=t;r>0;r--)a[r]=a[r-1];a[0]=r;break}}}return n}async function A(e,t,r,o,n){t.sort(((e,t)=>e.attributes[r]-t.attributes[r]));const a=t.map((e=>e.attributes[r])),s=[],i=F(o,e.fields,{originalFields:s}),l=await P(e,a,i,n);for(let c=0;c<t.length;c++){const e=t[c],r=l[c],o={};if(e.attributes)for(const t in e.attributes)o[t]=e.attributes[t];for(let t=0;t<s.length;t++)o[s[t]]=r[i[t]];e.attributes=o}return t}function P(e,t,n,a){const s=e.capabilities.query.maxRecordCount;if(null!=s&&t.length>s){const o=r(t,s);return Promise.all(o.map((t=>P(e,t,n,a)))).then((e=>e.flat()))}const i=new S({objectIds:t,outFields:n,orderByFields:[e.objectIdField]});return e.queryFeatures(i,a).then((e=>{if(e&&e.features&&e.features.length===t.length)return e.features.map((e=>e.attributes));throw new o("scenelayer:feature-not-in-associated-layer","Feature not found in associated feature layer")}))}function B(e,t,r,o,n,a,s,i){return G(e,t,r.resources.attributes,o,n,a,s,i)}async function G(t,r,o,n,a,s,i,l){const c=[];for(const e of r)if(e&&a.includes(e.name)){const r=`${t}/nodes/${o}/attributes/${e.key}/0`;c.push({url:r,storageInfo:e})}const u=await Promise.allSettled(c.map((t=>e(t.url,{responseType:"array-buffer",query:{...i,token:s},signal:l?.signal}).then((e=>b(t.storageInfo,e.data)))))),f=[];for(const e of n){const t={};for(let r=0;r<u.length;r++){const o=u[r];if("fulfilled"===o.status){const n=o.value;t[c[r].storageInfo.name]=w(n,e)}}f.push(t)}return f}function V(e){const t=e.store,r=t.indexCRS||t.geographicCRS,n=void 0===r?t.indexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference","Found indexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-index-incompatible","The indexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const a=r?new f(C(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function $(e){const t=e.store,r=t.vertexCRS||t.projectedCRS,n=void 0===r?t.vertexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference","Found vertexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-vertex-incompatible","The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const a=r?new f(C(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function z(e,t,r){if(!u(e,t))throw j("scene layer",e?.wkid,t?.wkid);if("local"===r&&!Z(e,t))throw j("scene layer",e?.wkid,t?.wkid)}function Q(e,t,r){if(e.serviceUpdateTimeStamp?.lastUpdate!==t.serviceUpdateTimeStamp?.lastUpdate||!r.isEmpty||e.associatedLayer?.url!==t.associatedLayer?.url)throw new o("layerview:recycle-failed","Could not recycle layerview")}function Z(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function H(e,t,r){const o=V(e),n=$(e);z(o,t,r),z(n,t,r)}function J(e){return(null==e.geometryType||"triangles"===e.geometryType)&&((null==e.topology||"PerAttributeArray"===e.topology)&&null!=e.vertexAttributes?.position)}function X(e){if(null==e.store?.defaultGeometrySchema||!J(e.store.defaultGeometrySchema))throw new o("scenelayer:unsupported-geometry-schema","The geometry schema of this scene layer is not supported.",{url:e.parsedUrl.path})}function Y(e,t){H(e,t.spatialReference,t.viewingMode)}function ee(e){return null!=e.geometryType&&"points"===e.geometryType&&((null==e.topology||"PerAttributeArray"===e.topology)&&((null==e.encoding||""===e.encoding||"lepcc-xyz"===e.encoding)&&null!=e.vertexAttributes?.position))}function te(e){if(null==e.store?.defaultGeometrySchema||!ee(e.store.defaultGeometrySchema))throw new o("pointcloud:unsupported-geometry-schema","The geometry schema of this point cloud scene layer is not supported.",{})}function re(e,t){z(e.spatialReference,t.spatialReference,t.viewingMode)}function oe(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type}function ne(e){return"mesh-3d"===e.type}function ae(e){if(null==e||!oe(e))return!0;if(("unique-value"===e.type||"class-breaks"===e.type)&&null==e.defaultSymbol)return!0;const t=e.symbols;if(0===t.length)return!0;for(const r of t){if(!ne(r)||0===r.symbolLayers.length)return!0;for(const e of r.symbolLayers.items)if("fill"!==e.type||null==e.material?.color||"replace"!==e.material.colorMixMode)return!0}return!1}!function(e){e[e.OUTSIDE=0]="OUTSIDE",e[e.INTERSECTS_CENTER_OUTSIDE=1]="INTERSECTS_CENTER_OUTSIDE",e[e.INTERSECTS_CENTER_INSIDE=2]="INTERSECTS_CENTER_INSIDE",e[e.INSIDE=3]="INSIDE"}(O||(O={}));const se=T({color:[0,0,0,0],opacity:0});class ie{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function le(e){const t=new ie;let r=!1,o=!1;for(const n of e.symbolLayers.items)if("fill"===n.type&&n.enabled){const e=n.material,a=n.edges;if(null!=e&&!r){const o=e.color,a=R(e.colorMixMode);t.material=null!=o?{color:[o.r/255,o.g/255,o.b/255],alpha:o.a,colorMixMode:a}:{color:[1,1,1],alpha:1,colorMixMode:v.Multiply},t.castShadows=n.castShadows,r=!0}null==a||o||(t.edgeMaterial=E(a,{}),o=!0)}return t.material||(t.material={color:[1,1,1],alpha:1,colorMixMode:v.Multiply}),t}function ce(e,t){return(0|e)+(0|t)|0}function ue(e,t,r,o,a,c,u){if(!c||0===c.length||null==t||!e.serviceMbsInIndexSR)return null;const f=I(e.serviceMbsInIndexSR,a,"none",r,t);n(be,f);let d=null;const S=()=>{if(!d)if(d=de,m(ye),null!=e.serviceObbInIndexSR){e.serviceObbInIndexSR.transform(he,r,t,a,u),he.getCorners(d);for(const e of d)i(e,e,be),y(ye,e)}else{const o=e.serviceMbsInIndexSR;if(!o)return;const n=o[3];p(g(o),r,ge,t),i(ge,ge,be),ge[2]+=a;for(let e=0;e<8;++e){const t=1&e?n:-n,r=2&e?n:-n,o=4&e?n:-n,a=d[e];l(a,[ge[0]+t,ge[1]+r,ge[2]+o]),y(ye,a)}}};let b=1/0,w=-1/0;const T=e=>{if("replace"!==e.type)return;const r=e.geometry;if(!r?.hasZ)return;m(me);const n=r.spatialReference||o,a=r.rings.reduce(((e,r)=>r.reduce(((e,r)=>(s(ge,r[0],r[1],r[2]),p(ge,n,ge,t),i(ge,ge,be),y(me,ge),Math.min(ge[2],e))),e)),1/0);S(),h(ye,me)&&(b=Math.min(b,a),w=Math.max(w,a))};if(c.forEach((e=>T(e))),b===1/0)return null;const E=(e,t,r)=>{i(ge,r,f),e[t]=ge[0],e[t+1]=ge[1],e[t+2]=ge[2],t+=24,r[2]=b,i(ge,r,f),e[t]=ge[0],e[t+1]=ge[1],e[t+2]=ge[2],t+=24,r[2]=w,i(ge,r,f),e[t]=ge[0],e[t+1]=ge[1],e[t+2]=ge[2]};for(let n=0;n<8;++n)E(Se.data,3*n,d[n]);return M(Se)}function fe(e){return e[3]>=0}function pe(e){null!=e&&(e[3]=-1)}const de=[c(),c(),c(),c(),c(),c(),c(),c()],me=d(),ye=d(),he=new x,ge=c(),Se={data:new Array(72),size:3,exclusive:!0,stride:3},be=a();export{O as MbsIntersectResult,ie as SymbolInfo,ce as addWraparound,re as checkPointCloudLayerCompatibleWithView,te as checkPointCloudLayerValid,Q as checkRecyclable,Y as checkSceneLayerCompatibleWithView,X as checkSceneLayerValid,z as checkSpatialReference,H as checkSpatialReferences,ue as computeVisibilityObb,U as containsDraco,C as extractWkid,N as filterInPlace,F as findFieldsCaseInsensitive,k as findIntersectingNodes,W as getClipRect,V as getIndexCrs,le as getSymbolInfo,$ as getVertexCrs,q as intersectBoundingRectWithMbs,pe as invalidateMbs,Z as isSupportedLocalModeProjection,fe as isValidMbs,D as objectIdFilter,G as queryAttributesFromCachedAttributesId,ae as rendererNeedsTextures,se as transparentEdgeMaterial,L as whenGraphicAttributes};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{shuffle as t}from"../../../../core/arrayUtils.js";import{baseObjectMemory as e}from"../../../../core/memoryEstimations.js";import{signal as s}from"../../../../core/signal.js";import{diameter as i,create as r}from"../../../../geometry/support/aaBoundingBox.js";import{fromExtent as u,create as a,intersects as h,copy as n,positiveInfinity as f,intersection as _}from"../../../../geometry/support/aaBoundingRect.js";import{numVertices as l,estimateSize as m,getObjectId as o,computeAABB as c}from"../../../../layers/graphics/dehydratedFeatures.js";import{computeMaxZ as d}from"../graphics/graphicUtils.js";const F=16438;class g{constructor(t){this.descriptor=t,this._numVertices=0,this._featuresMissing=s(!0),this._fetchFailed=s(!1),this._sorted=!1,this._numFeatures=E,this._emptyFeatureRatio=s(0),this._estimatedSize=-1,this._estimatedUnusedSize=0,this._estimatedUnusedSizeDirty=!1,this._displayingFeatures=null,this.alive=!0,this.filtered=!1,this._features=null,this._featuresLength=s(0),this._featureLimit=s(0),this._fetchStatus=p.FETCH_NEEDED,this.fetchingResolution=this.displayingResolution=t.resolution}get featuresMissing(){return this._featuresMissing.value}set featuresMissing(t){this._featuresMissing.value=t}get missingAttributes(){return this._missingAttributes}get fetchFailed(){return this._fetchFailed.value}set fetchFailed(t){this._fetchFailed.value=t}get displayingFeatures(){return this._displayingFeatures}set displayingFeatures(t){this._displayingFeatures=t,this.extentIncludingBorrowedFeatures=null}get perTileMaximumNumberOfFeaturesExceeded(){const t=this.isFetched&&this.featuresMissing;return!this.filtered&&(t||this.hasFeatureLimit)}get features(){return this._features}get featureLimit(){return this._featureLimit.value}set featureLimit(t){this._featureLimit.value!==t&&(this._featureLimit.value=t,this._estimatedUnusedSizeDirty=!0)}get hasFeatureLimit(){return this.featureLimit!==this._featuresLength.value}get hasAllFeatures(){return!this.featuresMissing&&!this.fetchFailed&&!this.hasFeatureLimit}get availableFields(){return this._availableFields}setFeatures(t,e,s,i){this._availableFields=s,this._features=t,this._featuresLength.value=t?.length??0,this._sorted=!1,this._estimatedSize=-1,this._estimatedUnusedSizeDirty=!0,this._missingAttributes=i,t&&t.length>0?(this._emptyFeatureRatio.value=e/(t.length+e),this._numVertices=t.reduce(((t,e)=>t+l(e.geometry)),0)):(this._emptyFeatureRatio.value=0,this._numVertices=0)}computeZQuantizationFactor(){if(this._features&&this._features.length>0){const t=this._features.reduce(((t,{geometry:e})=>Math.max(t,d(e)??0)),0);return Math.floor(t/this.descriptor.planetRadius)+1}return 1}get emptyFeatureRatio(){return this._emptyFeatureRatio.value}get numFeatures(){return this.hasPreciseFeatureCount?this._numFeatures:this._features?this._features.length:0}set numFeatures(t){this._numFeatures=t}get hasPreciseFeatureCount(){return this._numFeatures>E}get needsFeatureCount(){return this._numFeatures===E}get numVertices(){return this._numVertices}get id(){return this.descriptor.id}get estimatedSize(){return this.updateMemoryEstimates(),this._estimatedSize}get estimatedUnusedSize(){return this._estimatedUnusedSize}updateMemoryEstimates(){if(this._estimatedSize<0){if(this._estimatedSize=0,this._estimatedUnusedSize=0,this._features)for(let t=0;t<this._features.length;++t){const e=m(this._features[t]);this._estimatedSize+=e,t>=this.featureLimit&&(this._estimatedUnusedSize+=e)}return!0}if(this._estimatedUnusedSizeDirty){if(this._estimatedUnusedSize=0,this._estimatedUnusedSizeDirty=!1,this._features)for(let t=this.featureLimit;t<this._features.length;++t)this._estimatedUnusedSize+=m(this._features[t]);return!0}return!1}get fetchStatus(){return this._fetchStatus}requestFetch(){this._fetchStatus=p.FETCH_NEEDED}requestRefetch(){this._fetchStatus=p.REFETCH_NEEDED}startFetch(){this._fetchStatus=this.needsRefetch?p.REFETCHING:p.FETCHING}fetchDone(t){this._fetchStatus=t?p.FULL:p.DONE}get isFetching(){return this._fetchStatus===p.FETCHING||this._fetchStatus===p.REFETCHING}get isRefetching(){return this._fetchStatus===p.REFETCHING}get needsFetch(){return this._fetchStatus===p.FETCH_NEEDED||this._fetchStatus===p.REFETCH_NEEDED}get needsRefetch(){return this._fetchStatus===p.REFETCH_NEEDED}get isFetched(){return this._fetchStatus===p.DONE||this._fetchStatus===p.FULL}isFullyFetched(t){return!!this.features&&(this.features.length>=t||this.fetchStatus===p.FULL)}resetFetching(){this._fetchStatus=this.isRefetching?p.REFETCH_NEEDED:p.FETCH_NEEDED}get needsDisplayUpdate(){return!!this._features&&!L(this._features,this.displayingFeatures,this.featureLimit)}intersects(t){return null==t||!this.descriptor.extent||(u(t,R),h(this.descriptor.extent,R))}intersectionIncludingBorrowed(t,e){const s=null!=this.extentIncludingBorrowedFeatures?this.extentIncludingBorrowedFeatures:this.descriptor.extent;return t||s?(null!=t?(u(t,e),_(e,s,e)):n(e,s),e):(n(e,f),e)}_shuffle(e){this._features?.sort(((t,s)=>o(t,e)-o(s,e))),t(this._features,F)}_sortBySize(t){this._features?.sort(((e,s)=>i(c(s.geometry,N))-i(c(e.geometry,N))||o(e,t)-o(s,t)))}reduceFeatures(t,e,s,i){if(t<=0)return!1;if(!this._features)return this.featureLimit=0,!1;let r=!1;this.featureLimit=Math.ceil(this.numFeatures*t),this.featureLimit>this._features.length&&(this.featureLimit=this._features.length,this._fetchStatus===p.DONE&&this._features.length>0&&(this._fetchStatus=p.REFETCH_NEEDED,r=!0)),!this._sorted&&t<1&&(i===D.RANDOM?this._shuffle(s):this._sortBySize(s),this._sorted=!0,this._estimatedUnusedSizeDirty=!0);const u=Math.max(this.featureLimit,Math.ceil(e*this.numFeatures));return this._features.length>u&&(this._features.length=u,this._featuresLength.value=u,this.featuresMissing=!0,this._fetchStatus===p.FULL&&(this._fetchStatus=p.DONE)),r}get cache(){return new y(this,this._features,this._numFeatures,this._emptyFeatureRatio.value)}set cache(t){this.requestController=null,this._availableFields=t.availableFields,this._features=t.features,this._featuresLength.value=t.features?.length??0,this._numFeatures=t.numFeatures,this._emptyFeatureRatio.value=t.emptyFeatureRatio,this._fetchStatus=t.fetchStatus,this.featuresMissing=t.featuresMissing,this._estimatedSize=-1,this._estimatedUnusedSizeDirty=!0}}const E=-1,S=-2;var p,D;!function(t){t[t.FETCH_NEEDED=0]="FETCH_NEEDED",t[t.REFETCH_NEEDED=1]="REFETCH_NEEDED",t[t.FETCHING=2]="FETCHING",t[t.REFETCHING=3]="REFETCHING",t[t.DONE=4]="DONE",t[t.FULL=5]="FULL"}(p||(p={})),function(t){t[t.SIZE=0]="SIZE",t[t.RANDOM=1]="RANDOM"}(D||(D={}));class y{constructor(t,s,i,r){this.features=s,this.numFeatures=i,this.emptyFeatureRatio=r,this.cachedMemory=e+t.estimatedSize,this.resolution=t.displayingResolution,this.availableFields=t.availableFields,this.fetchStatus=t.fetchStatus,this.featuresMissing=t.featuresMissing}}function L(t,e,s){if(null==e||null==t||s!==e.length||s>t.length)return!1;for(let i=0;i<s;++i)if(t[i]!==e[i])return!1;return!0}const R=a(),N=r();export{g as FeatureTile,y as FeatureTileCacheItem,D as ReduceMode,S as failedFeatureCount};
5
+ import{shuffle as t}from"../../../../core/arrayUtils.js";import{baseObjectMemory as e}from"../../../../core/memoryEstimations.js";import{signal as s}from"../../../../core/signal.js";import{diameter as i,create as r}from"../../../../geometry/support/aaBoundingBox.js";import{fromExtent as a,create as u,intersects as h,copy as n,positiveInfinity as f,intersection as l}from"../../../../geometry/support/aaBoundingRect.js";import{numVertices as _,estimateSize as d,getObjectId as c,computeAABB as m}from"../../../../layers/graphics/dehydratedFeatures.js";import{computeMaxZ as o}from"../graphics/graphicUtils.js";const F=16438;class g{constructor(t){this.descriptor=t,this._numVertices=0,this.exceededTransferLimit=s(!1),this._fetchFailed=s(!1),this._sorted=!1,this._numFeatures=s(E),this._emptyFeatureRatio=s(0),this._estimatedSize=-1,this._estimatedUnusedSize=0,this._estimatedUnusedSizeDirty=!1,this._displayingFeatures=null,this.alive=!0,this.filtered=!1,this._features=null,this._featuresLength=s(0),this._featureLimit=s(0),this._fetchStatus=p.FETCH_NEEDED,this.fetchInformation=s(""),this.fetchingResolution=this.displayingResolution=t.resolution}get featuresMissing(){return this.fetchFailed||(this.hasPreciseFeatureCount?this._featuresLength.value<this.numFeatures:this.exceededTransferLimit.value)}get showsAllFeatures(){return!this.fetchFailed&&null!=this.displayingFeatures&&(this.hasPreciseFeatureCount?this.displayingFeatures.length===this.numFeatures:!this.exceededTransferLimit.value)}get missingAttributes(){return this._missingAttributes}get fetchFailed(){return this._fetchFailed.value}set fetchFailed(t){this._fetchFailed.value=t}get displayingFeatures(){return this._displayingFeatures}set displayingFeatures(t){this._displayingFeatures=t,this.extentIncludingBorrowedFeatures=null}get perTileMaximumNumberOfFeaturesExceeded(){const t=this.isFetched&&this.featuresMissing;return!this.filtered&&(t||this.hasFeatureLimit)}get features(){return this._features}get featureLimit(){return this._featureLimit.value}set featureLimit(t){this._featureLimit.value!==t&&(this._featureLimit.value=t,this._estimatedUnusedSizeDirty=!0)}get hasFeatureLimit(){return this.featureLimit!==this._featuresLength.value}get availableFields(){return this._availableFields}setFeatures(t,e,s,i){this._availableFields=s,this._features=t,this._featuresLength.value=t?.length??0,this._sorted=!1,this._estimatedSize=-1,this._estimatedUnusedSizeDirty=!0,this._missingAttributes=i,t&&t.length>0?(this._emptyFeatureRatio.value=e/(t.length+e),this._numVertices=t.reduce(((t,e)=>t+_(e.geometry)),0)):(this._emptyFeatureRatio.value=0,this._numVertices=0)}computeZQuantizationFactor(){if(this._features&&this._features.length>0){const t=this._features.reduce(((t,{geometry:e})=>Math.max(t,o(e)??0)),0);return Math.floor(t/this.descriptor.planetRadius)+1}return 1}get emptyFeatureRatio(){return this._emptyFeatureRatio.value}get numFeatures(){return this.hasPreciseFeatureCount?this._numFeatures.value:this._features?this._featuresLength.value:0}set numFeatures(t){this._numFeatures.value=t}get hasPreciseFeatureCount(){return this._numFeatures.value>E}get needsFeatureCount(){return this._numFeatures.value===E}get numVertices(){return this._numVertices}get id(){return this.descriptor.id}get estimatedSize(){return this.updateMemoryEstimates(),this._estimatedSize}get estimatedUnusedSize(){return this._estimatedUnusedSize}updateMemoryEstimates(){if(this._estimatedSize<0){if(this._estimatedSize=0,this._estimatedUnusedSize=0,this._features)for(let t=0;t<this._features.length;++t){const e=d(this._features[t]);this._estimatedSize+=e,t>=this.featureLimit&&(this._estimatedUnusedSize+=e)}return!0}if(this._estimatedUnusedSizeDirty){if(this._estimatedUnusedSize=0,this._estimatedUnusedSizeDirty=!1,this._features)for(let t=this.featureLimit;t<this._features.length;++t)this._estimatedUnusedSize+=d(this._features[t]);return!0}return!1}get fetchStatus(){return this._fetchStatus}requestFetch(){this._fetchStatus=p.FETCH_NEEDED}requestRefetch(){this._fetchStatus=p.REFETCH_NEEDED}startFetch(){this._fetchStatus=this.needsRefetch?p.REFETCHING:p.FETCHING}fetchDone(t){this._fetchStatus=t}get isFetching(){return this._fetchStatus===p.FETCHING||this._fetchStatus===p.REFETCHING}get isRefetching(){return this._fetchStatus===p.REFETCHING}get needsFetch(){return this._fetchStatus===p.FETCH_NEEDED||this._fetchStatus===p.REFETCH_NEEDED}get needsRefetch(){return this._fetchStatus===p.REFETCH_NEEDED}get isFetched(){return this._fetchStatus===p.DONE||this._fetchStatus===p.FULL}isFullyFetched(t){return!!this.features&&(this.features.length>=t||this.fetchStatus===p.FULL)}resetFetching(){this._fetchStatus=this.isRefetching?p.REFETCH_NEEDED:p.FETCH_NEEDED}get needsDisplayUpdate(){return!!this._features&&!L(this._features,this.displayingFeatures,this.featureLimit)}intersects(t){return null==t||!this.descriptor.extent||(a(t,v),h(this.descriptor.extent,v))}intersectionIncludingBorrowed(t,e){const s=null!=this.extentIncludingBorrowedFeatures?this.extentIncludingBorrowedFeatures:this.descriptor.extent;return t||s?(null!=t?(a(t,e),l(e,s,e)):n(e,s),e):(n(e,f),e)}_shuffle(e){this._features?.sort(((t,s)=>c(t,e)-c(s,e))),t(this._features,F)}_sortBySize(t){this._features?.sort(((e,s)=>i(m(s.geometry,R))-i(m(e.geometry,R))||c(e,t)-c(s,t)))}reduceFeatures(t,e,s,i){if(t<=0)return!1;if(!this._features)return this.featureLimit=0,!1;let r=!1;this.featureLimit=Math.ceil(this.numFeatures*t),this.featureLimit>this._features.length&&this._fetchStatus===p.DONE&&this._features.length>0&&(this._fetchStatus=p.REFETCH_NEEDED,r=!0),!this._sorted&&t<1&&(i===y.RANDOM?this._shuffle(s):this._sortBySize(s),this._sorted=!0,this._estimatedUnusedSizeDirty=!0);const a=Math.max(this.featureLimit,Math.ceil(e*this.numFeatures));return this._features.length>a&&(this._features.length=a,this._featuresLength.value=a,this.exceededTransferLimit.value=!1,this._fetchStatus===p.FULL&&(this._fetchStatus=p.DONE)),r}get cache(){return new D(this,this._features,this._numFeatures.value,this._emptyFeatureRatio.value)}set cache(t){this.requestController=null,this._availableFields=t.availableFields,this._features=t.features,this._featuresLength.value=t.features?.length??0,this._numFeatures.value=t.numFeatures,this._emptyFeatureRatio.value=t.emptyFeatureRatio,this._fetchStatus=t.fetchStatus,this.exceededTransferLimit.value=t.exceededTransferLimit,this._estimatedSize=-1,this._estimatedUnusedSizeDirty=!0,this.fetchInformation.value=t.fetchInformation}}const E=-1,S=-2;var p,y;!function(t){t[t.FETCH_NEEDED=0]="FETCH_NEEDED",t[t.REFETCH_NEEDED=1]="REFETCH_NEEDED",t[t.FETCHING=2]="FETCHING",t[t.REFETCHING=3]="REFETCHING",t[t.DONE=4]="DONE",t[t.FULL=5]="FULL"}(p||(p={})),function(t){t[t.SIZE=0]="SIZE",t[t.RANDOM=1]="RANDOM"}(y||(y={}));class D{constructor(t,s,i,r){this.features=s,this.numFeatures=i,this.emptyFeatureRatio=r,this.cachedMemory=e+t.estimatedSize,this.resolution=t.displayingResolution,this.availableFields=t.availableFields,this.fetchStatus=t.fetchStatus,this.exceededTransferLimit=t.exceededTransferLimit.value,this.fetchInformation=t.fetchInformation.value}}function L(t,e,s){if(null==e||null==t||s!==e.length||s>t.length)return!1;for(let i=0;i<s;++i)if(t[i]!==e[i])return!1;return!0}const v=u(),R=r();export{g as FeatureTile,D as FeatureTileCacheItem,p as FetchStatus,y as ReduceMode,S as failedFeatureCount};