@arcgis/core 4.34.0-next.86 → 4.34.0-next.88
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.
- package/Basemap.js +1 -1
- package/Ground.js +1 -1
- package/Map.js +1 -1
- package/analysis/ElevationProfile/ElevationProfileLineGround.d.ts +4 -0
- package/analysis/ElevationProfile/{ElevationProfileGroundLine.js → ElevationProfileLineGround.js} +1 -1
- package/analysis/ElevationProfile/ElevationProfileLineInput.d.ts +4 -0
- package/analysis/ElevationProfile/{ElevationProfileInputLine.js → ElevationProfileLineInput.js} +1 -1
- package/analysis/ElevationProfile/ElevationProfileLineQuery.d.ts +4 -0
- package/analysis/ElevationProfile/{ElevationProfileQueryLine.js → ElevationProfileLineQuery.js} +1 -1
- package/analysis/ElevationProfile/ElevationProfileLineScene.d.ts +4 -0
- package/analysis/ElevationProfile/{ElevationProfileSceneLine.js → ElevationProfileLineScene.js} +1 -1
- package/analysis/ElevationProfile/elevationProfileLineTypes.js +1 -1
- package/analysis/ElevationProfileAnalysis.js +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.ar.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.bg.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.bs.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.ca.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.cs.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.da.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.de.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.el.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.es.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.et.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.fi.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.fr.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.he.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.hr.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.hu.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.id.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.it.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.ja.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.ko.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.lt.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.lv.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.nl.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.no.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.pl.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.pt-BR.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.pt-PT.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.ro.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.ru.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.sk.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.sl.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.sr.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.sv.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.th.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.tr.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.uk.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.vi.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.zh-CN.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.zh-HK.json +1 -1
- package/assets/components/assets/accordion-item/t9n/messages.zh-TW.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.ar.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.bg.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.bs.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.ca.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.cs.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.da.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.de.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.el.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.es.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.et.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.fi.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.fr.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.he.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.hr.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.hu.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.id.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.it.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.ja.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.ko.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.lt.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.lv.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.nl.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.no.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.pl.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.pt-BR.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.pt-PT.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.ro.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.ru.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.sk.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.sl.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.sr.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.sv.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.th.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.tr.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.uk.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.vi.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.zh-CN.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.zh-HK.json +1 -1
- package/assets/components/assets/action-bar/t9n/messages.zh-TW.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.ar.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.bg.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.bs.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.ca.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.cs.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.da.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.de.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.el.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.es.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.et.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.fi.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.fr.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.he.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.hr.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.hu.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.id.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.it.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.ja.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.ko.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.lt.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.lv.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.nl.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.no.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.pl.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.pt-BR.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.pt-PT.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.ro.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.ru.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.sk.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.sl.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.sr.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.sv.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.th.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.tr.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.uk.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.vi.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.zh-CN.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.zh-HK.json +1 -1
- package/assets/components/assets/action-pad/t9n/messages.zh-TW.json +1 -1
- package/assets/components/assets/icon/layer3D16.json +1 -0
- package/assets/components/assets/icon/layer3D24.json +1 -0
- package/assets/components/assets/icon/layer3D32.json +1 -0
- package/assets/components/assets/sort-handle/t9n/messages.ar.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.bg.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.bs.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.ca.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.cs.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.da.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.de.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.el.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.es.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.et.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.fi.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.fr.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.he.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.hr.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.hu.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.id.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.it.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.ja.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.ko.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.lt.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.lv.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.nl.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.no.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.pl.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.pt-BR.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.pt-PT.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.ro.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.ru.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.sk.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.sl.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.sr.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.sv.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.th.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.tr.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.uk.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.vi.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.zh-CN.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.zh-HK.json +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.zh-TW.json +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0074f1836d7ff69ff6ec.js +1 -0
- package/assets/esri/core/workers/chunks/{c6d4b8d683a34fc0d111.js → 0103b70126bc5dffc55e.js} +1 -1
- package/assets/esri/core/workers/chunks/03ef19f0753d68770444.js +1 -0
- package/assets/esri/core/workers/chunks/{4a06ab00d095f63598b5.js → 09c2004126f4a5242b85.js} +1 -1
- package/assets/esri/core/workers/chunks/0f05425954578ac796ec.js +1 -0
- package/assets/esri/core/workers/chunks/109149c378aa4c5f8526.js +1 -0
- package/assets/esri/core/workers/chunks/{8307f635a5c0c4a95825.js → 143503f6eb270c4683f8.js} +1 -1
- package/assets/esri/core/workers/chunks/{6c36cef0b58b87a1f17f.js → 177840d5f0076c0de46b.js} +4 -4
- package/assets/esri/core/workers/chunks/1c1b0cc91fe9cb3fec61.js +1 -0
- package/assets/esri/core/workers/chunks/1fc6311d4f0d27e88737.js +1 -0
- package/assets/esri/core/workers/chunks/24921d31efa8d222ad2d.js +2 -0
- package/assets/esri/core/workers/chunks/{268f5b233640a9dbbf89.js.LICENSE.txt → 24921d31efa8d222ad2d.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/257fd65786feb5951b90.js +1 -0
- package/assets/esri/core/workers/chunks/2dc88379ee94fabdaf52.js +1 -0
- package/assets/esri/core/workers/chunks/366db86914a63e6d0c68.js +1 -0
- package/assets/esri/core/workers/chunks/3a457e718a901a45902e.js +2 -0
- package/assets/esri/core/workers/chunks/{47e4f66c33bb697fbe6b.js.LICENSE.txt → 3a457e718a901a45902e.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/46ef545d2b3b3f4e6d32.js +2 -0
- package/assets/esri/core/workers/chunks/{336b54144afec0c7d396.js.LICENSE.txt → 46ef545d2b3b3f4e6d32.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/481c2b01e2fe92249698.js +1 -0
- package/assets/esri/core/workers/chunks/4e77b9cc1d9437bcbb0c.js +1 -0
- package/assets/esri/core/workers/chunks/5f0a50ebd2a08b9b9de2.js +1 -0
- package/assets/esri/core/workers/chunks/639d856cd217914dfe1f.js +1 -0
- package/assets/esri/core/workers/chunks/67d9cfe02613cb73ee37.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/7540b34e743a23e67729.js +1 -0
- package/assets/esri/core/workers/chunks/773d106f60f7dad1493d.js +1 -0
- package/assets/esri/core/workers/chunks/7be11a3ef1f49245089f.js +1 -0
- package/assets/esri/core/workers/chunks/819a8bc1f0a694017ee6.js +1 -0
- package/assets/esri/core/workers/chunks/{1537b02e674f8ef77f4a.js → 8d63b42aea32ce2e5d09.js} +1 -1
- package/assets/esri/core/workers/chunks/8de11aab65d91e7f1a4d.js +1 -0
- package/assets/esri/core/workers/chunks/9386a0ebff78b6303ed2.js +1 -0
- package/assets/esri/core/workers/chunks/{4d47187bc0821413492d.js → 95bae3c275f1483eb7ed.js} +1 -1
- package/assets/esri/core/workers/chunks/9ca55d33ae4bf25e8edd.js +1 -0
- package/assets/esri/core/workers/chunks/{47e4f66c33bb697fbe6b.js → a8f998b8ec8c56150479.js} +2 -2
- package/assets/esri/core/workers/chunks/{f6e18668f728dfd8ba5e.js.LICENSE.txt → a8f998b8ec8c56150479.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/a9e133166e9200fe135e.js +1 -0
- package/assets/esri/core/workers/chunks/aa78b69219d9a0ef1c54.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/acb1c5dd987c801d7b31.js +1 -0
- package/assets/esri/core/workers/chunks/b09b34f64a6bc2b49e0a.js +1 -0
- package/assets/esri/core/workers/chunks/b0a03b6edbcf6e933431.js +1 -0
- package/assets/esri/core/workers/chunks/b8997ae5893afa0298d1.js +1 -0
- package/assets/esri/core/workers/chunks/c0ae186620b68d43b338.js +1 -0
- package/assets/esri/core/workers/chunks/c1d75c48558ed23c5b2b.js +1 -0
- package/assets/esri/core/workers/chunks/{9d7a22746dae1451deaf.js → c6cae8471c5d4ae40c65.js} +1 -1
- package/assets/esri/core/workers/chunks/{c50e8d5f554cf151865c.js → ce16489cf7eb0d78c741.js} +2 -2
- package/assets/esri/core/workers/chunks/{c50e8d5f554cf151865c.js.LICENSE.txt → ce16489cf7eb0d78c741.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/d6e0528eacee7ea4c1ce.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/db5a985ccc6b7d0ad855.js +1 -0
- package/assets/esri/core/workers/chunks/f3ee035fa7bf638c8e60.js +1 -0
- package/assets/esri/core/workers/chunks/f651c05604eab83aef5f.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/fc5ac54aab66562c8463.js +1 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/views/3d/analysis/VolumeMeasurement/t9n/VolumeMeasurementAnalysis.json +1 -0
- package/assets/esri/views/3d/analysis/VolumeMeasurement/t9n/VolumeMeasurementAnalysis_en.json +1 -0
- package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ar.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_bg.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_bs.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ca.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_cs.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_da.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_de.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_el.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_es.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_et.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_fi.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_fr.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_he.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_hr.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_hu.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_id.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_it.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ja.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ko.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_lt.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_lv.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_nl.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_no.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_pl.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_pt-BR.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_pt-PT.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ro.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ru.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_sk.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_sl.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_sr.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_sv.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_th.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_tr.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_uk.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_vi.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_zh-CN.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_zh-HK.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_zh-TW.json +1 -1
- package/config.js +1 -1
- package/geometry/support/curves/densifyCurvedGeometry.js +1 -1
- package/identity/IdentityManagerBase.js +1 -1
- package/interfaces.d.ts +199 -149
- package/kernel.js +1 -1
- package/layers/GaussianSplatLayer.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/IntegratedMeshLayer.js +1 -1
- package/layers/ParquetLayer.js +1 -1
- package/layers/VectorTileLayer.js +1 -1
- package/layers/graphics/sources/ParquetSource.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/support/BuildingFieldStatistics.js +5 -0
- package/layers/support/BuildingSummaryStatistics.js +1 -1
- package/layers/support/ControlPoint.js +5 -0
- package/layers/support/ControlPointsGeoreference.js +1 -1
- package/layers/support/FieldConfiguration.js +1 -1
- package/layers/support/VideoFrame.js +1 -1
- package/layers/support/fieldConfigUtils.js +1 -1
- package/layers/support/mediaUtils.js +1 -1
- package/layers/support/vectorTileLayerLoader.js +1 -1
- package/package.json +3 -3
- package/portal/schemas/definitions.js +1 -1
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/rest/support/imageMeasureUtils.js +1 -1
- package/support/basemapEnsureType.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
- package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TextureStatisticsTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsDiffShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsMinMaxSumShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsStdDevShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsSumOfSquaredDiffShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterColorizerStretchShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/math.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/stretch.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/utils.js +1 -1
- package/views/2d/layers/BaseLayerView2D.js +1 -1
- package/views/2d/layers/BaseLayerViewGL2D.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/featureServiceUtils.js +1 -1
- package/views/2d/layers/features/schema/SourceSchema.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
- package/views/2d/layers/features/sources/strategies/AFeatureLoadStrategy.js +5 -0
- package/views/2d/layers/features/sources/strategies/AFeatureTileLoadStrategy.js +5 -0
- package/views/2d/layers/features/sources/strategies/ALoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeatureDrillDownTileLoadStrategy.js +5 -0
- package/views/2d/layers/features/sources/strategies/FeaturePagedTileLoadStrategy.js +5 -0
- package/views/2d/layers/features/sources/strategies/FeatureSnapshotLoadStrategy.js +5 -0
- package/views/2d/layers/features/sources/strategies/ParquetSnapshotLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/StreamLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
- package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
- package/views/3d/GroundView3D.js +5 -0
- package/views/3d/analysis/ElevationProfile/{ElevationProfileSceneLineComputation.js → ElevationProfileLineSceneComputation.js} +1 -1
- package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementConfiguration.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
- package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
- package/views/3d/glTF/internal/Resource.js +1 -1
- package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
- package/views/3d/interactive/visualElements/DrapedVisualElementResources.js +1 -1
- package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/layers/DrapedSubView3D.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/layers/support/MediaLayerInteractionOptions.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/support/MemoryController.js +1 -1
- package/views/3d/support/QualitySettings.js +1 -1
- package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
- package/views/3d/support/popupHitTest.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileChart.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileHoveredPointsVisualization.js +1 -1
- package/views/analysis/ElevationProfile/{ElevationProfileGroundLineComputation.js → ElevationProfileLineGroundComputation.js} +1 -1
- package/views/analysis/ElevationProfile/{ElevationProfileInputLineComputation.js → ElevationProfileLineInputComputation.js} +1 -1
- package/views/analysis/ElevationProfile/{ElevationProfileQueryLineComputation.js → ElevationProfileLineQueryComputation.js} +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
- package/views/draw/input/DrawEvents.js +1 -1
- package/views/layers/ImageryTileLayerView.js +1 -1
- package/widgets/Editor/AddAssociationWorkflowData.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
- package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/UpdateRecordWorkflowData.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/UpdateWorkflowData.js +1 -1
- package/widgets/Editor/Upload.js +1 -1
- package/widgets/Editor/components/FeatureList.js +1 -1
- package/widgets/Editor/components/Notices.js +1 -1
- package/widgets/Editor/modelUploadUtils.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileLineGround.d.ts +2 -2
- package/widgets/ElevationProfile/ElevationProfileLineInput.d.ts +2 -2
- package/widgets/ElevationProfile/ElevationProfileLineQuery.d.ts +2 -2
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/FeatureTable/support/templateUtils.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/DataCaptureAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/view/MapViewAdapter.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/PanoramicVideoViewer.js +5 -0
- package/widgets/PanoramicViewer/PanoramicVideoViewerViewModel.js +5 -0
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/analysis/ElevationProfile/ElevationProfileGroundLine.d.ts +0 -4
- package/analysis/ElevationProfile/ElevationProfileInputLine.d.ts +0 -4
- package/analysis/ElevationProfile/ElevationProfileQueryLine.d.ts +0 -4
- package/analysis/ElevationProfile/ElevationProfileSceneLine.d.ts +0 -4
- package/assets/esri/core/workers/chunks/03e5d1a00d85e4d16bff.js +0 -1
- package/assets/esri/core/workers/chunks/0914a52fb33af5d77fab.js +0 -1
- package/assets/esri/core/workers/chunks/0dd6b8b3e634bb5f0ca7.js +0 -1
- package/assets/esri/core/workers/chunks/1d491447b13f2f2b4399.js +0 -1
- package/assets/esri/core/workers/chunks/20850b0fdb55fb17bc90.js +0 -1
- package/assets/esri/core/workers/chunks/268f5b233640a9dbbf89.js +0 -2
- package/assets/esri/core/workers/chunks/336b54144afec0c7d396.js +0 -2
- package/assets/esri/core/workers/chunks/42bc1e981624ce9844a4.js +0 -1
- package/assets/esri/core/workers/chunks/436bbe99bedd7b331edb.js +0 -1
- package/assets/esri/core/workers/chunks/4840bd93d8fe15c7aefd.js +0 -1
- package/assets/esri/core/workers/chunks/486ea51306c619238e41.js +0 -1
- package/assets/esri/core/workers/chunks/49cb78c85de0102e5f02.js +0 -1
- package/assets/esri/core/workers/chunks/5610dfde4e636e2333a9.js +0 -1
- package/assets/esri/core/workers/chunks/655a878ddea4907d830e.js +0 -1
- package/assets/esri/core/workers/chunks/72fe4f1f789abb5b4035.js +0 -1
- package/assets/esri/core/workers/chunks/7402c2853f6aed8d1bc7.js +0 -1
- package/assets/esri/core/workers/chunks/79a9f47dfa9ebabb5dbd.js +0 -1
- package/assets/esri/core/workers/chunks/804e3b3df375177e6c86.js +0 -1
- package/assets/esri/core/workers/chunks/86378d4f4d7f9a370c22.js +0 -1
- package/assets/esri/core/workers/chunks/a2652d10bb0bc41c9a8d.js +0 -1
- package/assets/esri/core/workers/chunks/b19d723d09f5bea9ca27.js +0 -1
- package/assets/esri/core/workers/chunks/b78ea9cc4d5f2fd3d871.js +0 -1
- package/assets/esri/core/workers/chunks/bd4125d163f372a7e978.js +0 -1
- package/assets/esri/core/workers/chunks/d0a149050f7f1c1ada09.js +0 -1
- package/assets/esri/core/workers/chunks/d142a42755a78bb157ed.js +0 -1
- package/assets/esri/core/workers/chunks/da42cc4f6142846cb745.js +0 -1
- package/assets/esri/core/workers/chunks/dd84f630466a26722d57.js +0 -1
- package/assets/esri/core/workers/chunks/e17df11c98dbd869302b.js +0 -1
- package/assets/esri/core/workers/chunks/e1b3ae6426886e2fab07.js +0 -1
- package/assets/esri/core/workers/chunks/f35003a90163847fe1e2.js +0 -1
- package/assets/esri/core/workers/chunks/f6513ec888a7d927d948.js +0 -1
- package/assets/esri/core/workers/chunks/f6e18668f728dfd8ba5e.js +0 -2
- package/views/2d/layers/features/sources/strategies/AFetchLoadStrategy.js +0 -5
- package/views/2d/layers/features/sources/strategies/ATileLoadStrategy.js +0 -5
- package/views/2d/layers/features/sources/strategies/DrillDownTileLoadStrategy.js +0 -5
- package/views/2d/layers/features/sources/strategies/PagedTileLoadStrategy.js +0 -5
- package/views/2d/layers/features/sources/strategies/SnapshotLoadStrategy.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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../Color.js";import i from"../../../Graphic.js";import{removeUnordered as s,isSome as r}from"../../../core/arrayUtils.js";import has from"../../../core/has.js";import o from"../../../core/Logger.js";import{equals as n}from"../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../core/maybe.js";import l from"../../../core/PooledArray.js";import{ignoreAbortErrors as d,isAbortError as h,throwIfAborted as c,createResolver as u}from"../../../core/promiseUtils.js";import{initial as _,watch as g}from"../../../core/reactiveUtils.js";import{schedule as m}from"../../../core/scheduling.js";import{equals as f}from"../../../core/SetUtils.js";import{isArrayBuffer as p}from"../../../core/typedArrayUtil.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import{subclass as b}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as v,invert as I}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as C}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{multiply as M,getTranslation as w}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{clone as x,create as R}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as S}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{i as O,t as j,o as E,a as F,f as V,g as D,d as T,H as A}from"../../../chunks/vec32.js";import{create as H}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as N}from"../../../chunks/vec42.js";import{fromValues as P}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as k}from"../../../core/support/UpdatingHandles.js";import{getSphericalPCPF as U}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{localLinearScaleFactors as L}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectBoundingSphere as G}from"../../../geometry/projection/projectBoundingSphere.js";import{projectBuffer as B}from"../../../geometry/projection/projectBuffer.js";import{getProjectorName as q}from"../../../geometry/projection/projectors.js";import{projectVectorToVector as z}from"../../../geometry/projection/projectVectorToVector.js";import{fromBuffer as W,create as $,toRect as K}from"../../../geometry/support/aaBoundingBox.js";import{create as Q,intersects as Y}from"../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as J,ensurePackedMat4f64 as X}from"../../../geometry/support/DoubleArray.js";import{compactFloatArray as Z}from"../../../geometry/support/FloatArray.js";import{compactIndices as ee}from"../../../geometry/support/Indices.js";import{a as te,f as ie,n as se,g as re}from"../../../chunks/sphere.js";import{newUByteArray as oe}from"../../../geometry/support/UByteArray.js";import{fallbackObjectIDAttribute as ne}from"../../../layers/LayerConstants.js";import ae from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as le}from"../../../layers/support/fieldUtils.js";import de from"../../../layers/support/SceneModification.js";import{getColor as he,getOpacity as ce}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{isBasemapLayerView as ue}from"../../../support/basemapUtils.js";import{getElevationOffset as _e}from"../../../support/elevationInfoUtils.js";import{loadArcade as ge}from"../../../support/loadArcade.js";import me from"../../../symbols/MeshSymbol3D.js";import fe from"../../../symbols/SimpleFillSymbol.js";import{ContentGeometryUpdateEvent as pe}from"./ContentGeometryLayerView.js";import ye from"./I3SMeshViewLabeler.js";import{I3SMeshViewPerformanceInfo as be}from"./I3SMeshViewPerformanceInfo.js";import{I3SMeshWorkerHandle as ve,toWasmModification as Ie}from"./I3SMeshWorkerHandle.js";import{initialize as Ce,setModificationsSync as Me,filterObbsForModificationsSync as we,interpretObbModificationResults as xe}from"./SceneLayerWorker.js";import{overrideColor as Re}from"./graphics/graphicUtils.js";import{areLabelsVisible as Se}from"./graphics/Labeler.js";import Oe from"./i3s/Highlights.js";import{I3SAsyncElevationUpdater as je}from"./i3s/I3SAsyncElevationUpdater.js";import{getCachedAttributeValue as Ee}from"./i3s/I3SBinaryReader.js";import{I3SCrossfadeHelper as Fe,NodeCrossfadeMetaData as Ve}from"./i3s/I3SCrossfadeHelper.js";import{boundingBoxCornerPoints as De}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as Te}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as Ae,selectEncoding as He,defaultMaterial as Ne,createTexture as Pe,configureMaterial as ke}from"./i3s/I3SMaterialUtil.js";import{I3SOverrides as Ue}from"./i3s/I3SOverrides.js";import{computeGlobalTransformation as Le}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as Ge,checkSceneLayerValid as Be,checkSceneLayerCompatibleWithView as qe,whenGraphicAttributes as ze,computeVisibilityObb as We,filterInPlace as $e,intersectBoundingRectWithMbs as Ke,addWraparound as Qe,getSymbolInfo as Ye,transparentEdgeMaterial as Je,getClipRect as Xe}from"./i3s/I3SUtil.js";import{IDBCache as Ze}from"./i3s/IDBCache.js";import{IDBMockCache as et}from"./i3s/IDBMockCache.js";import{LayerElevationProvider as tt}from"./i3s/LayerElevationProvider.js";import{SymbologyInfo as it}from"./i3s/SymbologyInfo.js";import{attributeLookup as st}from"./support/attributeUtils.js";import{normalizeHighlightTarget as rt,emptyHighlightHandle as ot}from"./support/highlightUtils.js";import{makeScheduleFunction as nt}from"./support/makeScheduleFunction.js";import{debugFlags as at}from"../support/debugFlags.js";import{ElevationRange as lt}from"../support/ElevationRange.js";import{toBoundingRect as dt}from"../support/extentUtils.js";import{Obb as ht,ensurePackedObbData as ct}from"../support/orientedBoundingBox.js";import{updatingProgress as ut}from"../support/updatingProperties.js";import{glLayout as _t}from"../support/buffer/glUtil.js";import{ObjectParameters as gt}from"../webgl-engine/collections/Component/ObjectParameters.js";import{createVertexBufferLayout as mt,GeometryParameters as ft}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as pt}from"../webgl-engine/collections/Component/Transform.js";import{emissiveStrengthDefault as yt}from"../webgl-engine/core/shaderLibrary/output/Emissions.glsl.js";import{loadBasisTranscoder as bt}from"../webgl-engine/lib/BasisUtil.js";import{getHighlightName as vt}from"../../support/highlightOptionsUtils.js";import{TextureCompressionTracker as It}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as Ct}from"../../../webscene/support/AlphaCutoff.js";const Mt=[1,1,1,1];class wt extends Ve{constructor(e,t,i,s,r,o,n,a,l){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=n,this.anchorIds=a,this.anchors=l,this.cachedElevationAnchors=null,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbologyStride=5}get usedMemory(){return this.node.memory}get featureExtents(){return this._featureExtents??=new Float64Array(6*this.featureIds.length).fill(Number.POSITIVE_INFINITY),this._featureExtents}}const xt=26,Rt=104857600,St=t=>{const p=t;let A=class extends p{constructor(){super(...arguments),this._applySSAO=!0,this._shadeNormals=!0,this._updatingHandles=new k,this._highlights=null,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._snappingSourcesTrackers=[],this._compressionTracker=new It,this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._currentRenderer=null,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._visibleGeometryChangedSchedulerHandle=null,this._hasComponentData=!1,this._hasVertexColors=!1,this._nodeColorOverride=null,this.updating=!0,this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.slicePlaneEnabled=!1,this._modifications=new Array,this.ignoresMemoryFactor=!1,this._layerUrl="",this._cacheKeySuffix=null,this._planetRadiusInGlobalMode=0,this._elevationTask=null,this._needFilterResolve=!1,this._filters=[],this._arcade=null,this._tmpAttributeOnlyGraphic=new i,this._crossfadeHelper=new Fe(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerViewUid(){return this.uid}get layerId(){return this.i3slayer&&this.i3slayer.id}get sublayerId(){return null}get _isIntegratedMesh(){return"integrated-mesh"===this.i3slayer.type}get contentVisible(){return!this.suspended&&this._controller?.rootNodeVisible&&this.fullOpacity>Ct}get legendEnabled(){return this.contentVisible&&!0===this.i3slayer?.legendEnabled}get updatingProgressValue(){return this._controller?.updatingProgress??0}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return Ge(this._currentRenderer)?this._usePBR||this._hasLoadedPBRTextures?63:37:this._usePBR||this._hasLoadedPBRTextures?44:36}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;return null!=e&&"absolute-height"===e.mode?_e(e,this.i3slayer.spatialReference):0}get elevationInfo(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null==e)return new Lt(0,0);const t=_e(e,this.i3slayer.spatialReference);switch(e.mode){case"absolute-height":return new Lt(0,t);case"relative-to-ground":return new Lt(1,t);case"on-the-ground":return new Lt(2,0);default:return new Lt(0,0)}}get supportedTextureEncodings(){return Ae(this.view.stage.renderView.capabilities)}get clientGeometry(){return this.i3sOverrides.geometryOverrides}get elevationRange(){const e=this._nodeId2Meta,t=new lt;for(const i of e.values()){if(null==i)continue;const{node:{serviceMbsInIndexSR:e}}=i,[s,r,o,n]=e;t.expandElevationRangeValues(o-n,o+n)}return t.elevationRangeValid?t:null}get fullExtent(){return this.i3slayer.fullExtent}initialize(){const e=has("enable-feature:idb-mock-cache");this._idbCache=e?new et(this.view,e):new Ze("esri-scenelayer-cache","geometries"),this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const t=this.view.resourceController,i=t.memoryController;this.i3sOverrides=new Ue({view:this.view,layer:this.i3slayer,memoryController:i}),this._workerHandle=new ve(nt(t)),this.addResolvingPromise(this._workerHandle.promise);const s=this.i3slayer.store;this.addResolvingPromise(this._workerHandle.setLegacySchema(this.uid,s.defaultGeometrySchema).catch(d)),Be(this.i3slayer),qe(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new ae({layerView:this,worker:this._workerHandle}),this._gpuMemoryEstimate=0,this._texMemoryEstimate=0,this._geoMemoryEstimate=0,this._stage=this.view.stage,this._collection=this._stage.renderView.componentObjectCollection;const r=s.defaultGeometrySchema;if(this._isIntegratedMesh||!r)this._hasComponentData=!1;else{const e=r.featureAttributes;this._hasComponentData=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=(r?.vertexAttributes.color??null)&&!this.i3slayer.cachedDrawingInfo?.color;const n=this.view.resourceController.memoryController.newCache(`sl-${this.uid}`,e=>this._deleteComponentObject(e));this._memCache=n;const l=this._controller,h=this._nodeId2Meta,c=this._nodeId2MetaReloading,u=e=>{const t=l.index;if(!t)return;const i=t.rootNode;if(!i)return;const s=t=>{const i=t.index,s=h.get(i)||c.get(i);return e(t,s?.objectHandle??null)};t.traverse(i,s)};this._intersectionHandler=new Te({layerViewUid:this.layerViewUid,sublayerId:this.sublayerId,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:u}),this._elevationProvider=new tt({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR,this._updatingHandles.add(()=>this.view.clippingArea,()=>this._clippingAreaChanged(),_),this._updatingHandles.add(()=>this.fullOpacity,e=>this._opacityChange(e)),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this.elevationOffset,(e,t)=>{this._reloadAll(t),this._controller.invalidateVisibilityObbs()}),this._updatingHandles.add(()=>this.elevationInfo,(e,t)=>this._elevationInfoChanged(e,t),_),this._updatingHandles.add(()=>!this.suspended&&0!==this.elevationInfo.mode,(e,t)=>{e?this.addHandles(this.view.basemapTerrain.on("elevation-change",({extent:e})=>this._ensureElevationTask().addExtent(e)),qt):t&&this.removeHandles(qt)},_),this._updatingHandles.add(()=>this._usePBR,e=>this._updatePBR(e));const m=()=>{this._reloadAll(),this.clearMemCache()};this._updatingHandles.add(()=>this.rendererTextureUsage,m),this._updatingHandles.add(()=>this.contentVisible,e=>this._contentVisibleChanged(e),_),this._updatingHandles.add(()=>this.i3slayer.labelsVisible,()=>this._labelingChanged(),_),this._updatingHandles.add(()=>this.i3slayer.labelingInfo,()=>this._labelingChanged(),_),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),_),this.addHandles([g(()=>at.I3S_TREE_SHOW_TILES,e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then(({I3STreeDebugger:t})=>{!this._treeDebugger&&at.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))})}else e||at.I3S_TREE_SHOW_TILES||(this._treeDebugger=a(this._treeDebugger))},_),g(()=>at.I3S_SHOW_MODIFICATIONS,()=>this._showModifications(),_)]),this._cacheKeySuffix=this._getCacheKeySuffix(),this._idbCache.init().catch(e=>o.getLogger(this).warn(`Failed to initialize IndexedDB cache: ${e}`));const{view:f}=this,{viewingMode:p,renderCoordsHelper:y}=f;this._planetRadiusInGlobalMode="local"===p?0:y.referenceEllipsoid.radius}destroy(){this._clearAddTasks(),this._elevationTask=a(this._elevationTask),this.i3sOverrides=a(this.i3sOverrides),this._elevationProvider&&(this._elevationProvider.notifyObjectsChanged(this.getVisibleObbs()),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._workerHandle;e&&(e.destroyContextAndSelf(this.uid),this._workerHandle=null),this._removeAllNodeDataFromStage(),this._memCache=a(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=a(this._labeler),this._treeDebugger=a(this._treeDebugger),this._controller=a(this._controller),this._highlights=a(this._highlights),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this._crossfadeHelper=a(this._crossfadeHelper),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null),this._updatingHandles=a(this._updatingHandles)}_memEstimateTextureAdded(e){const t=e.usedMemory;return this._gpuMemoryEstimate+=t,this._texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(null!=e){const t=e.usedMemory;this._gpuMemoryEstimate-=t,this._texMemoryEstimate-=t}}_memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this._gpuMemoryEstimate+=t,this._geoMemoryEstimate+=t,t}_memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this._gpuMemoryEstimate-=t,this._geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}get usedMemory(){let e=null!=this._labeler?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach(t=>e+=null!=t?t.node.memory:0),this._nodeId2MetaReloading.forEach(t=>e+=null!=t?t.node.memory:0),e}get unloadedMemory(){return(null!=this._controller?this._controller.unloadedMemoryEstimate:0)+(null!=this._labeler?this._labeler.unloadedMemoryEstimate:0)}_labelingChanged(){if(!(Se(this.i3slayer)&&this._supportsLabeling))return void(null!=this._labeler&&(this._labeler.destroy(),this._labeler=null));if(null!=this._labeler)return;const e=new ye({view:this.view,layer:this.i3slayer,collection:this._collection,overrides:this.i3sOverrides,layerViewUid:this.uid});this._nodeId2Meta.forEach(t=>null!=t&&this._addMetaToLabeler(e,t)),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then(e=>(--this._asyncModuleLoading,e),e=>{throw--this._asyncModuleLoading,e})}_modificationsChanged(){if(!this._i3sWasmLoaded&&this.hasModifications)return this._i3sWasmLoaded=Ce().then(()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()}),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=e=>o.getLogger(this).error("set-modifications-error","Error when setting modifications:",e),t=this.uid,i=this.i3slayer.spatialReference,s=i.isGeographic,r=Ie(this._layerClippingArea,this._modifications,i);this._workerHandle.setModifications(t,r,s).catch(e);try{Me({context:t,modifications:r,isGeodetic:s})}catch(a){e(a)}this._controller.modificationsChanged();const n=this.hasModifications?new l:null;this._nodeId2Meta.forEach((e,t)=>{null==e?(this._nodeId2Meta.delete(t),this._controller.updateLoadStatus(t,!1)):e.node.hasModifications?(this._updateFeatureIdCounts(e,-1),this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):null!=n&&n.push(e.node)}),this.notifyChange("elevationRange"),null!=n&&this._nodeId2MetaReloading.forEach(e=>n.push(e.node)),null!=n&&n.length>0&&(this.updateNodeModificationStatus(n),n.forAll(e=>{if(2!==e.imModificationImpact){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),null!=t?(this._updateFeatureIdCounts(t,-1),this._nodeId2Meta.delete(e.index),this._nodeId2MetaReloading.set(e.index,t),this.notifyChange("elevationRange")):this._nodeId2Meta.has(e.index)&&(this._nodeId2Meta.delete(e.index),this._controller.updateLoadStatus(e.index,!1))}})),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(null!=this._modificationGraphics&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!at.I3S_SHOW_MODIFICATIONS||0===this._modifications.length)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={outline:{color:[255,255,255],width:1}};this._modificationGraphics=[];for(const s of this._modifications){const r=s.geometry;r.spatialReference=this.i3slayer.spatialReference;const o=new fe({...t,color:e[s.type]});this._modificationGraphics.push(new i({geometry:r,symbol:o}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,(e,t)=>this._createAttributes(e,t))}_contentVisibleChanged(e){e?(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler)):(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(null!=t?.attributeInfo)return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(null!=t?.attributeInfo)return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);null!=i?.attributeInfo&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);null!=s&&(await this.i3sOverrides.applyAttributeOverrides(s.featureIds,t,i,this._controller.requiredAttributes),s.attributeInfo=t,this._controller.reschedule(()=>{this._nodeId2Meta.get(e)===s&&this._attributeValuesChanged(s)},i).catch(e=>{h(e)||o.getLogger(this).warn("Error while updating attribute values. Layer might not display correctly.",e)}))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.appliedFilters=null,null!=this._labeler&&this._labeler.setNodeMetaAttributes(e,(e,t)=>this._createAttributes(e,t)),this._updateEngineObject(e)}clearMemCache(){null!=this._memCache&&this._memCache.clear(),this._addTasks.forEach(e=>e.allowMemCache=!1)}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach(t=>null!=t&&e.push(t.node)),e}getVisibleObbs(){const e=new Array;return this._nodeId2Meta.forEach(t=>t&&e.push(this._collection.getComponentObb(t.objectHandle))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach((t,i)=>e.push(i)),this._nodeId2MetaReloading.forEach((t,i)=>e.push(i))}_preLoadBasis(){!has("disable-feature:i3s-basis")&&2&this.supportedTextureEncodings&&this.i3slayer.textureSetDefinitions?.some(e=>e.formats.some(e=>"basis"===e.format||"ktx2"===e.format))&&bt()}_getVertexBufferLayout(e,t){return _t(mt(this._getGeometryParameters({hasTexture:Tt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion})))}_getObjectIdField(){return this.i3slayer.objectIdField||ne}_getGlobalIdField(){return this.i3slayer.globalIdField}_findGraphicNodeAndIndex(e){const t=st(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());for(const i of this._nodeId2Meta.values()){const e=i?.featureIds.indexOf(t);if(null!=e&&e>=0)return{node:i.node,index:e}}return null}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(null==i)return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const n of t){const e=st(o,n.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this.getAABB(t.node.index,t.index);return null==i?Promise.reject():Promise.resolve({boundingBox:i,screenSpaceObjects:[]})}getAABBFromIntersectorTarget(e){return null==e.nodeIndex||null==e.componentIndex?null:this.getAABB(e.nodeIndex,e.componentIndex)}getAABB(e,t){const i=this._nodeId2Meta.get(e);if(null==i?.featureIds||t>=i.featureIds.length)return null;const s=i.objectHandle,r=De(t,this._collection,s,J(24),0),o=this.view.renderSpatialReference,n=this.view.spatialReference;return B(r,o,0,r,n,0)?W(r):null}whenGraphicAttributes(e,t){return ze(this.i3slayer,e,this._getObjectIdField(),t,()=>[...this._nodeId2Meta.values()].filter(r))}getGraphicFromIntersectorTarget(e,t){if(null==e.nodeIndex||null==e.componentIndex)return null;const i=this._nodeId2Meta.get(e.nodeIndex);if(null==i?.featureIds||e.componentIndex>=i.featureIds.length)return null;const s=this._createLayerGraphic(this._createAttributes(e.componentIndex,i));return s?t.defer?(t.defer(async()=>(s.geometry=(await import("./i3s/meshUtils.js")).createMesh({layerView:this,nodeIndex:e.nodeIndex,featureIndex:e.componentIndex}),s)),null):s:null}_getCacheKey(e){return`${this._layerUrl}/v${xt}/${e}${this._cacheKeySuffix}`}_getCacheKeySuffix(){const e=this.view.renderSpatialReference;if(null==e)return Wt;if(e===U(e))return $t;return this.i3slayer.spatialReference.equals(e)?zt:null!=e.wkid?`@${e.wkid}`:null}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return null!=this._memCache?this._memCache.pop(this._getMemCacheKey(e)):null}deleteCachedGPUData(e){null!=e&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(null==this._memCache)return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,i)}loadMissingTextures(e,t,i,s){const r=e?.filter((e,i)=>{if(0===(e.usage&this.rendererTextureUsage))return!1;if(null==t)return!0;const s=He(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(null==r?.data||s&&r.encoding!==s.encoding)})??[];return 0===r.length?Promise.resolve(!1):i(r,s).then(i=>{let s=0;for(let r=0;r<e.length;r++)s<i.length&&i[s].id===e[r].id&&(t[r]=i[s],s++);return!0})}loadCachedNodeData(e,t,i){return this._idbCacheEnabled?this._idbCache.get(this._getCacheKey(e.id),t).then(s=>null==s?null:(s.globalTrafo=X(s.globalTrafo),s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e.id)),null):(0===this.elevationInfo.mode&&(e.geometryObbInRenderSR=ht.fromData(s.geometryObbData)),this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then(i=>(i&&this._idbCache.initialized&&null!=s.textureData&&(s.byteSize=Nt(s.transformedGeometry,s.textureData),s.textureData.every(Ht)&&this._indexedDbSizeCheck(e,s)&&this._idbCache.put(this._getCacheKey(e.id),s).catch(t=>o.getLogger(this).warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`))),c(t),s))))):Promise.resolve(null)}addNode(e,t,i){return At(t)?null==t.geometryBuffer?(this._addNodeMeta(e.index,null),Promise.resolve()):this._addData(e,t.attributeDataInfo,()=>this._transformNode(e,t,i).then(s=>this._safeReschedule(()=>{if(null==s)return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:n,featureIds:a,anchorIds:l,anchors:d,transformedGeometry:h}=s,c=X(s.globalTrafo),u=O(Gt,r.center.x,r.center.y,r.center.z);j(u,u,c);const _=new ht(u,[r.extents.x,r.extents.y,r.extents.z],S(r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w));0===this.elevationInfo.mode&&(e.geometryObbInRenderSR=_),t.geometryData.componentOffsets=n,a&&(t.geometryData.featureIds=Array.from(a)),t.geometryData.anchorIds=l,t.geometryData.anchors=d;const g={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:h,globalTrafo:c,geometryObbData:_.data,byteSize:Nt(h,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&this._indexedDbSizeCheck(e,g)){const t=null!=g.textureData?g.textureData.map(e=>Ht(e)?e:null):null;this._idbCache.put(this._getCacheKey(e.id),{...g,textureData:t}).catch(t=>o.getLogger(this).warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`))}return this._addCachedNodeData(e,g,i)},i))):Promise.reject()}getElevationRange(e){const t=new lt,i=this._controller,{index:s}=i;if(!s)return t;const{rootNode:r}=s;if(!r)return t;const o=this._nodeId2Meta,n=e[3],a=i.viewportQueries,l=this._planetRadiusInGlobalMode,{view:d}=this,{renderCoordsHelper:h}=d,c=h.referenceEllipsoid.radius,u=this._collection,_=i=>{const{childrenLoaded:s}=i;if(0===s)return!1;const r=a.getAndUpdateVisibilityObbInRenderSR(i);let d=null,_=-1;if(r){if(_=r.radius,!r.intersectSphereWithMBS(e,_))return!1}else d=a.getServiceMbsInRenderSR(i),d&&(_=d[3]);if(_>=0&&n>=1*_)return null!=r?Yt(t,r,l):null!=d&&d[3]>=0&&Jt(t,d,l),!1;const g=Qt;if(g.elevationRangeMin=1/0,g.elevationRangeMax=-1/0,(null!=r||null!=d)&&(null!=r?Yt(g,r,l):null!=d&&Jt(g,d,l),g.elevationRangeMin>=t.elevationRangeMin&&g.elevationRangeMax<=t.elevationRangeMax))return!1;const m=o.get(i.index);if(m){const{geometryObbInRenderSR:s}=i;if(!s||s.intersectSphereWithMBS(e)){if(s){if(n>0*s.radius)return Yt(t,s,l),!1}const{objectHandle:e}=m,i=u.getObjectTransform(e),r=h.getAltitude(i.position);u.expandRangeWithComponentObjectElevationRange(e,r,c,t)}}return s-(m?1:0)>0};return s.traverse(r,_),t}computeVisibilityObb(e){return We(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications,this.view.renderCoordsHelper.sphericalPCPF)}_transformNode(e,t,i){const s=t.geometryData.geometries??[],r=new Array(s.length);for(let f=0;f<s.length;++f)r[f]=this._getVertexBufferLayout(s[f],t.geometryDescriptor);const o=this.i3slayer.normalReferenceFrame,n=t.normalReferenceFrame??o??"none",a=e.serviceMbsInIndexSR,l=this.elevationOffset,d=this._controller.crsIndex,h=this._controller.crsVertex,c=this.view.renderSpatialReference,u=Le(a,l,n,d,c),_=q(d,h),g=q(h,c);if(null==_||null==g)return Promise.resolve(null);const m={context:this.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,globalTrafo:u,mbs:a,obbData:e.serviceObbInIndexSR?.data,elevationOffset:l,needNormals:this._controller.isMeshPyramid,normalReferenceFrame:n,indexToVertexProjector:_,vertexToRenderProjector:g};return this._workerHandle.invoke(m,i)}get _supportsNodeCrossFading(){return!this.view?.stage?.renderer.shadowsEnabled}get nodeCrossfadingEnabled(){return this._supportsNodeCrossFading&&(this.lodCrossfadeinDuration>0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this._supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,i){if(0===this.elevationInfo.mode&&(e.geometryObbInRenderSR=this._collection.getComponentObb(t.objectHandle).clone()),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);null!=this._labeler&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,!0),this._updateMaterial(t),this._setNewNodeOpacity(t),0!==this.elevationInfo.mode&&this._ensureElevationTask().schedule(s),this._updateEngineObject(t),this._highlights?.objectCreated(t),null!=this._treeDebugger&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,()=>this._addCachedNodeData(e,t,s))}async deleteCachedNodeData(e){if(this._idbCacheEnabled)return this._idbCache.remove(this._getCacheKey(e))}async _addCachedNodeData(e,t,i){if(!this.contentVisible||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(null==t)return void this._addNodeMeta(e.index,null);const s=this._addTasks.get(e.index),{geometryData:r,transformedGeometry:n}=t;await this.i3sOverrides.applyAttributeOverrides(r.featureIds,s.attributeInfo,i,this._controller.requiredAttributes);const a=null!=t.textureData?t.textureData.filter(e=>null!=e&&0!==(e.usage&this.rendererTextureUsage)):[];!has("disable-feature:i3s-basis")&&a.some(e=>null!=e&&(2===e.encoding||1===e.encoding))&&await bt(),e.memory=0;const{componentOffsets:l,geometries:d,featureIds:h,anchorIds:c,anchors:u}=r,_=this._collection,g=d[0],{layout:m,indices:f,interleavedVertexData:p,positionData:y,hasColors:b}=n,{material:S,geometryParameters:O}=this._materialParameters(g,m),j=l||new Uint32Array([0,f?f.length:p.byteLength/m[0].stride]),V={vertices:{data:p,count:p.byteLength/m[0].stride,layoutParameters:O},positionData:{positions:Z(y.data),indices:ee(y.indices)},indices:f,componentOffsets:j},D=g.transformation?x(g.transformation):R(),T=X(t.globalTrafo);M(D,T,D);const A=w(H(),D),N=v(C(),D),k=this.view.renderSpatialReference,U=this.view.basemapTerrain.spatialReference,G=ht.fromData(ct(t.geometryObbData)).center,B=[1,1,1];L(G,k,B,U)||o.getLogger(this).errorOnce("Unsupported coordinate system for IM overlay");const q=H();z(G,k,q,U);const W=C();I(W,N);const $=H();E($,F($,G,A),W);const K=q[0]-$[0]*B[0],Q=q[1]-$[1]*B[1],Y=_.createObject(new gt(P(K,Q,B[0],B[1]),new pt(A,N),ht.fromData(ct(t.geometryObbData)),V)),J=2===O.textureCoordinateType,{textures:te,texturePromise:ie}=this._initMaterialAndTextures(Y,S,a,J,e);e.memory+=this._memEstimateGeometryAdded(Y),e.memory+=te.reduce((e,t)=>e+(null!=t?this._memEstimateTextureAdded(t):0),0);const se=!!S.hasParametersFromSource,re="blend"!==S.alphaMode&&S.metallicRoughness.baseColorFactor[3]>=1,oe=new wt(e,h,Y,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:se,isOpaque:re},te,c,u);s.meta=oe,this._hasTextures||=t.requiredTextures?.some(({usage:e})=>!!(19&e))||!!e.resources.texture,this._hasData=!0,this._hasColors||=b,this.notifyChange("hasTexturesOrVertexColors");const ne=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(oe),ie]).then(([t,s])=>(this._addTasks.has(e.index)&&t?.updateObjectVisibility(oe.objectHandle,!1).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),this._safeReschedule(()=>{const i=this._addTasks.get(e.index);if(!i)return;if(this._addNodeMeta(e.index,oe),i.meta=null,!this.contentVisible)return void this._removeNodeStageData(e.index,this.elevationOffset);_.setObjectVisibility(Y,!0),t?.updateObjectVisibility(oe.objectHandle,!0).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),oe.attributeInfo=i.attributeInfo;const s=oe.cachedRendererVersion!==this._rendererVersion,r=ne!==this.slicePlaneEnabled;this._updateElevationOffsets(oe);const o=oe.elevationOffsets;this._updateComponentData(oe);const n=this._applyFiltersToNode(oe);(s||null!=t&&(r||n||o))&&this._addOrUpdateEdgeRendering(oe),null!=this._labeler&&this._addMetaToLabeler(this._labeler,oe),this._visibleGeometryChanged(oe,0),this._highlights?.objectCreated(oe),this._updateMaterial(oe),this._setNewNodeOpacity(oe),null!=this._treeDebugger&&this._treeDebugger.update()},i))).catch(e=>{const{meta:t,allowMemCache:i}=s;throw s.meta=null,t&&i?this._cacheGPUData(t):t&&this._deleteComponentObject(t),e})}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){o.getLogger(this).error("Removing duplicated node");const t=this._nodeId2Meta.get(e);t&&(this._deleteComponentObject(t),this._updateFeatureIdCounts(t,-1))}else this._controller.updateLoadStatus(e,!0);t&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Ut(t.cachedEdgeMaterials,0),this._updateFeatureIdCounts(t,1)),this._nodeId2Meta.set(e,t),this.notifyChange("elevationRange")}_updateElevationOffsets(e){const t=this.view.renderSpatialReference,i=this._controller.crsIndex,s=this.elevationInfo,r=this.view.basemapTerrain,o=r.spatialReference,n=s.mode;if(null==t||null==o||0===n)return void(e.elevationOffsets=null);const a=this._collection.getObjectTransform(e.objectHandle);e.elevationOffsets=e.elevationOffsets??[];const l=Gt,d=Bt,h=2===n,c=this.view.renderCoordsHelper,u=e.featureIds.length,_=(()=>{if(e.cachedElevationAnchors)return e.cachedElevationAnchors;const s=J(3*u);e.cachedElevationAnchors=s;for(let r=0;r<u;r++){const n=3*r,h=e.anchorIds?.indexOf(r)??-1;e.anchors&&h>=0?(O(l,e.anchors[3*h],e.anchors[3*h+1],e.anchors[3*h+2]),V(l,l,te(e.node.serviceMbsInIndexSR)),z(l,i,l,o),s[n]=l[0],s[n+1]=l[1],s[n+2]=c.getAltitude(l)):(this._collection.getComponentAabb(e.objectHandle,r,d,!0),O(l,(d[0]+d[3])/2,(d[1]+d[4])/2,d[2]),E(l,l,a.rotationScale),V(l,l,a.position),s[n+2]=c.getAltitude(l),z(l,t,l,o),s[n]=l[0],s[n+1]=l[1])}return s})(),g=s.offset,m=e.elevationOffsets,f=(e,t)=>{const i=h?_[3*e+2]:0;m[e]=g+(t??0)-i};r.getElevations(_,u,f)}_ensureElevationTask(){return null!=this._elevationTask||(this._elevationTask=new je(this.view.resourceController.scheduler,e=>this._controller.updateElevationChanged(e,this.view.basemapTerrain.spatialReference)?.filterInPlace(e=>null!=this._nodeId2Meta.get(e)),e=>this._nodeElevationAlignmentChanged(this._nodeId2Meta.get(e)),()=>this.elevationInfo?.mode)),this._elevationTask}_elevationInfoChanged(e,t){const i=0!==e.mode,s=!!t&&t!==e&&0!==t.mode;this._intersectionHandler.updateElevationAlignState(i,this.view.state.viewingMode),i&&!s&&this._controller.removeAllGeometryObbs(),this._nodeId2Meta.forEach(e=>this._nodeElevationAlignmentChanged(e))}_nodeElevationAlignmentChanged(e){null!=e&&(this._updateElevationOffsets(e),this._updateComponentData(e),this._updateEdgeRendering(e),null!=this._labeler&&this._labeler.updateLabelPositions(e),this._updateSnappingSources(e,2),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e.objectHandle)))}_safeReschedule(e,t){return c(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=null!=e.params.material?e.params.material:Ne(),s=t.some(e=>"uvRegion"===e.name),r=t.some(e=>"normalCompressed"===e.name),o=Tt(i);return{geometryParameters:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s,r){const o=this._stage.renderView,n=e=>{this._gpuMemoryEstimate-=e,this._texMemoryEstimate-=e,r.memory-=e},a=i.map(e=>Pe(e,t,s,o,this._compressionTracker,n));this._stage.addTextures(a);let l=null;return this._collection.updateMaterial(e,e=>{l=ke(e,t,a,i,this.view.stage.renderView.textures,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR,isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)}),{textures:a,texturePromise:l}}_getGeometryParameters(e){return new ft(this._hasVertexColors,e.hasTexture?e.hasRegions?2:1:0,e.hasNormals,this._shadeNormals,this._applySSAO)}_addData(e,t,i){let s=this._addTasks.get(e.index);if(s)s.attributeInfo=t;else{const r=u();s=new kt(t,null,r.promise),this._addTasks.set(e.index,s),i().then(r.resolve,r.reject).then(()=>this._addTasks.delete(e.index)).catch(t=>{throw this._addTasks.delete(e.index),t})}return s.promise}_clearAddTasks(){this._addTasks.forEach(e=>{null!=e.meta&&(this._cacheGPUData(e.meta),e.meta=null)}),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=Q();this._renderClippingArea=dt(this.view.clippingArea,i,e)?i:null;const s=Q();this._layerClippingArea=dt(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}get hasGeometryFilter(){return!1}_geometryFilterChange(){const e=this.hasGeometryFilter;this._controller.geometryFilterChanged(e),this._applyFilters(e),this._assertFeatureIdNodeCounts(e)}_assertFeatureIdNodeCounts(e){e&&!this._featureIdCounts?(this._featureIdCounts=ti(this._nodeId2Meta.values()),this._filteredIdCounts=ti(this._nodeId2Meta.values(),1),this._weaklyRemovedIdCounts=ti(this._nodeId2Meta.values(),2),this.addHandles(g(()=>this._controller.updating,e=>{!e&&this._needFilterResolve&&(this.multiGeometryFilterResolve(),this._needFilterResolve=!1,this.notifyUpdate())},{sync:!0}),"updateFinished")):!e&&this._featureIdCounts&&(this._featureIdCounts=null,this._filteredIdCounts=null,this._weaklyRemovedIdCounts=null,this._mismatchShow=null,this._mismatchHide=null,this.removeHandles("updateFinished"),this._needFilterResolve=!1,this.notifyUpdate())}_updateFeatureIdCounts(e,t){this._featureIdCounts&&(this._needFilterResolve=!0,ei(this._featureIdCounts,e.featureIds,t),ei(this._filteredIdCounts,e.filteredIds,t),ei(this._weaklyRemovedIdCounts,e.weaklyRemovedIds,t))}_updateFilteredIdCounts(e,t,i){this._filteredIdCounts&&(this._needFilterResolve=!0,ei(this._filteredIdCounts,t,-1),ei(this._filteredIdCounts,e.filteredIds,1),ei(this._weaklyRemovedIdCounts,i,-1),ei(this._weaklyRemovedIdCounts,e.weaklyRemovedIds,1))}_checkFeatureIdNodeCountInvariant(){const e=null!=this._featureIdCounts;if(this.hasGeometryFilter!==e&&o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","LayerView should have feature id node counts if and only if it has a geometry filter",{layerView:this,hasNodeCounts:e}),!this._featureIdCounts||!this._filteredIdCounts)return;const t=ti(this._nodeId2Meta.values());n(this._featureIdCounts,t)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _featureIdCounts",{layerView:this,counts:this._featureIdCounts,expected:t});const i=ti(this._nodeId2Meta.values(),1);n(this._filteredIdCounts,i)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _filteredIdCounts",{layerView:this,counts:this._filteredIdCounts,expected:i});const s=ti(this._nodeId2Meta.values(),2);n(this._weaklyRemovedIdCounts,s)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _weaklyRemovedIdCounts",{layerView:this,counts:this._weaklyRemovedIdCounts,expected:i})}multiGeometryFilterResolve(){if(!this._featureIdCounts||!this._filteredIdCounts)return;let e=null,t=null;for(const[i,s]of this._filteredIdCounts){const r=this._featureIdCounts.get(i);if(r!==s){s+(this._weaklyRemovedIdCounts?.get(i)??0)===r?(e??=new Set,e.add(i)):(t??=new Set,t.add(i))}}f(e,this._mismatchShow)&&f(t,this._mismatchHide)||(this._mismatchShow=e,this._mismatchHide=t,this._nodeId2Meta.forEach(e=>{if(!e?.filteredIds)return;const t=Zt(e,this._mismatchShow,this._mismatchHide);this._collection.setAllComponentVisibilities(e.objectHandle,t),this._visibleGeometryChanged(e,2)}))}_filterChange(){this._applyFilters(this.hasGeometryFilter)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach(e=>{e&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,2))})}getFilters(){const e=[],t=this._renderClippingArea;return null!=t&&e.push((e,i)=>this._boundingRectFilter(e,i,t)),e}addSqlFilter(e,t,i){if(null!=t){const s=t.fieldNames;e.push((e,r)=>this._sqlFilter(e,r,t,s,i))}}_sqlFilter(e,t,i,s,r){const o={},n=this._createLayerGraphic(o);if(!n)return;const a=this.i3slayer.objectIdField,l=t.featureIds,d=t.attributeInfo?.attributeData;s.every(e=>e===a||null!=d?.[e])&&$e(e,l,e=>{o[a]=l[e];for(const i of s)i!==a&&(o[i]=d?Ee(d[i],e):null);try{return i.testFeature(n)}catch(t){return r(t),!1}})}_boundingRectNodeTest(e,t){return G(e.node.serviceMbsInIndexSR,this._controller.crsIndex,Dt,this.view.renderSpatialReference),Ke(t,Dt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,Ot),K(Ot,jt),Y(i,jt)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(3===r)return;if(0===r)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const n=this._transformClippingArea(Et,i,t.objectHandle);$e(e,t.featureIds,e=>this._boundingRectFeatureTest(t,e,n))}_transformClippingArea(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,o=s.rotationScale;return e[0]=(t[0]-r[0])/o[0],e[1]=(t[1]-r[1])/o[4],e[2]=(t[2]-r[0])/o[0],e[3]=(t[3]-r[1])/o[4],e}async _addOrUpdateEdgeRendering(e,t=!0){const i=e.objectHandle,{hasEdges:s,perFeatureEdgeMaterials:r}=this._getFilteredEdgeMaterials(e);s&&!this._edgeView&&(this._edgeView=await this._stage.renderer.loadEdgeView());const o=this._edgeView;if(!o)return null;const n=o.hasObject(i);if(s){if(n){if(this.nodeCrossfadingEnabled){Ut(r,this.getNodeOpacity(e))}return o.updateAllComponentMaterials(i,r,this.slicePlaneEnabled,t).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),o.updateObjectVisibility(i,!0).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),o.updateAllVerticalOffsets(i,e.elevationOffsets).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),o}const s=await this._collection.addEdges(i,o,r,this.slicePlaneEnabled,e.elevationOffsets);return e.edgeMemoryUsage=s,e.node.memory+=s,o}return n&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,o.removeObject(i)),null}_applyFiltersToNode(e){const{filteredIds:t,weaklyRemovedIds:i}=e,s=this._applyFiltersToNodeComponents(e);return this._updateFilteredIdCounts(e,t,i),s&&this._labeler?.applyFilterChange(e),s}_applyFiltersToNodeComponents(e){const t=this._collection,i=t.getComponentCount(e.objectHandle),s=null!=e.filteredIds,r=0===i.invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!r;if(null!=e.filteredIds&&e.appliedFilters===this._filters||(e.weaklyRemovedIds=null,e.filteredIds=Xt(e,this._filters),e.appliedFilters=this._filters),s&&e.filteredIds===e.featureIds&&(!this._mismatchHide||e.filteredIds.every(e=>!this._mismatchHide?.has(e))))return!r;const o=Zt(e,this._mismatchShow,this._mismatchHide);return t.setAllComponentVisibilities(e.objectHandle,o),!0}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach((t,i)=>this._removeNodeStageData(i,e)),this._nodeId2MetaReloading.forEach((t,i)=>this._removeNodeStageData(i,e,this._nodeId2MetaReloading)),this._elevationTask=a(this._elevationTask)}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading),null!=this._elevationTask&&this._elevationTask.remove(e)}_removeNodeStageData(e,t,i=this._nodeId2Meta){i.has(e)&&this._controller.updateLoadStatus(e,!1);const s=i.get(e);null!=s?(this._collection.setObjectVisibility(s.objectHandle,!1),null!=this._edgeView&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),this._visibleGeometryChanged(s,1),null!=this._labeler&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights?.objectDeleted(s),i===this._nodeId2Meta?(this._updateFeatureIdCounts(s,-1),this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),null!=this._treeDebugger&&this._treeDebugger.update()):i.delete(e)}_deleteComponentObject(e){if(null!=this._edgeView&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.removeTexture(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);null!=i&&this._collection.updateMaterial(i.objectHandle,e=>e.polygonOffsetEnabled=0===t)}updateNodeIndex(e,t){if(this._nodeId2Meta.has(e)){const i=this._nodeId2Meta.get(e);this._nodeId2Meta.delete(e),this._nodeId2Meta.set(t,i),this.notifyChange("elevationRange")}const i=this._nodeId2MetaReloading.get(e);i&&(this._nodeId2MetaReloading.delete(e),this._nodeId2MetaReloading.set(t,i))}_invalidateAllSymbols(){this._rendererVersion=Qe(this._rendererVersion,1),this._controller?.requestUpdate()}_getInvalidRendererVersion(){return Qe(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=Qe(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.i3slayer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await ge()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:o.getLogger(this).warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.symbols)"mesh-3d"!==t.type&&o.getLogger(this).error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getComponentParameters(e){this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(i,s)=>{const r=i*e.cachedSymbologyStride;N(s.externalColor,t[r]/255,t[r+1]/255,t[r+2]/255,t[r+3]/255);const o=this._stage.renderView.olidRenderHelper;if(o){const t=e.featureIds[i],r=this.sublayerId?`${this.layerViewUid}_${this.sublayerId}`:this.layerViewUid,n=ue(this.view,this.uid);o.setUidToObjectAndLayerId(t,t,this.layerId,r,this.layerPopupEnabledAndHasTemplate&&!n,e.node.resources.attributes,i,this.sublayerId),s.olidColor=o.getObjectAndLayerIdColor({graphicUid:t,layerViewUid:r})}s.externalColorMixMode=15&t[r+4],s.castShadows=!!(16&t[r+4]),s.pickable=!!(32&t[r+4]),s.elevationOffset=e.elevationOffsets?.[i]??0,s.emissiveStrength=e.emissiveStrengths?.[i]??1,s.emissiveSource=e.emissiveSources?.[i]??0}}_getSymbolInfo(e,t){const i=e?.getSymbol(t,{arcade:this._arcade});if(!(i instanceof me))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=Ye(i);return this._symbolInfos.set(s,r),r}_setSymbologyOverride(e,t){this._symbologyOverride!==e&&(this._symbologyOverride=e,this._symbologyOverrideFields=t,this._invalidateAllSymbols(),this._updateSymbologyFields())}_updateSymbologyFields(){this._symbologyFields=null!=this._symbologyOverrideFields&&this._symbologyOverrideFields.length>0?null!=this._rendererFields&&this._rendererFields.length>0?le(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasComponentData)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=e.attributeInfo?.attributeData,o=e.featureIds?this.i3slayer.objectIdField:null,n=null!=r&&null!=this._symbologyFields&&this._symbologyFields.length>0;let a=null,l=null;if(n&&null!=this._symbologyFields){a=[],l=[];for(const e of this._symbologyFields){const t=r[e];t&&(a.push(e),l.push(t))}}e.cachedSymbology||(e.cachedSymbology=oe(e.featureIds.length*e.cachedSymbologyStride));const d=new it,h=this.fullOpacity,c=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):h;let u=null,_=1,g=Je,m=0;for(let f=0;f<e.featureIds.length;f++){if(null!=o&&(i[o]=e.featureIds[f]),n&&a)for(let e=0;e<a.length;e++)i[a[e]]=Ee(l[e],f);const r=s?this._getSymbolInfo(s,t):null;let h,p;if(d.pickable=!0,s&&"visualVariables"in s){if(this._colorVariable){const e=he(this._colorVariable,t,{color:Vt,arcade:this._arcade});e&&(h=d.color,h[0]=e.r/255,h[1]=e.g/255,h[2]=e.b/255,h[3]=e.a??1,this._opacityVariable||null===e.a||(p=e.a))}this._opacityVariable&&(p=ce(this._opacityVariable,t,{arcade:this._arcade}))}if(r?.material){const e=r.material;h=null==h||null==p?Re(h,p,e.color,e.alpha,Mt,d.color):Re(h,p,null,null,Mt,d.color)}h??=N(d.color,1,1,1,1);const y=r?.material;if(d.colorMixMode=y?.colorMixMode??1,d.edgeMaterial=r?.edgeMaterial,this._symbologyOverride?.(t,d),null!=this._nodeColorOverride&&(this._nodeColorOverride(e.node,h),d.colorMixMode=3),d.pickable&&=h[3]>=Ct,d.castShadows=r?r.castShadows:d.pickable,null!=d.edgeMaterial){const t=h[3]>=1&&(e.material.isOpaque||3===d.colorMixMode)?1:0;d.edgeMaterial===u&&t===_||(g={...d.edgeMaterial,opacity:c,objectTransparency:t},u=d.edgeMaterial,_=t),e.cachedEdgeMaterials[f]=g}else e.cachedEdgeMaterials[f]=Je;e.cachedSymbology[m++]=Math.round(255*h[0]),e.cachedSymbology[m++]=Math.round(255*h[1]),e.cachedSymbology[m++]=Math.round(255*h[2]),e.cachedSymbology[m++]=Math.round(255*h[3]),e.cachedSymbology[m++]=d.colorMixMode|+d.castShadows<<4|+d.pickable<<5;const b=y?.emissive?.strength??yt;b===yt||e.emissiveStrengths||(e.emissiveStrengths=new Array(e.featureIds.length).fill(yt)),e.emissiveStrengths&&(e.emissiveStrengths[f]=b);const v=y?.emissive?.source||0;0===v||e.emissiveSources||(e.emissiveSources=new Array(e.featureIds.length).fill(0)),e.emissiveSources&&(e.emissiveSources[f]=v)}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);this.nodeCrossfadingEnabled||Ut(t,this.fullOpacity);const i=e.filteredIds;if(null==i){return{hasEdges:t.some(e=>e!==Je),perFeatureEdgeMaterials:t}}let s=0,r=!1;const o=t.map((t,o)=>e.featureIds[o]!==i[s]?Je:(r=r||t!==Je,s++,t));return{hasEdges:r,perFeatureEdgeMaterials:o}}_updateComponentData(e){if(!this._hasComponentData)return;const t=e.objectHandle,i=this._getComponentParameters(e);this._collection.setComponentData(t,i),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach(t=>{null!=t&&(this._collection.updateMaterial(t.objectHandle,t=>t.objectOpacity=e),Ut(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))})}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,e=>{e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.usePBR=this._usePBR,this._updateMaterialOverlay(e)})}_updateMaterialOverlay(e){}_updateEngineObject(e){this._updateComponentData(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,2)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),null!=this._labeler&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach(t=>{null!=t&&(this._collection.updateMaterial(t.objectHandle,t=>t.commonMaterialParameters.hasSlicePlane=e),this._updateEdgeRendering(t,!1))})}_updatePBR(e){this._nodeId2Meta.forEach(t=>{null!=t&&this._collection.updateMaterial(t.objectHandle,t=>t.usePBR=e)}),this._hasLoadedPBRTextures=!0}get _usePBR(){return this._shadeNormals&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){null!=this._edgeView&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_ignoreClientNodeOverriddenFeatures(e){return this.i3sOverrides.hasGeometryChanges?(t,i,s)=>s.node.index>=0&&this.i3sOverrides.featureHasGeometryChanges(t)?1:e(t,i,s):e}_forAllFeatures(e,t,i){for(const s of this._nodeId2Meta.values()){if(null==s)continue;if(null!=t){switch(t(s.node.serviceMbsInIndexSR)){case 0:return;case 2:continue}}let r=1;switch(i){case 1:r=this._forAllFeaturesOfNode(s,e);break;case 0:r=this._forAllVisibleFeaturesOfNode(s,e);break;case 2:r=this._forAllQueryableFeaturesOfNode(s,e)}if(0===r)return}}_forAllFeaturesOfNode(e,t){let i=1;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),0===i)return i;return i}_forAllVisibleFeaturesOfNode(e,t){let i=1;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,r=>(i=t(s[r],r,e),1===i)),i}_forAllQueryableFeaturesOfNode(e,t){const i=this._ignoreClientNodeOverriddenFeatures(t);if(null==this._renderClippingArea)return this._forAllFeaturesOfNode(e,i);const s=this._boundingRectNodeTest(e,this._renderClippingArea);if(0===s)return 1;if(3===s)return this._forAllFeaturesOfNode(e,i);const r=1,o=e.featureIds,n=e.objectHandle,a=Xe(this._renderClippingArea,this._collection.getObjectTransform(n));for(let l=0;l<o.length;l++){if(!this._boundingRectFeatureTest(e,l,a))continue;const t=i(o[l],l,e);if(0===t)return t}return r}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=t.attributeInfo?.attributeData;if(null!=s)for(const r of Object.keys(s))i[r]=Ee(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e,t){const s=rt(e);if(0===s.length)return ot;const r=vt(t),o=s[0]instanceof i?this._featureIdsFromGraphics(s):"number"==typeof s[0]?s:null;if(!o)return ot;const n=this._ensureHighlights(),{set:a,handle:l}=n.acquireSet(r);return n.setFeatureIds(a,o),l}_featureIdsFromGraphics(e){const t=this.i3slayer.fieldsIndex,i=this._getObjectIdField();return e.map(e=>st(t,e.attributes,i))}_ensureHighlights(){let e=this._highlights;return e||(e=new Oe({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,1),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._highlights=e),e}resetHighlights(){this._highlights=a(this._highlights)}_visibleGeometryChanged(e,t){this._elevationProvider&&(null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=m(()=>{const{node:t}=e,i=t.visibilityObbInRenderSR??t.geometryObbInRenderSR??t.serviceObbInRenderSR;if(null!=i){const e=$();i.toAaBoundingBox(e),this.emit("visible-geometry-changed",new pe(e))}else this.emit("visible-geometry-changed");this._visibleGeometryChangedSchedulerHandle=null})),this._updateSnappingSources(e,t),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e.objectHandle)))}get performanceInfo(){return new be(this.usedMemory,this._nodeId2Meta.size,Math.round(this._gpuMemoryEstimate/1048576),Math.round(this._geoMemoryEstimate/1048576),Math.round(this._texMemoryEstimate/1048576),Math.round(this.unloadedMemory/1048576),this._idbCacheEnabled?Math.round(100*this._idbCache.getHitRate()):0)}checkInvariants(){}get test(){}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return null!=e?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}getNodeComponentHandle(e){return this._nodeId2Meta.get(e)?.objectHandle}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(e)}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);null!=s&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);null!=i&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,e=>e.objectOpacity=t),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(null==this._edgeView||!e.cachedEdgeMaterials)return;Ut(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t).catch(e=>this._logEdgeViewError(e,this.i3slayer.title))}get hasModifications(){return this._isIntegratedMesh&&null!=this._layerClippingArea||this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this.hasModifications||t<=0||!0!==this._i3sWasmLoaded)return;const i=this.uid,s=Pt(e);if(s){const t={context:i,buffer:s.buffer};we(t);const r=new Float64Array(s.buffer);e.forAll((e,t)=>{const i=r[t],s=xe(i);e.imModificationImpact=s,0!==s&&this._controller.invalidateGeometryVisibility(e.index)})}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||null!=this._labeler&&this._labeler.updating||this._crossfadeHelper?.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0||null!=this._elevationTask&&this._elevationTask.readyToRun||this._needFilterResolve||this._compressionTracker.compressing}trackSnappingSources(e){const t={events:e,fetchEdgeLocations:async(e,t,i)=>{const s=this._nodeId2Meta.get(e);if(null==s)throw new Error("invalid-node");const{origin:r,buffer:o}=await this._collection.extractEdgeInformation(s.objectHandle,t,i);return this._snappingLocationsApplyElevation(s,o,r),{type:"components",objectIds:s.featureIds,locations:o,origin:r}},remove:()=>s(this._snappingSourcesTrackers,t)};return this._snappingSourcesTrackers.push(t),this._nodeId2Meta.forEach((t,i)=>{if(null==t)return;const s=this._controller.getRenderMbs(t.node);s&&e.add(i,s)}),t}_snappingLocationsApplyElevation(e,t,i){if(!e.elevationOffsets||0===this.elevationInfo.mode)return;const s=t.position0,r=t.position1,o=t.componentIndex,n=H(),a=H(),l=(e,t)=>{V(e,e,i),this.view.renderCoordsHelper.worldUpAtPosition(e,a),V(e,e,D(a,a,t)),T(e,e,i)};for(let d=0;d<s.count;d++){const t=e.elevationOffsets[o.get(d)];s.getVec(d,n),l(n,t),s.setVec(d,n),r.getVec(d,n),l(n,t),r.setVec(d,n)}}_updateSnappingSources(e,t){const{index:i}=e.node,s=this._controller.getRenderMbs(e.node);if(null!=s)for(const r of this._snappingSourcesTrackers)1!==t&&2!==t||r.events.remove(i),0!==t&&2!==t||r.events.add(i,s)}_logEdgeViewError(e,t){h(e)||o.getLogger(this).warn("Error while processing edges. Edges on this layer might not display correctly",t,e)}_indexedDbSizeCheck(e,t){return t.byteSize>Rt?(o.getLogger(this).warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}};return e([y()],A.prototype,"_hasLoadedPBRTextures",void 0),e([y()],A.prototype,"_asyncModuleLoading",void 0),e([y()],A.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([y()],A.prototype,"view",void 0),e([y()],A.prototype,"i3slayer",void 0),e([y()],A.prototype,"_controller",void 0),e([y()],A.prototype,"_labeler",void 0),e([y()],A.prototype,"updating",void 0),e([y()],A.prototype,"suspended",void 0),e([y()],A.prototype,"contentVisible",null),e([y({readOnly:!0})],A.prototype,"legendEnabled",null),e([y(ut)],A.prototype,"updatingProgress",void 0),e([y()],A.prototype,"updatingProgressValue",null),e([y()],A.prototype,"hasTexturesOrVertexColors",null),e([y()],A.prototype,"rendererTextureUsage",null),e([y()],A.prototype,"elevationOffset",null),e([y()],A.prototype,"elevationInfo",null),e([y({type:Boolean})],A.prototype,"slicePlaneEnabled",void 0),e([y()],A.prototype,"supportedTextureEncodings",null),e([y({type:[de]})],A.prototype,"_modifications",void 0),e([y({readOnly:!0})],A.prototype,"clientGeometry",null),e([y()],A.prototype,"elevationRange",null),e([y()],A.prototype,"fullExtent",null),e([y()],A.prototype,"_elevationTask",void 0),e([y({readOnly:!0})],A.prototype,"_usePBR",null),A=e([b("esri.views.3d.layers.I3SMeshView3D")],A),A},Ot=$(),jt=Q(),Et=Q(),Ft=new ht,Vt=new t([0,0,0,0]),Dt=ie(0,0,0,0);function Tt(e){if(null==e)return!1;const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function At(e){return"geometryData"in e}function Ht(e){return null!=e&&p(e.data)}function Nt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(null!=t)for(const s of t)null!=s&&p(s.data)&&(i+=s.data.byteLength);return i}function Pt(e){if(0===e.length)return;const t=10*e.length,i=new Float64Array(t);let s=0;return e.forAll(e=>{let t=e.serviceObbInIndexSR;null==t&&(t=Ft,t.center=se(e.serviceMbsInIndexSR,H()),t.halfSize=[e.serviceMbsInIndexSR[3],e.serviceMbsInIndexSR[3],e.serviceMbsInIndexSR[3]]);const r=t.data;i[s++]=r[0],i[s++]=r[1],i[s++]=r[2],i[s++]=r[3],i[s++]=r[4],i[s++]=r[5],i[s++]=r[6],i[s++]=r[7],i[s++]=r[8],i[s++]=r[9]}),i}class kt{constructor(e,t,i){this.attributeInfo=e,this.meta=t,this.promise=i,this.allowMemCache=!0}}function Ut(e,t){e.forEach(e=>e.opacity=t)}class Lt{constructor(e,t){this.mode=e,this.offset=t}}const Gt=H(),Bt=$(),qt="elevation-change",zt="",Wt="@null",$t="@ECEF",Kt=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],Qt=new lt;function Yt(e,t,i){let s=e.elevationRangeMin,r=e.elevationRangeMax;const o=i;if(o>0){t.getCorners(Kt);for(const e of Kt){const t=A(e)-o;s=Math.min(s,t),r=Math.max(r,t)}}else{t.getCorners(Kt);for(const e of Kt){const t=e[2];s=Math.min(s,t),r=Math.max(r,t)}}e.expandElevationRangeValues(s,r)}function Jt(e,t,i){const s=te(t),r=i>0?A(s)-i:s[2],o=re(t);e.expandElevationRangeValues(r-o,r+o)}function Xt(e,t){const i=e.featureIds.slice();for(const s of t)if(s(i,e),0===i.length)break;return i.length===e.featureIds.length?e.featureIds:i}function Zt(e,t,i){const s=new Array,r=e.filteredIds;if(null==r||t?.size||i?.size){if(null!=r){let o=0;e.featureIds.forEach((e,n)=>{if(r[o]===e)++o;else if(!t?.has(e))return;i?.has(e)||s.push(n)})}}else e.featureIds.forEach((e,t)=>{r[s.length]===e&&s.push(t)});return s}function ei(e,t,i){if(e&&t)for(const s of t){const t=(e.get(s)??0)+i;t>0?e.set(s,t):e.delete(s)}}function ti(e,t=0){const i=new Map;for(const s of e){ei(i,0===t?s?.featureIds:1===t?s?.filteredIds:s?.weaklyRemovedIds,1)}return i}export{St as I3SMeshView3D};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../Color.js";import i from"../../../Graphic.js";import{removeUnordered as s,isSome as r}from"../../../core/arrayUtils.js";import has from"../../../core/has.js";import o from"../../../core/Logger.js";import{equals as n}from"../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../core/maybe.js";import l from"../../../core/PooledArray.js";import{ignoreAbortErrors as d,isAbortError as h,throwIfAborted as c,createResolver as u}from"../../../core/promiseUtils.js";import{initial as _,watch as g}from"../../../core/reactiveUtils.js";import{schedule as m}from"../../../core/scheduling.js";import{equals as f}from"../../../core/SetUtils.js";import{isArrayBuffer as p}from"../../../core/typedArrayUtil.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import{subclass as b}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as v,invert as I}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as C}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{multiply as M,getTranslation as w}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{clone as x,create as R}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as S}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{i as O,t as j,o as E,a as F,f as V,g as D,d as T,H as A}from"../../../chunks/vec32.js";import{create as H}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as N}from"../../../chunks/vec42.js";import{fromValues as P}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as k}from"../../../core/support/UpdatingHandles.js";import{getSphericalPCPF as U}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{localLinearScaleFactors as L}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectBoundingSphere as G}from"../../../geometry/projection/projectBoundingSphere.js";import{projectBuffer as B}from"../../../geometry/projection/projectBuffer.js";import{getProjectorName as q}from"../../../geometry/projection/projectors.js";import{projectVectorToVector as z}from"../../../geometry/projection/projectVectorToVector.js";import{fromBuffer as W,create as $,toRect as K}from"../../../geometry/support/aaBoundingBox.js";import{create as Q,intersects as Y}from"../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as J,ensurePackedMat4f64 as X}from"../../../geometry/support/DoubleArray.js";import{compactFloatArray as Z}from"../../../geometry/support/FloatArray.js";import{compactIndices as ee}from"../../../geometry/support/Indices.js";import{a as te,f as ie,n as se,g as re}from"../../../chunks/sphere.js";import{newUByteArray as oe}from"../../../geometry/support/UByteArray.js";import{fallbackObjectIDAttribute as ne}from"../../../layers/LayerConstants.js";import ae from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as le}from"../../../layers/support/fieldUtils.js";import de from"../../../layers/support/SceneModification.js";import{getColor as he,getOpacity as ce}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{isBasemapLayerView as ue}from"../../../support/basemapUtils.js";import{getElevationOffset as _e}from"../../../support/elevationInfoUtils.js";import{loadArcade as ge}from"../../../support/loadArcade.js";import me from"../../../symbols/MeshSymbol3D.js";import fe from"../../../symbols/SimpleFillSymbol.js";import{ContentGeometryUpdateEvent as pe}from"./ContentGeometryLayerView.js";import ye from"./I3SMeshViewLabeler.js";import{I3SMeshViewPerformanceInfo as be}from"./I3SMeshViewPerformanceInfo.js";import{I3SMeshWorkerHandle as ve,toWasmModification as Ie}from"./I3SMeshWorkerHandle.js";import{initialize as Ce,setModificationsSync as Me,filterObbsForModificationsSync as we,interpretObbModificationResults as xe}from"./SceneLayerWorker.js";import{overrideColor as Re}from"./graphics/graphicUtils.js";import{areLabelsVisible as Se}from"./graphics/Labeler.js";import Oe from"./i3s/Highlights.js";import{I3SAsyncElevationUpdater as je}from"./i3s/I3SAsyncElevationUpdater.js";import{getCachedAttributeValue as Ee}from"./i3s/I3SBinaryReader.js";import{I3SCrossfadeHelper as Fe,NodeCrossfadeMetaData as Ve}from"./i3s/I3SCrossfadeHelper.js";import{boundingBoxCornerPoints as De}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as Te}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as Ae,selectEncoding as He,defaultMaterial as Ne,createTexture as Pe,configureMaterial as ke}from"./i3s/I3SMaterialUtil.js";import{I3SOverrides as Ue}from"./i3s/I3SOverrides.js";import{computeGlobalTransformation as Le}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as Ge,checkSceneLayerValid as Be,checkSceneLayerCompatibleWithView as qe,whenGraphicAttributes as ze,computeVisibilityObb as We,filterInPlace as $e,intersectBoundingRectWithMbs as Ke,addWraparound as Qe,getSymbolInfo as Ye,transparentEdgeMaterial as Je,getClipRect as Xe}from"./i3s/I3SUtil.js";import{IDBCache as Ze}from"./i3s/IDBCache.js";import{IDBMockCache as et}from"./i3s/IDBMockCache.js";import{LayerElevationProvider as tt}from"./i3s/LayerElevationProvider.js";import{SymbologyInfo as it}from"./i3s/SymbologyInfo.js";import{attributeLookup as st}from"./support/attributeUtils.js";import{normalizeHighlightTarget as rt,emptyHighlightHandle as ot}from"./support/highlightUtils.js";import{makeScheduleFunction as nt}from"./support/makeScheduleFunction.js";import{debugFlags as at}from"../support/debugFlags.js";import{ElevationRange as lt}from"../support/ElevationRange.js";import{toBoundingRect as dt}from"../support/extentUtils.js";import{Obb as ht,ensurePackedObbData as ct}from"../support/orientedBoundingBox.js";import{updatingProgress as ut}from"../support/updatingProperties.js";import{glLayout as _t}from"../support/buffer/glUtil.js";import{ObjectParameters as gt}from"../webgl-engine/collections/Component/ObjectParameters.js";import{createVertexBufferLayout as mt,GeometryParameters as ft}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as pt}from"../webgl-engine/collections/Component/Transform.js";import{emissiveStrengthDefault as yt}from"../webgl-engine/core/shaderLibrary/output/Emissions.glsl.js";import{loadBasisTranscoder as bt}from"../webgl-engine/lib/BasisUtil.js";import{getHighlightName as vt}from"../../support/highlightOptionsUtils.js";import{TextureCompressionTracker as It}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as Ct}from"../../../webscene/support/AlphaCutoff.js";const Mt=[1,1,1,1];class wt extends Ve{constructor(e,t,i,s,r,o,n,a,l){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=n,this.anchorIds=a,this.anchors=l,this.cachedElevationAnchors=null,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbologyStride=5}get usedMemory(){return this.node.memory}get featureExtents(){return this._featureExtents??=new Float64Array(6*this.featureIds.length).fill(Number.POSITIVE_INFINITY),this._featureExtents}}const xt=26,Rt=104857600,St=t=>{const p=t;let A=class extends p{constructor(){super(...arguments),this._applySSAO=!0,this._shadeNormals=!0,this._updatingHandles=new k,this._highlights=null,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._snappingSourcesTrackers=[],this._compressionTracker=new It,this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._currentRenderer=null,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._visibleGeometryChangedSchedulerHandle=null,this._hasComponentData=!1,this._hasVertexColors=!1,this._nodeColorOverride=null,this.updating=!0,this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.slicePlaneEnabled=!1,this._modifications=new Array,this.ignoresMemoryFactor=!1,this._layerUrl="",this._cacheKeySuffix=null,this._planetRadiusInGlobalMode=0,this._elevationTask=null,this._needFilterResolve=!1,this._filters=[],this._arcade=null,this._tmpAttributeOnlyGraphic=new i,this._crossfadeHelper=new Fe(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerViewUid(){return this.uid}get layerId(){return this.i3slayer&&this.i3slayer.id}get sublayerId(){return null}get _isIntegratedMesh(){return"integrated-mesh"===this.i3slayer.type}get contentVisible(){return!this.suspended&&this._controller?.rootNodeVisible&&this.fullOpacity>Ct}get legendEnabled(){return this.contentVisible&&!0===this.i3slayer?.legendEnabled}get updatingProgressValue(){return this._controller?.updatingProgress??0}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return Ge(this._currentRenderer)?this._usePBR||this._hasLoadedPBRTextures?63:37:this._usePBR||this._hasLoadedPBRTextures?44:36}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;return null!=e&&"absolute-height"===e.mode?_e(e,this.i3slayer.spatialReference):0}get elevationInfo(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null==e)return new Lt(0,0);const t=_e(e,this.i3slayer.spatialReference);switch(e.mode){case"absolute-height":return new Lt(0,t);case"relative-to-ground":return new Lt(1,t);case"on-the-ground":return new Lt(2,0);default:return new Lt(0,0)}}get supportedTextureEncodings(){return Ae(this.view.stage.renderView.capabilities)}get clientGeometry(){return this.i3sOverrides.geometryOverrides}get elevationRange(){const e=this._nodeId2Meta,t=new lt;for(const i of e.values()){if(null==i)continue;const{node:{serviceMbsInIndexSR:e}}=i,[s,r,o,n]=e;t.expandElevationRangeValues(o-n,o+n)}return t.elevationRangeValid?t:null}get fullExtent(){return this.i3slayer.fullExtent}initialize(){const e=has("enable-feature:idb-mock-cache");this._idbCache=e?new et(this.view,e):new Ze("esri-scenelayer-cache","geometries"),this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const t=this.view.resourceController,i=t.memoryController;this.i3sOverrides=new Ue({view:this.view,layer:this.i3slayer,memoryController:i}),this._workerHandle=new ve(nt(t)),this.addResolvingPromise(this._workerHandle.promise);const s=this.i3slayer.store;this.addResolvingPromise(this._workerHandle.setLegacySchema(this.uid,s.defaultGeometrySchema).catch(d)),Be(this.i3slayer),qe(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new ae({layerView:this,worker:this._workerHandle}),this._gpuMemoryEstimate=0,this._texMemoryEstimate=0,this._geoMemoryEstimate=0,this._stage=this.view.stage,this._collection=this._stage.renderView.componentObjectCollection;const r=s.defaultGeometrySchema;if(this._isIntegratedMesh||!r)this._hasComponentData=!1;else{const e=r.featureAttributes;this._hasComponentData=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=(r?.vertexAttributes.color??null)&&!this.i3slayer.cachedDrawingInfo?.color;const n=this.view.resourceController.memoryController.newCache(`sl-${this.uid}`,e=>this._deleteComponentObject(e));this._memCache=n;const l=this._controller,h=this._nodeId2Meta,c=this._nodeId2MetaReloading,u=e=>{const t=l.index;if(!t)return;const i=t.rootNode;if(!i)return;const s=t=>{const i=t.index,s=h.get(i)||c.get(i);return e(t,s?.objectHandle??null)};t.traverse(i,s)};this._intersectionHandler=new Te({layerViewUid:this.layerViewUid,sublayerId:this.sublayerId,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:u}),this._elevationProvider=new tt({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR,this._updatingHandles.add(()=>this.view.clippingArea,()=>this._clippingAreaChanged(),_),this._updatingHandles.add(()=>this.fullOpacity,e=>this._opacityChange(e)),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this.elevationOffset,(e,t)=>{this._reloadAll(t),this._controller.invalidateVisibilityObbs()}),this._updatingHandles.add(()=>this.elevationInfo,(e,t)=>this._elevationInfoChanged(e,t),_),this._updatingHandles.add(()=>!this.suspended&&0!==this.elevationInfo.mode,(e,t)=>{e?this.addHandles(this.view.basemapTerrain.on("elevation-change",({extent:e})=>this._ensureElevationTask().addExtent(e)),qt):t&&this.removeHandles(qt)},_),this._updatingHandles.add(()=>this._usePBR,e=>this._updatePBR(e));const m=()=>{this._reloadAll(),this.clearMemCache()};this._updatingHandles.add(()=>this.rendererTextureUsage,m),this._updatingHandles.add(()=>this.contentVisible,e=>this._contentVisibleChanged(e),_),this._updatingHandles.add(()=>this.i3slayer.labelsVisible,()=>this._labelingChanged(),_),this._updatingHandles.add(()=>this.i3slayer.labelingInfo,()=>this._labelingChanged(),_),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),_),this.addHandles([g(()=>at.I3S_TREE_SHOW_TILES,e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then(({I3STreeDebugger:t})=>{!this._treeDebugger&&at.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))})}else e||at.I3S_TREE_SHOW_TILES||(this._treeDebugger=a(this._treeDebugger))},_),g(()=>at.I3S_SHOW_MODIFICATIONS,()=>this._showModifications(),_)]),this._cacheKeySuffix=this._getCacheKeySuffix(),this._idbCache.init().catch(e=>o.getLogger(this).warn(`Failed to initialize IndexedDB cache: ${e}`));const{view:f}=this,{viewingMode:p,renderCoordsHelper:y}=f;this._planetRadiusInGlobalMode="local"===p?0:y.referenceEllipsoid.radius}destroy(){this._clearAddTasks(),this._elevationTask=a(this._elevationTask),this.i3sOverrides=a(this.i3sOverrides),this._elevationProvider&&(this._elevationProvider.notifyObjectsChanged(this.getVisibleObbs()),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._workerHandle;e&&(e.destroyContextAndSelf(this.uid),this._workerHandle=null),this._removeAllNodeDataFromStage(),this._memCache=a(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=a(this._labeler),this._treeDebugger=a(this._treeDebugger),this._controller=a(this._controller),this._highlights=a(this._highlights),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this._crossfadeHelper=a(this._crossfadeHelper),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null),this._updatingHandles=a(this._updatingHandles)}_memEstimateTextureAdded(e){const t=e.usedMemory;return this._gpuMemoryEstimate+=t,this._texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(null!=e){const t=e.usedMemory;this._gpuMemoryEstimate-=t,this._texMemoryEstimate-=t}}_memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this._gpuMemoryEstimate+=t,this._geoMemoryEstimate+=t,t}_memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this._gpuMemoryEstimate-=t,this._geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}get usedMemory(){let e=null!=this._labeler?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach(t=>e+=null!=t?t.node.memory:0),this._nodeId2MetaReloading.forEach(t=>e+=null!=t?t.node.memory:0),e}get unloadedMemory(){return(null!=this._controller?this._controller.unloadedMemoryEstimate:0)+(null!=this._labeler?this._labeler.unloadedMemoryEstimate:0)}_labelingChanged(){if(!(Se(this.i3slayer)&&this._supportsLabeling))return void(null!=this._labeler&&(this._labeler.destroy(),this._labeler=null));if(null!=this._labeler)return;const e=new ye({view:this.view,layer:this.i3slayer,collection:this._collection,overrides:this.i3sOverrides,layerViewUid:this.uid});this._nodeId2Meta.forEach(t=>null!=t&&this._addMetaToLabeler(e,t)),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then(e=>(--this._asyncModuleLoading,e),e=>{throw--this._asyncModuleLoading,e})}_modificationsChanged(){if(!this._i3sWasmLoaded&&this.hasModifications)return this._i3sWasmLoaded=Ce().then(()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()}),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=e=>o.getLogger(this).error("set-modifications-error","Error when setting modifications:",e),t=this.uid,i=this.i3slayer.spatialReference,s=i.isGeographic,r=Ie(this._layerClippingArea,this._modifications,i);this._workerHandle.setModifications(t,r,s).catch(e);try{Me({context:t,modifications:r,isGeodetic:s})}catch(a){e(a)}this._controller.modificationsChanged();const n=this.hasModifications?new l:null;this._nodeId2Meta.forEach((e,t)=>{null==e?(this._nodeId2Meta.delete(t),this._controller.updateLoadStatus(t,!1)):e.node.hasModifications?(this._updateFeatureIdCounts(e,-1),this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):null!=n&&n.push(e.node)}),this.notifyChange("elevationRange"),null!=n&&this._nodeId2MetaReloading.forEach(e=>n.push(e.node)),null!=n&&n.length>0&&(this.updateNodeModificationStatus(n),n.forAll(e=>{if(2!==e.imModificationImpact){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),null!=t?(this._updateFeatureIdCounts(t,-1),this._nodeId2Meta.delete(e.index),this._nodeId2MetaReloading.set(e.index,t),this.notifyChange("elevationRange")):this._nodeId2Meta.has(e.index)&&(this._nodeId2Meta.delete(e.index),this._controller.updateLoadStatus(e.index,!1))}})),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(null!=this._modificationGraphics&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!at.I3S_SHOW_MODIFICATIONS||0===this._modifications.length)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={outline:{color:[255,255,255],width:1}};this._modificationGraphics=[];for(const s of this._modifications){const r=s.geometry;r.spatialReference=this.i3slayer.spatialReference;const o=new fe({...t,color:e[s.type]});this._modificationGraphics.push(new i({geometry:r,symbol:o}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,(e,t)=>this._createAttributes(e,t))}_contentVisibleChanged(e){e?(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler)):(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(null!=t?.attributeInfo)return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(null!=t?.attributeInfo)return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);null!=i?.attributeInfo&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);null!=s&&(await this.i3sOverrides.applyAttributeOverrides(s.featureIds,t,i,this._controller.requiredAttributes),s.attributeInfo=t,this._controller.reschedule(()=>{this._nodeId2Meta.get(e)===s&&this._attributeValuesChanged(s)},i).catch(e=>{h(e)||o.getLogger(this).warn("Error while updating attribute values. Layer might not display correctly.",e)}))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.appliedFilters=null,null!=this._labeler&&this._labeler.setNodeMetaAttributes(e,(e,t)=>this._createAttributes(e,t)),this._updateEngineObject(e)}clearMemCache(){null!=this._memCache&&this._memCache.clear(),this._addTasks.forEach(e=>e.allowMemCache=!1)}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach(t=>null!=t&&e.push(t.node)),e}getVisibleObbs(){const e=new Array;return this._nodeId2Meta.forEach(t=>t&&e.push(this._collection.getComponentObb(t.objectHandle))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach((t,i)=>e.push(i)),this._nodeId2MetaReloading.forEach((t,i)=>e.push(i))}_preLoadBasis(){!has("disable-feature:i3s-basis")&&2&this.supportedTextureEncodings&&this.i3slayer.textureSetDefinitions?.some(e=>e.formats.some(e=>"basis"===e.format||"ktx2"===e.format))&&bt()}_getVertexBufferLayout(e,t){return _t(mt(this._getGeometryParameters({hasTexture:Tt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion})))}_getObjectIdField(){return this.i3slayer.objectIdField||ne}_getGlobalIdField(){return this.i3slayer.globalIdField}_findGraphicNodeAndIndex(e){const t=st(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());for(const i of this._nodeId2Meta.values()){const e=i?.featureIds.indexOf(t);if(null!=e&&e>=0)return{node:i.node,index:e}}return null}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(null==i)return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const n of t){const e=st(o,n.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this.getAABB(t.node.index,t.index);return null==i?Promise.reject():Promise.resolve({boundingBox:i,screenSpaceObjects:[]})}getAABBFromIntersectorTarget(e){return null==e.nodeIndex||null==e.componentIndex?null:this.getAABB(e.nodeIndex,e.componentIndex)}getAABB(e,t){const i=this._nodeId2Meta.get(e);if(null==i?.featureIds||t>=i.featureIds.length)return null;const s=i.objectHandle,r=De(t,this._collection,s,J(24),0),o=this.view.renderSpatialReference,n=this.view.spatialReference;return B(r,o,0,r,n,0)?W(r):null}whenGraphicAttributes(e,t){return ze(this.i3slayer,e,this._getObjectIdField(),t,()=>[...this._nodeId2Meta.values()].filter(r))}getGraphicFromIntersectorTarget(e,t){if(null==e.nodeIndex||null==e.componentIndex)return null;const i=this._nodeId2Meta.get(e.nodeIndex);if(null==i?.featureIds||e.componentIndex>=i.featureIds.length)return null;const s=this._createLayerGraphic(this._createAttributes(e.componentIndex,i));return s?t.defer?(t.defer(async()=>(s.geometry=(await import("./i3s/meshUtils.js")).createMesh({layerView:this,nodeIndex:e.nodeIndex,featureIndex:e.componentIndex}),s)),null):s:null}_getCacheKey(e){return`${this._layerUrl}/v${xt}/${e}${this._cacheKeySuffix}`}_getCacheKeySuffix(){const e=this.view.renderSpatialReference;if(null==e)return Wt;if(e===U(e))return $t;return this.i3slayer.spatialReference.equals(e)?zt:null!=e.wkid?`@${e.wkid}`:null}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return null!=this._memCache?this._memCache.pop(this._getMemCacheKey(e)):null}deleteCachedGPUData(e){null!=e&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(null==this._memCache)return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,i)}loadMissingTextures(e,t,i,s){const r=e?.filter((e,i)=>{if(0===(e.usage&this.rendererTextureUsage))return!1;if(null==t)return!0;const s=He(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(null==r?.data||s&&r.encoding!==s.encoding)})??[];return 0===r.length?Promise.resolve(!1):i(r,s).then(i=>{let s=0;for(let r=0;r<e.length;r++)s<i.length&&i[s].id===e[r].id&&(t[r]=i[s],s++);return!0})}loadCachedNodeData(e,t,i){return this._idbCacheEnabled?this._idbCache.get(this._getCacheKey(e.id),t).then(s=>null==s?null:(s.globalTrafo=X(s.globalTrafo),s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e.id)),null):(0===this.elevationInfo.mode&&(e.geometryObbInRenderSR=ht.fromData(s.geometryObbData)),this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then(i=>(i&&this._idbCache.initialized&&null!=s.textureData&&(s.byteSize=Nt(s.transformedGeometry,s.textureData),s.textureData.every(Ht)&&this._indexedDbSizeCheck(e,s)&&this._idbCache.put(this._getCacheKey(e.id),s).catch(t=>o.getLogger(this).warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`))),c(t),s))))):Promise.resolve(null)}addNode(e,t,i){return At(t)?null==t.geometryBuffer?(this._addNodeMeta(e.index,null),Promise.resolve()):this._addData(e,t.attributeDataInfo,()=>this._transformNode(e,t,i).then(s=>this._safeReschedule(()=>{if(null==s)return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:n,featureIds:a,anchorIds:l,anchors:d,transformedGeometry:h}=s,c=X(s.globalTrafo),u=O(Gt,r.center.x,r.center.y,r.center.z);j(u,u,c);const _=new ht(u,[r.extents.x,r.extents.y,r.extents.z],S(r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w));0===this.elevationInfo.mode&&(e.geometryObbInRenderSR=_),t.geometryData.componentOffsets=n,a&&(t.geometryData.featureIds=Array.from(a)),t.geometryData.anchorIds=l,t.geometryData.anchors=d;const g={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:h,globalTrafo:c,geometryObbData:_.data,byteSize:Nt(h,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&this._indexedDbSizeCheck(e,g)){const t=null!=g.textureData?g.textureData.map(e=>Ht(e)?e:null):null;this._idbCache.put(this._getCacheKey(e.id),{...g,textureData:t}).catch(t=>o.getLogger(this).warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`))}return this._addCachedNodeData(e,g,i)},i))):Promise.reject()}getElevationRange(e){const t=new lt,i=this._controller,{index:s}=i;if(!s)return t;const{rootNode:r}=s;if(!r)return t;const o=this._nodeId2Meta,n=e[3],a=i.viewportQueries,l=this._planetRadiusInGlobalMode,{view:d}=this,{renderCoordsHelper:h}=d,c=h.referenceEllipsoid.radius,u=this._collection,_=i=>{const{childrenLoaded:s}=i;if(0===s)return!1;const r=a.getAndUpdateVisibilityObbInRenderSR(i);let d=null,_=-1;if(r){if(_=r.radius,!r.intersectSphereWithMBS(e,_))return!1}else d=a.getServiceMbsInRenderSR(i),d&&(_=d[3]);if(_>=0&&n>=1*_)return null!=r?Yt(t,r,l):null!=d&&d[3]>=0&&Jt(t,d,l),!1;const g=Qt;if(g.elevationRangeMin=1/0,g.elevationRangeMax=-1/0,(null!=r||null!=d)&&(null!=r?Yt(g,r,l):null!=d&&Jt(g,d,l),g.elevationRangeMin>=t.elevationRangeMin&&g.elevationRangeMax<=t.elevationRangeMax))return!1;const m=o.get(i.index);if(m){const{geometryObbInRenderSR:s}=i;if(!s||s.intersectSphereWithMBS(e)){if(s){if(n>0*s.radius)return Yt(t,s,l),!1}const{objectHandle:e}=m,i=u.getObjectTransform(e),r=h.getAltitude(i.position);u.expandRangeWithComponentObjectElevationRange(e,r,c,t)}}return s-(m?1:0)>0};return s.traverse(r,_),t}computeVisibilityObb(e){return We(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications,this.view.renderCoordsHelper.sphericalPCPF)}_transformNode(e,t,i){const s=t.geometryData.geometries??[],r=new Array(s.length);for(let f=0;f<s.length;++f)r[f]=this._getVertexBufferLayout(s[f],t.geometryDescriptor);const o=this.i3slayer.normalReferenceFrame,n=t.normalReferenceFrame??o??"none",a=e.serviceMbsInIndexSR,l=this.elevationOffset,d=this._controller.crsIndex,h=this._controller.crsVertex,c=this.view.renderSpatialReference,u=Le(a,l,n,d,c),_=q(d,h),g=q(h,c);if(null==_||null==g)return Promise.resolve(null);const m={context:this.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,globalTrafo:u,mbs:a,obbData:e.serviceObbInIndexSR?.data,elevationOffset:l,needNormals:this._controller.isMeshPyramid,normalReferenceFrame:n,indexToVertexProjector:_,vertexToRenderProjector:g};return this._workerHandle.invoke(m,i)}get _supportsNodeCrossFading(){return!this.view?.stage?.renderer.shadowsEnabled}get nodeCrossfadingEnabled(){return this._supportsNodeCrossFading&&(this.lodCrossfadeinDuration>0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this._supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,i){if(0===this.elevationInfo.mode&&(e.geometryObbInRenderSR=this._collection.getComponentObb(t.objectHandle).clone()),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);null!=this._labeler&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,!0),this._updateMaterial(t),this._setNewNodeOpacity(t),0!==this.elevationInfo.mode&&this._ensureElevationTask().schedule(s),this._updateEngineObject(t),this._highlights?.objectCreated(t),null!=this._treeDebugger&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,()=>this._addCachedNodeData(e,t,s))}async deleteCachedNodeData(e){if(this._idbCacheEnabled)return this._idbCache.remove(this._getCacheKey(e))}async _addCachedNodeData(e,t,i){if(!this.contentVisible||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(null==t)return void this._addNodeMeta(e.index,null);const s=this._addTasks.get(e.index),{geometryData:r,transformedGeometry:n}=t;await this.i3sOverrides.applyAttributeOverrides(r.featureIds,s.attributeInfo,i,this._controller.requiredAttributes);const a=null!=t.textureData?t.textureData.filter(e=>null!=e&&0!==(e.usage&this.rendererTextureUsage)):[];!has("disable-feature:i3s-basis")&&a.some(e=>null!=e&&(2===e.encoding||1===e.encoding))&&await bt(),e.memory=0;const{componentOffsets:l,geometries:d,featureIds:h,anchorIds:c,anchors:u}=r,_=this._collection,g=d[0],{layout:m,indices:f,interleavedVertexData:p,positionData:y,hasColors:b}=n,{material:S,geometryParameters:O}=this._materialParameters(g,m),j=l||new Uint32Array([0,f?f.length:p.byteLength/m[0].stride]),V={vertices:{data:p,count:p.byteLength/m[0].stride,layoutParameters:O},positionData:{positions:Z(y.data),indices:ee(y.indices)},indices:f,componentOffsets:j},D=g.transformation?x(g.transformation):R(),T=X(t.globalTrafo);M(D,T,D);const A=w(H(),D),N=v(C(),D),k=this.view.renderSpatialReference,U=this.view.basemapTerrain.spatialReference,G=ht.fromData(ct(t.geometryObbData)).center,B=[1,1,1];L(G,k,B,U)||o.getLogger(this).errorOnce("Unsupported coordinate system for IM overlay");const q=H();z(G,k,q,U);const W=C();I(W,N);const $=H();E($,F($,G,A),W);const K=q[0]-$[0]*B[0],Q=q[1]-$[1]*B[1],Y=_.createObject(new gt(P(K,Q,B[0],B[1]),new pt(A,N),ht.fromData(ct(t.geometryObbData)),V)),J=2===O.textureCoordinateType,{textures:te,texturePromise:ie}=this._initMaterialAndTextures(Y,S,a,J,e);e.memory+=this._memEstimateGeometryAdded(Y),e.memory+=te.reduce((e,t)=>e+(null!=t?this._memEstimateTextureAdded(t):0),0);const se=!!S.hasParametersFromSource,re="blend"!==S.alphaMode&&S.metallicRoughness.baseColorFactor[3]>=1,oe=new wt(e,h,Y,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:se,isOpaque:re},te,c,u);s.meta=oe,this._hasTextures||=t.requiredTextures?.some(({usage:e})=>!!(19&e))||!!e.resources.texture,this._hasData=!0,this._hasColors||=b,this.notifyChange("hasTexturesOrVertexColors");const ne=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(oe),ie]).then(([t,s])=>(this._addTasks.has(e.index)&&t?.updateObjectVisibility(oe.objectHandle,!1).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),this._safeReschedule(()=>{const i=this._addTasks.get(e.index);if(!i)return;if(this._addNodeMeta(e.index,oe),i.meta=null,!this.contentVisible)return void this._removeNodeStageData(e.index,this.elevationOffset);_.setObjectVisibility(Y,!0),t?.updateObjectVisibility(oe.objectHandle,!0).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),oe.attributeInfo=i.attributeInfo;const s=oe.cachedRendererVersion!==this._rendererVersion,r=ne!==this.slicePlaneEnabled;this._updateElevationOffsets(oe);const o=oe.elevationOffsets;this._updateComponentData(oe);const n=this._applyFiltersToNode(oe);(s||null!=t&&(r||n||o))&&this._addOrUpdateEdgeRendering(oe),null!=this._labeler&&this._addMetaToLabeler(this._labeler,oe),this._visibleGeometryChanged(oe,0),this._highlights?.objectCreated(oe),this._updateMaterial(oe),this._setNewNodeOpacity(oe),null!=this._treeDebugger&&this._treeDebugger.update()},i))).catch(e=>{const{meta:t,allowMemCache:i}=s;throw s.meta=null,t&&i?this._cacheGPUData(t):t&&this._deleteComponentObject(t),e})}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){o.getLogger(this).error("Removing duplicated node");const t=this._nodeId2Meta.get(e);t&&(this._deleteComponentObject(t),this._updateFeatureIdCounts(t,-1))}else this._controller.updateLoadStatus(e,!0);t&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Ut(t.cachedEdgeMaterials,0),this._updateFeatureIdCounts(t,1)),this._nodeId2Meta.set(e,t),this.notifyChange("elevationRange")}_updateElevationOffsets(e){const t=this.view.renderSpatialReference,i=this._controller.crsIndex,s=this.elevationInfo,r=this.view.basemapTerrain,o=r.spatialReference,n=s.mode;if(null==t||null==o||0===n)return void(e.elevationOffsets=null);const a=this._collection.getObjectTransform(e.objectHandle);e.elevationOffsets=e.elevationOffsets??[];const l=Gt,d=Bt,h=2===n,c=this.view.renderCoordsHelper,u=e.featureIds.length,_=(()=>{if(e.cachedElevationAnchors)return e.cachedElevationAnchors;const s=J(3*u);e.cachedElevationAnchors=s;for(let r=0;r<u;r++){const n=3*r,h=e.anchorIds?.indexOf(r)??-1;e.anchors&&h>=0?(O(l,e.anchors[3*h],e.anchors[3*h+1],e.anchors[3*h+2]),V(l,l,te(e.node.serviceMbsInIndexSR)),z(l,i,l,o),s[n]=l[0],s[n+1]=l[1],s[n+2]=c.getAltitude(l)):(this._collection.getComponentAabb(e.objectHandle,r,d,!0),O(l,(d[0]+d[3])/2,(d[1]+d[4])/2,d[2]),E(l,l,a.rotationScale),V(l,l,a.position),s[n+2]=c.getAltitude(l),z(l,t,l,o),s[n]=l[0],s[n+1]=l[1])}return s})(),g=s.offset,m=e.elevationOffsets,f=(e,t)=>{const i=h?_[3*e+2]:0;m[e]=g+(t??0)-i};r.getElevations(_,u,f)}_ensureElevationTask(){return null!=this._elevationTask||(this._elevationTask=new je(this.view.resourceController.scheduler,e=>this._controller.updateElevationChanged(e,this.view.basemapTerrain.spatialReference)?.filterInPlace(e=>null!=this._nodeId2Meta.get(e)),e=>this._nodeElevationAlignmentChanged(this._nodeId2Meta.get(e)),()=>this.elevationInfo?.mode)),this._elevationTask}_elevationInfoChanged(e,t){const i=0!==e.mode,s=!!t&&t!==e&&0!==t.mode;this._intersectionHandler.updateElevationAlignState(i,this.view.state.viewingMode),i&&!s&&this._controller.removeAllGeometryObbs(),this._nodeId2Meta.forEach(e=>this._nodeElevationAlignmentChanged(e))}_nodeElevationAlignmentChanged(e){null!=e&&(this._updateElevationOffsets(e),this._updateComponentData(e),this._updateEdgeRendering(e),null!=this._labeler&&this._labeler.updateLabelPositions(e),this._updateSnappingSources(e,2),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e.objectHandle)))}_safeReschedule(e,t){return c(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=null!=e.params.material?e.params.material:Ne(),s=t.some(e=>"uvRegion"===e.name),r=t.some(e=>"normalCompressed"===e.name),o=Tt(i);return{geometryParameters:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s,r){const o=this._stage.renderView,n=e=>{this._gpuMemoryEstimate-=e,this._texMemoryEstimate-=e,r.memory-=e},a=i.map(e=>Pe(e,t,s,o,this._compressionTracker,n));this._stage.addTextures(a);let l=null;return this._collection.updateMaterial(e,e=>{l=ke(e,t,a,i,this.view.stage.renderView.textures,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR,isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)}),{textures:a,texturePromise:l}}_getGeometryParameters(e){return new ft(this._hasVertexColors,e.hasTexture?e.hasRegions?2:1:0,e.hasNormals,this._shadeNormals,this._applySSAO)}_addData(e,t,i){let s=this._addTasks.get(e.index);if(s)s.attributeInfo=t;else{const r=u();s=new kt(t,null,r.promise),this._addTasks.set(e.index,s),i().then(r.resolve,r.reject).then(()=>this._addTasks.delete(e.index)).catch(t=>{throw this._addTasks.delete(e.index),t})}return s.promise}_clearAddTasks(){this._addTasks.forEach(e=>{null!=e.meta&&(this._cacheGPUData(e.meta),e.meta=null)}),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=Q();this._renderClippingArea=dt(this.view.clippingArea,i,e)?i:null;const s=Q();this._layerClippingArea=dt(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}get hasGeometryFilter(){return!1}_geometryFilterChange(){const e=this.hasGeometryFilter;this._controller.geometryFilterChanged(e),this._applyFilters(e),this._assertFeatureIdNodeCounts(e)}_assertFeatureIdNodeCounts(e){e&&!this._featureIdCounts?(this._featureIdCounts=ti(this._nodeId2Meta.values()),this._filteredIdCounts=ti(this._nodeId2Meta.values(),1),this._weaklyRemovedIdCounts=ti(this._nodeId2Meta.values(),2),this.addHandles(g(()=>this._controller.updating,e=>{!e&&this._needFilterResolve&&(this.multiGeometryFilterResolve(),this._needFilterResolve=!1,this.notifyUpdate())},{sync:!0}),"updateFinished")):!e&&this._featureIdCounts&&(this._featureIdCounts=null,this._filteredIdCounts=null,this._weaklyRemovedIdCounts=null,this._mismatchShow=null,this._mismatchHide=null,this.removeHandles("updateFinished"),this._needFilterResolve=!1,this.notifyUpdate())}_updateFeatureIdCounts(e,t){this._featureIdCounts&&(this._needFilterResolve=!0,ei(this._featureIdCounts,e.featureIds,t),ei(this._filteredIdCounts,e.filteredIds,t),ei(this._weaklyRemovedIdCounts,e.weaklyRemovedIds,t))}_updateFilteredIdCounts(e,t,i){this._filteredIdCounts&&(this._needFilterResolve=!0,ei(this._filteredIdCounts,t,-1),ei(this._filteredIdCounts,e.filteredIds,1),ei(this._weaklyRemovedIdCounts,i,-1),ei(this._weaklyRemovedIdCounts,e.weaklyRemovedIds,1))}_checkFeatureIdNodeCountInvariant(){const e=null!=this._featureIdCounts;if(this.hasGeometryFilter!==e&&o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","LayerView should have feature id node counts if and only if it has a geometry filter",{layerView:this,hasNodeCounts:e}),!this._featureIdCounts||!this._filteredIdCounts)return;const t=ti(this._nodeId2Meta.values());n(this._featureIdCounts,t)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _featureIdCounts",{layerView:this,counts:this._featureIdCounts,expected:t});const i=ti(this._nodeId2Meta.values(),1);n(this._filteredIdCounts,i)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _filteredIdCounts",{layerView:this,counts:this._filteredIdCounts,expected:i});const s=ti(this._nodeId2Meta.values(),2);n(this._weaklyRemovedIdCounts,s)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _weaklyRemovedIdCounts",{layerView:this,counts:this._weaklyRemovedIdCounts,expected:i})}multiGeometryFilterResolve(){if(!this._featureIdCounts||!this._filteredIdCounts)return;let e=null,t=null;for(const[i,s]of this._filteredIdCounts){const r=this._featureIdCounts.get(i);if(r!==s){s+(this._weaklyRemovedIdCounts?.get(i)??0)===r?(e??=new Set,e.add(i)):(t??=new Set,t.add(i))}}f(e,this._mismatchShow)&&f(t,this._mismatchHide)||(this._mismatchShow=e,this._mismatchHide=t,this._nodeId2Meta.forEach(e=>{if(!e?.filteredIds)return;const t=Zt(e,this._mismatchShow,this._mismatchHide);this._collection.setAllComponentVisibilities(e.objectHandle,t),this._visibleGeometryChanged(e,2)}))}_filterChange(){this._applyFilters(this.hasGeometryFilter)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach(e=>{e&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,2))})}getFilters(){const e=[],t=this._renderClippingArea;return null!=t&&e.push((e,i)=>this._boundingRectFilter(e,i,t)),e}addSqlFilter(e,t,i){if(null!=t){const s=t.fieldNames;e.push((e,r)=>this._sqlFilter(e,r,t,s,i))}}_sqlFilter(e,t,i,s,r){const o={},n=this._createLayerGraphic(o);if(!n)return;const a=this.i3slayer.objectIdField,l=t.featureIds,d=t.attributeInfo?.attributeData;s.every(e=>e===a||null!=d?.[e])&&$e(e,l,e=>{o[a]=l[e];for(const i of s)i!==a&&(o[i]=d?Ee(d[i],e):null);try{return i.testFeature(n)}catch(t){return r(t),!1}})}_boundingRectNodeTest(e,t){return G(e.node.serviceMbsInIndexSR,this._controller.crsIndex,Dt,this.view.renderSpatialReference),Ke(t,Dt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,Ot),K(Ot,jt),Y(i,jt)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(3===r)return;if(0===r)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const n=this._transformClippingArea(Et,i,t.objectHandle);$e(e,t.featureIds,e=>this._boundingRectFeatureTest(t,e,n))}_transformClippingArea(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,o=s.rotationScale;return e[0]=(t[0]-r[0])/o[0],e[1]=(t[1]-r[1])/o[4],e[2]=(t[2]-r[0])/o[0],e[3]=(t[3]-r[1])/o[4],e}async _addOrUpdateEdgeRendering(e,t=!0){const i=e.objectHandle,{hasEdges:s,perFeatureEdgeMaterials:r}=this._getFilteredEdgeMaterials(e);s&&!this._edgeView&&(this._edgeView=await this._stage.renderer.loadEdgeView());const o=this._edgeView;if(!o)return null;const n=o.hasObject(i);if(s){if(n){if(this.nodeCrossfadingEnabled){Ut(r,this.getNodeOpacity(e))}return o.updateAllComponentMaterials(i,r,this.slicePlaneEnabled,t).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),o.updateObjectVisibility(i,!0).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),o.updateAllVerticalOffsets(i,e.elevationOffsets).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),o}const s=await this._collection.addEdges(i,o,r,this.slicePlaneEnabled,e.elevationOffsets);return e.edgeMemoryUsage=s,e.node.memory+=s,o}return n&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,o.removeObject(i)),null}_applyFiltersToNode(e){const{filteredIds:t,weaklyRemovedIds:i}=e,s=this._applyFiltersToNodeComponents(e);return this._updateFilteredIdCounts(e,t,i),s&&this._labeler?.applyFilterChange(e),s}_applyFiltersToNodeComponents(e){const t=this._collection,i=t.getComponentCount(e.objectHandle),s=null!=e.filteredIds,r=0===i.invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!r;if(null!=e.filteredIds&&e.appliedFilters===this._filters||(e.weaklyRemovedIds=null,e.filteredIds=Xt(e,this._filters),e.appliedFilters=this._filters),s&&e.filteredIds===e.featureIds&&(!this._mismatchHide||e.filteredIds.every(e=>!this._mismatchHide?.has(e))))return!r;const o=Zt(e,this._mismatchShow,this._mismatchHide);return t.setAllComponentVisibilities(e.objectHandle,o),!0}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach((t,i)=>this._removeNodeStageData(i,e)),this._nodeId2MetaReloading.forEach((t,i)=>this._removeNodeStageData(i,e,this._nodeId2MetaReloading)),this._elevationTask=a(this._elevationTask)}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading),null!=this._elevationTask&&this._elevationTask.remove(e)}_removeNodeStageData(e,t,i=this._nodeId2Meta){i.has(e)&&this._controller.updateLoadStatus(e,!1);const s=i.get(e);null!=s?(this._collection.setObjectVisibility(s.objectHandle,!1),null!=this._edgeView&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),this._visibleGeometryChanged(s,1),null!=this._labeler&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights?.objectDeleted(s),i===this._nodeId2Meta?(this._updateFeatureIdCounts(s,-1),this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),null!=this._treeDebugger&&this._treeDebugger.update()):i.delete(e)}_deleteComponentObject(e){if(null!=this._edgeView&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.removeTexture(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);null!=i&&this._collection.updateMaterial(i.objectHandle,e=>e.polygonOffsetEnabled=0===t)}updateNodeIndex(e,t){if(this._nodeId2Meta.has(e)){const i=this._nodeId2Meta.get(e);this._nodeId2Meta.delete(e),this._nodeId2Meta.set(t,i),this.notifyChange("elevationRange")}const i=this._nodeId2MetaReloading.get(e);i&&(this._nodeId2MetaReloading.delete(e),this._nodeId2MetaReloading.set(t,i))}_invalidateAllSymbols(){this._rendererVersion=Qe(this._rendererVersion,1),this._controller?.requestUpdate()}_getInvalidRendererVersion(){return Qe(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=Qe(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.i3slayer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await ge()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:o.getLogger(this).warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.symbols)"mesh-3d"!==t.type&&o.getLogger(this).error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getComponentParameters(e){this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(i,s)=>{const r=i*e.cachedSymbologyStride;N(s.externalColor,t[r]/255,t[r+1]/255,t[r+2]/255,t[r+3]/255);const o=this._stage.renderView.olidRenderHelper;if(o){const t=e.featureIds[i],r=this.sublayerId?`${this.layerViewUid}_${this.sublayerId}`:this.layerViewUid,n=ue(this.view,this.uid);o.setUidToObjectAndLayerId(t,t,this.layerId,r,this.layerPopupEnabledAndHasTemplate&&!n,e.node.resources.attributes,i,this.sublayerId),s.olidColor=o.getObjectAndLayerIdColor({graphicUid:t,layerViewUid:r})}s.externalColorMixMode=15&t[r+4],s.castShadows=!!(16&t[r+4]),s.pickable=!!(32&t[r+4]),s.elevationOffset=e.elevationOffsets?.[i]??0,s.emissiveStrength=e.emissiveStrengths?.[i]??1,s.emissiveSource=e.emissiveSources?.[i]??0}}_getSymbolInfo(e,t){const i=e?.getSymbol(t,{arcade:this._arcade});if(!(i instanceof me))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=Ye(i);return this._symbolInfos.set(s,r),r}_setSymbologyOverride(e,t){this._symbologyOverride!==e&&(this._symbologyOverride=e,this._symbologyOverrideFields=t,this._invalidateAllSymbols(),this._updateSymbologyFields())}_updateSymbologyFields(){this._symbologyFields=null!=this._symbologyOverrideFields&&this._symbologyOverrideFields.length>0?null!=this._rendererFields&&this._rendererFields.length>0?le(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasComponentData)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=e.attributeInfo?.attributeData,o=e.featureIds?this.i3slayer.objectIdField:null,n=null!=r&&null!=this._symbologyFields&&this._symbologyFields.length>0;let a=null,l=null;if(n&&null!=this._symbologyFields){a=[],l=[];for(const e of this._symbologyFields){const t=r[e];t&&(a.push(e),l.push(t))}}e.cachedSymbology||(e.cachedSymbology=oe(e.featureIds.length*e.cachedSymbologyStride));const d=new it,h=this.fullOpacity,c=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):h;let u=null,_=1,g=Je,m=0;for(let f=0;f<e.featureIds.length;f++){if(null!=o&&(i[o]=e.featureIds[f]),n&&a)for(let e=0;e<a.length;e++)i[a[e]]=Ee(l[e],f);const r=s?this._getSymbolInfo(s,t):null;let h,p;if(d.pickable=!0,s&&"visualVariables"in s){if(this._colorVariable){const e=he(this._colorVariable,t,{color:Vt,arcade:this._arcade});e&&(h=d.color,h[0]=e.r/255,h[1]=e.g/255,h[2]=e.b/255,h[3]=e.a??1,this._opacityVariable||null===e.a||(p=e.a))}this._opacityVariable&&(p=ce(this._opacityVariable,t,{arcade:this._arcade}))}if(r?.material){const e=r.material;h=null==h||null==p?Re(h,p,e.color,e.alpha,Mt,d.color):Re(h,p,null,null,Mt,d.color)}h??=N(d.color,1,1,1,1);const y=r?.material;if(d.colorMixMode=y?.colorMixMode??1,d.edgeMaterial=r?.edgeMaterial,this._symbologyOverride?.(t,d),null!=this._nodeColorOverride&&(this._nodeColorOverride(e.node,h),d.colorMixMode=3),d.pickable&&=h[3]>=Ct,d.castShadows=r?r.castShadows:d.pickable,null!=d.edgeMaterial){const t=h[3]>=1&&(e.material.isOpaque||3===d.colorMixMode)?1:0;d.edgeMaterial===u&&t===_||(g={...d.edgeMaterial,opacity:c,objectTransparency:t},u=d.edgeMaterial,_=t),e.cachedEdgeMaterials[f]=g}else e.cachedEdgeMaterials[f]=Je;e.cachedSymbology[m++]=Math.round(255*h[0]),e.cachedSymbology[m++]=Math.round(255*h[1]),e.cachedSymbology[m++]=Math.round(255*h[2]),e.cachedSymbology[m++]=Math.round(255*h[3]),e.cachedSymbology[m++]=d.colorMixMode|+d.castShadows<<4|+d.pickable<<5;const b=y?.emissive?.strength??yt;b===yt||e.emissiveStrengths||(e.emissiveStrengths=new Array(e.featureIds.length).fill(yt)),e.emissiveStrengths&&(e.emissiveStrengths[f]=b);const v=y?.emissive?.source||0;0===v||e.emissiveSources||(e.emissiveSources=new Array(e.featureIds.length).fill(0)),e.emissiveSources&&(e.emissiveSources[f]=v)}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);this.nodeCrossfadingEnabled||Ut(t,this.fullOpacity);const i=e.filteredIds;if(null==i){return{hasEdges:t.some(e=>e!==Je),perFeatureEdgeMaterials:t}}let s=0,r=!1;const o=t.map((t,o)=>e.featureIds[o]!==i[s]?Je:(r=r||t!==Je,s++,t));return{hasEdges:r,perFeatureEdgeMaterials:o}}_updateComponentData(e){if(!this._hasComponentData)return;const t=e.objectHandle,i=this._getComponentParameters(e);this._collection.setComponentData(t,i),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach(t=>{null!=t&&(this._collection.updateMaterial(t.objectHandle,t=>t.objectOpacity=e),Ut(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))})}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,e=>{e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.usePBR=this._usePBR,this._updateMaterialOverlay(e)})}_updateMaterialOverlay(e){}_updateEngineObject(e){this._updateComponentData(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,2)}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),null!=this._labeler&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach(t=>{null!=t&&(this._collection.updateMaterial(t.objectHandle,t=>t.commonMaterialParameters.hasSlicePlane=e),this._updateEdgeRendering(t,!1))})}_updatePBR(e){this._nodeId2Meta.forEach(t=>{null!=t&&this._collection.updateMaterial(t.objectHandle,t=>t.usePBR=e)}),this._hasLoadedPBRTextures=!0}get _usePBR(){return this._shadeNormals&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){null!=this._edgeView&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_ignoreClientNodeOverriddenFeatures(e){return this.i3sOverrides.hasGeometryChanges?(t,i,s)=>s.node.index>=0&&this.i3sOverrides.featureHasGeometryChanges(t)?1:e(t,i,s):e}_forAllFeatures(e,t,i){for(const s of this._nodeId2Meta.values()){if(null==s)continue;if(null!=t){switch(t(s.node.serviceMbsInIndexSR)){case 0:return;case 2:continue}}let r=1;switch(i){case 1:r=this._forAllFeaturesOfNode(s,e);break;case 0:r=this._forAllVisibleFeaturesOfNode(s,e);break;case 2:r=this._forAllQueryableFeaturesOfNode(s,e)}if(0===r)return}}_forAllFeaturesOfNode(e,t){let i=1;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),0===i)return i;return i}_forAllVisibleFeaturesOfNode(e,t){let i=1;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,r=>(i=t(s[r],r,e),1===i)),i}_forAllQueryableFeaturesOfNode(e,t){const i=this._ignoreClientNodeOverriddenFeatures(t);if(null==this._renderClippingArea)return this._forAllFeaturesOfNode(e,i);const s=this._boundingRectNodeTest(e,this._renderClippingArea);if(0===s)return 1;if(3===s)return this._forAllFeaturesOfNode(e,i);const r=1,o=e.featureIds,n=e.objectHandle,a=Xe(this._renderClippingArea,this._collection.getObjectTransform(n));for(let l=0;l<o.length;l++){if(!this._boundingRectFeatureTest(e,l,a))continue;const t=i(o[l],l,e);if(0===t)return t}return r}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=t.attributeInfo?.attributeData;if(null!=s)for(const r of Object.keys(s))i[r]=Ee(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e,t){const s=rt(e);if(0===s.length)return ot;const r=vt(t),o=s[0]instanceof i?this._featureIdsFromGraphics(s):"number"==typeof s[0]?s:null;if(!o)return ot;const n=this._ensureHighlights(),{set:a,handle:l}=n.acquireSet(r);return n.setFeatureIds(a,o),l}_featureIdsFromGraphics(e){const t=this.i3slayer.fieldsIndex,i=this._getObjectIdField();return e.map(e=>st(t,e.attributes,i))}_ensureHighlights(){let e=this._highlights;return e||(e=new Oe({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,1),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._highlights=e),e}resetHighlights(){this._highlights=a(this._highlights)}_visibleGeometryChanged(e,t){this._elevationProvider&&(null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=m(()=>{const{node:t}=e,i=t.visibilityObbInRenderSR??t.geometryObbInRenderSR??t.serviceObbInRenderSR;if(null!=i){const e=$();i.toAaBoundingBox(e),this.emit("visible-geometry-changed",new pe(e))}else this.emit("visible-geometry-changed");this._visibleGeometryChangedSchedulerHandle=null})),this._updateSnappingSources(e,t),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e.objectHandle)))}get performanceInfo(){return new be(this.usedMemory,this._nodeId2Meta.size,Math.round(this._gpuMemoryEstimate/1048576),Math.round(this._geoMemoryEstimate/1048576),Math.round(this._texMemoryEstimate/1048576),Math.round(this.unloadedMemory/1048576),this._idbCacheEnabled?Math.round(100*this._idbCache.getHitRate()):0)}checkInvariants(){}get test(){}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return null!=e?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}getNodeComponentHandle(e){return this._nodeId2Meta.get(e)?.objectHandle}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(e)}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);null!=s&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);null!=i&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,e=>e.objectOpacity=t),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(null==this._edgeView||!e.cachedEdgeMaterials)return;Ut(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t).catch(e=>this._logEdgeViewError(e,this.i3slayer.title))}get hasModifications(){return this._isIntegratedMesh&&null!=this._layerClippingArea||this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this.hasModifications||t<=0||!0!==this._i3sWasmLoaded)return;const i=this.uid,s=Pt(e);if(s){const t={context:i,buffer:s.buffer};we(t);const r=new Float64Array(s.buffer);e.forAll((e,t)=>{const i=r[t],s=xe(i);e.imModificationImpact=s,0!==s&&this._controller.invalidateGeometryVisibility(e.index)})}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||null!=this._labeler&&this._labeler.updating||this._crossfadeHelper?.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0||null!=this._elevationTask&&this._elevationTask.readyToRun||this._needFilterResolve||this._compressionTracker.compressing}trackSnappingSources(e){const t={events:e,fetchEdgeLocations:async(e,t,i)=>{const s=this._nodeId2Meta.get(e);if(null==s)throw new Error("invalid-node");const{origin:r,buffer:o}=await this._collection.extractEdgeInformation(s.objectHandle,t,i);return this._snappingLocationsApplyElevation(s,o,r),{type:"components",objectIds:s.featureIds,locations:o,origin:r}},remove:()=>s(this._snappingSourcesTrackers,t)};return this._snappingSourcesTrackers.push(t),this._nodeId2Meta.forEach((t,i)=>{if(null==t)return;const s=this._controller.getRenderMbs(t.node);s&&e.add(i,s)}),t}_snappingLocationsApplyElevation(e,t,i){if(!e.elevationOffsets||0===this.elevationInfo.mode)return;const s=t.position0,r=t.position1,o=t.componentIndex,n=H(),a=H(),l=(e,t)=>{V(e,e,i),this.view.renderCoordsHelper.worldUpAtPosition(e,a),V(e,e,D(a,a,t)),T(e,e,i)};for(let d=0;d<s.count;d++){const t=e.elevationOffsets[o.get(d)];s.getVec(d,n),l(n,t),s.setVec(d,n),r.getVec(d,n),l(n,t),r.setVec(d,n)}}_updateSnappingSources(e,t){const{index:i}=e.node,s=this._controller.getRenderMbs(e.node);if(null!=s)for(const r of this._snappingSourcesTrackers)1!==t&&2!==t||r.events.remove(i),0!==t&&2!==t||r.events.add(i,s)}_logEdgeViewError(e,t){h(e)||o.getLogger(this).warn("Error while processing edges. Edges on this layer might not display correctly",t,e)}_indexedDbSizeCheck(e,t){return t.byteSize>Rt?(o.getLogger(this).warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}get elevationProvider(){return this._elevationProvider}};return e([y()],A.prototype,"_hasLoadedPBRTextures",void 0),e([y()],A.prototype,"_asyncModuleLoading",void 0),e([y()],A.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([y()],A.prototype,"view",void 0),e([y()],A.prototype,"i3slayer",void 0),e([y()],A.prototype,"_controller",void 0),e([y()],A.prototype,"_labeler",void 0),e([y()],A.prototype,"updating",void 0),e([y()],A.prototype,"suspended",void 0),e([y()],A.prototype,"contentVisible",null),e([y({readOnly:!0})],A.prototype,"legendEnabled",null),e([y(ut)],A.prototype,"updatingProgress",void 0),e([y()],A.prototype,"updatingProgressValue",null),e([y()],A.prototype,"hasTexturesOrVertexColors",null),e([y()],A.prototype,"rendererTextureUsage",null),e([y()],A.prototype,"elevationOffset",null),e([y()],A.prototype,"elevationInfo",null),e([y({type:Boolean})],A.prototype,"slicePlaneEnabled",void 0),e([y()],A.prototype,"supportedTextureEncodings",null),e([y({type:[de]})],A.prototype,"_modifications",void 0),e([y({readOnly:!0})],A.prototype,"clientGeometry",null),e([y()],A.prototype,"elevationRange",null),e([y()],A.prototype,"fullExtent",null),e([y()],A.prototype,"_elevationTask",void 0),e([y({readOnly:!0})],A.prototype,"_usePBR",null),A=e([b("esri.views.3d.layers.I3SMeshView3D")],A),A},Ot=$(),jt=Q(),Et=Q(),Ft=new ht,Vt=new t([0,0,0,0]),Dt=ie(0,0,0,0);function Tt(e){if(null==e)return!1;const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function At(e){return"geometryData"in e}function Ht(e){return null!=e&&p(e.data)}function Nt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(null!=t)for(const s of t)null!=s&&p(s.data)&&(i+=s.data.byteLength);return i}function Pt(e){if(0===e.length)return;const t=10*e.length,i=new Float64Array(t);let s=0;return e.forAll(e=>{let t=e.serviceObbInIndexSR;null==t&&(t=Ft,t.center=se(e.serviceMbsInIndexSR,H()),t.halfSize=[e.serviceMbsInIndexSR[3],e.serviceMbsInIndexSR[3],e.serviceMbsInIndexSR[3]]);const r=t.data;i[s++]=r[0],i[s++]=r[1],i[s++]=r[2],i[s++]=r[3],i[s++]=r[4],i[s++]=r[5],i[s++]=r[6],i[s++]=r[7],i[s++]=r[8],i[s++]=r[9]}),i}class kt{constructor(e,t,i){this.attributeInfo=e,this.meta=t,this.promise=i,this.allowMemCache=!0}}function Ut(e,t){e.forEach(e=>e.opacity=t)}class Lt{constructor(e,t){this.mode=e,this.offset=t}}const Gt=H(),Bt=$(),qt="elevation-change",zt="",Wt="@null",$t="@ECEF",Kt=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],Qt=new lt;function Yt(e,t,i){let s=e.elevationRangeMin,r=e.elevationRangeMax;const o=i;if(o>0){t.getCorners(Kt);for(const e of Kt){const t=A(e)-o;s=Math.min(s,t),r=Math.max(r,t)}}else{t.getCorners(Kt);for(const e of Kt){const t=e[2];s=Math.min(s,t),r=Math.max(r,t)}}e.expandElevationRangeValues(s,r)}function Jt(e,t,i){const s=te(t),r=i>0?A(s)-i:s[2],o=re(t);e.expandElevationRangeValues(r-o,r+o)}function Xt(e,t){const i=e.featureIds.slice();for(const s of t)if(s(i,e),0===i.length)break;return i.length===e.featureIds.length?e.featureIds:i}function Zt(e,t,i){const s=new Array,r=e.filteredIds;if(null==r||t?.size||i?.size){if(null!=r){let o=0;e.featureIds.forEach((e,n)=>{if(r[o]===e)++o;else if(!t?.has(e))return;i?.has(e)||s.push(n)})}}else e.featureIds.forEach((e,t)=>{r[s.length]===e&&s.push(t)});return s}function ei(e,t,i){if(e&&t)for(const s of t){const t=(e.get(s)??0)+i;t>0?e.set(s,t):e.delete(s)}}function ti(e,t=0){const i=new Map;for(const s of e){ei(i,0===t?s?.featureIds:1===t?s?.filteredIds:s?.weaklyRemovedIds,1)}return i}export{St as I3SMeshView3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{initial as s,watch as r,when as o}from"../../../core/reactiveUtils.js";import{schedule as a}from"../../../core/scheduling.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as c,invert as d}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as m,IDENTITY as h}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as p}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{f,o as g}from"../../../chunks/vec32.js";import{fromArray as y,clone as b,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as w}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{SphericalECEFSpatialReferenceLike as v}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as j}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as x}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as C}from"../../../geometry/projection/projectVectorToVector.js";import{create as M}from"../../../geometry/support/aaBoundingRect.js";import{BufferViewVec2f as T,BufferViewVec4f as O,BufferViewVec4u8 as U,BufferViewVec4u16 as P,BufferViewVec3f as H,BufferViewVec3u8 as E,BufferViewVec3u16 as F,BufferViewInt16 as S,BufferViewUint32 as R,BufferViewUint16 as A}from"../../../geometry/support/buffer/BufferView.js";import k from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as V}from"../../../support/elevationInfoUtils.js";import{toWasmModification as I}from"./I3SMeshWorkerHandle.js";import{LayerView3D as D}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as L}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as B,removeLayerViewFromWasm as G,getLyr3DWasm as z}from"./Lyr3DWasm.js";import{LayerElevationProvider as N}from"./i3s/LayerElevationProvider.js";import{primTypeConversion as W,alphaModeConversion as $,faceCullingConversion as J,wrapModeConversion as q,lyr3DTypeToByteSize as K}from"./support/lyr3dTypeConversions.js";import{Tiles3DIntersectionHandler as Q}from"./support/Tiles3DIntersectionHandler.js";import{ElevationRange as X}from"../support/ElevationRange.js";import{toBoundingRect as Y}from"../support/extentUtils.js";import{Obb as Z,compute as ee}from"../support/orientedBoundingBox.js";import{ObjectParameters as te}from"../webgl-engine/collections/Component/ObjectParameters.js";import{GeometryParameters as ie,createVertexBufferLayout as se}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as re}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as oe}from"../webgl-engine/core/material/RenderTexture.js";import{getEllipsoidMode as ae}from"../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{Attribute as ne}from"../webgl-engine/lib/Attribute.js";import{compressAndTransformNormals as le}from"../webgl-engine/lib/Normals.js";import{Texture as ce}from"../webgl-engine/lib/Texture.js";import{writeAttribute as de,writeBufferVec2 as me}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import he from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as ue,isInEffectiveScaleRange as pe}from"../../support/layerViewUtils.js";import{TextureCompressionTracker as fe}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as ge}from"../../../webscene/support/AlphaCutoff.js";class ye{constructor(e,t,i,s,r,o){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.isVisible=!1,this.usedMemory=this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}}function be(e){return Math.round(e/1048.576)/1e3}let _e=class extends(D(he)){get hasModifications(){return this._modifications&&this._modifications.length>0}constructor(e){super(e),this.type="integrated-mesh-3dtiles",this._compressionTracker=new fe,this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._initialCullFace=new Map,this._suspendedHandle=null,this._dbgFlags=new Set,this._memCache=e.view.resourceController.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e))}initialize(){this._dbgFlags.add(3),this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),s),!this._canProjectWithoutEngine())throw ue("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=B(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new Q(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),s),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),s),this._elevationProvider=new N({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),e.elevationProvider.register(1,this._elevationProvider),e.basemapTerrain.overlayManager.registerDrapeTarget(this),this.addHandles([r(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e))]),this._suspendedHandle=r(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),s)});this.addResolvingPromise(t),this._replacesTerrain&&this.addHandles(o(()=>this.view.map.ground.opacity,()=>{this._opacityChange()}))}get _replacesTerrain(){return this.layer.replacesTerrain&&!!this.view.map.basemap?.groundLayers.includes(this.layer)}get opacity(){return this.fullOpacity*(this._replacesTerrain?this.view.map.ground.opacity:1)}_opacityChange(){const{opacity:e}=this;this.forEachComponentObject(t=>{this._collection.getMaterial(t).objectOpacity=e})}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),G(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.basemapTerrain.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._initialCullFace.clear(),this._visibleObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_modificationsChanged(){const e=this.layer.spatialReference,t=I(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t,e.wkid)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=M();this._layerClippingArea=Y(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=a(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),this.forEachComponentObject(t=>{const i=this._collection.getMaterial(t);i.commonMaterialParameters.hasSlicePlane=e,i.commonMaterialParameters.cullFace=e?0:this._initialCullFace.get(t)})}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,V(e))}get _wasm(){return z(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return pe(this.layer.effectiveScaleRange,this.view.scale)}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(a=>{a.isVisible?(e+=a.textureMemoryUsage,t+=a.vboMemoryUsage,r++):(i+=a.textureMemoryUsage,s+=a.vboMemoryUsage,o++)}),new L(this.usedMemory,r,o,be(t),be(e),be(s),be(i))}_canProjectWithoutEngine(){if(2===this.view.state.viewingMode){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationOffset(){return V(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new X(e.zmin,e.zmax):null}getElevationRange(e){return null}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const i of e)for(const e of i.componentObjects)t(e)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const i=y(t.desc.origin),s=new Array,r=this.view.basemapTerrain.spatialReference;let o,a;if("global"===this.view.viewingMode){const e=u();j(v,i,e,r),o=c(m(),e),a=d(m(),o)}else o=h,a=h;const n=b(i);let l=null;const M=_();if(t.desc.obb){const e=t.desc.obb.quaternion;l=new Z(t.desc.obb.center,t.desc.obb.halfSize,p(e[0],e[1],e[2],e[3]))}let O=0,U=0;const P={textureMemoryUsage:0},H=new Array,E=new Map;for(let c=0;c<t.desc.prims.length;c++){const e=t.desc.prims[c];this._dbg(2,JSON.stringify(e));if(null==W[e.ptype]||null==t.data){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive.");continue}const d=t.desc?.materials&&null!=e.materialId?t.desc.materials[e.materialId]:null,m=null!=d?d.lightingModel:"Unlit",{positionView:u,positionAttr:p,normalsView:y,normalsAttr:b,colorAttr:v,texCoord0Attr:j,indicesView:F}=this.getBufferViews(e,t.data.buffer,o);if(null==p||null==u||null==F)continue;const S=new ie(null!=v,j?1:0,null!=y,this._shadeNormals||this._replacesTerrain,this._applySSAO),R=p.data.length/p.size,A=(e,t)=>!e||e.data.length/e.size===R||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!A(j,"numTexcoord")||!A(v,"numColors")||!A(b,"normals"))continue;const k=se(S);if(null!=l?l=l.clone():(l=ee(p),f(M,l.center,i),l.center=M),o!==h)for(let t=0;t<u.count;t++)u.getVec(t,M),g(M,M,o),u.setVec(t,M);const V=k.createBuffer(p.data.length);if(de("position",p,null,null,V,0),null!=j){const e=V.getField("uv0",T);me(j,e,0)}null!=v&&de("color",v,null,null,V,0),null!=b&&de("normalCompressed",b,null,null,V,0);const I=new Uint32Array([0,F.typedBuffer.length]),D={vertices:{data:V.buffer,count:V.byteLength/k.stride,layoutParameters:S},positionData:{positions:u.typedBuffer,indices:F.typedBuffer},indices:F.typedBuffer,componentOffsets:I};O+=u.count+F.count;const L=this.view.renderSpatialReference,B=_(),G=[1,1,1];x(n,L,G,r)||this._dbg(3,"Unsupported coordinate system for IM overlay"),C(n,L,B,r);const z=this._collection.createObject(new te(w(B[0],B[1],G[0],G[1]),new re(n,a),l,D));d&&this._collection.updateMaterial(z,e=>{e.baseColor=d.baseColorFactor,e.usePBR="Pbr"===m,e.hasParametersFromSource=!1,e.baseColorTexture=this._getTexture(d.baseColorTex,t,E,P),e.usePBR&&(e.mrrFactors=[d.metallicFactor,d.roughnessFactor,0],e.emissiveBaseColor=d.emissiveFactor??[0,0,0],e.metallicRoughnessTexture=this._getTexture(d.metalTex,t,E,P),e.emissionTexture=this._getTexture(d.emissiveTex,t,E,P),e.occlusionTexture=this._getTexture(d.occlusionTex,t,E,P),e.normalTexture=this._getTexture(d.normalTex,t,E,P)),e.objectOpacity=0,e.alphaDiscardMode=2;const i=[];e.baseColorTexture&&i.push(e.baseColorTexture.loadPromise),e.usePBR&&(e.metallicRoughnessTexture&&i.push(e.metallicRoughnessTexture.loadPromise),e.emissionTexture&&i.push(e.emissionTexture.loadPromise),e.occlusionTexture&&i.push(e.occlusionTexture.loadPromise),e.normalTexture&&i.push(e.normalTexture.loadPromise));const r=Promise.all(i);s.push(r),r.then(()=>{e.alphaDiscardMode=$[d.alphaMode],e.objectOpacity=this.opacity,P.textureMemoryUsage+=e.baseColorTexture?.glTexture?.usedMemory??0,e.usePBR&&(P.textureMemoryUsage+=(e.metallicRoughnessTexture?.glTexture?.usedMemory??0)+(e.emissionTexture?.glTexture?.usedMemory??0)+(e.occlusionTexture?.glTexture?.usedMemory??0)+(e.normalTexture?.glTexture?.usedMemory??0))}),e.commonMaterialParameters.doubleSided=d.isDoubleSided,e.commonMaterialParameters.cullFace=d.faceCulling?J[d.faceCulling]:2,this._initialCullFace.set(z,e.commonMaterialParameters.cullFace),e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.componentParameters.castShadows=0,e.textureAlphaCutoff=d.alphaCutoff??ge,e.alphaDiscardMode=$[d.alphaMode],e.isIntegratedMesh=!0,e.sphereDepthInterpolate=this.layer.replacesTerrain,e.polygonOffsetEnabled=!1,e.hasOccludees=!1,e.ellipsoidMode=ae(this.view.spatialReference)}),H.push(z),U+=this._collection.getObjectGPUMemoryUsage(z)}await Promise.all(s);const F=new Array;E.forEach(e=>{F.push(e)});const S=new ye(e.handle,H,F,O,U,P.textureMemoryUsage);return this._memCache.put(`${S.handle}`,S),this._lyrHandleToObjects.set(e.handle,S),this._cacheMemory+=S.usedMemory,{memUsageBytes:S.usedMemory}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t&&(t.isVisible?(this._visibleObjects.delete(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e))}freeObject(e){this._memCache.pop(`${e.handle}`),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>{this._collection.destroyObject(e),this._initialCullFace.delete(e)})}setRenderableVisibility(e,t,i){for(let s=0;s<i;++s){const i=t[s];if(!i)continue;const r=e[s],o=this._lyrHandleToObjects.get(r);if(o){if(o.isVisible)continue;this._visibleGeometryChanged(),o.isVisible=!0,this._visibleObjects.add(o),this._usedMemory+=o.usedMemory,this._cacheMemory-=o.usedMemory,o.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,i),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e))}),this._memCache.pop(`${r}`)}}for(let s=0;s<i;++s){const i=e[s],r=t[s];if(r)continue;const o=this._lyrHandleToObjects.get(i);if(o){if(!o.isVisible)continue;this._visibleGeometryChanged(),o.isVisible=!1,this._visibleObjects.delete(o),this._usedMemory-=o.usedMemory,this._cacheMemory+=o.usedMemory,o.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,r),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e))}),this._memCache.put(`${i}`,o)}}}_getTexture(e,t,i,s){let r=null;if(e&&t.desc?.images&&t.data?.buffer){const o=t.desc.images[e?.imageId];if(r=i.get(o),!r&&o){const a=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,n=!!o.mipCount||a>1,l=q[e.wrapMode??"None"];let c=o.alpha?6408:6407;const d=new Uint8Array(t.data.buffer,o.data.byteOffset,o.data.byteCount);let m=null,h=null,u=null;switch(o.format){case"Raw":"R8"===o.pixelFormat?(m=d,c=6403,h=""):"Rgb8"===o.pixelFormat?(m=d,c=6407,h=""):"Rgba8"===o.pixelFormat&&(m=d,c=6408,h="");break;case"Dxt1":m=d,c=6407,h="image/vnd-ms.dds";break;case"Dxt5":m=d,c=6408,h="image/vnd-ms.dds";break;case"Basis":m=d,c=6407,h="image/ktx2";break;case"Png":h="image/png",u=document.createElement("img");break;case"Jpeg":h="image/jpeg",u=document.createElement("img");break;case"Etc2":h="image/ktx",u=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(u&&h){const e=new Blob([d],{type:h});u.src=URL.createObjectURL(e),m=u}if(m&&null!=h){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker,compressionCallback:e=>{e&&e>0&&(s.textureMemoryUsage-=e)}}:void 0;r=new ce(m,{mipmap:n,maxAnisotropy:a,encoding:h,wrap:l,pixelFormat:c,compressionOptions:e,noUnpackFlip:!0,width:o.mip0Width,height:o.mip0Height}),this._stage.addTexture(r),i.set(o,r)}}}return r?new oe(this.view.stage.renderView.textures,r.id):null}getBufferViews(e,t,i){let s,r,o,a,n,l,c,d=null;for(let h=0;h<e.atrbs.length;h++){const c=e.atrbs[h],u=c.view,p=void 0,f=u.byteOffset+u.byteCount,g=u.byteCount/K[u.type],y=[...Array(g).keys()].map(e=>e);try{switch(c.sem){case"Position":3!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(s=new H(t,u.byteOffset,p,f),r=new ne(s.typedBuffer,y,3));break;case"Normal":if(3!==u.ncomp||"F32"!==u.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+u+")");else{const e=new H(t,u.byteOffset,p,f),s=le(e.typedBuffer,i);n=new S(s.buffer),l=new ne(n.typedBuffer,y,2)}break;case"TexCoord":2!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+u+")"):void 0===a&&(a=new ne(new T(t,u.byteOffset,p,f).typedBuffer,y,2));break;case"Color":4===u.ncomp?("F32"===u.type&&(d=new O(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new U(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new P(t,u.byteOffset,p,f))):3===u.ncomp&&("F32"===u.type&&(d=new H(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new E(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new F(t,u.byteOffset,p,f))),null==d?this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new ne(d.typedBuffer,y,u.ncomp);break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+c.sem+"). Skipping vertex attribute.")}}catch(m){this._dbg(2,"Error Creating buffer ("+m+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,s=void 0,r=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":c=new A(t,i.byteOffset,s,r);break;case"U32":c=new R(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==c&&null!=s){const e=s.count;if(e<65535){const t=new Uint16Array(e);c=new A(t.buffer)}else{const t=new Uint32Array(e);c=new R(t.buffer)}for(let t=0;t<e;t++)c.set(t,t)}return{positionView:s,positionAttr:r,colorAttr:o,texCoord0Attr:a,indicesView:c,normalsView:n,normalsAttr:l}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>this._modifications=e.toArray(),s),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([n({type:[k]})],_e.prototype,"_modifications",void 0),e([n()],_e.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([n()],_e.prototype,"layer",void 0),e([n({readOnly:!0})],_e.prototype,"visibleAtCurrentScale",null),e([n()],_e.prototype,"elevationOffset",null),_e=e([l("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],_e);const we=_e;export{we as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{initial as s,watch as r,when as o}from"../../../core/reactiveUtils.js";import{schedule as a}from"../../../core/scheduling.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as c,invert as d}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as m,IDENTITY as h}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as p}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{f,o as g}from"../../../chunks/vec32.js";import{fromArray as y,clone as b,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as w}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{SphericalECEFSpatialReferenceLike as v}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as j}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as x}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as C}from"../../../geometry/projection/projectVectorToVector.js";import{create as M}from"../../../geometry/support/aaBoundingRect.js";import{BufferViewVec2f as O,BufferViewVec4f as T,BufferViewVec4u8 as P,BufferViewVec4u16 as U,BufferViewVec3f as H,BufferViewVec3u8 as E,BufferViewVec3u16 as F,BufferViewInt16 as S,BufferViewUint32 as R,BufferViewUint16 as A}from"../../../geometry/support/buffer/BufferView.js";import k from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as V}from"../../../support/elevationInfoUtils.js";import{toWasmModification as I}from"./I3SMeshWorkerHandle.js";import{LayerView3D as D}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as L}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as B,removeLayerViewFromWasm as G,getLyr3DWasm as z}from"./Lyr3DWasm.js";import{LayerElevationProvider as N}from"./i3s/LayerElevationProvider.js";import{primTypeConversion as W,alphaModeConversion as $,faceCullingConversion as J,wrapModeConversion as q,lyr3DTypeToByteSize as K}from"./support/lyr3dTypeConversions.js";import{Tiles3DIntersectionHandler as Q}from"./support/Tiles3DIntersectionHandler.js";import{ElevationRange as X}from"../support/ElevationRange.js";import{toBoundingRect as Y}from"../support/extentUtils.js";import{Obb as Z,compute as ee}from"../support/orientedBoundingBox.js";import{ObjectParameters as te}from"../webgl-engine/collections/Component/ObjectParameters.js";import{GeometryParameters as ie,createVertexBufferLayout as se}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as re}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as oe}from"../webgl-engine/core/material/RenderTexture.js";import{getEllipsoidMode as ae}from"../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{Attribute as ne}from"../webgl-engine/lib/Attribute.js";import{compressAndTransformNormals as le}from"../webgl-engine/lib/Normals.js";import{Texture as ce}from"../webgl-engine/lib/Texture.js";import{writeAttribute as de,writeBufferVec2 as me}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import he from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as ue,isInEffectiveScaleRange as pe}from"../../support/layerViewUtils.js";import{TextureCompressionTracker as fe}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as ge}from"../../../webscene/support/AlphaCutoff.js";class ye{constructor(e,t,i,s,r,o){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.isVisible=!1,this.usedMemory=this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}}function be(e){return Math.round(e/1048.576)/1e3}let _e=class extends(D(he)){get hasModifications(){return this._modifications&&this._modifications.length>0}constructor(e){super(e),this.type="integrated-mesh-3dtiles",this._compressionTracker=new fe,this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._initialCullFace=new Map,this._suspendedHandle=null,this._dbgFlags=new Set,this._memCache=e.view.resourceController.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e))}initialize(){this._dbgFlags.add(3),this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),s),!this._canProjectWithoutEngine())throw ue("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=B(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new Q(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),s),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),s),this._elevationProvider=new N({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),e.elevationProvider.register(1,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([r(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e))]),this._suspendedHandle=r(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),s)});this.addResolvingPromise(t),this._replacesTerrain&&this.addHandles(o(()=>this.view.map.ground.opacity,()=>{this._opacityChange()}))}get _replacesTerrain(){return this.layer.replacesTerrain&&!!this.view.map.basemap?.groundLayers.includes(this.layer)}get opacity(){return this.fullOpacity*(this._replacesTerrain?this.view.map.ground.opacity:1)}_opacityChange(){const{opacity:e}=this;this.forEachComponentObject(t=>{this._collection.getMaterial(t).objectOpacity=e})}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}get ready(){return!0}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),G(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._initialCullFace.clear(),this._visibleObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_modificationsChanged(){const e=this.layer.spatialReference,t=I(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t,e.wkid)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=M();this._layerClippingArea=Y(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=a(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),this.forEachComponentObject(t=>{const i=this._collection.getMaterial(t);i.commonMaterialParameters.hasSlicePlane=e,i.commonMaterialParameters.cullFace=e?0:this._initialCullFace.get(t)})}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,V(e))}get _wasm(){return z(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return pe(this.layer.effectiveScaleRange,this.view.scale)}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(a=>{a.isVisible?(e+=a.textureMemoryUsage,t+=a.vboMemoryUsage,r++):(i+=a.textureMemoryUsage,s+=a.vboMemoryUsage,o++)}),new L(this.usedMemory,r,o,be(t),be(e),be(s),be(i))}_canProjectWithoutEngine(){if(2===this.view.state.viewingMode){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return V(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new X(e.zmin,e.zmax):null}getElevationRange(e){return null}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const i of e)for(const e of i.componentObjects)t(e)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const i=y(t.desc.origin),s=new Array,r=this.view.basemapTerrain.spatialReference;let o,a;if("global"===this.view.viewingMode){const e=u();j(v,i,e,r),o=c(m(),e),a=d(m(),o)}else o=h,a=h;const n=b(i);let l=null;const M=_();if(t.desc.obb){const e=t.desc.obb.quaternion;l=new Z(t.desc.obb.center,t.desc.obb.halfSize,p(e[0],e[1],e[2],e[3]))}let T=0,P=0;const U={textureMemoryUsage:0},H=new Array,E=new Map;for(let c=0;c<t.desc.prims.length;c++){const e=t.desc.prims[c];this._dbg(2,JSON.stringify(e));if(null==W[e.ptype]||null==t.data){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive.");continue}const d=t.desc?.materials&&null!=e.materialId?t.desc.materials[e.materialId]:null,m=null!=d?d.lightingModel:"Unlit",{positionView:u,positionAttr:p,normalsView:y,normalsAttr:b,colorAttr:v,texCoord0Attr:j,indicesView:F}=this.getBufferViews(e,t.data.buffer,o);if(null==p||null==u||null==F)continue;const S=new ie(null!=v,j?1:0,null!=y,this._shadeNormals||this._replacesTerrain,this._applySSAO),R=p.data.length/p.size,A=(e,t)=>!e||e.data.length/e.size===R||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!A(j,"numTexcoord")||!A(v,"numColors")||!A(b,"normals"))continue;const k=se(S);if(null!=l?l=l.clone():(l=ee(p),f(M,l.center,i),l.center=M),o!==h)for(let t=0;t<u.count;t++)u.getVec(t,M),g(M,M,o),u.setVec(t,M);const V=k.createBuffer(p.data.length);if(de("position",p,null,null,V,0),null!=j){const e=V.getField("uv0",O);me(j,e,0)}null!=v&&de("color",v,null,null,V,0),null!=b&&de("normalCompressed",b,null,null,V,0);const I=new Uint32Array([0,F.typedBuffer.length]),D={vertices:{data:V.buffer,count:V.byteLength/k.stride,layoutParameters:S},positionData:{positions:u.typedBuffer,indices:F.typedBuffer},indices:F.typedBuffer,componentOffsets:I};T+=u.count+F.count;const L=this.view.renderSpatialReference,B=_(),G=[1,1,1];x(n,L,G,r)||this._dbg(3,"Unsupported coordinate system for IM overlay"),C(n,L,B,r);const z=this._collection.createObject(new te(w(B[0],B[1],G[0],G[1]),new re(n,a),l,D));d&&this._collection.updateMaterial(z,e=>{e.baseColor=d.baseColorFactor,e.usePBR="Pbr"===m,e.hasParametersFromSource=!1,e.baseColorTexture=this._getTexture(d.baseColorTex,t,E,U),e.usePBR&&(e.mrrFactors=[d.metallicFactor,d.roughnessFactor,0],e.emissiveBaseColor=d.emissiveFactor??[0,0,0],e.metallicRoughnessTexture=this._getTexture(d.metalTex,t,E,U),e.emissionTexture=this._getTexture(d.emissiveTex,t,E,U),e.occlusionTexture=this._getTexture(d.occlusionTex,t,E,U),e.normalTexture=this._getTexture(d.normalTex,t,E,U)),e.objectOpacity=0,e.alphaDiscardMode=2;const i=[];e.baseColorTexture&&i.push(e.baseColorTexture.loadPromise),e.usePBR&&(e.metallicRoughnessTexture&&i.push(e.metallicRoughnessTexture.loadPromise),e.emissionTexture&&i.push(e.emissionTexture.loadPromise),e.occlusionTexture&&i.push(e.occlusionTexture.loadPromise),e.normalTexture&&i.push(e.normalTexture.loadPromise));const r=Promise.all(i);s.push(r),r.then(()=>{e.alphaDiscardMode=$[d.alphaMode],e.objectOpacity=this.opacity,U.textureMemoryUsage+=e.baseColorTexture?.glTexture?.usedMemory??0,e.usePBR&&(U.textureMemoryUsage+=(e.metallicRoughnessTexture?.glTexture?.usedMemory??0)+(e.emissionTexture?.glTexture?.usedMemory??0)+(e.occlusionTexture?.glTexture?.usedMemory??0)+(e.normalTexture?.glTexture?.usedMemory??0))}),e.commonMaterialParameters.doubleSided=d.isDoubleSided,e.commonMaterialParameters.cullFace=d.faceCulling?J[d.faceCulling]:2,this._initialCullFace.set(z,e.commonMaterialParameters.cullFace),e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.componentParameters.castShadows=0,e.textureAlphaCutoff=d.alphaCutoff??ge,e.alphaDiscardMode=$[d.alphaMode],e.isIntegratedMesh=!0,e.sphereDepthInterpolate=this.layer.replacesTerrain,e.polygonOffsetEnabled=!1,e.hasOccludees=!1,e.ellipsoidMode=ae(this.view.spatialReference)}),H.push(z),P+=this._collection.getObjectGPUMemoryUsage(z)}await Promise.all(s);const F=new Array;E.forEach(e=>{F.push(e)});const S=new ye(e.handle,H,F,T,P,U.textureMemoryUsage);return this._memCache.put(`${S.handle}`,S),this._lyrHandleToObjects.set(e.handle,S),this._cacheMemory+=S.usedMemory,{memUsageBytes:S.usedMemory}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t&&(t.isVisible?(this._visibleObjects.delete(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e))}freeObject(e){this._memCache.pop(`${e.handle}`),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>{this._collection.destroyObject(e),this._initialCullFace.delete(e)})}setRenderableVisibility(e,t,i){for(let s=0;s<i;++s){const i=t[s];if(!i)continue;const r=e[s],o=this._lyrHandleToObjects.get(r);if(o){if(o.isVisible)continue;this._visibleGeometryChanged(),o.isVisible=!0,this._visibleObjects.add(o),this._usedMemory+=o.usedMemory,this._cacheMemory-=o.usedMemory,o.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,i),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e))}),this._memCache.pop(`${r}`)}}for(let s=0;s<i;++s){const i=e[s],r=t[s];if(r)continue;const o=this._lyrHandleToObjects.get(i);if(o){if(!o.isVisible)continue;this._visibleGeometryChanged(),o.isVisible=!1,this._visibleObjects.delete(o),this._usedMemory-=o.usedMemory,this._cacheMemory+=o.usedMemory,o.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,r),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e))}),this._memCache.put(`${i}`,o)}}}_getTexture(e,t,i,s){let r=null;if(e&&t.desc?.images&&t.data?.buffer){const o=t.desc.images[e?.imageId];if(r=i.get(o),!r&&o){const a=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,n=!!o.mipCount||a>1,l=q[e.wrapMode??"None"];let c=o.alpha?6408:6407;const d=new Uint8Array(t.data.buffer,o.data.byteOffset,o.data.byteCount);let m=null,h=null,u=null;switch(o.format){case"Raw":"R8"===o.pixelFormat?(m=d,c=6403,h=""):"Rgb8"===o.pixelFormat?(m=d,c=6407,h=""):"Rgba8"===o.pixelFormat&&(m=d,c=6408,h="");break;case"Dxt1":m=d,c=6407,h="image/vnd-ms.dds";break;case"Dxt5":m=d,c=6408,h="image/vnd-ms.dds";break;case"Basis":m=d,c=6407,h="image/ktx2";break;case"Png":h="image/png",u=document.createElement("img");break;case"Jpeg":h="image/jpeg",u=document.createElement("img");break;case"Etc2":h="image/ktx",u=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(u&&h){const e=new Blob([d],{type:h});u.src=URL.createObjectURL(e),m=u}if(m&&null!=h){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker,compressionCallback:e=>{e&&e>0&&(s.textureMemoryUsage-=e)}}:void 0;r=new ce(m,{mipmap:n,maxAnisotropy:a,encoding:h,wrap:l,pixelFormat:c,compressionOptions:e,noUnpackFlip:!0,width:o.mip0Width,height:o.mip0Height}),this._stage.addTexture(r),i.set(o,r)}}}return r?new oe(this.view.stage.renderView.textures,r.id):null}getBufferViews(e,t,i){let s,r,o,a,n,l,c,d=null;for(let h=0;h<e.atrbs.length;h++){const c=e.atrbs[h],u=c.view,p=void 0,f=u.byteOffset+u.byteCount,g=u.byteCount/K[u.type],y=[...Array(g).keys()].map(e=>e);try{switch(c.sem){case"Position":3!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(s=new H(t,u.byteOffset,p,f),r=new ne(s.typedBuffer,y,3));break;case"Normal":if(3!==u.ncomp||"F32"!==u.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+u+")");else{const e=new H(t,u.byteOffset,p,f),s=le(e.typedBuffer,i);n=new S(s.buffer),l=new ne(n.typedBuffer,y,2)}break;case"TexCoord":2!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+u+")"):void 0===a&&(a=new ne(new O(t,u.byteOffset,p,f).typedBuffer,y,2));break;case"Color":4===u.ncomp?("F32"===u.type&&(d=new T(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new P(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new U(t,u.byteOffset,p,f))):3===u.ncomp&&("F32"===u.type&&(d=new H(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new E(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new F(t,u.byteOffset,p,f))),null==d?this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new ne(d.typedBuffer,y,u.ncomp);break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+c.sem+"). Skipping vertex attribute.")}}catch(m){this._dbg(2,"Error Creating buffer ("+m+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,s=void 0,r=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":c=new A(t,i.byteOffset,s,r);break;case"U32":c=new R(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==c&&null!=s){const e=s.count;if(e<65535){const t=new Uint16Array(e);c=new A(t.buffer)}else{const t=new Uint32Array(e);c=new R(t.buffer)}for(let t=0;t<e;t++)c.set(t,t)}return{positionView:s,positionAttr:r,colorAttr:o,texCoord0Attr:a,indicesView:c,normalsView:n,normalsAttr:l}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>this._modifications=e.toArray(),s),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([n({type:[k]})],_e.prototype,"_modifications",void 0),e([n()],_e.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([n()],_e.prototype,"layer",void 0),e([n({readOnly:!0})],_e.prototype,"visibleAtCurrentScale",null),e([n()],_e.prototype,"elevationOffset",null),_e=e([l("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],_e);const we=_e;export{we as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{initial as r}from"../../../core/reactiveUtils.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{I3SMeshView3D as o}from"./I3SMeshView3D.js";import{LayerView3D as s}from"./LayerView3D.js";import{updatingProgress as a}from"../support/updatingProperties.js";import l from"../../layers/LayerView.js";import{isInEffectiveScaleRange as n}from"../../support/layerViewUtils.js";const p=.2;let d=class extends(o(s(l))){constructor(){super(...arguments),this.type="integrated-mesh-3d",this._elevationContext=1,this._supportsLabeling=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this.drapeTargetType=1}get i3slayer(){return this.layer}get updatingProgressValue(){return this._controller?.updatingProgress??0}get lodFactor(){return this.view?.qualitySettings?.sceneService?.integratedMesh?.lodFactor??1}get progressiveLoadFactor(){return this.lodFactor>=1?p:1}get visibleAtCurrentScale(){return n(this.i3slayer.effectiveScaleRange,this.view.scale)}get layerPopupEnabledAndHasTemplate(){return!1}initialize(){this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),r),this.view.
|
|
5
|
+
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{initial as r}from"../../../core/reactiveUtils.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{I3SMeshView3D as o}from"./I3SMeshView3D.js";import{LayerView3D as s}from"./LayerView3D.js";import{updatingProgress as a}from"../support/updatingProperties.js";import l from"../../layers/LayerView.js";import{isInEffectiveScaleRange as n}from"../../support/layerViewUtils.js";const p=.2;let d=class extends(o(s(l))){constructor(){super(...arguments),this.type="integrated-mesh-3d",this._elevationContext=1,this._supportsLabeling=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this.drapeTargetType=1}get i3slayer(){return this.layer}get updatingProgressValue(){return this._controller?.updatingProgress??0}get lodFactor(){return this.view?.qualitySettings?.sceneService?.integratedMesh?.lodFactor??1}get progressiveLoadFactor(){return this.lodFactor>=1?p:1}get visibleAtCurrentScale(){return n(this.i3slayer.effectiveScaleRange,this.view.scale)}get layerPopupEnabledAndHasTemplate(){return!1}initialize(){this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),r),this.view.overlayManager.registerDrapeTarget(this)}destroy(){this.view.overlayManager.unregisterDrapeTarget(this)}get ready(){return this.layer.loaded}_createLayerGraphic(){}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>this._modifications=e.toArray(),r),"modifications")}};e([t()],d.prototype,"layer",void 0),e([t()],d.prototype,"i3slayer",null),e([t(a)],d.prototype,"updatingProgress",void 0),e([t()],d.prototype,"updatingProgressValue",null),e([t()],d.prototype,"lodFactor",null),e([t({readOnly:!0})],d.prototype,"progressiveLoadFactor",null),e([t({readOnly:!0})],d.prototype,"visibleAtCurrentScale",null),d=e([i("esri.views.3d.layers.IntegratedMeshLayerView3D")],d);const c=d;export{c as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{makeHandle as r,handlesGroup as i,destroyHandle as n}from"../../../core/handleUtils.js";import"../../../core/has.js";import{isIterable as s}from"../../../core/iteratorUtils.js";import{getProjectiveTransform as a}from"../../../core/perspectiveUtils.js";import{debounce as o,isPromiseLike as d}from"../../../core/promiseUtils.js";import{watch as l,syncAndInitial as h,on as m}from"../../../core/reactiveUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{toExtent as u}from"../../../geometry/support/aaBoundingRect.js";import{MediaElementView as y}from"../../../layers/support/MediaElementView.js";import{LayerView3D as _}from"./LayerView3D.js";import{MediaLayerInteraction as f}from"./support/MediaLayerInteraction.js";import{drapedZ as v}from"../terrain/OverlayRenderer.js";import{Attribute as w}from"../webgl-engine/lib/Attribute.js";import{Geometry as E}from"../webgl-engine/lib/Geometry.js";import{Object3DHighlightStateID as R}from"../webgl-engine/lib/Object3DStateID.js";import{RenderGeometry as D}from"../webgl-engine/lib/RenderGeometry.js";import{Texture as b}from"../webgl-engine/lib/Texture.js";import{ImageMaterial as j}from"../webgl-engine/materials/ImageMaterial.js";import x from"../../layers/LayerView.js";import A from"../../layers/MediaLayerView.js";import{getHighlightName as H}from"../../support/highlightOptionsUtils.js";import{isInEffectiveScaleRange as G}from"../../support/layerViewUtils.js";let M=class extends(_(A(x))){get interactive(){return this._interaction.enabled}set interactive(e){this._interaction&&(this._interaction.enabled=e)}get selectedElement(){return this._interaction.selectedElement}set selectedElement(e){this._interaction&&(this._interaction.selectedElement=e)}get visibleAtCurrentScale(){return G(this.layer.effectiveScaleRange,this.view.scale)}get usedMemory(){return Array.from(this._renderElements.values()).reduce((e,t)=>e+(t.getRenderData()?.texture.usedMemory??0),0)}constructor(e){super(e),this.type="media-3d",this.drapeSourceType=1,this.updatePolicy=1,this.ignoresMemoryFactor=!0,this.unloadedMemory=0,this._uidToElement=new Map,this._highlightedElements=new Map,this._elementsInHighlightedId=new Map,this._renderElements=new Map,this._lastDrapingExtent=null,this._update=o(async(e,t,r)=>{const i=await this._collectMediaElements(e,t,r);this._synchronizeRenderElements(i)},0);const{view:t,layer:r}=e;this._interaction=new f({view:t,layer:r}),this.addHandles(l(()=>this.interactionOptions,e=>this._interaction.options=e,h))}initialize(){const{view:e,layer:t}=this;this._renderer=e.
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{makeHandle as r,handlesGroup as i,destroyHandle as n}from"../../../core/handleUtils.js";import"../../../core/has.js";import{isIterable as s}from"../../../core/iteratorUtils.js";import{getProjectiveTransform as a}from"../../../core/perspectiveUtils.js";import{debounce as o,isPromiseLike as d}from"../../../core/promiseUtils.js";import{watch as l,syncAndInitial as h,on as m}from"../../../core/reactiveUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{toExtent as u}from"../../../geometry/support/aaBoundingRect.js";import{MediaElementView as y}from"../../../layers/support/MediaElementView.js";import{LayerView3D as _}from"./LayerView3D.js";import{MediaLayerInteraction as f}from"./support/MediaLayerInteraction.js";import{drapedZ as v}from"../terrain/OverlayRenderer.js";import{Attribute as w}from"../webgl-engine/lib/Attribute.js";import{Geometry as E}from"../webgl-engine/lib/Geometry.js";import{Object3DHighlightStateID as R}from"../webgl-engine/lib/Object3DStateID.js";import{RenderGeometry as D}from"../webgl-engine/lib/RenderGeometry.js";import{Texture as b}from"../webgl-engine/lib/Texture.js";import{ImageMaterial as j}from"../webgl-engine/materials/ImageMaterial.js";import x from"../../layers/LayerView.js";import A from"../../layers/MediaLayerView.js";import{getHighlightName as H}from"../../support/highlightOptionsUtils.js";import{isInEffectiveScaleRange as G}from"../../support/layerViewUtils.js";let M=class extends(_(A(x))){get interactive(){return this._interaction.enabled}set interactive(e){this._interaction&&(this._interaction.enabled=e)}get selectedElement(){return this._interaction.selectedElement}set selectedElement(e){this._interaction&&(this._interaction.selectedElement=e)}get visibleAtCurrentScale(){return G(this.layer.effectiveScaleRange,this.view.scale)}get usedMemory(){return Array.from(this._renderElements.values()).reduce((e,t)=>e+(t.getRenderData()?.texture.usedMemory??0),0)}constructor(e){super(e),this.type="media-3d",this.drapeSourceType=1,this.updatePolicy=1,this.ignoresMemoryFactor=!0,this.unloadedMemory=0,this._uidToElement=new Map,this._highlightedElements=new Map,this._elementsInHighlightedId=new Map,this._renderElements=new Map,this._lastDrapingExtent=null,this._update=o(async(e,t,r)=>{const i=await this._collectMediaElements(e,t,r);this._synchronizeRenderElements(i)},0);const{view:t,layer:r}=e;this._interaction=new f({view:t,layer:r}),this.addHandles(l(()=>this.interactionOptions,e=>this._interaction.options=e,h))}initialize(){const{view:e,layer:t}=this;this._renderer=e.overlayManager.registerGeometryDrapeSource(this);const i=()=>this._updateWithLastDrapingExtent();this.addHandles([r(()=>e.overlayManager.unregisterDrapeSource(this)),m(()=>t.effectiveSource,"change",i),m(()=>t.effectiveSource,"refresh",i)]),this._updatingHandles.add(()=>this.suspended,i)}destroy(){this._synchronizeRenderElements(new Set)}setDrapingExtent(e,t){this._lastDrapingExtent={overlays:e,spatialReference:t},this._updateWithLastDrapingExtent()}getHit(e){const t=this._uidToElement.get(e);return t?{type:"media",element:t,layer:this.layer}:null}highlight(e,t){const i=H(t),n=new R(i),a=s(e)?Array.from(e):[e];this._elementsInHighlightedId.set(n,a);for(const r of a){const e=this._highlightedElements.get(r);e?e.add(n):this._highlightedElements.set(r,new Set([n]));const t=this._renderElements.get(r)?.getRenderData();t&&(t.renderGeometry.geometry.addHighlight(n),this._renderer.modifyGeometries([t.renderGeometry],8))}return r(()=>{const e=this._elementsInHighlightedId.get(n);if(e){for(const t of e){const e=this._highlightedElements.get(t);if(!e)continue;e.delete(n);const r=this._renderElements.get(t)?.getRenderData();r&&(r.renderGeometry.geometry.removeHighlight(n),this._renderer.modifyGeometries([r.renderGeometry],8)),0===e.size&&this._highlightedElements.delete(t)}this._elementsInHighlightedId.delete(n)}})}isUpdating(){return super.isUpdating()||this._interaction.updating}_updateWithLastDrapingExtent(){if(null==this._lastDrapingExtent||this.suspended)return void(this._renderer&&this._synchronizeRenderElements(new Set));const{overlays:e,spatialReference:t}=this._lastDrapingExtent;this._updatingHandles.addPromise(this._update(e,t).catch(()=>{}))}async _collectMediaElements(e,t,r){const i=this.layer.effectiveSource;return null==i?new Set:new Set((await Promise.all(e.map(e=>i.queryElements(u(e.extent,t),{signal:r})))).flat())}_synchronizeRenderElements(e){this._synchronizeRenderElementsRemove(e),this._synchronizeRenderElementsAdd(e)}_synchronizeRenderElementsRemove(e){this._renderElements.forEach((t,r)=>{e.has(r)||(this._removeElement(r,t),this.emit("element-render-changed",{element:r}))})}_synchronizeRenderElementsAdd(e){for(const t of e)this._renderElements.has(t)||this._createRenderElement(t)}_removeElement(e,t){this._destroyRenderData(e,t),this._renderElements.delete(e),this._uidToElement.delete(e.uid),t.handle.remove()}_createRenderElement(e){const t=new y({spatialReference:this.view.spatialReference,element:e}),r=new I(i([this._updatingHandles.add(()=>e.opacity,e=>r.getRenderData()?.material.setParameters({opacity:e})),this._updatingHandles.add(()=>t.coords,()=>{r.data?this._updateGeometry(t,r):this._initializeRenderData(t,r)}),this._updatingHandles.add(()=>e.content,()=>this._initializeRenderData(t,r)),n(t)]));this._renderElements.set(e,r),this._uidToElement.set(e.uid,e),this._updatingHandles.addPromise(e.load().catch(()=>{})),this._initializeRenderData(t,r)}_initializeRenderData(e,t){const{coords:r,element:i}=e,{contentWidth:n,contentHeight:s}=i;if(null==r||null==i.content)return void this._destroyRenderData(i,t);if(t.data)return;const a=this._createTexture(i.content),o=a.load(this.view.stage.renderView.renderingContext),l=()=>{if(!a.loaded)return;this.view.stage.addTexture(a);const e=new j({draped:!0,texture:a,opacity:i.opacity,perspectiveInterpolation:!0}),o=this._getPositionAttributeArray(r),d=[0,0,1,0,1,1,0,1],l=this._getPerspectiveDivideAttributeArray(o,n,s),h=[0,1,2,0,2,3],m=new E(e,[["position",new w(o,h,3,!0)],["uv0",new w(d,h,2,!0)],["perspectiveDivide",new w(l,h,1,!0)]]),c=new D(m,{layerViewUid:this.uid,graphicUid:i.uid}),p=this._highlightedElements.get(i);p?.forEach(e=>c.geometry.addHighlight(e)),this._renderer.addGeometries([c],0),t.data=new z(c,a,e),this.emit("element-render-changed",{element:i})};d(o)?(t.data=a,this._updatingHandles.addPromise(o),o.then(l).catch(()=>a.dispose())):l()}_updateGeometry(e,t){const{coords:r,element:i}=e;if(null==r||null==i.content)return void this._destroyRenderData(i,t);const n=t.getRenderData();if(!n)return;const s=this._getPositionAttributeArray(r);n.renderGeometry.geometry.setAttributeData("position",s);const a=this._getPerspectiveDivideAttributeArray(s,i.contentWidth,i.contentHeight);n.renderGeometry.geometry.setAttributeData("perspectiveDivide",a),n.renderGeometry.geometry.invalidateBoundingInfo(),this._renderer.modifyGeometries([n.renderGeometry],2),this.emit("element-render-changed",{element:i})}_getPositionAttributeArray(e){const[t,r,i,n]=e.rings[0];return[t[0],t[1],v,n[0],n[1],v,i[0],i[1],v,r[0],r[1],v]}_getPerspectiveDivideAttributeArray(e,t,r){a(S,[0,0,t,0,t,r,0,r],[e[0],e[1],e[3],e[4],e[6],e[7],e[9],e[10]]);const i=S[6]/S[8]*t,n=S[7]/S[8]*r;return[1,1+i,1+i+n,1+n]}_destroyRenderData(e,t){const r=t.data;if(null==r)return;if(t.data=null,"dispose"in r)return void r.dispose();const i=r.texture;i.unload(),this.view.stage.removeTexture(i),this._renderer.removeGeometries([r.renderGeometry],2),this.emit("element-render-changed",{element:e})}_createTexture(e){const r=e instanceof HTMLImageElement?e.naturalWidth:e.width,i=e instanceof HTMLImageElement?e.naturalHeight:e.height;if("getFrame"in e)throw new t("media-layer-view-3d","animation is not supported");return new b(e,{wrap:{s:33071,t:33071},preMultiplyAlpha:!0,width:r,height:i,mipmap:!0,updateCallback:()=>this.view.overlayManager.requestRender()})}get test(){}};e([c({readOnly:!0})],M.prototype,"type",void 0),e([c()],M.prototype,"layer",void 0),e([c()],M.prototype,"interactive",null),e([c()],M.prototype,"selectedElement",null),e([c({readOnly:!0})],M.prototype,"visibleAtCurrentScale",null),M=e([p("esri.views.3d.layers.MediaLayerView3D")],M);const S=g();class I{constructor(e){this.handle=e}getRenderData(){return this.data&&"type"in this.data&&"RenderData"===this.data.type?this.data:null}}class z{constructor(e,t,r){this.renderGeometry=e,this.texture=t,this.material=r,this.type="RenderData"}}const L=M;export{L as default};
|