@arcgis/core 5.2.0-next.80 → 5.2.0-next.82
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/applications/Components/imageryUtils.d.ts +5 -3
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/004966b5bf60a8a80b8c.js +1 -0
- package/assets/esri/core/workers/chunks/027af54888befb209aaa.js +1 -0
- package/assets/esri/core/workers/chunks/03cf74b2e488eb144ad5.js +1 -0
- package/assets/esri/core/workers/chunks/{913fb883455aeac8582b.js → 04f5ff688785a4bd3b03.js} +1 -1
- package/assets/esri/core/workers/chunks/055802283f7e01ee87fb.js +1 -0
- package/assets/esri/core/workers/chunks/06df9ce870360cda06c7.js +1 -0
- package/assets/esri/core/workers/chunks/{08ec5461af74356e7570.js → 075eb62465edb9cbf907.js} +1 -1
- package/assets/esri/core/workers/chunks/{5fe9eea35ddb428efd8b.js → 0b26c01a1190e8fd63fb.js} +1 -1
- package/assets/esri/core/workers/chunks/{24729603dcdbd95fd01e.js → 0d982abff7c9496f7890.js} +1 -1
- package/assets/esri/core/workers/chunks/0fd7590e545864f5fff4.js +1 -0
- package/assets/esri/core/workers/chunks/{b9d1bb106737a05290e1.js → 104d74bc36c28c519396.js} +1 -1
- package/assets/esri/core/workers/chunks/10ac92dcd3738ec23dfb.js +1 -0
- package/assets/esri/core/workers/chunks/11d911f70bf0ca252c19.js +1 -0
- package/assets/esri/core/workers/chunks/1352b5c6767e5421bc02.js +1 -0
- package/assets/esri/core/workers/chunks/1354b8442c2c501238f1.js +1 -0
- package/assets/esri/core/workers/chunks/1438f571f738e83b4d1c.js +1 -0
- package/assets/esri/core/workers/chunks/14469f664fd5ede469fc.js +1 -0
- package/assets/esri/core/workers/chunks/14511c92cbbc26d80c86.js +1 -0
- package/assets/esri/core/workers/chunks/14be79c4cc6137c7db95.js +1 -0
- package/assets/esri/core/workers/chunks/{ef47a5da641cb0d33fdf.js → 197a6d561f77ac74283a.js} +1 -1
- package/assets/esri/core/workers/chunks/19dac19122eeeb5e36b2.js +1 -0
- package/assets/esri/core/workers/chunks/{e4e5a171a4874c5af4a4.js → 1a7d2912c8eac8c83c70.js} +1 -1
- package/assets/esri/core/workers/chunks/{b9c61b20bbc91cb63036.js → 1c3861297f65ee1ca5d0.js} +1 -1
- package/assets/esri/core/workers/chunks/1d1cfe0bee506d34268e.js +1 -0
- package/assets/esri/core/workers/chunks/20db27d9828397d0b37a.js +1 -0
- package/assets/esri/core/workers/chunks/2161cf64601f28bbe72d.js +1 -0
- package/assets/esri/core/workers/chunks/218ddad849745d652a28.js +1 -0
- package/assets/esri/core/workers/chunks/{5b70295da76d9227f64b.js → 22c477147421e68f7f00.js} +1 -1
- package/assets/esri/core/workers/chunks/24944b625ed8dcd904f0.js +1 -0
- package/assets/esri/core/workers/chunks/25696c194457e42b3bdc.js +1 -0
- package/assets/esri/core/workers/chunks/25f6d5604a7959afd5a5.js +1 -0
- package/assets/esri/core/workers/chunks/26c12804a0d801df29bf.js +1 -0
- package/assets/esri/core/workers/chunks/{67ebde34377f98d17cda.js → 26c8ed0aef59ed6d5267.js} +1 -1
- package/assets/esri/core/workers/chunks/{c1e5ffe9a251be5a0744.js → 278760d194203dd27fc3.js} +1 -1
- package/assets/esri/core/workers/chunks/28b576663ed4570ec825.js +1 -0
- package/assets/esri/core/workers/chunks/{841c81c280114412c95b.js → 2a4c91b006de1ceba539.js} +1 -1
- package/assets/esri/core/workers/chunks/2b299aec2a758bcd9731.js +1 -0
- package/assets/esri/core/workers/chunks/2d1c0d80a9843567df8d.js +1 -0
- package/assets/esri/core/workers/chunks/{b084829a3fd709dc47a8.js → 2d683ac4a993ec5fd6f6.js} +1 -1
- package/assets/esri/core/workers/chunks/2d6e1bf7c1981bed4357.js +1 -0
- package/assets/esri/core/workers/chunks/{a8ec5b85c2fa6fb4f391.js → 30b40ee875d46e6fde02.js} +1 -1
- package/assets/esri/core/workers/chunks/31b3744f71750e512d4e.js +1 -0
- package/assets/esri/core/workers/chunks/3239c7994019f15e261d.js +1 -0
- package/assets/esri/core/workers/chunks/{d520d407043bc52e5410.js → 3336ad383c184dd07bb3.js} +1 -1
- package/assets/esri/core/workers/chunks/{c29df43817278f674707.js → 33aaa5a49e396a0aca47.js} +1 -1
- package/assets/esri/core/workers/chunks/{7529c0fcfb83998e63db.js → 34f6093d2c00e3584037.js} +1 -1
- package/assets/esri/core/workers/chunks/36265e5f6d396eadf0be.js +1 -0
- package/assets/esri/core/workers/chunks/{0ae0483b72f5e8d00d55.js → 3715d6b295016eeb5031.js} +1 -1
- package/assets/esri/core/workers/chunks/3851ebf3548e2763b24f.js +1 -0
- package/assets/esri/core/workers/chunks/3a4b117af89dab5153eb.js +1 -0
- package/assets/esri/core/workers/chunks/3a9ef47122e10cecd3a4.js +1 -0
- package/assets/esri/core/workers/chunks/3f0625c31dd46b563160.js +1 -0
- package/assets/esri/core/workers/chunks/40b842d055b87e442156.js +1 -0
- package/assets/esri/core/workers/chunks/{c37b28f200b704ae6002.js → 4239d64f067417e0643c.js} +1 -1
- package/assets/esri/core/workers/chunks/43122c435497228a7583.js +1 -0
- package/assets/esri/core/workers/chunks/44d13f65465646e5f6e9.js +1 -0
- package/assets/esri/core/workers/chunks/463b7952a4825541eb13.js +1 -0
- package/assets/esri/core/workers/chunks/{345510a95e893fa8040a.js → 469e72ab6cd44272f474.js} +1 -1
- package/assets/esri/core/workers/chunks/{bd88228f781a0399d8bd.js → 49e37f653b81f9e4f7cc.js} +1 -1
- package/assets/esri/core/workers/chunks/4c5200e22b8a723f53f9.js +1 -0
- package/assets/esri/core/workers/chunks/4cf2c33494cb75942511.js +1 -0
- package/assets/esri/core/workers/chunks/{2bcb7e43578124538c3c.js → 4d672110aee304692f60.js} +1 -1
- package/assets/esri/core/workers/chunks/4f36596280142be1c666.js +1 -0
- package/assets/esri/core/workers/chunks/50e6e43ea98cb0d05d91.js +1 -0
- package/assets/esri/core/workers/chunks/{8e374ce47256a567ae11.js → 519745cf844c76452a46.js} +1 -1
- package/assets/esri/core/workers/chunks/52042fd36f4a572938f0.js +1 -0
- package/assets/esri/core/workers/chunks/{3b14ed3184743df336a6.js → 53d80202b5f43542d45b.js} +1 -1
- package/assets/esri/core/workers/chunks/54524cc4328f31d8c25d.js +1 -0
- package/assets/esri/core/workers/chunks/5515005e8893bd551aaf.js +1 -0
- package/assets/esri/core/workers/chunks/563a4d6788ad66b676e4.js +1 -0
- package/assets/esri/core/workers/chunks/{eee1fd629619021ea279.js → 56a6c7abfb4d88ea1bb5.js} +1 -1
- package/assets/esri/core/workers/chunks/58d10928959ae1e2e8d9.js +1 -0
- package/assets/esri/core/workers/chunks/598221c7054415b84904.js +1 -0
- package/assets/esri/core/workers/chunks/59f0a2bd40b033ce77e4.js +1 -0
- package/assets/esri/core/workers/chunks/{38660a8cc3623c854d88.js → 5a006ff759fad9fc25cb.js} +1 -1
- package/assets/esri/core/workers/chunks/{087bd698b80ca0cea71e.js → 5aadfd11df6618883c5d.js} +1 -1
- package/assets/esri/core/workers/chunks/5b60fc95757b2a53558a.js +1 -0
- package/assets/esri/core/workers/chunks/5c634b3e6dc76299b1df.js +1 -0
- package/assets/esri/core/workers/chunks/5d30accf1dcda0c70f95.js +1 -0
- package/assets/esri/core/workers/chunks/605da92d28e067f4a4c6.js +1 -0
- package/assets/esri/core/workers/chunks/61f230e50787abbfc8ba.js +1 -0
- package/assets/esri/core/workers/chunks/6270acb7545be2c5126f.js +1 -0
- package/assets/esri/core/workers/chunks/{f3bbebedad51f776bb98.js → 62992c3d98c20f611b7b.js} +1 -1
- package/assets/esri/core/workers/chunks/{ac87be2210f868524996.js → 629f60ee49e0dcfb7165.js} +1 -1
- package/assets/esri/core/workers/chunks/645d5db85f84b1f19b59.js +1 -0
- package/assets/esri/core/workers/chunks/{1f888f026b004447772c.js → 657528eb6a3d3b3cb631.js} +1 -1
- package/assets/esri/core/workers/chunks/66292e98b4111ea3658d.js +1 -0
- package/assets/esri/core/workers/chunks/680496660b2aaa710099.js +1 -0
- package/assets/esri/core/workers/chunks/{ee63c693f2539f3bfa17.js → 6c389e9646a48c26da20.js} +2 -2
- package/assets/esri/core/workers/chunks/{2d1ae18a28491b00091d.js → 6db4a4f9a9ce7cc738d0.js} +1 -1
- package/assets/esri/core/workers/chunks/6eb28086dc28f6d144ec.js +1 -0
- package/assets/esri/core/workers/chunks/{702b2381acf4d1f90094.js → 6f08c8a1e8e3ffd0a96a.js} +1 -1
- package/assets/esri/core/workers/chunks/6f4ee60e89d154e7b1c4.js +1 -0
- package/assets/esri/core/workers/chunks/7230d74ef720431cc75e.js +1 -0
- package/assets/esri/core/workers/chunks/73a8a3baf0fed803ef4f.js +1 -0
- package/assets/esri/core/workers/chunks/{4d7a3b3aaf876da0891b.js → 76e6d894c33221369895.js} +1 -1
- package/assets/esri/core/workers/chunks/7833a82d5bac2aed565e.js +1 -0
- package/assets/esri/core/workers/chunks/7a05f5b0848dd11d2f4f.js +1 -0
- package/assets/esri/core/workers/chunks/{4c82f5f23004f905a18f.js → 7b605ed92e65083da35f.js} +1 -1
- package/assets/esri/core/workers/chunks/7bd8ebb321ecf1f06496.js +1 -0
- package/assets/esri/core/workers/chunks/7d5877eede2f552dea9f.js +1 -0
- package/assets/esri/core/workers/chunks/7eb94fc75926bc739233.js +1 -0
- package/assets/esri/core/workers/chunks/809349086117f199b7a5.js +1 -0
- package/assets/esri/core/workers/chunks/82e62a54b350e7a325f7.js +1 -0
- package/assets/esri/core/workers/chunks/836c458a7eb96391cfda.js +1 -0
- package/assets/esri/core/workers/chunks/83a77d3f45c8c21cec45.js +1 -0
- package/assets/esri/core/workers/chunks/851a5a0262dc8dcb67eb.js +1 -0
- package/assets/esri/core/workers/chunks/865f9adc591056458b6b.js +1 -0
- package/assets/esri/core/workers/chunks/88771a75adcbd54c4fac.js +1 -0
- package/assets/esri/core/workers/chunks/8c6a60d96c73982febd2.js +1 -0
- package/assets/esri/core/workers/chunks/{619aa1381296172ff47b.js → 8e19b2ce9868a9a08da0.js} +1 -1
- package/assets/esri/core/workers/chunks/8ea28a4b1afe8bb2d313.js +1 -0
- package/assets/esri/core/workers/chunks/911f3a1b8dd4bc5c9782.js +1 -0
- package/assets/esri/core/workers/chunks/{40693ee558a1eb1e93f4.js → 918577ea025f67ebe372.js} +1 -1
- package/assets/esri/core/workers/chunks/{fe71a0604f0928113419.js → 958e161634b5bfd50625.js} +1 -1
- package/assets/esri/core/workers/chunks/95ff342e5c29bf91a765.js +1 -0
- package/assets/esri/core/workers/chunks/97162bbbedb02e42d0b8.js +1 -0
- package/assets/esri/core/workers/chunks/{680dd7b7638465eb33de.js → 98739b6e7904045edbab.js} +1 -1
- package/assets/esri/core/workers/chunks/99966339b061eb9945b8.js +1 -0
- package/assets/esri/core/workers/chunks/9aa41d098eeda01ded3a.js +1 -0
- package/assets/esri/core/workers/chunks/{315031323e11a18154e3.js → 9c04233d18a9585b5bfe.js} +1 -1
- package/assets/esri/core/workers/chunks/9c7afe90495766bba37f.js +1 -0
- package/assets/esri/core/workers/chunks/{69b9a327f23e052fced7.js → 9d5d7289a9e23efc7f73.js} +1 -1
- package/assets/esri/core/workers/chunks/9e49a6ce4a133476092f.js +1 -0
- package/assets/esri/core/workers/chunks/9e840a71906c4deef776.js +1 -0
- package/assets/esri/core/workers/chunks/a1bf2111fee455b16e6a.js +29 -0
- package/assets/esri/core/workers/chunks/{910c93bbbf8113a4a51f.js → a2a231a671ff578b7b01.js} +1 -1
- package/assets/esri/core/workers/chunks/a2fd945659ce052f99d2.js +1 -0
- package/assets/esri/core/workers/chunks/{16929524565a677db4dc.js → a406a41a2f117247f1ef.js} +1 -1
- package/assets/esri/core/workers/chunks/a4b63162615a485b08dc.js +1 -0
- package/assets/esri/core/workers/chunks/a9a1061cdf82b372835f.js +1 -0
- package/assets/esri/core/workers/chunks/ab10388dcc17a665ac3b.js +2 -0
- package/assets/esri/core/workers/chunks/ac9a3dfd02160e43fc8a.js +2 -0
- package/assets/esri/core/workers/chunks/af88f8dd1a53e4740aa6.js +1 -0
- package/assets/esri/core/workers/chunks/{2b3f76e03b7a28fc4453.js → b09e9ac5fd928e69b053.js} +1 -1
- package/assets/esri/core/workers/chunks/{6c982779d6d47ec99899.js → b0a9a770b735440846cd.js} +1 -1
- package/assets/esri/core/workers/chunks/b2d6fd436981c890152f.js +1 -0
- package/assets/esri/core/workers/chunks/b3034fbcbe77ef9e7c20.js +1 -0
- package/assets/esri/core/workers/chunks/b4b4fe06364bea9b0750.js +1 -0
- package/assets/esri/core/workers/chunks/b661aae7e3ce955a783e.js +1 -0
- package/assets/esri/core/workers/chunks/b7bcc2d0b0fa8e703c83.js +1 -0
- package/assets/esri/core/workers/chunks/{75fc0b1db8e2e3fd2458.js → b8548eb7680abeaf3cd1.js} +1 -1
- package/assets/esri/core/workers/chunks/b9db8d059c2ea39518e7.js +1 -0
- package/assets/esri/core/workers/chunks/ba67aaa08e4f11e1140a.js +1 -0
- package/assets/esri/core/workers/chunks/ba8777844fef6ed3ac2b.js +1 -0
- package/assets/esri/core/workers/chunks/ba99a650ea64f5024185.js +1 -0
- package/assets/esri/core/workers/chunks/{e421dee5d8b030e79ffb.js → bbeb61d9302323bae9fb.js} +1 -1
- package/assets/esri/core/workers/chunks/bbfd2b4af8e498b61af9.js +1 -0
- package/assets/esri/core/workers/chunks/{cada52d719c35d40958a.js → bd1c870694edd25bf8aa.js} +1 -1
- package/assets/esri/core/workers/chunks/c1f125594e684c1b4ffc.js +1 -0
- package/assets/esri/core/workers/chunks/c30b6bbabd05e4976fba.js +1 -0
- package/assets/esri/core/workers/chunks/c456abf5ee2a1ad5cc5b.js +1 -0
- package/assets/esri/core/workers/chunks/c61e94806b37ca3dd549.js +2 -0
- package/assets/esri/core/workers/chunks/c71368cd64f240da1743.js +1 -0
- package/assets/esri/core/workers/chunks/c899457f19b749516275.js +1 -0
- package/assets/esri/core/workers/chunks/c8d83f71326222b98608.js +1 -0
- package/assets/esri/core/workers/chunks/c9653a15324ca53d50e7.js +1 -0
- package/assets/esri/core/workers/chunks/{9937920e7993814d0b2c.js → ca695ab000a1e8765d69.js} +1 -1
- package/assets/esri/core/workers/chunks/cc1a00694cc9f7c606d6.js +1 -0
- package/assets/esri/core/workers/chunks/{b792857a178da2dd77d6.js → cc419e1c5c1dee7ec972.js} +1 -1
- package/assets/esri/core/workers/chunks/{2ce845c990bb4d701362.js → cc817c9d3f8e8f8c56e4.js} +1 -1
- package/assets/esri/core/workers/chunks/cdd4aeaa3f30bc4ea93a.js +1 -0
- package/assets/esri/core/workers/chunks/cf6799fd008d0d7016f7.js +1 -0
- package/assets/esri/core/workers/chunks/cfcb258b7e464f219434.js +1 -0
- package/assets/esri/core/workers/chunks/d0c8630177d3a4e316f1.js +2 -0
- package/assets/esri/core/workers/chunks/{ac59218847e5ef4c4160.js → d0e00f0bb7b9435e170d.js} +1 -1
- package/assets/esri/core/workers/chunks/{33e293836f5d28dc5d62.js → d13eeff678972a245d5d.js} +1 -1
- package/assets/esri/core/workers/chunks/d1aa87d846a884492b47.js +1 -0
- package/assets/esri/core/workers/chunks/{0179949495c87466b428.js → d3a183d90f1ccc8da2bb.js} +10 -10
- package/assets/esri/core/workers/chunks/d433bfa2abf2ca8239ba.js +1 -0
- package/assets/esri/core/workers/chunks/d4cc8eef64b8c84217a5.js +1 -0
- package/assets/esri/core/workers/chunks/{2740f755c3a322cbd477.js → d672c2a1c8eddd235171.js} +1 -1
- package/assets/esri/core/workers/chunks/{24006cea112d657f053a.js → da233362b06b6db375f1.js} +1 -1
- package/assets/esri/core/workers/chunks/da6134c7883531f21afe.js +1 -0
- package/assets/esri/core/workers/chunks/dbc36b85413fae52b56d.js +1 -0
- package/assets/esri/core/workers/chunks/dd91824692bec809909c.js +1 -0
- package/assets/esri/core/workers/chunks/dd9af4ddefa0b998aa4b.js +1 -0
- package/assets/esri/core/workers/chunks/e2ceddd6bcdabec77cc7.js +1 -0
- package/assets/esri/core/workers/chunks/e3eab61815ef1c521a6c.js +1 -0
- package/assets/esri/core/workers/chunks/e706c37b44e98fbcb5f7.js +1 -0
- package/assets/esri/core/workers/chunks/ead4143d811aab610e00.js +2 -0
- package/assets/esri/core/workers/chunks/ef269dd559c1c79957e5.js +1 -0
- package/assets/esri/core/workers/chunks/efaa455beeefbf97a4c5.js +1 -0
- package/assets/esri/core/workers/chunks/f0692e10af5983f6ad93.js +1 -0
- package/assets/esri/core/workers/chunks/f16b6cd6b325eb600e82.js +1 -0
- package/assets/esri/core/workers/chunks/f1d0208c6b09c1c4b248.js +1 -0
- package/assets/esri/core/workers/chunks/f1fa377e8fa53b02876f.js +1 -0
- package/assets/esri/core/workers/chunks/{ebb722118a220c92efc3.js → f248131df4eaa5291623.js} +1 -1
- package/assets/esri/core/workers/chunks/f762f0f6c83748d8e328.js +1 -0
- package/assets/esri/core/workers/chunks/{b9bdb1f05e904c3655e4.js → f834aa732c3f06525089.js} +1 -1
- package/assets/esri/core/workers/chunks/{fb12d3c63fcac8391e06.js → fa29b5064d6626cfc019.js} +1 -1
- package/assets/esri/core/workers/chunks/fa7a6906598d1002abfd.js +1 -0
- package/assets/esri/core/workers/chunks/{e9e4b27ba06a29e6340c.js → faf14281a74a06fa1f30.js} +1 -1
- package/assets/esri/core/workers/chunks/fb86b334bfca4670dcfa.js +1 -0
- package/assets/esri/core/workers/chunks/{1ef28d4457c8c943ad19.js → fbede01a363895b6381f.js} +1 -1
- package/assets/esri/core/workers/chunks/{073f1d5f89875c6aefb1.js → fc1aeea22f8c9d63864a.js} +1 -1
- package/assets/esri/core/workers/chunks/fcf7299e2ee904ab9882.js +1 -0
- package/assets/esri/core/workers/chunks/{9230ad807020fc2bbf8e.js → fe06cc2f90b2d551e4c1.js} +1 -1
- package/assets/esri/core/workers/chunks/{8a3289e15e0ce92e3813.js → fe335441ea233cb0fad5.js} +1 -1
- package/assets/esri/core/workers/chunks/{d7b6985984071e78c764.js → ffad5fd9c5e98f4fe2c3.js} +1 -1
- package/assets/esri/core/workers/chunks/ffe2cbfea38b92a231d6.js +1 -0
- package/assets/esri/geometry/support/pe-wasm.wasm +0 -0
- package/chunks/Bufferer-CclWhXVb.js +1 -1
- package/chunks/Distance2DCalculator-DjIp2uQi.js +1 -1
- package/chunks/EmissionComposite.glsl.js +7 -1
- package/chunks/Envelope.js +1 -1
- package/chunks/GaussianSplat.glsl.js +8 -8
- package/chunks/GaussianSplatDepth.glsl.js +4 -4
- package/chunks/GeodeticDistanceCalculator-zRp89-dW.js +1 -1
- package/chunks/GeodeticUtils.js +1 -1
- package/chunks/GeographicTransformation.js +2 -0
- package/chunks/Geometry.js +1 -1
- package/chunks/MultiPathImpl.js +1 -1
- package/chunks/OperatorCrosses.js +1 -1
- package/chunks/OperatorCut.js +1 -1
- package/chunks/OperatorGeodesicBuffer.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
- package/chunks/OperatorGeodeticLength.js +1 -1
- package/chunks/OperatorGraphicBuffer.js +1 -1
- package/chunks/OperatorIntegrate.js +1 -1
- package/chunks/OperatorIntersects.js +1 -1
- package/chunks/OperatorMultiPartToSinglePart.js +1 -1
- package/chunks/OperatorOverlaps.js +1 -1
- package/chunks/OperatorProject.js +1 -1
- package/chunks/OperatorProximity.js +1 -1
- package/chunks/OperatorProximityGeodesic.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorShapePreservingProject.js +1 -1
- package/chunks/OperatorSimplifyOGC.js +1 -1
- package/chunks/OperatorTouches.js +1 -1
- package/chunks/OperatorWithin.js +1 -1
- package/chunks/Point2D.js +1 -1
- package/chunks/ProjectionTransformation.js +1 -1
- package/chunks/SideCalculator2D-DX0718xq.js +1 -1
- package/chunks/SpatialReference.js +1 -1
- package/chunks/UnitFactory.js +2 -0
- package/chunks/containsOperator.js +1 -1
- package/chunks/disjointOperator.js +1 -1
- package/chunks/equalsOperator.js +1 -1
- package/chunks/pe-wasm.js +1 -1
- package/chunks/relateOperator.js +1 -1
- package/config.js +1 -1
- package/geometry/operators/containsOperator.js +1 -1
- package/geometry/operators/disjointOperator.js +1 -1
- package/geometry/operators/gx/geodeticUtils.js +1 -1
- package/geometry/operators/gx/operatorAutoComplete.js +1 -1
- package/geometry/operators/gx/operatorBuffer.js +1 -1
- package/geometry/operators/gx/operatorDifference.js +1 -1
- package/geometry/operators/gx/operatorGeodesicBuffer.js +1 -1
- package/geometry/operators/gx/operatorGeodeticArea.js +1 -1
- package/geometry/operators/gx/operatorGeodeticDensify.js +1 -1
- package/geometry/operators/gx/operatorGeodeticDistance.js +1 -1
- package/geometry/operators/gx/operatorGeodeticLength.js +1 -1
- package/geometry/operators/gx/operatorIntersection.js +1 -1
- package/geometry/operators/gx/operatorLabelPoint.js +1 -1
- package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
- package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
- package/geometry/operators/gx/operatorProject.js +1 -1
- package/geometry/operators/gx/operatorProximityGeodesic.js +1 -1
- package/geometry/operators/gx/operatorShapePreservingProject.js +1 -1
- package/geometry/operators/gx/operatorSimplify.js +1 -1
- package/geometry/operators/gx/operatorSinglePartToMultiPart.js +1 -1
- package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
- package/geometry/operators/gx/operatorUnion.js +1 -1
- package/geometry/operators/json/containsOperator.js +1 -1
- package/geometry/operators/json/disjointOperator.js +1 -1
- package/geometry/operators/projectOperator.js +1 -1
- package/geometry/operators/reshapeOperator.js +1 -1
- package/geometry/operators/support/GeographicTransformation.d.ts +7 -0
- package/geometry/operators/support/GeographicTransformation.js +1 -1
- package/geometry/operators/support/GeographicTransformationStep.d.ts +7 -1
- package/geometry/operators/support/GeographicTransformationStep.js +1 -1
- package/geometry/operators/support/geographicTransformationUtils.d.ts +13 -2
- package/geometry/operators/support/geographicTransformationUtils.js +1 -1
- package/geometry/operators/support/initNoPeFactory.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry/operators/support/projectionTransformation.js +1 -1
- package/geometry/projection/projectionUtilsState.js +2 -0
- package/geometry/projectionUtils.js +1 -1
- package/geometry/support/geometryUtils.js +1 -1
- package/kernel.js +1 -1
- package/layers/raster/datasets/MRFRaster.js +1 -1
- package/layers/raster/formats/JpgPlus.js +1 -1
- package/layers/raster/formats/RasterCodec.js +1 -1
- package/layers/raster/types.d.ts +65 -0
- package/layers/support/AggregateField.d.ts +9 -3
- package/layers/support/FeatureReductionCluster.d.ts +16 -6
- package/layers/support/I3SExtractChanges.js +2 -0
- package/package.json +3 -3
- package/renderers/support/AuthoringInfo.d.ts +8 -3
- package/support/revision.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/cim/effects/EffectRadial.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/SymbolRepository.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriter.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
- package/views/3d/GroundView3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightDrawToolRenderer.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightEditTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightInteractionVisuals.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
- package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
- package/views/3d/layers/BuildingSceneLayerView3D.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/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
- package/views/3d/layers/i3s/I3SOverrides.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
- package/views/3d/state/controllers/RotateController.js +1 -1
- package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
- package/views/3d/state/controllers/ZoomControllerLocal.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/support/PBFDecoder.js +1 -1
- package/views/3d/support/QualityProfile.js +1 -1
- package/views/3d/support/QualitySettings.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
- package/views/3d/terrain/PlanarPatch.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/lib/BasisUtil.js +1 -1
- package/views/3d/webgl-engine/lib/EmissionComposite.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/EmissionComposite.js +1 -1
- package/views/3d/webgl-engine/lib/EmissionCompositeTechnique.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderUtils.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderer.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatDepthPolicy.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatPass.glsl.js +50 -22
- package/views/MapView.d.ts +0 -60
- package/views/View2D.d.ts +59 -1
- package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
- package/views/draw/support/managers/InteractiveHandleManager.js +1 -1
- package/views/support/GroundElevationSampler.js +1 -1
- package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
- package/widgets/BatchAttributeForm/expressions/expressionUtils.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileViewModel.js +1 -1
- package/widgets/Legend/support/sizeRampUtils.js +1 -1
- package/widgets/Legend/support/utils.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageLocationViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/assets/esri/core/workers/chunks/04105d83556409489835.js +0 -1
- package/assets/esri/core/workers/chunks/05b6b2c0b76afb100e33.js +0 -1
- package/assets/esri/core/workers/chunks/0909816f13d25cacf250.js +0 -1
- package/assets/esri/core/workers/chunks/0933203eee15ea50e123.js +0 -1
- package/assets/esri/core/workers/chunks/0b18de5147d76b68896f.js +0 -1
- package/assets/esri/core/workers/chunks/0d9d33f29124d464a4cb.js +0 -1
- package/assets/esri/core/workers/chunks/0d9fe49812554e7d7ba7.js +0 -1
- package/assets/esri/core/workers/chunks/0da5b27b070ab780f8b3.js +0 -1
- package/assets/esri/core/workers/chunks/0e333aced8b23aa49a0e.js +0 -1
- package/assets/esri/core/workers/chunks/0eaa8265a4cd64297545.js +0 -1
- package/assets/esri/core/workers/chunks/1142f8e9c80207d6bdae.js +0 -1
- package/assets/esri/core/workers/chunks/118ccfa2d685764752ee.js +0 -1
- package/assets/esri/core/workers/chunks/12a64eca4c571926d9d4.js +0 -1
- package/assets/esri/core/workers/chunks/1642fa1263d8f4a45101.js +0 -1
- package/assets/esri/core/workers/chunks/16a04fc184728d66e6e1.js +0 -1
- package/assets/esri/core/workers/chunks/18e0e993c0c39c962e61.js +0 -1
- package/assets/esri/core/workers/chunks/19233d0016e5b154c5ce.js +0 -1
- package/assets/esri/core/workers/chunks/1a467da4c0b33f655199.js +0 -1
- package/assets/esri/core/workers/chunks/1ac8a7a129ba33e05a24.js +0 -1
- package/assets/esri/core/workers/chunks/1d92d53186debd52e753.js +0 -1
- package/assets/esri/core/workers/chunks/1dba93abe84d30f05d8d.js +0 -1
- package/assets/esri/core/workers/chunks/2033e6d42453e4e67048.js +0 -1
- package/assets/esri/core/workers/chunks/20b54e7872d967f3be32.js +0 -1
- package/assets/esri/core/workers/chunks/2501d9459f6d14c797e5.js +0 -1
- package/assets/esri/core/workers/chunks/253c231b5a52f1d2d3a5.js +0 -1
- package/assets/esri/core/workers/chunks/257f1e8316877f611e11.js +0 -1
- package/assets/esri/core/workers/chunks/28924f31f5ba8ebdc60a.js +0 -1
- package/assets/esri/core/workers/chunks/28b09fe50b855a1d8a3f.js +0 -1
- package/assets/esri/core/workers/chunks/2b0558c1716425974563.js +0 -2
- package/assets/esri/core/workers/chunks/2e7c830b5b1fe406169f.js +0 -1
- package/assets/esri/core/workers/chunks/2f4ed8a63d57636a4ebe.js +0 -1
- package/assets/esri/core/workers/chunks/393f79843d5a78c1cc37.js +0 -1
- package/assets/esri/core/workers/chunks/3958d92c737b3a2a3bc2.js +0 -1
- package/assets/esri/core/workers/chunks/3978f00a03e97645b276.js +0 -1
- package/assets/esri/core/workers/chunks/3b5c5356353f1a2303a0.js +0 -1
- package/assets/esri/core/workers/chunks/40e48b720d89cd067892.js +0 -1
- package/assets/esri/core/workers/chunks/436d51b9f1b1b5abc4bc.js +0 -1
- package/assets/esri/core/workers/chunks/44a786aba84918f2b247.js +0 -1
- package/assets/esri/core/workers/chunks/463747a822499dd933ef.js +0 -1
- package/assets/esri/core/workers/chunks/484b251fbcbffcb58323.js +0 -1
- package/assets/esri/core/workers/chunks/495f90fe3d0ad32bb82d.js +0 -1
- package/assets/esri/core/workers/chunks/49a3888bf9e2481642ac.js +0 -1
- package/assets/esri/core/workers/chunks/4ce57dd39075e8fb357c.js +0 -1
- package/assets/esri/core/workers/chunks/5459ba8fdeb2370bb52b.js +0 -1
- package/assets/esri/core/workers/chunks/55924fb0de05e727f5e3.js +0 -1
- package/assets/esri/core/workers/chunks/55dda957c79fb285185f.js +0 -1
- package/assets/esri/core/workers/chunks/56e6d8c4a9ed893ce951.js +0 -1
- package/assets/esri/core/workers/chunks/57159bcac86d660dcceb.js +0 -1
- package/assets/esri/core/workers/chunks/58026fc30d8a0ded4102.js +0 -1
- package/assets/esri/core/workers/chunks/5eb29f0068f1c839d05e.js +0 -1
- package/assets/esri/core/workers/chunks/5f553da48d0ccbbfcd3c.js +0 -2
- package/assets/esri/core/workers/chunks/5fb76575575fe8cfb1f0.js +0 -1
- package/assets/esri/core/workers/chunks/6072c63a5da4366e9942.js +0 -1
- package/assets/esri/core/workers/chunks/626a715fdec93e188e0c.js +0 -1
- package/assets/esri/core/workers/chunks/6525c925bb91facb3575.js +0 -1
- package/assets/esri/core/workers/chunks/6529b5cc3ac6baa29fff.js +0 -2
- package/assets/esri/core/workers/chunks/65d1e338612e59063eba.js +0 -1
- package/assets/esri/core/workers/chunks/66e60351aacbd162775f.js +0 -1
- package/assets/esri/core/workers/chunks/694371f51c52a7a94da4.js +0 -1
- package/assets/esri/core/workers/chunks/69b0dcd7bcd8ec42e2c3.js +0 -1
- package/assets/esri/core/workers/chunks/7260e63252fa5452dc22.js +0 -1
- package/assets/esri/core/workers/chunks/72eb0ac55026a4f5d6a7.js +0 -1
- package/assets/esri/core/workers/chunks/79429c8be5da85713200.js +0 -1
- package/assets/esri/core/workers/chunks/79c0a966f7d11d3c217f.js +0 -1
- package/assets/esri/core/workers/chunks/7b470d6ad182548b9e95.js +0 -1
- package/assets/esri/core/workers/chunks/7b862a074816c099b9ff.js +0 -1
- package/assets/esri/core/workers/chunks/7baa363b3b0a442a63d2.js +0 -1
- package/assets/esri/core/workers/chunks/7d8eb4dbea1916320f74.js +0 -1
- package/assets/esri/core/workers/chunks/7ddf9b2718dd047f15e6.js +0 -1
- package/assets/esri/core/workers/chunks/835af7b4fd92cb4e7af0.js +0 -1
- package/assets/esri/core/workers/chunks/8566449c39eba55147f5.js +0 -1
- package/assets/esri/core/workers/chunks/864691186c449ca2c3db.js +0 -1
- package/assets/esri/core/workers/chunks/88d5541679e77117bf03.js +0 -1
- package/assets/esri/core/workers/chunks/88fd698b940dadcc6dc5.js +0 -1
- package/assets/esri/core/workers/chunks/894ebc64b698e5d7604b.js +0 -1
- package/assets/esri/core/workers/chunks/8be707044d992ef5f1d8.js +0 -1
- package/assets/esri/core/workers/chunks/8c1bddc88cc5f4251021.js +0 -1
- package/assets/esri/core/workers/chunks/8eecc6df6511c8830f5d.js +0 -1
- package/assets/esri/core/workers/chunks/8f0d4aec8bd3cbfefc40.js +0 -1
- package/assets/esri/core/workers/chunks/8fea514aada1195c8f30.js +0 -1
- package/assets/esri/core/workers/chunks/9234a293d61e134f121f.js +0 -1
- package/assets/esri/core/workers/chunks/94bf7f0da6ad3f7ea277.js +0 -1
- package/assets/esri/core/workers/chunks/987594539981483a7c5e.js +0 -1
- package/assets/esri/core/workers/chunks/995a433936fc90d41634.js +0 -2
- package/assets/esri/core/workers/chunks/9bbff8237540409610b3.js +0 -1
- package/assets/esri/core/workers/chunks/9e1392a0c608a13ab036.js +0 -1
- package/assets/esri/core/workers/chunks/9f1211d2267fb7673c4d.js +0 -1
- package/assets/esri/core/workers/chunks/a486d99f9879f94151ba.js +0 -1
- package/assets/esri/core/workers/chunks/a50421fe79f264ae3619.js +0 -1
- package/assets/esri/core/workers/chunks/a5c115fc53edb52ce1de.js +0 -1
- package/assets/esri/core/workers/chunks/a739e617fc461014ad1f.js +0 -1
- package/assets/esri/core/workers/chunks/aa21031c8f12ca438eaa.js +0 -1
- package/assets/esri/core/workers/chunks/ad27689b231e282b7620.js +0 -1
- package/assets/esri/core/workers/chunks/aed16c3e26652960ad3f.js +0 -1
- package/assets/esri/core/workers/chunks/af6e8c961fd768fa7be3.js +0 -1
- package/assets/esri/core/workers/chunks/b3a1a93c6dc9247cb048.js +0 -1
- package/assets/esri/core/workers/chunks/b4abf82b8ac974a55ae1.js +0 -1
- package/assets/esri/core/workers/chunks/b8cd81d8fcc78d272130.js +0 -1
- package/assets/esri/core/workers/chunks/b9a1046ca2cd0cca5da5.js +0 -1
- package/assets/esri/core/workers/chunks/b9d6f89f9b8e9d1bc787.js +0 -1
- package/assets/esri/core/workers/chunks/bab5f4b2424b487b87ac.js +0 -1
- package/assets/esri/core/workers/chunks/c02b3b8b71205f6ce290.js +0 -1
- package/assets/esri/core/workers/chunks/c17dda6fadb8bfad0d51.js +0 -1
- package/assets/esri/core/workers/chunks/c21212c356f65244e34e.js +0 -1
- package/assets/esri/core/workers/chunks/c374e5d5980db74c4aca.js +0 -1
- package/assets/esri/core/workers/chunks/c6bf17b5ff6ec4b980a1.js +0 -1
- package/assets/esri/core/workers/chunks/c99dcc17fbd7acd2ad2e.js +0 -1
- package/assets/esri/core/workers/chunks/ce481eeb27ea9c1782ae.js +0 -1
- package/assets/esri/core/workers/chunks/cec1c87eb3749276ced4.js +0 -1
- package/assets/esri/core/workers/chunks/cef02ed3942c010da2e8.js +0 -29
- package/assets/esri/core/workers/chunks/cfdbc48f58433a3d5fc3.js +0 -1
- package/assets/esri/core/workers/chunks/d456520e4b119a2816b6.js +0 -1
- package/assets/esri/core/workers/chunks/d8da31bfe2bc4174e5aa.js +0 -1
- package/assets/esri/core/workers/chunks/da1c9257793c2817f40f.js +0 -1
- package/assets/esri/core/workers/chunks/dc0c3109b7558b4fe016.js +0 -1
- package/assets/esri/core/workers/chunks/ddd8f6154e265dbb6f9f.js +0 -1
- package/assets/esri/core/workers/chunks/de601f0d5a2a282d2efd.js +0 -1
- package/assets/esri/core/workers/chunks/e227eb44cd139fe2bc1b.js +0 -1
- package/assets/esri/core/workers/chunks/e2ddfc96ddba92302e0c.js +0 -1
- package/assets/esri/core/workers/chunks/e61ab8ef30bbe788b9d7.js +0 -1
- package/assets/esri/core/workers/chunks/e89e6eea380ca2c13b64.js +0 -1
- package/assets/esri/core/workers/chunks/e9d352d030dcad1619a6.js +0 -1
- package/assets/esri/core/workers/chunks/eb95464bd017fb839510.js +0 -1
- package/assets/esri/core/workers/chunks/ed4ac5568dc2815b066d.js +0 -1
- package/assets/esri/core/workers/chunks/ed564358cc7b3ee463a3.js +0 -1
- package/assets/esri/core/workers/chunks/ef2e0a014c982d9c7ca4.js +0 -1
- package/assets/esri/core/workers/chunks/ef9489d1dccb817460bb.js +0 -2
- package/assets/esri/core/workers/chunks/f086c6d229fb34a9d7f9.js +0 -1
- package/assets/esri/core/workers/chunks/f35e749bb5be39880cbe.js +0 -1
- package/assets/esri/core/workers/chunks/f4bc563c71c478d3912f.js +0 -1
- package/assets/esri/core/workers/chunks/f6150b51a9430691a040.js +0 -1
- package/assets/esri/core/workers/chunks/f6f7d885b4d6080e3f58.js +0 -1
- package/assets/esri/core/workers/chunks/f95870bb4d8e4e13e69e.js +0 -1
- package/assets/esri/core/workers/chunks/fa59f10ed0f182a2a7f3.js +0 -1
- package/assets/esri/core/workers/chunks/fc9065d0cd6285fe0f0d.js +0 -1
- /package/assets/esri/core/workers/chunks/{2b0558c1716425974563.js.LICENSE.txt → 6c389e9646a48c26da20.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{995a433936fc90d41634.js.LICENSE.txt → ab10388dcc17a665ac3b.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{ef9489d1dccb817460bb.js.LICENSE.txt → ac9a3dfd02160e43fc8a.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{ee63c693f2539f3bfa17.js.LICENSE.txt → c61e94806b37ca3dd549.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{5f553da48d0ccbbfcd3c.js.LICENSE.txt → d0c8630177d3a4e316f1.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{6529b5cc3ac6baa29fff.js.LICENSE.txt → ead4143d811aab610e00.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import 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}from"../../../core/promiseUtils.js";import{initial as u,watch as g}from"../../../core/reactiveUtils.js";import{schedule as m}from"../../../core/scheduling.js";import{equals as _}from"../../../core/SetUtils.js";import{isArrayBuffer as f}from"../../../core/typedArrayUtil.js";import{property as p,subclass as y}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as b,exactEquals as v,invert as I}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as C,IDENTITY as M}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{multiply as w,getTranslation as x}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{clone as R,create as E}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as O}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{set as S,transformMat4 as j,transformMat3 as V,sub as F,add as A,scale as D,subtract as T}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as H}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as N}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as P}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as U}from"../../../core/support/UpdatingHandles.js";import{getSphericalPCPF as k}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{localLinearScaleFactors as G}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectBoundingSphere as L}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{create as $,fromBuffer as W,toRect as K}from"../../../geometry/support/aaBoundingBox.js";import{create as Q,intersects as J}from"../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as Y,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{Sphere as te}from"../../../geometry/support/sphere.js";import{newUByteArray as ie}from"../../../geometry/support/UByteArray.js";import{fallbackObjectIDAttribute as se}from"../../../layers/LayerConstants.js";import re from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as oe}from"../../../layers/support/fieldUtils.js";import ne from"../../../layers/support/SceneModification.js";import{getColor as ae,getOpacity as le}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{isBasemapLayerView as de}from"../../../support/basemapUtils.js";import{getElevationOffset as he}from"../../../support/elevationInfoUtils.js";import{loadArcade as ce}from"../../../support/loadArcade.js";import ue from"../../../symbols/MeshSymbol3D.js";import ge from"../../../symbols/SimpleFillSymbol.js";import{ContentGeometryUpdateEvent as me}from"./ContentGeometryLayerView.js";import _e from"./I3SMeshViewLabeler.js";import{I3SMeshViewPerformanceInfo as fe}from"./I3SMeshViewPerformanceInfo.js";import{initialize as pe,setModificationsSync as ye,filterObbsForModificationsSync as be,interpretObbModificationResults as ve}from"./SceneLayerWorker.js";import{SceneLayerWorkerHandle as Ie,toWasmModification as Ce}from"./SceneLayerWorkerHandle.js";import{overrideColor as Me}from"./graphics/graphicUtils.js";import{areLabelsVisible as we}from"./graphics/Labeler.js";import xe from"./i3s/Highlights.js";import{I3SAsyncElevationUpdater as Re}from"./i3s/I3SAsyncElevationUpdater.js";import{getCachedAttributeValue as Ee}from"./i3s/I3SBinaryReader.js";import{I3SCrossfadeHelper as Oe,NodeCrossfadeMetaData as Se}from"./i3s/I3SCrossfadeHelper.js";import{boundingBoxCornerPoints as je}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as Ve,TraversedIntersectionNode as Fe}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as Ae,selectEncoding as De,defaultMaterial as Te,createTexture as He,configureMaterial as Ne}from"./i3s/I3SMaterialUtil.js";import{I3SOverrides as Pe}from"./i3s/I3SOverrides.js";import{computeGlobalTransformation as Ue}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as ke,checkSceneLayerValid as Ge,checkSceneLayerCompatibleWithView as Le,whenGraphicAttributes as Be,computeVisibilityObb as qe,filterInPlace as ze,intersectBoundingRectWithMbs as $e,addWraparound as We,getSymbolInfo as Ke,transparentEdgeMaterial as Qe,getClipRect as Je}from"./i3s/I3SUtil.js";import{IDBCache as Ye}from"./i3s/IDBCache.js";import{IDBMockCache as Xe}from"./i3s/IDBMockCache.js";import{LayerElevationProvider as Ze}from"./i3s/LayerElevationProvider.js";import{SymbologyInfo as et}from"./i3s/SymbologyInfo.js";import{attributeLookup as tt}from"./support/attributeUtils.js";import{normalizeHighlightTarget as it,emptyHighlightHandle as st}from"./support/highlightUtils.js";import{makeScheduleFunction as rt}from"./support/makeScheduleFunction.js";import{debugFlags as ot}from"../support/debugFlags.js";import{ElevationRange as nt}from"../support/ElevationRange.js";import{toBoundingRect as at}from"../support/extentUtils.js";import{Obb as lt,ensurePackedObbData as dt}from"../support/orientedBoundingBox.js";import{updatingProgress as ht}from"../support/updatingProperties.js";import{glLayout as ct}from"../support/buffer/glUtil.js";import{ObjectParameters as ut}from"../webgl-engine/collections/Component/ObjectParameters.js";import{createVertexBufferLayout as gt,ComponentGeometryParameters as mt,SourceGeometry as _t,VertexBufferLayoutCreationParameters 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/getEmissions.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 Se{constructor(e,t,i,s,r,o,n,a,l,d,h){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._elevationAlignmentRange=new nt,this._geometryElevationRange=new nt,this.cachedElevationAnchors=null,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbologyStride=5,this.elevationAlignmentOffset=0,this._baseGeometryElevationRange=new nt(d,h),this.updateGeometryElevationRange()}get geometryElevationRange(){return this._geometryElevationRange}updateGeometryElevationRange(){const e=this._baseGeometryElevationRange;if(!e.elevationRangeValid||e.isEmpty)return this._elevationAlignmentRange.invalidateElevationRange(),void this._geometryElevationRange.invalidateElevationRange();const t=this.elevationOffsets;if(!t||0===t.length){const t=this.elevationAlignmentOffset;return this._elevationAlignmentRange.setElevationRangeValues(t,t),void this._geometryElevationRange.setElevationRangeValues(e.minElevation+t,e.maxElevation+t)}let i=1/0,s=-1/0;for(let r=0;r<t.length;++r){const e=this.elevationAlignmentOffset+(t[r]??0);i=Math.min(i,e),s=Math.max(s,e)}this._elevationAlignmentRange.setElevationRangeValues(i,s),this._geometryElevationRange.setElevationRangeValues(e.minElevation+i,e.maxElevation+s)}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=28,Rt=104857600,Et=t=>{const f=t;let te=class extends f{constructor(){super(...arguments),this._applySSAO=!0,this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._updatingHandles=new U,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._meshUtilsImporterModule=null,this._meshUtilsImporterPromise=null,this._planetRadiusInGlobalMode=0,this._elevationTask=null,this._needFilterResolve=!1,this._filters=[],this._arcade=null,this._tmpAttributeOnlyGraphic=new i,this._crossfadeHelper=new Oe(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerViewUid(){return this.uid}get layerId(){return this.layer.id}get sublayerId(){return null}get _isIntegratedMesh(){return"integrated-mesh"===this.layer.type}get contentVisible(){return!this.suspended&&this._controller?.rootNodeVisible&&this.fullOpacity>Ct}get legendEnabled(){return this.contentVisible&&!0===this.layer?.legendEnabled}get updatingProgressValue(){return this._controller?.updatingProgress??0}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return ke(this._currentRenderer)?this._usePBR||this._hasLoadedPBRTextures?63:53:this._usePBR||this._hasLoadedPBRTextures?44:36}get elevationOffset(){const e=this.layer?.elevationInfo;return"absolute-height"===e?.mode?he(e,this.layer.spatialReference):0}get elevationInfo(){const e=this.layer?.elevationInfo;switch(e?.mode){case"absolute-height":return new Gt(0,he(e,this.layer.spatialReference));case"relative-to-ground":return new Gt(1,he(e,this.layer.spatialReference));case"on-the-ground":return new Gt(2,0);default:return new Gt(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 nt;for(const i of e.values()){const e=i?.geometryElevationRange;e?.elevationRangeValid&&!e.isEmpty&&t.expandElevationRange(e)}return t.elevationRangeValid&&!t.isEmpty?t:null}get fullExtent(){return this.layer.fullExtent}initialize(){const e=has("enable-feature:idb-mock-cache");this._idbCache=e?new Xe(this.view,e):new Ye("esri-scenelayer-cache","geometries"),this._preLoadBasis(),this.addResolvingPromise(this.layer.indexInfo);const t=this.view.resourceController,i=t.memoryController;this.i3sOverrides=new Pe({view:this.view,layer:this.layer,memoryController:i}),this._workerHandle=new Ie(rt(t)),this.addResolvingPromise(this._workerHandle.promise),Ge(this.layer),Le(this.layer,this.view);const s=this.layer.store.defaultGeometrySchema;if(this.addResolvingPromise(this._workerHandle.setLegacySchema(this.uid,s).catch(d)),this._layerUrl=this.layer.parsedUrl.path,this._controller=new re({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,this._isIntegratedMesh||!s)this._hasComponentData=!1;else{const e=s.featureAttributes;this._hasComponentData=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=(s?.vertexAttributes.color??null)&&!this.layer.cachedDrawingInfo?.color;const r=this.view.resourceController.memoryController.newCache(`sl-${this.uid}`,e=>this._deleteComponentObject(e));this._memCache=r;const n=this._controller,l=this._nodeId2Meta,h=this._nodeId2MetaReloading;function*c(e){const t=n.index;if(!t)return;const i=t.rootNode;if(!i)return;let s=null;for(const r of t.traverseValues(i,t=>{const i=l.get(t.index)||h.get(t.index);return s=i?.objectHandle??null,e(t,s)}))yield new Fe(r,s)}this._intersectionHandler=new Ve({layerViewUid:this.layerViewUid,sublayerId:this.sublayerId,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:c}),this._elevationProvider=new Ze({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR,this._updatingHandles.add(()=>this.view.clippingArea,()=>this._clippingAreaChanged(),u),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),u),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)},u),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),u),this._updatingHandles.add(()=>this.layer.labelsVisible,()=>this._labelingChanged(),u),this._updatingHandles.add(()=>this.layer.labelingInfo,()=>this._labelingChanged(),u),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),u),this.addHandles([g(()=>ot.I3S_TREE_SHOW_TILES,e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then(({I3STreeDebugger:t})=>{!this._treeDebugger&&ot.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))})}else e||ot.I3S_TREE_SHOW_TILES||(this._treeDebugger=a(this._treeDebugger))},u),g(()=>ot.I3S_SHOW_MODIFICATIONS,()=>this._showModifications(),u)]),this._cacheKeySuffix=this._getCacheKeySuffix(),this._idbCache.init().catch(e=>o.getLogger(this).warn(`Failed to initialize IndexedDB cache: ${e}`));const{view:_}=this,{viewingMode:f,renderCoordsHelper:p}=_;this._planetRadiusInGlobalMode="local"===f?0:p.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(!(we(this.layer)&&this._supportsLabeling))return void(null!=this._labeler&&(this._labeler.destroy(),this._labeler=null));if(null!=this._labeler)return;const e=new _e({view:this.view,layer:this.layer,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=pe().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.layer.spatialReference,s=i.isGeographic,r=Ce(this._layerClippingArea,this._modifications,i,this.view.state.isGlobal);this._workerHandle.setModifications(t,r,s).catch(e);try{ye({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),!ot.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.layer.spatialReference;const o=new ge({...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.layer.textureSetDefinitions?.some(e=>e.formats.some(e=>"basis"===e.format||"ktx2"===e.format))&&bt()}_getVertexBufferLayout(e,t){return ct(gt(this._getGeometryParameters({hasTexture:Dt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion})))}_getObjectIdField(){return this.layer.objectIdField||se}_getGlobalIdField(){return this.layer.globalIdField}_findGraphicNodeAndIndex(e){const t=tt(this.layer.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.layer.fieldsIndex;for(const n of t){const e=tt(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=je(t,this._collection,s,Y(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 Be(this.layer,e,this._getObjectIdField(),t,()=>this._nodeId2Meta.values().filter(r).toArray())}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?this._meshUtilsImporterModule?(s.geometry=this._meshUtilsImporterModule.createMesh({layerView:this,nodeIndex:e.nodeIndex,featureIndex:e.componentIndex}),s):t.defer?(t.defer(async()=>(s.geometry=(await this._meshUtilsImporter).createMesh({layerView:this,nodeIndex:e.nodeIndex,featureIndex:e.componentIndex}),s)),null):s:null}_getCacheKey(e){return`${this._layerUrl}/v${xt}/${e}${this._cacheKeySuffix}`}get _meshUtilsImporter(){return this._meshUtilsImporterPromise||(this._meshUtilsImporterPromise=import("./i3s/meshUtils.js"),this._meshUtilsImporterPromise.then(e=>this._meshUtilsImporterModule=e,()=>{})),this._meshUtilsImporterPromise}_getCacheKeySuffix(){const e=this.view.renderSpatialReference;if(null==e)return $t;if(e===k(e))return Wt;return this.layer.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=De(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=lt.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 Tt(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);const{obb:r,componentOffsets:n,featureIds:a,anchorIds:l,anchors:d,transformedGeometry:h,geometryMinElevation:c,geometryMaxElevation:u}=s;e.hasModifications=h.hasModifications;const g=X(s.globalTrafo),m=S(Lt,r.center.x,r.center.y,r.center.z);j(m,m,g);const _=new lt(m,[r.extents.x,r.extents.y,r.extents.z],O(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 f={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:h,globalTrafo:g,geometryObbData:_.data,geometryMinElevation:c,geometryMaxElevation:u,byteSize:Nt(h,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&this._indexedDbSizeCheck(e,f)){const t=null!=f.textureData?f.textureData.map(e=>Ht(e)?e:null):null;this._idbCache.put(this._getCacheKey(e.id),{...f,textureData:t}).catch(t=>o.getLogger(this).warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`))}return this._addCachedNodeData(e,f,i)},i))):Promise.reject()}getElevationRange(e){const t=new nt,i=this._controller,{index:s}=i;if(!s)return t;const{rootNode:r}=s;if(!r)return t;const o=this._nodeId2Meta,n=i.viewportQueries,a=i=>{const{childrenLoaded:s}=i;if(0===s)return!1;const r=n.getAndUpdateVisibilityObbInRenderSR(i);let a=null;if(r){if(!r.intersectSphereWithMBS(e,r.radius))return!1}else if(a=n.calculateServiceMbsInRenderSRElevationAdjusted(i),a?.isValid&&!e.intersects(a))return!1;const l=o.get(i.index);if(l){const{geometryObbInRenderSR:s}=i;if(!s||s.intersectSphereWithMBS(e)){const e=l.geometryElevationRange;e.elevationRangeValid&&!e.isEmpty&&t.expandElevationRange(e)}}return s-(l?1:0)>0};return s.traverse(r,a),t}computeVisibilityObb(e){return qe(e,this.view.renderSpatialReference,this._controller.crsIndex,this.layer.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.layer.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=Ue(a,l,n,d,c),g=q(d,h),m=q(h,c);if(null==g||null==m)return Promise.resolve(null);const _={context:this.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,globalTrafo:u,geometryElevationOffset:l,mbs:a.toJSON(),obbData:e.serviceObbInIndexSR?.data,elevationOffset:l,planetRadiusInGlobalMode:this._planetRadiusInGlobalMode,needNormals:this._controller.isMeshPyramid||this._imVertexNormals,computeNormals:this._isIntegratedMesh&&this._imVertexNormals,normalReferenceFrame:n,indexToVertexProjector:g,vertexToRenderProjector:m};return this._workerHandle.invoke(_,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);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,!0),this._updateElevationOffsets(t),null!=this._labeler&&this._addMetaToLabeler(this._labeler,t),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,g=this._collection,m=d[0],{layout:_,indices:f,interleavedVertexData:p,positionData:y,hasColors:O}=n,{material:S,geometryParameters:j}=this._materialParameters(m,_),A=p.byteLength/_[0].stride,D=l||new Uint32Array([0,f?f.length:A]),T=m.transformation?R(m.transformation):E(),N=X(t.globalTrafo);w(T,N,T);const U=x(H(),T),k=b(C(),T),L=this._isIntegratedMesh?this._imShading?2:0:1,B=j.textureCoordinateType,q=!v(k,M),$=new mt(_,L,B,q?1:0),W=new _t({interleavedVertexData:p,vertexCount:A,indexData:f},{positions:Z(y.data),indices:ee(y.indices)},D,$),K=this.view.renderSpatialReference,Q=this.view.groundView.spatialReference,J=lt.fromData(dt(t.geometryObbData)).getCenter(Xt),Y=[1,1,1];G(J,K,Y,Q)||o.getLogger(this).errorOnce("Unsupported coordinate system for IM overlay");const te=H();z(J,K,te,Q);const ie=C();I(ie,k);const se=H();V(se,F(se,J,U),ie);const re=te[0]-se[0]*Y[0],oe=te[1]-se[1]*Y[1],ne=2===j.textureCoordinateType,{textures:ae,texturePromise:le,materialParameters:de}=this._initMaterialAndTextures(S,a,ne,e),he=g.createObject(new ut(P(re,oe,Y[0],Y[1]),new pt(U,k),lt.fromData(dt(t.geometryObbData)),W,!this._isIntegratedMesh),de);e.memory+=this._memEstimateGeometryAdded(he),e.memory+=ae.reduce((e,t)=>e+(null!=t?this._memEstimateTextureAdded(t):0),0);const ce=!!S.hasParametersFromSource,ue="blend"!==S.alphaMode&&S.metallicRoughness.baseColorFactor[3]>=1,ge=new wt(e,h,he,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:ce,isOpaque:ue},ae,c,u,t.geometryMinElevation,t.geometryMaxElevation);s.meta=ge,this._hasTextures||=t.requiredTextures?.some(({usage:e})=>!!(19&e))||!!e.resources.texture,this._hasData=!0,this._hasColors||=O,this.notifyChange("hasTexturesOrVertexColors");const me=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(ge),le]).then(([t,s])=>(this._addTasks.has(e.index)&&t?.updateObjectVisibility(ge.objectHandle,!1).catch(e=>this._logEdgeViewError(e,this.layer.title)),this._safeReschedule(()=>{const i=this._addTasks.get(e.index);if(!i)return;if(this._addNodeMeta(e.index,ge),i.meta=null,!this.contentVisible)return void this._removeNodeStageData(e.index,this.elevationOffset);g.setObjectVisibility(he,!0),t?.updateObjectVisibility(ge.objectHandle,!0).catch(e=>this._logEdgeViewError(e,this.layer.title)),ge.attributeInfo=i.attributeInfo;const s=ge.cachedRendererVersion!==this._rendererVersion,r=me!==this.slicePlaneEnabled;this._updateElevationOffsets(ge);const o=ge.elevationOffsets;this._updateComponentData(ge);const n=this._applyFiltersToNode(ge);(s||null!=t&&(r||n||o))&&this._addOrUpdateEdgeRendering(ge),null!=this._labeler&&this._addMetaToLabeler(this._labeler,ge),this._visibleGeometryChanged(ge,0),this._highlights?.objectCreated(ge),this._updateMaterial(ge),this._setNewNodeOpacity(ge),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&&kt(t.cachedEdgeMaterials,0),this._updateFeatureIdCounts(t,1)),this._nodeId2Meta.set(e,t),this.notifyChange("elevationRange")}_updateElevationOffsets(e){if(!e.node.serviceMbsInIndexSR)return;const{view:t,elevationInfo:i}=this,s=this._controller.crsIndex,{groundView:r,groundSpatialReference:o,renderSpatialReference:n}=t,a=i.mode;if(0===a)return e.elevationAlignmentOffset=i.offset,e.elevationOffsets=null,e.updateGeometryElevationRange(),void this.notifyChange("elevationRange");if(e.elevationAlignmentOffset=0,null==n||null==o)return e.elevationOffsets=null,e.updateGeometryElevationRange(),void this.notifyChange("elevationRange");const l=this._collection.getObjectTransform(e.objectHandle);e.elevationOffsets=e.elevationOffsets??[];const d=Lt,h=Bt,c=2===a,u=this.view.renderCoordsHelper,g=e.featureIds.length,m=(()=>{if(e.cachedElevationAnchors)return e.cachedElevationAnchors;const t=Y(3*g);e.cachedElevationAnchors=t;const{center:i}=e.node.serviceMbsInIndexSR;for(let r=0;r<g;r++){const a=3*r,c=e.anchorIds?.indexOf(r)??-1;e.anchors&&c>=0?(S(d,e.anchors[3*c],e.anchors[3*c+1],e.anchors[3*c+2]),A(d,d,i),z(d,s,d,o),t[a]=d[0],t[a+1]=d[1],t[a+2]=u.getAltitude(d)):(this._collection.getComponentAabb(e.objectHandle,r,h,!0),S(d,(h[0]+h[3])/2,(h[1]+h[4])/2,h[2]),V(d,d,l.rotationScale),A(d,d,l.position),t[a+2]=u.getAltitude(d),z(d,n,d,o),t[a]=d[0],t[a+1]=d[1])}return t})(),_=i.offset,f=e.elevationOffsets,p=(e,t)=>{const i=c?m[3*e+2]:0;f[e]=_+(t??0)-i};r.getElevations(m,g,p),e.updateGeometryElevationRange(),this.notifyChange("elevationRange")}_ensureElevationTask(){return null!=this._elevationTask||(this._elevationTask=new Re(this.view.resourceController.scheduler,e=>this._controller.updateElevationChanged(e,this.view.groundView.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:Te(),s=t.some(({name:e})=>"uvRegion"===e),r=t.some(({name:e})=>"normalCompressed"===e),o=Dt(i);return{geometryParameters:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=e=>{this._gpuMemoryEstimate-=e,this._texMemoryEstimate-=e,s.memory-=e},n=t.map(t=>He(t,e,i,r,this._compressionTracker,o));this._stage.addTextures(n);const{materialParameters:a,texturePromise:l}=Ne(e,n,t,this.view.stage.renderView.textures,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR,isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference,applySSAO:this._applySSAO});return{textures:n,texturePromise:l,materialParameters:a}}_getGeometryParameters(e){return new ft(this._hasVertexColors,e.hasNormals,e.hasTexture?e.hasRegions?2:1:0)}_addData(e,t,i){let s=this._addTasks.get(e.index);if(s)s.attributeInfo=t;else{const r=Promise.withResolvers();s=new Ut(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.layer.spatialReference,i=Q();this._renderClippingArea=at(this.view.clippingArea,i,e)?i:null;const s=Q();this._layerClippingArea=at(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=Yt(this._nodeId2Meta.values()),this._filteredIdCounts=Yt(this._nodeId2Meta.values(),1),this._weaklyRemovedIdCounts=Yt(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,Jt(this._featureIdCounts,e.featureIds,t),Jt(this._filteredIdCounts,e.filteredIds,t),Jt(this._weaklyRemovedIdCounts,e.weaklyRemovedIds,t))}_updateFilteredIdCounts(e,t,i){this._filteredIdCounts&&(this._needFilterResolve=!0,Jt(this._filteredIdCounts,t,-1),Jt(this._filteredIdCounts,e.filteredIds,1),Jt(this._weaklyRemovedIdCounts,i,-1),Jt(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=Yt(this._nodeId2Meta.values());n(this._featureIdCounts,t)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _featureIdCounts",{layerView:this,counts:this._featureIdCounts,expected:t});const i=Yt(this._nodeId2Meta.values(),1);n(this._filteredIdCounts,i)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _filteredIdCounts",{layerView:this,counts:this._filteredIdCounts,expected:i});const s=Yt(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))}}_(e,this._mismatchShow)&&_(t,this._mismatchHide)||(this._mismatchShow=e,this._mismatchHide=t,this._nodeId2Meta.forEach(e=>{if(!e?.filteredIds)return;const t=Qt(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.layer.objectIdField,l=t.featureIds,d=t.attributeInfo?.attributeData;s.every(e=>e===a||null!=d?.[e])&&ze(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 L(e.node.serviceMbsInIndexSR,this._controller.crsIndex,At,this.view.renderSpatialReference),$e(t,At)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,Ot),K(Ot,St),J(i,St)}_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(jt,i,t.objectHandle);ze(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){kt(r,this.getNodeOpacity(e))}return o.updateAllComponentMaterials(i,r,this.slicePlaneEnabled,t).catch(e=>this._logEdgeViewError(e,this.layer.title)),o.updateObjectVisibility(i,!0).catch(e=>this._logEdgeViewError(e,this.layer.title)),o.updateAllVerticalOffsets(i,e.elevationOffsets).catch(e=>this._logEdgeViewError(e,this.layer.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=Kt(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=Qt(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.layer.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&&i.objectHandle.updateMaterial({polygonOffset:0===t?1:0})}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=We(this._rendererVersion,1),this._controller?.requestUpdate()}_getInvalidRendererVersion(){return We(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=We(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.layer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await ce()),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=de(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 ue))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=Ke(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?oe(this.layer.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.layer.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=ie(e.featureIds.length*e.cachedSymbologyStride));const d=new et,h=this.fullOpacity,c=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):h;let u=null,g=1,m=Qe,_=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=ae(this._colorVariable,t,{color:Ft,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=le(this._opacityVariable,t,{arcade:this._arcade}))}if(r?.material){const e=r.material;h=null==h||null==p?Me(h,p,e.color,e.alpha,Mt,d.color):Me(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||(m={...d.edgeMaterial,opacity:c,objectTransparency:t},u=d.edgeMaterial,g=t),e.cachedEdgeMaterials[f]=m}else e.cachedEdgeMaterials[f]=Qe;e.cachedSymbology[_++]=Math.round(255*h[0]),e.cachedSymbology[_++]=Math.round(255*h[1]),e.cachedSymbology[_++]=Math.round(255*h[2]),e.cachedSymbology[_++]=Math.round(255*h[3]),e.cachedSymbology[_++]=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||kt(t,this.fullOpacity);const i=e.filteredIds;if(null==i){return{hasEdges:t.some(e=>e!==Qe),perFeatureEdgeMaterials:t}}let s=0,r=!1;const o=t.map((t,o)=>e.featureIds[o]!==i[s]?Qe:(r=r||t!==Qe,s++,t));return{hasEdges:r,perFeatureEdgeMaterials:o}}_updateComponentData(e){if(!this._hasComponentData)return;const{objectHandle:t}=e,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.updateObjectOpacity(t.objectHandle,e),kt(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))})}_updateMaterial(e){e.objectHandle.updateMaterial({slicePlaneEnabled:this.slicePlaneEnabled,usePBR:this._usePBR})}_updateEngineObject(e){this._updateComponentData(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,2)}intersect(e,t,i,s){this._intersectionHandler.intersectRay(e,t,i,s,null,!1)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),null!=this._labeler&&(this._labeler.slicePlaneEnabled=e),this._foreachMeta(t=>{t.objectHandle.updateMaterial({slicePlaneEnabled:e}),this._updateEdgeRendering(t,!1)})}_updatePBR(e){this._foreachMeta(t=>t.objectHandle.updateMaterial({usePBR:e})),this._hasLoadedPBRTextures=!0}_foreachMeta(e){this._nodeId2Meta.forEach(t=>{null!=t&&e(t)})}get _usePBR(){return this._imShading&&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)?0:e(t,i,s):e}_forAllFeatures(e,t,i){for(const s of this._nodeId2Meta.values())if(!(null==s||t&&s.node.serviceMbsInIndexSR&&1===t(s.node.serviceMbsInIndexSR)))switch(i){case 1:this._forAllFeaturesOfNode(s,e);break;case 0:this._forAllVisibleFeaturesOfNode(s,e);break;case 2:this._forAllQueryableFeaturesOfNode(s,e)}}_forAllFeaturesOfNode(e,t){e.featureIds.forEach((i,s)=>t(i,s,e))}_forAllVisibleFeaturesOfNode(e,t){const i=e.featureIds;this._collection.forEachVisibleComponent(e.objectHandle,s=>0===t(i[s],s,e))}_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;if(3===s)return this._forAllFeaturesOfNode(e,i);const r=e.featureIds,o=e.objectHandle,n=Je(this._renderClippingArea,this._collection.getObjectTransform(o));for(let a=0;a<r.length;a++)this._boundingRectFeatureTest(e,a,n)&&i(r[a],a,e)}_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=it(e);if(0===s.length)return st;const r=vt(t),o=s[0]instanceof i?this._featureIdsFromGraphics(s):"number"==typeof s[0]?s:null;if(!o)return st;const n=this._ensureHighlights(),{set:a,handle:l}=n.acquireSet(r);return n.setFeatureIds(a,o),l}_featureIdsFromGraphics(e){const t=this.layer.fieldsIndex,i=this._getObjectIdField();return e.map(e=>tt(t,e.attributes,i))}_ensureHighlights(){return this._highlights??=new xe({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,1),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._highlights}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 me(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 fe(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.getObjectOpacity(e.objectHandle):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.updateObjectOpacity(e.objectHandle,t),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(null==this._edgeView||!e.cachedEdgeMaterials)return;kt(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t).catch(e=>this._logEdgeViewError(e,this.layer.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};be(t);const r=new Float64Array(s.buffer);e.forAll((e,t)=>{const i=r[t],s=ve(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)=>{A(e,e,i),this.view.renderCoordsHelper.worldUpAtPosition(e,a),A(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([p()],te.prototype,"_hasLoadedPBRTextures",void 0),e([p()],te.prototype,"_asyncModuleLoading",void 0),e([p()],te.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([p()],te.prototype,"view",void 0),e([p()],te.prototype,"layer",void 0),e([p()],te.prototype,"_controller",void 0),e([p()],te.prototype,"_labeler",void 0),e([p()],te.prototype,"updating",void 0),e([p()],te.prototype,"suspended",void 0),e([p()],te.prototype,"contentVisible",null),e([p({readOnly:!0})],te.prototype,"legendEnabled",null),e([p(ht)],te.prototype,"updatingProgress",void 0),e([p()],te.prototype,"updatingProgressValue",null),e([p()],te.prototype,"hasTexturesOrVertexColors",null),e([p()],te.prototype,"rendererTextureUsage",null),e([p()],te.prototype,"elevationOffset",null),e([p()],te.prototype,"elevationInfo",null),e([p({type:Boolean})],te.prototype,"slicePlaneEnabled",void 0),e([p()],te.prototype,"supportedTextureEncodings",null),e([p({type:[ne]})],te.prototype,"_modifications",void 0),e([p({readOnly:!0})],te.prototype,"clientGeometry",null),e([p()],te.prototype,"elevationRange",null),e([p()],te.prototype,"fullExtent",null),e([p()],te.prototype,"_elevationTask",void 0),e([p({readOnly:!0})],te.prototype,"_usePBR",null),te=e([y("esri.views.3d.layers.I3SMeshView3D")],te),te},Ot=$(),St=Q(),jt=Q(),Vt=new lt,Ft=new t([0,0,0,0]),At=new te(0,0,0,0);function Dt(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 Tt(e){return"geometryData"in e}function Ht(e){return null!=e&&f(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&&f(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=Vt,e.serviceMbsInIndexSR?(t.setCenter(e.serviceMbsInIndexSR.center),t.setHalfSizeFromValues(e.serviceMbsInIndexSR.radius,e.serviceMbsInIndexSR.radius,e.serviceMbsInIndexSR.radius)):t.invalidate());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 Ut{constructor(e,t,i){this.attributeInfo=e,this.meta=t,this.promise=i,this.allowMemCache=!0}}function kt(e,t){e.forEach(e=>e.opacity=t)}class Gt{constructor(e,t){this.mode=e,this.offset=t}}const Lt=H(),Bt=$(),qt="elevation-change",zt="",$t="@null",Wt="@ECEF";function Kt(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 Qt(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 Jt(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 Yt(e,t=0){const i=new Map;for(const s of e){Jt(i,0===t?s?.featureIds:1===t?s?.filteredIds:s?.weaklyRemovedIds,1)}return i}const Xt=H();export{Et as I3SMeshView3D};
|
|
2
|
+
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}from"../../../core/promiseUtils.js";import{initial as u,watch as g}from"../../../core/reactiveUtils.js";import{schedule as m}from"../../../core/scheduling.js";import{equals as _}from"../../../core/SetUtils.js";import{isArrayBuffer as f}from"../../../core/typedArrayUtil.js";import{property as p,subclass as y}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as b,exactEquals as v,invert as I}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as C,IDENTITY as M}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{multiply as x,getTranslation as w}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{clone as E,create as R}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as O}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{set as S,transformMat4 as j,transformMat3 as V,sub as F,add as A,scale as D,subtract as T}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as H}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as N}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as P}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as U}from"../../../core/support/UpdatingHandles.js";import{getSphericalPCPF as k}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{localLinearScaleFactors as G}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectBoundingSphere as L}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{create as $,fromBuffer as W,toRect as K}from"../../../geometry/support/aaBoundingBox.js";import{create as Q,intersects as J}from"../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as Y,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{Sphere as te}from"../../../geometry/support/sphere.js";import{newUByteArray as ie}from"../../../geometry/support/UByteArray.js";import{fallbackObjectIDAttribute as se}from"../../../layers/LayerConstants.js";import re from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as oe}from"../../../layers/support/fieldUtils.js";import{I3SExtractChanges as ne}from"../../../layers/support/I3SExtractChanges.js";import ae from"../../../layers/support/SceneModification.js";import{getColor as le,getOpacity as de}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{isBasemapLayerView as he}from"../../../support/basemapUtils.js";import{getElevationOffset as ce}from"../../../support/elevationInfoUtils.js";import{loadArcade as ue}from"../../../support/loadArcade.js";import ge from"../../../symbols/MeshSymbol3D.js";import me from"../../../symbols/SimpleFillSymbol.js";import{ContentGeometryUpdateEvent as _e}from"./ContentGeometryLayerView.js";import fe from"./I3SMeshViewLabeler.js";import{I3SMeshViewPerformanceInfo as pe}from"./I3SMeshViewPerformanceInfo.js";import{initialize as ye,setModificationsSync as be,filterObbsForModificationsSync as ve,interpretObbModificationResults as Ie}from"./SceneLayerWorker.js";import{SceneLayerWorkerHandle as Ce,toWasmModification as Me}from"./SceneLayerWorkerHandle.js";import{overrideColor as xe}from"./graphics/graphicUtils.js";import{areLabelsVisible as we}from"./graphics/Labeler.js";import Ee from"./i3s/Highlights.js";import{I3SAsyncElevationUpdater as Re}from"./i3s/I3SAsyncElevationUpdater.js";import{getCachedAttributeValue as Oe}from"./i3s/I3SBinaryReader.js";import{I3SCrossfadeHelper as Se,NodeCrossfadeMetaData as je}from"./i3s/I3SCrossfadeHelper.js";import{boundingBoxCornerPoints as Ve}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as Fe,TraversedIntersectionNode as Ae}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as De,selectEncoding as Te,defaultMaterial as He,createTexture as Ne,configureMaterial as Pe}from"./i3s/I3SMaterialUtil.js";import{I3SOverrides as Ue}from"./i3s/I3SOverrides.js";import{computeGlobalTransformation as ke}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as Ge,checkSceneLayerValid as Le,checkSceneLayerCompatibleWithView as Be,whenGraphicAttributes as qe,computeVisibilityObb as ze,filterInPlace as $e,intersectBoundingRectWithMbs as We,addWraparound as Ke,getSymbolInfo as Qe,transparentEdgeMaterial as Je,getClipRect as Ye}from"./i3s/I3SUtil.js";import{IDBCache as Xe}from"./i3s/IDBCache.js";import{IDBMockCache as Ze}from"./i3s/IDBMockCache.js";import{LayerElevationProvider as et}from"./i3s/LayerElevationProvider.js";import{SymbologyInfo as tt}from"./i3s/SymbologyInfo.js";import{attributeLookup as it}from"./support/attributeUtils.js";import{normalizeHighlightTarget as st,emptyHighlightHandle as rt}from"./support/highlightUtils.js";import{makeScheduleFunction as ot}from"./support/makeScheduleFunction.js";import{debugFlags as nt}from"../support/debugFlags.js";import{ElevationRange as at}from"../support/ElevationRange.js";import{toBoundingRect as lt}from"../support/extentUtils.js";import{Obb as dt,ensurePackedObbData as ht}from"../support/orientedBoundingBox.js";import{updatingProgress as ct}from"../support/updatingProperties.js";import{glLayout as ut}from"../support/buffer/glUtil.js";import{ObjectParameters as gt}from"../webgl-engine/collections/Component/ObjectParameters.js";import{createVertexBufferLayout as mt,ComponentGeometryParameters as _t,SourceGeometry as ft,VertexBufferLayoutCreationParameters as pt}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as yt}from"../webgl-engine/collections/Component/Transform.js";import{emissiveStrengthDefault as bt}from"../webgl-engine/core/shaderLibrary/output/getEmissions.glsl.js";import{loadBasisTranscoder as vt}from"../webgl-engine/lib/BasisUtil.js";import{getHighlightName as It}from"../../support/highlightOptionsUtils.js";import{TextureCompressionTracker as Ct}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as Mt}from"../../../webscene/support/AlphaCutoff.js";const xt=[1,1,1,1];class wt extends je{constructor(e,t,i,s,r,o,n,a,l,d,h){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._elevationAlignmentRange=new at,this._geometryElevationRange=new at,this.cachedElevationAnchors=null,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbologyStride=5,this.elevationAlignmentOffset=0,this._baseGeometryElevationRange=new at(d,h),this.updateGeometryElevationRange()}get geometryElevationRange(){return this._geometryElevationRange}updateGeometryElevationRange(){const e=this._baseGeometryElevationRange;if(!e.elevationRangeValid||e.isEmpty)return this._elevationAlignmentRange.invalidateElevationRange(),void this._geometryElevationRange.invalidateElevationRange();const t=this.elevationOffsets;if(!t||0===t.length){const t=this.elevationAlignmentOffset;return this._elevationAlignmentRange.setElevationRangeValues(t,t),void this._geometryElevationRange.setElevationRangeValues(e.minElevation+t,e.maxElevation+t)}let i=1/0,s=-1/0;for(let r=0;r<t.length;++r){const e=this.elevationAlignmentOffset+(t[r]??0);i=Math.min(i,e),s=Math.max(s,e)}this._elevationAlignmentRange.setElevationRangeValues(i,s),this._geometryElevationRange.setElevationRangeValues(e.minElevation+i,e.maxElevation+s)}get usedMemory(){return this.node.memory}get featureExtents(){return this._featureExtents??=new Float64Array(6*this.featureIds.length).fill(Number.POSITIVE_INFINITY),this._featureExtents}}const Et=28,Rt=104857600,Ot=t=>{const f=t;let te=class extends f{constructor(){super(...arguments),this._extractChanges=null,this._applySSAO=!0,this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._updatingHandles=new U,this._highlights=null,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._snappingSourcesTrackers=[],this._compressionTracker=new Ct,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._meshUtilsImporterModule=null,this._meshUtilsImporterPromise=null,this._planetRadiusInGlobalMode=0,this._elevationTask=null,this._needFilterResolve=!1,this._filters=[],this._arcade=null,this._tmpAttributeOnlyGraphic=new i,this._crossfadeHelper=new Se(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get extractChanges(){return this._extractChanges?.layer!==this.layer&&(this._extractChanges?.destroy(),this._extractChanges=new ne({layer:this.layer})),this._extractChanges}get layerViewUid(){return this.uid}get layerId(){return this.layer.id}get sublayerId(){return null}get _isIntegratedMesh(){return"integrated-mesh"===this.layer.type}get contentVisible(){return!this.suspended&&this._controller?.rootNodeVisible&&this.fullOpacity>Mt}get legendEnabled(){return this.contentVisible&&!0===this.layer?.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:53:this._usePBR||this._hasLoadedPBRTextures?44:36}get elevationOffset(){const e=this.layer?.elevationInfo;return"absolute-height"===e?.mode?ce(e,this.layer.spatialReference):0}get elevationInfo(){const e=this.layer?.elevationInfo;switch(e?.mode){case"absolute-height":return new Lt(0,ce(e,this.layer.spatialReference));case"relative-to-ground":return new Lt(1,ce(e,this.layer.spatialReference));case"on-the-ground":return new Lt(2,0);default:return new Lt(0,0)}}get supportedTextureEncodings(){return De(this.view.stage.renderView.capabilities)}get clientGeometry(){return this.i3sOverrides.geometryOverrides}get elevationRange(){const e=this._nodeId2Meta,t=new at;for(const i of e.values()){const e=i?.geometryElevationRange;e?.elevationRangeValid&&!e.isEmpty&&t.expandElevationRange(e)}return t.elevationRangeValid&&!t.isEmpty?t:null}get fullExtent(){return this.layer.fullExtent}initialize(){const e=has("enable-feature:idb-mock-cache");this._idbCache=e?new Ze(this.view,e):new Xe("esri-scenelayer-cache","geometries"),this._preLoadBasis(),this.addResolvingPromise(this.layer.indexInfo);const t=this.view.resourceController,i=t.memoryController;this.i3sOverrides=new Ue({view:this.view,layer:this.layer,memoryController:i,extractChanges:this.extractChanges}),this._workerHandle=new Ce(ot(t)),this.addResolvingPromise(this._workerHandle.promise),Le(this.layer),Be(this.layer,this.view);const s=this.layer.store.defaultGeometrySchema;if(this.addResolvingPromise(this._workerHandle.setLegacySchema(this.uid,s).catch(d)),this._layerUrl=this.layer.parsedUrl.path,this._controller=new re({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,this._isIntegratedMesh||!s)this._hasComponentData=!1;else{const e=s.featureAttributes;this._hasComponentData=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=(s?.vertexAttributes.color??null)&&!this.layer.cachedDrawingInfo?.color;const r=this.view.resourceController.memoryController.newCache(`sl-${this.uid}`,e=>this._deleteComponentObject(e));this._memCache=r;const n=this._controller,l=this._nodeId2Meta,h=this._nodeId2MetaReloading;function*c(e){const t=n.index;if(!t)return;const i=t.rootNode;if(!i)return;let s=null;for(const r of t.traverseValues(i,t=>{const i=l.get(t.index)||h.get(t.index);return s=i?.objectHandle??null,e(t,s)}))yield new Ae(r,s)}this._intersectionHandler=new Fe({layerViewUid:this.layerViewUid,sublayerId:this.sublayerId,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:c}),this._elevationProvider=new et({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR,this._updatingHandles.add(()=>this.view.clippingArea,()=>this._clippingAreaChanged(),u),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),u),this._updatingHandles.add(()=>!this.suspended&&0!==this.elevationInfo.mode,(e,t)=>{e?this.addHandles(this.view.groundView.on("elevation-change",({extent:e})=>this._ensureElevationTask().addExtent(e)),zt):t&&this.removeHandles(zt)},u),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),u),this._updatingHandles.add(()=>this.layer.labelsVisible,()=>this._labelingChanged(),u),this._updatingHandles.add(()=>this.layer.labelingInfo,()=>this._labelingChanged(),u),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),u),this.addHandles([g(()=>nt.I3S_TREE_SHOW_TILES,e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then(({I3STreeDebugger:t})=>{!this._treeDebugger&&nt.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))})}else e||nt.I3S_TREE_SHOW_TILES||(this._treeDebugger=a(this._treeDebugger))},u),g(()=>nt.I3S_SHOW_MODIFICATIONS,()=>this._showModifications(),u)]),this._cacheKeySuffix=this._getCacheKeySuffix(),this._idbCache.init().catch(e=>o.getLogger(this).warn(`Failed to initialize IndexedDB cache: ${e}`));const{view:_}=this,{viewingMode:f,renderCoordsHelper:p}=_;this._planetRadiusInGlobalMode="local"===f?0:p.referenceEllipsoid.radius}destroy(){this._clearAddTasks(),this._elevationTask=a(this._elevationTask),this.i3sOverrides=a(this.i3sOverrides),this._extractChanges=a(this._extractChanges),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(!(we(this.layer)&&this._supportsLabeling))return void(null!=this._labeler&&(this._labeler.destroy(),this._labeler=null));if(null!=this._labeler)return;const e=new fe({view:this.view,layer:this.layer,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=ye().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.layer.spatialReference,s=i.isGeographic,r=Me(this._layerClippingArea,this._modifications,i,this.view.state.isGlobal);this._workerHandle.setModifications(t,r,s).catch(e);try{be({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),!nt.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.layer.spatialReference;const o=new me({...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.layer.textureSetDefinitions?.some(e=>e.formats.some(e=>"basis"===e.format||"ktx2"===e.format))&&vt()}_getVertexBufferLayout(e,t){return ut(mt(this._getGeometryParameters({hasTexture:Tt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion})))}_getObjectIdField(){return this.layer.objectIdField||se}_getGlobalIdField(){return this.layer.globalIdField}_findGraphicNodeAndIndex(e){const t=it(this.layer.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.layer.fieldsIndex;for(const n of t){const e=it(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=Ve(t,this._collection,s,Y(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 qe(this.layer,e,this._getObjectIdField(),t,()=>this._nodeId2Meta.values().filter(r).toArray())}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?this._meshUtilsImporterModule?(s.geometry=this._meshUtilsImporterModule.createMesh({layerView:this,nodeIndex:e.nodeIndex,featureIndex:e.componentIndex}),s):t.defer?(t.defer(async()=>(s.geometry=(await this._meshUtilsImporter).createMesh({layerView:this,nodeIndex:e.nodeIndex,featureIndex:e.componentIndex}),s)),null):s:null}_getCacheKey(e){return`${this._layerUrl}/v${Et}/${e}${this._cacheKeySuffix}`}get _meshUtilsImporter(){return this._meshUtilsImporterPromise||(this._meshUtilsImporterPromise=import("./i3s/meshUtils.js"),this._meshUtilsImporterPromise.then(e=>this._meshUtilsImporterModule=e,()=>{})),this._meshUtilsImporterPromise}_getCacheKeySuffix(){const e=this.view.renderSpatialReference;if(null==e)return Wt;if(e===k(e))return Kt;return this.layer.spatialReference.equals(e)?$t: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=Te(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=dt.fromData(s.geometryObbData)),this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then(i=>(i&&this._idbCache.initialized&&null!=s.textureData&&(s.byteSize=Pt(s.transformedGeometry,s.textureData),s.textureData.every(Nt)&&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 Ht(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);const{obb:r,componentOffsets:n,featureIds:a,anchorIds:l,anchors:d,transformedGeometry:h,geometryMinElevation:c,geometryMaxElevation:u}=s;e.hasModifications=h.hasModifications;const g=X(s.globalTrafo),m=S(Bt,r.center.x,r.center.y,r.center.z);j(m,m,g);const _=new dt(m,[r.extents.x,r.extents.y,r.extents.z],O(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 f={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:h,globalTrafo:g,geometryObbData:_.data,geometryMinElevation:c,geometryMaxElevation:u,byteSize:Pt(h,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&this._indexedDbSizeCheck(e,f)){const t=null!=f.textureData?f.textureData.map(e=>Nt(e)?e:null):null;this._idbCache.put(this._getCacheKey(e.id),{...f,textureData:t}).catch(t=>o.getLogger(this).warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`))}return this._addCachedNodeData(e,f,i)},i))):Promise.reject()}getElevationRange(e){const t=new at,i=this._controller,{index:s}=i;if(!s)return t;const{rootNode:r}=s;if(!r)return t;const o=this._nodeId2Meta,n=i.viewportQueries,a=i=>{const{childrenLoaded:s}=i;if(0===s)return!1;const r=n.getAndUpdateVisibilityObbInRenderSR(i);let a=null;if(r){if(!r.intersectSphereWithMBS(e,r.radius))return!1}else if(a=n.calculateServiceMbsInRenderSRElevationAdjusted(i),a?.isValid&&!e.intersects(a))return!1;const l=o.get(i.index);if(l){const{geometryObbInRenderSR:s}=i;if(!s||s.intersectSphereWithMBS(e)){const e=l.geometryElevationRange;e.elevationRangeValid&&!e.isEmpty&&t.expandElevationRange(e)}}return s-(l?1:0)>0};return s.traverse(r,a),t}computeVisibilityObb(e){return ze(e,this.view.renderSpatialReference,this._controller.crsIndex,this.layer.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.layer.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=ke(a,l,n,d,c),g=q(d,h),m=q(h,c);if(null==g||null==m)return Promise.resolve(null);const _={context:this.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,globalTrafo:u,geometryElevationOffset:l,mbs:a.toJSON(),obbData:e.serviceObbInIndexSR?.data,elevationOffset:l,planetRadiusInGlobalMode:this._planetRadiusInGlobalMode,needNormals:this._controller.isMeshPyramid||this._imVertexNormals,computeNormals:this._isIntegratedMesh&&this._imVertexNormals,normalReferenceFrame:n,indexToVertexProjector:g,vertexToRenderProjector:m};return this._workerHandle.invoke(_,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);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,!0),this._updateElevationOffsets(t),null!=this._labeler&&this._addMetaToLabeler(this._labeler,t),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 vt(),e.memory=0;const{componentOffsets:l,geometries:d,featureIds:h,anchorIds:c,anchors:u}=r,g=this._collection,m=d[0],{layout:_,indices:f,interleavedVertexData:p,positionData:y,hasColors:O}=n,{material:S,geometryParameters:j}=this._materialParameters(m,_),A=p.byteLength/_[0].stride,D=l||new Uint32Array([0,f?f.length:A]),T=m.transformation?E(m.transformation):R(),N=X(t.globalTrafo);x(T,N,T);const U=w(H(),T),k=b(C(),T),L=this._isIntegratedMesh?this._imShading?2:0:1,B=j.textureCoordinateType,q=!v(k,M),$=new _t(_,L,B,q?1:0),W=new ft({interleavedVertexData:p,vertexCount:A,indexData:f},{positions:Z(y.data),indices:ee(y.indices)},D,$),K=this.view.renderSpatialReference,Q=this.view.groundView.spatialReference,J=dt.fromData(ht(t.geometryObbData)).getCenter(Zt),Y=[1,1,1];G(J,K,Y,Q)||o.getLogger(this).errorOnce("Unsupported coordinate system for IM overlay");const te=H();z(J,K,te,Q);const ie=C();I(ie,k);const se=H();V(se,F(se,J,U),ie);const re=te[0]-se[0]*Y[0],oe=te[1]-se[1]*Y[1],ne=2===j.textureCoordinateType,{textures:ae,texturePromise:le,materialParameters:de}=this._initMaterialAndTextures(S,a,ne,e),he=g.createObject(new gt(P(re,oe,Y[0],Y[1]),new yt(U,k),dt.fromData(ht(t.geometryObbData)),W,!this._isIntegratedMesh),de);e.memory+=this._memEstimateGeometryAdded(he),e.memory+=ae.reduce((e,t)=>e+(null!=t?this._memEstimateTextureAdded(t):0),0);const ce=!!S.hasParametersFromSource,ue="blend"!==S.alphaMode&&S.metallicRoughness.baseColorFactor[3]>=1,ge=new wt(e,h,he,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:ce,isOpaque:ue},ae,c,u,t.geometryMinElevation,t.geometryMaxElevation);s.meta=ge,this._hasTextures||=t.requiredTextures?.some(({usage:e})=>!!(19&e))||!!e.resources.texture,this._hasData=!0,this._hasColors||=O,this.notifyChange("hasTexturesOrVertexColors");const me=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(ge),le]).then(([t,s])=>(this._addTasks.has(e.index)&&t?.updateObjectVisibility(ge.objectHandle,!1).catch(e=>this._logEdgeViewError(e,this.layer.title)),this._safeReschedule(()=>{const i=this._addTasks.get(e.index);if(!i)return;if(this._addNodeMeta(e.index,ge),i.meta=null,!this.contentVisible)return void this._removeNodeStageData(e.index,this.elevationOffset);g.setObjectVisibility(he,!0),t?.updateObjectVisibility(ge.objectHandle,!0).catch(e=>this._logEdgeViewError(e,this.layer.title)),ge.attributeInfo=i.attributeInfo;const s=ge.cachedRendererVersion!==this._rendererVersion,r=me!==this.slicePlaneEnabled;this._updateElevationOffsets(ge);const o=ge.elevationOffsets;this._updateComponentData(ge);const n=this._applyFiltersToNode(ge);(s||null!=t&&(r||n||o))&&this._addOrUpdateEdgeRendering(ge),null!=this._labeler&&this._addMetaToLabeler(this._labeler,ge),this._visibleGeometryChanged(ge,0),this._highlights?.objectCreated(ge),this._updateMaterial(ge),this._setNewNodeOpacity(ge),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&&Gt(t.cachedEdgeMaterials,0),this._updateFeatureIdCounts(t,1)),this._nodeId2Meta.set(e,t),this.notifyChange("elevationRange")}_updateElevationOffsets(e){if(!e.node.serviceMbsInIndexSR)return;const{view:t,elevationInfo:i}=this,s=this._controller.crsIndex,{groundView:r,groundSpatialReference:o,renderSpatialReference:n}=t,a=i.mode;if(0===a)return e.elevationAlignmentOffset=i.offset,e.elevationOffsets=null,e.updateGeometryElevationRange(),void this.notifyChange("elevationRange");if(e.elevationAlignmentOffset=0,null==n||null==o)return e.elevationOffsets=null,e.updateGeometryElevationRange(),void this.notifyChange("elevationRange");const l=this._collection.getObjectTransform(e.objectHandle);e.elevationOffsets=e.elevationOffsets??[];const d=Bt,h=qt,c=2===a,u=this.view.renderCoordsHelper,g=e.featureIds.length,m=(()=>{if(e.cachedElevationAnchors)return e.cachedElevationAnchors;const t=Y(3*g);e.cachedElevationAnchors=t;const{center:i}=e.node.serviceMbsInIndexSR;for(let r=0;r<g;r++){const a=3*r,c=e.anchorIds?.indexOf(r)??-1;e.anchors&&c>=0?(S(d,e.anchors[3*c],e.anchors[3*c+1],e.anchors[3*c+2]),A(d,d,i),z(d,s,d,o),t[a]=d[0],t[a+1]=d[1],t[a+2]=u.getAltitude(d)):(this._collection.getComponentAabb(e.objectHandle,r,h,!0),S(d,(h[0]+h[3])/2,(h[1]+h[4])/2,h[2]),V(d,d,l.rotationScale),A(d,d,l.position),t[a+2]=u.getAltitude(d),z(d,n,d,o),t[a]=d[0],t[a+1]=d[1])}return t})(),_=i.offset,f=e.elevationOffsets,p=(e,t)=>{const i=c?m[3*e+2]:0;f[e]=_+(t??0)-i};r.getElevations(m,g,p),e.updateGeometryElevationRange(),this.notifyChange("elevationRange")}_ensureElevationTask(){return null!=this._elevationTask||(this._elevationTask=new Re(this.view.resourceController.scheduler,e=>this._controller.updateElevationChanged(e,this.view.groundView.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:He(),s=t.some(({name:e})=>"uvRegion"===e),r=t.some(({name:e})=>"normalCompressed"===e),o=Tt(i);return{geometryParameters:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=e=>{this._gpuMemoryEstimate-=e,this._texMemoryEstimate-=e,s.memory-=e},n=t.map(t=>Ne(t,e,i,r,this._compressionTracker,o));this._stage.addTextures(n);const{materialParameters:a,texturePromise:l}=Pe(e,n,t,this.view.stage.renderView.textures,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR,isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference,applySSAO:this._applySSAO});return{textures:n,texturePromise:l,materialParameters:a}}_getGeometryParameters(e){return new pt(this._hasVertexColors,e.hasNormals,e.hasTexture?e.hasRegions?2:1:0)}_addData(e,t,i){let s=this._addTasks.get(e.index);if(s)s.attributeInfo=t;else{const r=Promise.withResolvers();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.layer.spatialReference,i=Q();this._renderClippingArea=lt(this.view.clippingArea,i,e)?i:null;const s=Q();this._layerClippingArea=lt(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=Xt(this._nodeId2Meta.values()),this._filteredIdCounts=Xt(this._nodeId2Meta.values(),1),this._weaklyRemovedIdCounts=Xt(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,Yt(this._featureIdCounts,e.featureIds,t),Yt(this._filteredIdCounts,e.filteredIds,t),Yt(this._weaklyRemovedIdCounts,e.weaklyRemovedIds,t))}_updateFilteredIdCounts(e,t,i){this._filteredIdCounts&&(this._needFilterResolve=!0,Yt(this._filteredIdCounts,t,-1),Yt(this._filteredIdCounts,e.filteredIds,1),Yt(this._weaklyRemovedIdCounts,i,-1),Yt(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=Xt(this._nodeId2Meta.values());n(this._featureIdCounts,t)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _featureIdCounts",{layerView:this,counts:this._featureIdCounts,expected:t});const i=Xt(this._nodeId2Meta.values(),1);n(this._filteredIdCounts,i)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _filteredIdCounts",{layerView:this,counts:this._filteredIdCounts,expected:i});const s=Xt(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))}}_(e,this._mismatchShow)&&_(t,this._mismatchHide)||(this._mismatchShow=e,this._mismatchHide=t,this._nodeId2Meta.forEach(e=>{if(!e?.filteredIds)return;const t=Jt(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.layer.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?Oe(d[i],e):null);try{return i.testFeature(n)}catch(t){return r(t),!1}})}_boundingRectNodeTest(e,t){return L(e.node.serviceMbsInIndexSR,this._controller.crsIndex,Dt,this.view.renderSpatialReference),We(t,Dt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,St),K(St,jt),J(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(Vt,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){Gt(r,this.getNodeOpacity(e))}return o.updateAllComponentMaterials(i,r,this.slicePlaneEnabled,t).catch(e=>this._logEdgeViewError(e,this.layer.title)),o.updateObjectVisibility(i,!0).catch(e=>this._logEdgeViewError(e,this.layer.title)),o.updateAllVerticalOffsets(i,e.elevationOffsets).catch(e=>this._logEdgeViewError(e,this.layer.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=Qt(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=Jt(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.layer.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&&i.objectHandle.updateMaterial({polygonOffset:0===t?1:0})}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=Ke(this._rendererVersion,1),this._controller?.requestUpdate()}_getInvalidRendererVersion(){return Ke(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=Ke(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.layer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await ue()),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=he(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 ge))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=Qe(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?oe(this.layer.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.layer.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=ie(e.featureIds.length*e.cachedSymbologyStride));const d=new tt,h=this.fullOpacity,c=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):h;let u=null,g=1,m=Je,_=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]]=Oe(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=le(this._colorVariable,t,{color:At,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=de(this._opacityVariable,t,{arcade:this._arcade}))}if(r?.material){const e=r.material;h=null==h||null==p?xe(h,p,e.color,e.alpha,xt,d.color):xe(h,p,null,null,xt,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]>=Mt,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||(m={...d.edgeMaterial,opacity:c,objectTransparency:t},u=d.edgeMaterial,g=t),e.cachedEdgeMaterials[f]=m}else e.cachedEdgeMaterials[f]=Je;e.cachedSymbology[_++]=Math.round(255*h[0]),e.cachedSymbology[_++]=Math.round(255*h[1]),e.cachedSymbology[_++]=Math.round(255*h[2]),e.cachedSymbology[_++]=Math.round(255*h[3]),e.cachedSymbology[_++]=d.colorMixMode|+d.castShadows<<4|+d.pickable<<5;const b=y?.emissive?.strength??bt;b===bt||e.emissiveStrengths||(e.emissiveStrengths=new Array(e.featureIds.length).fill(bt)),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||Gt(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{objectHandle:t}=e,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.updateObjectOpacity(t.objectHandle,e),Gt(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))})}_updateMaterial(e){e.objectHandle.updateMaterial({slicePlaneEnabled:this.slicePlaneEnabled,usePBR:this._usePBR})}_updateEngineObject(e){this._updateComponentData(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,2)}intersect(e,t,i,s){this._intersectionHandler.intersectRay(e,t,i,s,null,!1)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),null!=this._labeler&&(this._labeler.slicePlaneEnabled=e),this._foreachMeta(t=>{t.objectHandle.updateMaterial({slicePlaneEnabled:e}),this._updateEdgeRendering(t,!1)})}_updatePBR(e){this._foreachMeta(t=>t.objectHandle.updateMaterial({usePBR:e})),this._hasLoadedPBRTextures=!0}_foreachMeta(e){this._nodeId2Meta.forEach(t=>{null!=t&&e(t)})}get _usePBR(){return this._imShading&&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)?0:e(t,i,s):e}_forAllFeatures(e,t,i){for(const s of this._nodeId2Meta.values())if(!(null==s||t&&s.node.serviceMbsInIndexSR&&1===t(s.node.serviceMbsInIndexSR)))switch(i){case 1:this._forAllFeaturesOfNode(s,e);break;case 0:this._forAllVisibleFeaturesOfNode(s,e);break;case 2:this._forAllQueryableFeaturesOfNode(s,e)}}_forAllFeaturesOfNode(e,t){e.featureIds.forEach((i,s)=>t(i,s,e))}_forAllVisibleFeaturesOfNode(e,t){const i=e.featureIds;this._collection.forEachVisibleComponent(e.objectHandle,s=>0===t(i[s],s,e))}_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;if(3===s)return this._forAllFeaturesOfNode(e,i);const r=e.featureIds,o=e.objectHandle,n=Ye(this._renderClippingArea,this._collection.getObjectTransform(o));for(let a=0;a<r.length;a++)this._boundingRectFeatureTest(e,a,n)&&i(r[a],a,e)}_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]=Oe(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e,t){const s=st(e);if(0===s.length)return rt;const r=It(t),o=s[0]instanceof i?this._featureIdsFromGraphics(s):"number"==typeof s[0]?s:null;if(!o)return rt;const n=this._ensureHighlights(),{set:a,handle:l}=n.acquireSet(r);return n.setFeatureIds(a,o),l}_featureIdsFromGraphics(e){const t=this.layer.fieldsIndex,i=this._getObjectIdField();return e.map(e=>it(t,e.attributes,i))}_ensureHighlights(){return this._highlights??=new Ee({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,1),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._highlights}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 _e(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 pe(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.getObjectOpacity(e.objectHandle):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.updateObjectOpacity(e.objectHandle,t),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(null==this._edgeView||!e.cachedEdgeMaterials)return;Gt(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t).catch(e=>this._logEdgeViewError(e,this.layer.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=Ut(e);if(s){const t={context:i,buffer:s.buffer};ve(t);const r=new Float64Array(s.buffer);e.forAll((e,t)=>{const i=r[t],s=Ie(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)=>{A(e,e,i),this.view.renderCoordsHelper.worldUpAtPosition(e,a),A(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([p()],te.prototype,"extractChanges",null),e([p()],te.prototype,"_hasLoadedPBRTextures",void 0),e([p()],te.prototype,"_asyncModuleLoading",void 0),e([p()],te.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([p()],te.prototype,"view",void 0),e([p()],te.prototype,"layer",void 0),e([p()],te.prototype,"_controller",void 0),e([p()],te.prototype,"_labeler",void 0),e([p()],te.prototype,"updating",void 0),e([p()],te.prototype,"suspended",void 0),e([p()],te.prototype,"contentVisible",null),e([p({readOnly:!0})],te.prototype,"legendEnabled",null),e([p(ct)],te.prototype,"updatingProgress",void 0),e([p()],te.prototype,"updatingProgressValue",null),e([p()],te.prototype,"hasTexturesOrVertexColors",null),e([p()],te.prototype,"rendererTextureUsage",null),e([p()],te.prototype,"elevationOffset",null),e([p()],te.prototype,"elevationInfo",null),e([p({type:Boolean})],te.prototype,"slicePlaneEnabled",void 0),e([p()],te.prototype,"supportedTextureEncodings",null),e([p({type:[ae]})],te.prototype,"_modifications",void 0),e([p({readOnly:!0})],te.prototype,"clientGeometry",null),e([p()],te.prototype,"elevationRange",null),e([p()],te.prototype,"fullExtent",null),e([p()],te.prototype,"_elevationTask",void 0),e([p({readOnly:!0})],te.prototype,"_usePBR",null),te=e([y("esri.views.3d.layers.I3SMeshView3D")],te),te},St=$(),jt=Q(),Vt=Q(),Ft=new dt,At=new t([0,0,0,0]),Dt=new te(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 Ht(e){return"geometryData"in e}function Nt(e){return null!=e&&f(e.data)}function Pt(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&&f(s.data)&&(i+=s.data.byteLength);return i}function Ut(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,e.serviceMbsInIndexSR?(t.setCenter(e.serviceMbsInIndexSR.center),t.setHalfSizeFromValues(e.serviceMbsInIndexSR.radius,e.serviceMbsInIndexSR.radius,e.serviceMbsInIndexSR.radius)):t.invalidate());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 Gt(e,t){e.forEach(e=>e.opacity=t)}class Lt{constructor(e,t){this.mode=e,this.offset=t}}const Bt=H(),qt=$(),zt="elevation-change",$t="",Wt="@null",Kt="@ECEF";function Qt(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 Jt(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 Yt(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 Xt(e,t=0){const i=new Map;for(const s of e){Yt(i,0===t?s?.featureIds:1===t?s?.filteredIds:s?.weaklyRemovedIds,1)}return i}const Zt=H();export{Ot as I3SMeshView3D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{abortMaybe as i,destroyMaybe as r,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as a,createAbortError as o}from"../../../core/promiseUtils.js";import{initial as n,watch as l,when as c}from"../../../core/reactiveUtils.js";import{schedule as d}from"../../../core/scheduling.js";import{isUint8Array as h,isFloat32Array as m,isUint32Array as u,isUint16Array as p}from"../../../core/typedArrayUtil.js";import{unitFromRESTJSON as f,convertUnit as g}from"../../../core/units.js";import{property as y,subclass as b}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as _,invert as v}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as w,IDENTITY as C}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as T}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as x}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as j,sub as E,dot as M,set as R}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as O,freeze as S,clone as V,ZEROS as U,fromValues as P}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as H,clone as I,ONES as D}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as L,isMars as k,getReferenceEllipsoid as A,SphericalECEFSpatialReferenceLike as F}from"../../../geometry/ellipsoidUtils.js";import G from"../../../geometry/HeightModelInfo.js";import{computeTranslationToOriginAndRotation as z}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as B}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as N}from"../../../geometry/projection/projectVectorToVector.js";import{create as W}from"../../../geometry/support/aaBoundingRect.js";import{isCompatible as q}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as X,isWebMercator as $,equals as Z,isGeographic as Y,isCGCS2000 as J}from"../../../geometry/support/spatialReferenceUtils.js";import K from"../../../geometry/support/WKIDUnitConversion.js";import{BufferViewVec4u8 as Q,BufferViewVec3u8 as ee,BufferViewVec2f as te,BufferViewVec3f as ie,BufferViewUint32 as re,BufferViewUint16 as se}from"../../../geometry/support/buffer/BufferView.js";import{nullId as ae}from"../../../layers/ILyr3DWasmPerSceneView.js";import oe from"../../../layers/support/SceneModification.js";import{getHeightModelInfoFromVCS as ne,validateEntity3D as le,makeCacheKey as ce}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as de}from"../../../support/elevationInfoUtils.js";import{IntegratedMesh3DTilesLayerWorkerHandle as he}from"./IntegratedMesh3DTilesLayerWorkerHandle.js";import{LayerView3D as me}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as ue}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as pe,removeLayerViewFromWasm as fe,getLyr3DWasm as ge}from"./Lyr3DWasm.js";import{toWasmModification as ye}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as be}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as _e}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as ve,alphaModeConversion as we,faceCullingConversion as Ce,wrapModeConversion as Te}from"./support/lyr3dTypeConversions.js";import{makeScheduleFunction as xe}from"./support/makeScheduleFunction.js";import{Tiles3DMeshIntersectionHandler as je}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as Ee}from"../state/Frustum.js";import{ElevationRange as Me}from"../support/ElevationRange.js";import{toBoundingRect as Re}from"../support/extentUtils.js";import{Obb as Oe}from"../support/orientedBoundingBox.js";import{glLayout as Se}from"../support/buffer/glUtil.js";import{getGroundTransparencyModeFromOpacity as Ve}from"../terrain/TransparencyMode.js";import{ComponentGeometryParameters as Ue,SourceGeometry as Pe}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as He}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as Ie}from"../webgl-engine/core/material/RenderTexture.js";import{ManagedTexture as De}from"../webgl-engine/lib/ManagedTexture.js";import{compressNormals as Le}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as ke}from"../webgl-engine/materials/pbrUtils.js";import Ae from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Fe,isInEffectiveScaleRange as Ge,validateScaleRange as ze}from"../../support/layerViewUtils.js";import{TaskPriority as Be}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ne}from"../../support/TextureCompressionTracker.js";import{CompressedTextureFormat as We,SizedPixelFormat as qe}from"../../webgl/enums.js";import{alphaCutoff as Xe}from"../../../webscene/support/AlphaCutoff.js";var $e;function Ze(e,t,i){if("image/vnd-ms.dds"===t)switch(i){case"Dxt1":return We.COMPRESSED_RGB_S3TC_DXT1_EXT;case"Dxt5":return We.COMPRESSED_RGBA_S3TC_DXT5_EXT;default:return null}if("image/ktx"===t)return"Etc1"===i?We.COMPRESSED_RGB8_ETC2:null;switch(e){case 33319:return qe.RG8;case 6407:return qe.RGB8;case 6408:return qe.RGBA8;case 6403:return qe.R8;default:return null}}let Ye=class extends(me(Ae)){static{$e=_e}constructor(e){super(e),this[$e]=!0,this.type="integrated-mesh-3dtiles",this.freeze=!1,this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._initializationController=null,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new Ne,this._dbgFlags=new Set;const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._isUsedAsGroundLayer=e.layer.isUsedAsGroundLayer,this._frameTask=t.scheduler.registerTask(Be.TILES3D,this),this._frustum=new Ee(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{a(t);const i=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=i}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._workerHandle=new he(xe(e.resourceController)),this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),n),!this._canProjectWithoutEngine())throw Fe("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);this._initializationController=new AbortController;const t=pe(this,this._initializationController.signal).then(t=>{a(this._initializationController.signal),this._wasmLayerId=t,this._intersectionHandler=new je(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>this.view.overlayManager.renderer.isEmpty,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),n),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),n),this._elevationProvider=new be({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler});const i=this._replacesTerrain?0:1;e.elevationProvider.register(i,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([l(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),c(()=>this.fullOpacity,()=>this._opacityChange()),l(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),n),l(()=>this.freeze,e=>{e?this._wasm?.incrementFrozenLayerViewCount(this):(this._wasm?.decrementFrozenLayerViewCount(this),this._cameraChanged())})]),this._initializationController=null,this.addHandles(c(()=>this._replacesTerrain&&this._wasm?.isTerrainReady,()=>{this.layer.queryElevationCallback=(e,t)=>this._queryElevation(e,t)}))});this.addResolvingPromise(t)}destroy(){if(this.freeze=!1,this._initializationController=i(this._initializationController),this._dbg(2,"Tiles3DLayerView3D destroy() called"),this._workerHandle?.destroyContextAndSelf(this.uid),fe(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider){const e=Array.from(this._lyrHandleToObjects.values()),t=e.reduce((e,{componentObjects:t})=>e+t.length,0);this._elevationProvider.notifyObjectsChangedFunctional(t,t=>{for(const{componentObjects:i}of e)for(const{obb:e}of i)if(!t(e))return}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null}this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._frameTask.remove(),this._updatingHandles=r(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}get fullOpacity(){return this.layer.replacesTerrain?this.view.map.ground.opacity:1}get _groundTransparencyMode(){return this.layer.replacesTerrain?Ve(this.fullOpacity,this.view.overlayManager.renderer.isEmpty):0}get _renderOpacity(){switch(this._groundTransparencyMode){case 3:return 0;case 2:return Xe;default:return this.fullOpacity}}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const e=this._renderOpacity,t=this._groundTransparencyMode;this.forEachComponentObject(i=>this._collection.updateObjectOpacity(i,e,t))}_cameraChanged(){if(this.freeze)return;const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(r=>{const s=r.obb?.intersectsFrustum(e)??!1;s!==r.isVisible&&(r.isVisible=s,s?t.add(r):t.delete(r),r.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,s)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(s,r.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,r){this._intersectionHandler.intersectRay(e,t,i,r,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.useEsriCrs?this.layer.supportedSpatialReferences[1]:this.layer.supportedSpatialReferences[0],t=ye(this._layerClippingArea,this._modifications,e,this.view.state.isGlobal);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=W();this._layerClippingArea=Re(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=d(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,de(e))}get _wasm(){return ge(this.view)}_queryElevation(e,t){return this.destroying||this.destroyed?Promise.reject(o()):this._wasm?.queryElevation(this,e,t)??Promise.reject(o())}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get useEsriCrs(){return this._useEsriCrs}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||Ge(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||ze(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,r=0,s=0,a=0;return this._lyrHandleToObjects.forEach(o=>{o.isLoaded?(e+=o.textureMemoryUsage,t+=o.vboMemoryUsage,s++):(i+=o.textureMemoryUsage,r+=o.vboMemoryUsage,a++)}),new ue(this.usedMemory,s,a,Qe(t),Qe(e),Qe(r),Qe(i))}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(X(this.view.renderSpatialReference)||$(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&Z(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=ne(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!Y(t)&&t.wkid&&-1!==t.wkid&&(i=f(K.units[K[t.wkid]])),i&&(e=new G({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===q(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=g(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return de(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new Me(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new Me;0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));const t=this._get("visibleElevationRange");return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}_forEachRelevantVisibleTile(e){const{view:t}=this,{spatialReference:i}=t,r=i.isWGS84||i.isWebMercator||J(i)||L(i)||k(i);if(this.view.state.isGlobal||!r)return this.forEachVisibleTile(e);const s=A(i).radius,{eye:a,viewForward:o,near:n}=t.state.contentCamera,l=j(O(),o),c=500,d=Math.max(a[2],c),h=d+s,m=Math.sqrt(h**2-s**2),u=Math.abs(Math.atan2(m,s))*s,p=d>.5*s?.5*Math.PI*s:u,f=O();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:r}=t;if(i<0)return;E(f,r,a);const s=M(f,l);Math.abs(s)<p&&s+i>n&&s-i<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachTile(e){for(const t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const{componentObjects:i}of e)for(const e of i)t(e)}get drapeTargetType(){return this._replacesTerrain?0:1}isUpdating(){const e=this._wasm;return!this.freeze&&this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return!!this._frameTask?.readyToRun}runTask(e){this._frameTask.processQueue(e)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{entity3d:t}=e;if(!le(t))throw new Error("entity3D not valid");const i=new Map;let r;try{r=this._createPrimitiveTextureBundles(t,i)}catch(a){throw i.forEach(e=>this._stage?.removeTexture(e)),a}let s=null;try{if(s=await this._createRenderableMain(t,r),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");const{tileObb:a,componentObjects:o,elevationRange:n}=s;let l=0,c=0,d=0;for(const e of o){const{texture:t,textureMetallicRoughness:i,textureEmissive:r,textureOcclusion:s,textureNormal:a}=e.renderable.drawParameters;l+=(t?.usedMemory??0)+(i?.usedMemory??0)+(r?.usedMemory??0)+(s?.usedMemory??0)+(a?.usedMemory??0),c+=this._collection.getObjectGPUMemoryUsage(e),d+=e.intersectionGeometry.usedMemory}const h=Array.from(i.values()),m=new Ke(e.handle,o,h,d,c,l,a,e.stableNodeId,e.nodeDepth,n);return this._lyrHandleToObjects.set(e.handle,m),()=>{this._memCache.put(ce(m.handle),m);const{usedMemory:e}=m;return this._cacheMemory+=e,{memUsageBytes:e}}}catch(a){throw r.forEach(e=>e.cleanup()),s?.componentObjects.forEach(e=>this._collection.destroyObject(e)),i.forEach(e=>this._stage?.removeTexture(e)),a}}_createPrimitiveTextureBundles(e,t){const i=new Array;try{const r=e.desc.geometry;for(const s of e.validPrimitiveIndices){const a=r.prims[s].materialId,o=e.desc.materials?.materials&&null!=a&&a!==ae?e.desc.materials.materials[a]:null;let n=Promise.resolve(tt),l=null,c=null,d=null,h=null,m=null;if(o){const i="Pbr"===o.lightingModel;l=this._getTexture(o.baseColorTex,e,t),c=i?this._getTexture(o.metalTex,e,t):null,d=i?this._getTexture(o.emissiveTex,e,t):null,h=i?this._getTexture(o.occlusionTex,e,t):null,m=i?this._getTexture(o.normalTex,e,t):null;const r=[l,c,d,h,m].map(e=>e?.loadPromise??null);n=Promise.all(r)}i.push(new it(n,l,c,d,h,m))}}catch(r){throw i.forEach(e=>e.cleanup()),r}return i}async _createRenderableMain(e,t){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain called after destroy");const i=new Array,r=e.desc,s=S(...e.origin),a=this.view.groundView.spatialReference,o=this.view.state.isGlobal;let n=C;if(o){const e=T();z(F,s,e,a),n=_(w(),e)}const l=et(r.obb),c=o?A(this.view.spatialReference).radius:0,d=new Array;try{let h=-1;for(const i of e.validPrimitiveIndices){h+=1;const s=r.geometry.prims[i],a=t[h];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(s));if(null==ve[s.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+s.ptype+"). Skipping primitive."),a.cleanup();continue}const{positionView:o,normalsData:n,colorView:l,texCoord0Data:c,indicesView:m}=this._getBufferViews(s,e);if(null==o||null==m){a.cleanup();continue}const u=o.count,p=(e,t)=>null==e||e===u||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);p(null!=c?c.length/2:void 0,"numTexcoord")&&p(l?.count,"numColors")&&p(n?.length,"normals")?d.push({componentIndex:h,positionView:o,indicesView:m,texCoord0Data:c,colorView:l,normalsData:n}):a.cleanup()}const m=n!==C,u=m?v(w(),n)??C:C,{vertexProcessingOutputs:p,obbHalfSizeAccumulator:f,elevationRange:g}=await this._workerHandle.processTiles3DVertices(d,s,c,o,n,l,this._imVertexNormals&&!this._isUsedAsGroundLayer);if(this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");const y=r.materials;if(await Promise.all(t.map(e=>e.materialPromise)),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");p.length>0&&l.setHalfSize(f);for(const o of p){const{componentIndex:n,positionView:c,indicesView:d,layout:h,textureCoordinateType:p,interleavedVertexData:f,indices:g}=o,b=e.validPrimitiveIndices[n],_=r.geometry.prims[b],v=t[n],w=l.clone(),C=Se(h),T=new Uint32Array([0,d.typedBuffer.length]),x=new Ue(C,this._imShading?2:0,p,m?2:0),j=new Pe({interleavedVertexData:f,vertexCount:f.byteLength/C[0].stride,indexData:g},{positions:c.typedBuffer,indices:d.typedBuffer},T,x),E=this.view.renderSpatialReference,M=O(),R=[1,1,1];B(s,E,R,a)||this._dbg(3,"Unsupported coordinate system for IM overlay"),N(s,E,M,a);const S=this._createComponentMaterialInitParameters(y,_.materialId,v);S.baseColorTexture||this._dbg(3,"No colour texture 1");const V=this._collection.createObject({toMapSpace:H(M[0],M[1],R[0],R[1]),transform:new He(s,u),obb:w,geometry:j,elevationAlignable:!1},S);i.push(V)}const{fullExtent:b}=this.layer;return b?.hasZ&&b.zmax&&b.zmin&&(g.minElevation=Math.max(g.minElevation,b.zmin),g.maxElevation=Math.min(g.maxElevation,b.zmax)),{tileObb:l,componentObjects:i,elevationRange:g}}catch(h){throw i.forEach(e=>this._collection.destroyObject(e)),h}}_createComponentMaterialInitParameters(e,t,i){const r=null!=e?.materials&&null!=t&&t!==ae?e.materials[t]:null;let s=1;const a=r?.baseColorTex?.imageId;if(null!=a&&e&&Array.isArray(e.images)&&a>=0&&a<e.images.length){const t=e.images[a];t.alpha&&(s=we[t.alpha])}const o="Pbr"===(null!=r?r.lightingModel:"Unlit");let n=D,l=Xe,c=!1,d=2,h=P(0,0,0);const m=V(ke),u=i.baseColorTexture,p=i.metallicRoughnessTexture,f=i.emissionTexture,g=i.occlusionTexture,y=i.normalTexture;return r&&(n=I(r.baseColorFactor),l=r.alphaCutoff??Xe,o&&(R(m,r.metallicFactor,r.roughnessFactor,0),r.emissiveFactor&&(h=r.emissiveFactor)),c=r.isDoubleSided,d=Ce[r.faceCulling??"NotSet"]),{isIntegratedMesh:!0,baseColor:n,textureAlphaCutoff:l,mrrFactors:m,baseColorTexture:u,metallicRoughnessTexture:p,normalTexture:y,occlusionTexture:g,emissionTexture:f,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:s,doubleSided:c,cullFace:d,isGround:this.layer.replacesTerrain,groundTransparencyMode:this._groundTransparencyMode,emissiveBaseColor:h,usePBR:o,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this._renderOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=ce(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const r=this._frustum,s=new Array;let a=!1,o=!1;for(let n=0;n<i;++n){if(!t[n])continue;const i=e[n],l=this._lyrHandleToObjects.get(i);if(l){if(l.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${l.stableNodeId}`);continue}a=!0,l.isLoaded=!0,this._loadedObjects.add(l),this._intersectionHandler.addTile(l),this._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(r)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),o||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),s.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(ce(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let n=0;n<i;++n){const i=e[n];if(t[n])continue;const r=this._lyrHandleToObjects.get(i);if(r){if(!r.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${r.stableNodeId}`);continue}const e=r.isVisible;this._visibleObjects.delete(r),r.isVisible=!1,r.isLoaded=!1,this._loadedObjects.delete(r),this._intersectionHandler.removeTile(r),e&&(this._visibleGeometryChanged(),o||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,r.elevationRange)),this._usedMemory-=r.usedMemory,this._cacheMemory+=r.usedMemory,s.push(r.obb),r.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(ce(i),r)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}a&&this._visibleGeometryChanged(),s.length>0&&this._elevationProvider.notifyObjectsChanged(s),o&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:r,maxElevation:s}=t;return e?r<i.minElevation||s>i.maxElevation:r===i.minElevation||s===i.maxElevation}_getTexture(e,t,i){const r=e&&t.desc.materials?.images?.[e.imageId];if(!r||null==r.data||r.data===ae)return null;const s=t.assets[r.data];if(!s||s.byteCount<1||"U8"!==s.dataType)return null;const a=i.get(r)??this._createTexture(e,r,s,i);return a?new Ie(this._stage.renderView.textures,a.id):null}_createTexture(e,t,i,r){const s=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,a=!!t.mipCount||s>1,o=Te[e.wrapMode??"None"];let n=t.alpha?6408:6407;const l=new Uint8Array(i.data.buffer,0,i.byteCount);let c=null,d=null,h=null;switch(t.format){case"Raw":"R8"===t.pixelFormat?(c=l,n=6403,d=""):"Rg8"===t.pixelFormat||"Ga8"===t.pixelFormat?(c=l,n=33319,d=""):"Rgb8"===t.pixelFormat?(c=l,n=6407,d=""):"Rgba8"===t.pixelFormat&&(c=l,n=6408,d="");break;case"Dxt1":c=l,n=6407,d="image/vnd-ms.dds";break;case"Dxt5":c=l,n=6408,d="image/vnd-ms.dds";break;case"Basis":c=l,n=6407,d="image/ktx2";break;case"Etc1":c=l,n=6407,d="image/ktx";break;case"Png":d="image/png",h=document.createElement("img");break;case"Jpeg":d="image/jpeg",h=document.createElement("img");break;case"Etc2":d="image/ktx",h=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([l],{type:d});h.src=URL.createObjectURL(e),c=h}if(c&&null!=d){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker}:void 0,i=Ze(n,d,t.format),l=new De(c,{mipmap:a,maxAnisotropy:s,encoding:d,wrap:o,pixelFormat:n,internalFormat:i??void 0,immutable:null!=i,compressionOptions:e,noUnpackFlip:!0,width:t.mip0Width,height:t.mip0Height});return this._stage.addTexture(l),r.set(t,l),l}return null}_getBufferViews(e,t){let i,r,s,a,o;for(let c=0;c<e.atrbs.length;c++){const o=e.atrbs[c],n=t.assets[o.assetId];if(!n)continue;const d=n.data.buffer,u=void 0,p=0,f=n.byteCount;try{switch(o.sem){case"Position":3===n.ncomp&&"F32"===n.dataType&&m(n.data)?i=new ie(d,p,u,f):this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+n+")");break;case"Normal":if(3===n.ncomp&&"F32"===n.dataType&&m(n.data)){const e=new ie(d,p,u,f);a=new Uint32Array(e.count),Le(e.typedBuffer,new Int16Array(a.buffer,a.byteOffset,2*a.length))}else this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+n+")");break;case"TexCoord":2===n.ncomp&&"F32"===n.dataType&&m(n.data)?void 0===s&&(s=new te(d,p,u,f).typedBuffer):this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+n+")");break;case"Color":"U8"===n.dataType&&h(n.data)&&(4===n.ncomp?r=new Q(d,p,u,f):3===n.ncomp&&(r=new ee(d,p,u,f))),null==r&&this._dbg(3,"[Unsupported Feature] Unsupported view for Color ("+n+")");break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+o.sem+"). Skipping vertex attribute.")}}catch(l){this._dbg(2,"Error Creating buffer ("+l+"). Skipping vertex attribute.")}}let n=!1;if(null!=e.index&&e.index!==ae){const i=t.assets[e.index];if(i){const e=void 0,t=0,r=i.byteCount;switch(i.dataType){case"U16":1===i.ncomp&&p(i.data)&&(o=new se(i.data.buffer,t,e,r));break;case"U32":1===i.ncomp&&u(i.data)&&(o=new re(i.data.buffer,t,e,r))}n=!o}else n=!0}if(!n&&null==o&&null!=i){const e=i.count;o=o=e<65535?new se(new Uint16Array(e).buffer):new re(new Uint32Array(e).buffer);for(let t=0;t<e;t++)o.set(t,t)}return{positionView:i,colorView:r,texCoord0Data:s,indicesView:o,normalsData:a}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},n),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([y()],Ye.prototype,"freeze",void 0),e([y()],Ye.prototype,"fullOpacity",null),e([y({readOnly:!0})],Ye.prototype,"ready",null),e([y({type:[oe]})],Ye.prototype,"_modifications",void 0),e([y()],Ye.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([y()],Ye.prototype,"layer",void 0),e([y({readOnly:!0})],Ye.prototype,"visibleAtCurrentScale",null),e([y({readOnly:!0})],Ye.prototype,"_collection",null),e([y()],Ye.prototype,"elevationOffset",null),e([y({readOnly:!0})],Ye.prototype,"visibleElevationRange",null),e([y()],Ye.prototype,"fullExtentInLocalViewSpatialReference",void 0),Ye=e([b("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Ye);const Je=Ye;class Ke{constructor(e,t,i,r,s,a,o,n,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=r,this.vboMemoryUsage=s,this.textureMemoryUsage=a,this.obb=o,this.stableNodeId=n,this.nodeDepth=l,this.elevationRange=c,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const d=O();o?.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const h=o?.radius??-1;this._obbRadius=h,this._obbRadiusSquared=h*h,this._obbShortestHalfsize=o?Math.min(o.halfSizeX,o.halfSizeY,o.halfSizeZ):0,this._mbsCenter=o?o.getCenter(O()):U}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:r,_obbCenterZ:s}=this,a=i-e[0],o=r-e[1],n=s-e[2],l=a*t[0]+o*t[1]+n*t[2];return a*a+o*o+n*n-l*l<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const t=this._obbRadius;if(t<0)return!0;const i=e.center,r=e.radius,s=t+r,a=this._obbCenterX-i[0];if(a>s)return!1;const o=this._obbCenterY-i[1];if(o>s)return!1;const n=this._obbCenterZ-i[2];if(n>s)return!1;const l=a*a+o*o+n*n;if(l>s*s)return!1;if(l<=(this._obbShortestHalfsize+r)**2)return!0;const c=r-t;return c>0&&l<=c*c||(this.obb?.intersectSphere(e)??!0)}}function Qe(e){return Math.round(e/1048.576)/1e3}function et(e){return new Oe(e.center,e.halfSize,x(...e.quaternion))}const tt=new Array;class it{constructor(e,t,i,r,s,a){this.materialPromise=e,this.baseColorTexture=t,this.metallicRoughnessTexture=i,this.emissionTexture=r,this.occlusionTexture=s,this.normalTexture=a}cleanup(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}}export{Je as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{abortMaybe as i,destroyMaybe as r,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as a,createAbortError as o}from"../../../core/promiseUtils.js";import{initial as n,watch as l,when as c}from"../../../core/reactiveUtils.js";import{schedule as d}from"../../../core/scheduling.js";import{isUint8Array as h,isFloat32Array as u,isUint32Array as m,isUint16Array as p}from"../../../core/typedArrayUtil.js";import{unitFromRESTJSON as f,convertUnit as g}from"../../../core/units.js";import{property as y,subclass as b}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as _,invert as v}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as w,IDENTITY as C}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as T}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as x}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as j,sub as E,dot as M,set as R}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as O,freeze as S,clone as V,ZEROS as U,fromValues as P}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as H,clone as I,ONES as D}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as L,isMars as k,getReferenceEllipsoid as A,SphericalECEFSpatialReferenceLike as F}from"../../../geometry/ellipsoidUtils.js";import G from"../../../geometry/HeightModelInfo.js";import{computeTranslationToOriginAndRotation as z}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as B}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as N}from"../../../geometry/projection/projectVectorToVector.js";import{create as q}from"../../../geometry/support/aaBoundingRect.js";import{isCompatible as W}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as X,isWebMercator as $,equals as Z,isGeographic as Y,isCGCS2000 as J}from"../../../geometry/support/spatialReferenceUtils.js";import K from"../../../geometry/support/WKIDUnitConversion.js";import{BufferViewVec4u8 as Q,BufferViewVec3u8 as ee,BufferViewVec2f as te,BufferViewVec3f as ie,BufferViewUint32 as re,BufferViewUint16 as se}from"../../../geometry/support/buffer/BufferView.js";import{nullId as ae}from"../../../layers/ILyr3DWasmPerSceneView.js";import oe from"../../../layers/support/SceneModification.js";import{getHeightModelInfoFromVCS as ne,validateEntity3D as le,makeCacheKey as ce}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as de}from"../../../support/elevationInfoUtils.js";import{IntegratedMesh3DTilesLayerWorkerHandle as he}from"./IntegratedMesh3DTilesLayerWorkerHandle.js";import{LayerView3D as ue}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as me}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as pe,removeLayerViewFromWasm as fe,getLyr3DWasm as ge}from"./Lyr3DWasm.js";import{toWasmModification as ye}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as be}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as _e}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as ve,alphaModeConversion as we,faceCullingConversion as Ce,wrapModeConversion as Te}from"./support/lyr3dTypeConversions.js";import{makeScheduleFunction as xe}from"./support/makeScheduleFunction.js";import{Tiles3DMeshIntersectionHandler as je}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as Ee}from"../state/Frustum.js";import{ElevationRange as Me}from"../support/ElevationRange.js";import{toBoundingRect as Re}from"../support/extentUtils.js";import{Obb as Oe}from"../support/orientedBoundingBox.js";import{glLayout as Se}from"../support/buffer/glUtil.js";import{getGroundTransparencyModeFromOpacity as Ve}from"../terrain/TransparencyMode.js";import{ComponentGeometryParameters as Ue,SourceGeometry as Pe}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as He}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as Ie}from"../webgl-engine/core/material/RenderTexture.js";import{ManagedTexture as De}from"../webgl-engine/lib/ManagedTexture.js";import{compressNormals as Le}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as ke}from"../webgl-engine/materials/pbrUtils.js";import Ae from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Fe,isInEffectiveScaleRange as Ge,validateScaleRange as ze}from"../../support/layerViewUtils.js";import{TaskPriority as Be}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ne}from"../../support/TextureCompressionTracker.js";import{CompressedTextureFormat as qe,SizedPixelFormat as We}from"../../webgl/enums.js";import{alphaCutoff as Xe}from"../../../webscene/support/AlphaCutoff.js";var $e;function Ze(e,t,i){if("image/vnd-ms.dds"===t)switch(i){case"Dxt1":return qe.COMPRESSED_RGB_S3TC_DXT1_EXT;case"Dxt5":return qe.COMPRESSED_RGBA_S3TC_DXT5_EXT;default:return null}if("image/ktx"===t)return"Etc1"===i?qe.COMPRESSED_RGB8_ETC2:null;switch(e){case 33319:return We.RG8;case 6407:return We.RGB8;case 6408:return We.RGBA8;case 6403:return We.R8;default:return null}}let Ye=class extends(ue(Ae)){static{$e=_e}constructor(e){super(e),this[$e]=!0,this.type="integrated-mesh-3dtiles",this.freeze=!1,this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._initializationController=null,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new Ne,this._dbgFlags=new Set;const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._isUsedAsGroundLayer=e.layer.isUsedAsGroundLayer,this._frameTask=t.scheduler.registerTask(Be.TILES3D,this),this._frustum=new Ee(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{a(t);const i=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=i}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._workerHandle=new he(xe(e.resourceController)),this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),n),!this._canProjectWithoutEngine())throw Fe("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);this._initializationController=new AbortController;const t=pe(this,this._initializationController.signal).then(t=>{a(this._initializationController.signal),this._wasmLayerId=t,this._intersectionHandler=new je(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>this.view.overlayManager.renderer.isEmpty,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),n),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),n),this._elevationProvider=new be({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler});const i=this._replacesTerrain?0:1;e.elevationProvider.register(i,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([l(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),c(()=>this.fullOpacity,()=>this._opacityChange()),l(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),n),l(()=>this.freeze,e=>{e?this._wasm?.incrementFrozenLayerViewCount(this):(this._wasm?.decrementFrozenLayerViewCount(this),this._cameraChanged())})]),this._initializationController=null,this.addHandles(c(()=>this._replacesTerrain&&this._wasm?.isTerrainReady,()=>{this.layer.queryElevationCallback=(e,t)=>this._queryElevation(e,t)}))});this.addResolvingPromise(t)}destroy(){if(this.freeze=!1,this._initializationController=i(this._initializationController),this._dbg(2,"Tiles3DLayerView3D destroy() called"),this._workerHandle?.destroyContextAndSelf(this.uid),fe(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider){const e=Array.from(this._lyrHandleToObjects.values()),t=e.reduce((e,{componentObjects:t})=>e+t.length,0);this._elevationProvider.notifyObjectsChangedFunctional(t,t=>{for(const{componentObjects:i}of e)for(const{obb:e}of i)if(!t(e))return}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null}this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._frameTask.remove(),this._updatingHandles=r(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}get fullOpacity(){return this.layer.replacesTerrain?this.view.map.ground.opacity:1}get opaque(){return 0===this._groundTransparencyMode}get invisible(){return 3===this._groundTransparencyMode}get _groundTransparencyMode(){return this.layer.replacesTerrain?Ve(this.fullOpacity,this.view.overlayManager.renderer.isEmpty):0}get _renderOpacity(){switch(this._groundTransparencyMode){case 3:return 0;case 2:return Xe;default:return this.fullOpacity}}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const e=this._renderOpacity,t=this._groundTransparencyMode;this.forEachComponentObject(i=>this._collection.updateObjectOpacity(i,e,t))}_cameraChanged(){if(this.freeze)return;const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(r=>{const s=r.obb?.intersectsFrustum(e)??!1;s!==r.isVisible&&(r.isVisible=s,s?t.add(r):t.delete(r),r.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,s)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(s,r.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,r){this._intersectionHandler.intersectRay(e,t,i,r,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.useEsriCrs?this.layer.supportedSpatialReferences[1]:this.layer.supportedSpatialReferences[0],t=ye(this._layerClippingArea,this._modifications,e,this.view.state.isGlobal);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=q();this._layerClippingArea=Re(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=d(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,de(e))}get _wasm(){return ge(this.view)}_queryElevation(e,t){return this.destroying||this.destroyed?Promise.reject(o()):this._wasm?.queryElevation(this,e,t)??Promise.reject(o())}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get useEsriCrs(){return this._useEsriCrs}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||Ge(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||ze(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,r=0,s=0,a=0;return this._lyrHandleToObjects.forEach(o=>{o.isLoaded?(e+=o.textureMemoryUsage,t+=o.vboMemoryUsage,s++):(i+=o.textureMemoryUsage,r+=o.vboMemoryUsage,a++)}),new me(this.usedMemory,s,a,Qe(t),Qe(e),Qe(r),Qe(i))}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(X(this.view.renderSpatialReference)||$(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&Z(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=ne(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!Y(t)&&t.wkid&&-1!==t.wkid&&(i=f(K.units[K[t.wkid]])),i&&(e=new G({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===W(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=g(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return de(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new Me(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new Me;0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));const t=this._get("visibleElevationRange");return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}_forEachRelevantVisibleTile(e){const{view:t}=this,{spatialReference:i}=t,r=i.isWGS84||i.isWebMercator||J(i)||L(i)||k(i);if(this.view.state.isGlobal||!r)return this.forEachVisibleTile(e);const s=A(i).radius,{eye:a,viewForward:o,near:n}=t.state.contentCamera,l=j(O(),o),c=500,d=Math.max(a[2],c),h=d+s,u=Math.sqrt(h**2-s**2),m=Math.abs(Math.atan2(u,s))*s,p=d>.5*s?.5*Math.PI*s:m,f=O();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:r}=t;if(i<0)return;E(f,r,a);const s=M(f,l);Math.abs(s)<p&&s+i>n&&s-i<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachTile(e){for(const t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const{componentObjects:i}of e)for(const e of i)t(e)}get drapeTargetType(){return this._replacesTerrain?0:1}isUpdating(){const e=this._wasm;return!this.freeze&&this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return!!this._frameTask?.readyToRun}runTask(e){this._frameTask.processQueue(e)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{entity3d:t}=e;if(!le(t))throw new Error("entity3D not valid");const i=new Map;let r;try{r=this._createPrimitiveTextureBundles(t,i)}catch(a){throw i.forEach(e=>this._stage?.removeTexture(e)),a}let s=null;try{if(s=await this._createRenderableMain(t,r),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");const{tileObb:a,componentObjects:o,elevationRange:n}=s;let l=0,c=0,d=0;for(const e of o){const{texture:t,textureMetallicRoughness:i,textureEmissive:r,textureOcclusion:s,textureNormal:a}=e.renderable.drawParameters;l+=(t?.usedMemory??0)+(i?.usedMemory??0)+(r?.usedMemory??0)+(s?.usedMemory??0)+(a?.usedMemory??0),c+=this._collection.getObjectGPUMemoryUsage(e),d+=e.intersectionGeometry.usedMemory}const h=Array.from(i.values()),u=new Ke(e.handle,o,h,d,c,l,a,e.stableNodeId,e.nodeDepth,n);return this._lyrHandleToObjects.set(e.handle,u),()=>{this._memCache.put(ce(u.handle),u);const{usedMemory:e}=u;return this._cacheMemory+=e,{memUsageBytes:e}}}catch(a){throw r.forEach(e=>e.cleanup()),s?.componentObjects.forEach(e=>this._collection.destroyObject(e)),i.forEach(e=>this._stage?.removeTexture(e)),a}}_createPrimitiveTextureBundles(e,t){const i=new Array;try{const r=e.desc.geometry;for(const s of e.validPrimitiveIndices){const a=r.prims[s].materialId,o=e.desc.materials?.materials&&null!=a&&a!==ae?e.desc.materials.materials[a]:null;let n=Promise.resolve(tt),l=null,c=null,d=null,h=null,u=null;if(o){const i="Pbr"===o.lightingModel;l=this._getTexture(o.baseColorTex,e,t),c=i?this._getTexture(o.metalTex,e,t):null,d=i?this._getTexture(o.emissiveTex,e,t):null,h=i?this._getTexture(o.occlusionTex,e,t):null,u=i?this._getTexture(o.normalTex,e,t):null;const r=[l,c,d,h,u].map(e=>e?.loadPromise??null);n=Promise.all(r)}i.push(new it(n,l,c,d,h,u))}}catch(r){throw i.forEach(e=>e.cleanup()),r}return i}async _createRenderableMain(e,t){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain called after destroy");const i=new Array,r=e.desc,s=S(...e.origin),a=this.view.groundView.spatialReference,o=this.view.state.isGlobal;let n=C;if(o){const e=T();z(F,s,e,a),n=_(w(),e)}const l=et(r.obb),c=o?A(this.view.spatialReference).radius:0,d=new Array;try{let h=-1;for(const i of e.validPrimitiveIndices){h+=1;const s=r.geometry.prims[i],a=t[h];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(s));if(null==ve[s.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+s.ptype+"). Skipping primitive."),a.cleanup();continue}const{positionView:o,normalsData:n,colorView:l,texCoord0Data:c,indicesView:u}=this._getBufferViews(s,e);if(null==o||null==u){a.cleanup();continue}const m=o.count,p=(e,t)=>null==e||e===m||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);p(null!=c?c.length/2:void 0,"numTexcoord")&&p(l?.count,"numColors")&&p(n?.length,"normals")?d.push({componentIndex:h,positionView:o,indicesView:u,texCoord0Data:c,colorView:l,normalsData:n}):a.cleanup()}const u=n!==C,m=u?v(w(),n)??C:C,{vertexProcessingOutputs:p,obbHalfSizeAccumulator:f,elevationRange:g}=await this._workerHandle.processTiles3DVertices(d,s,c,o,n,l,this._imVertexNormals&&!this._isUsedAsGroundLayer);if(this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");const y=r.materials;if(await Promise.all(t.map(e=>e.materialPromise)),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");p.length>0&&l.setHalfSize(f);for(const o of p){const{componentIndex:n,positionView:c,indicesView:d,layout:h,textureCoordinateType:p,interleavedVertexData:f,indices:g}=o,b=e.validPrimitiveIndices[n],_=r.geometry.prims[b],v=t[n],w=l.clone(),C=Se(h),T=new Uint32Array([0,d.typedBuffer.length]),x=new Ue(C,this._imShading?2:0,p,u?2:0),j=new Pe({interleavedVertexData:f,vertexCount:f.byteLength/C[0].stride,indexData:g},{positions:c.typedBuffer,indices:d.typedBuffer},T,x),E=this.view.renderSpatialReference,M=O(),R=[1,1,1];B(s,E,R,a)||this._dbg(3,"Unsupported coordinate system for IM overlay"),N(s,E,M,a);const S=this._createComponentMaterialInitParameters(y,_.materialId,v);S.baseColorTexture||this._dbg(3,"No colour texture 1");const V=this._collection.createObject({toMapSpace:H(M[0],M[1],R[0],R[1]),transform:new He(s,m),obb:w,geometry:j,elevationAlignable:!1},S);i.push(V)}const{fullExtent:b}=this.layer;return b?.hasZ&&b.zmax&&b.zmin&&(g.minElevation=Math.max(g.minElevation,b.zmin),g.maxElevation=Math.min(g.maxElevation,b.zmax)),{tileObb:l,componentObjects:i,elevationRange:g}}catch(h){throw i.forEach(e=>this._collection.destroyObject(e)),h}}_createComponentMaterialInitParameters(e,t,i){const r=null!=e?.materials&&null!=t&&t!==ae?e.materials[t]:null;let s=1;const a=r?.baseColorTex?.imageId;if(null!=a&&e&&Array.isArray(e.images)&&a>=0&&a<e.images.length){const t=e.images[a];t.alpha&&(s=we[t.alpha])}const o="Pbr"===(null!=r?r.lightingModel:"Unlit");let n=D,l=Xe,c=!1,d=2,h=P(0,0,0);const u=V(ke),m=i.baseColorTexture,p=i.metallicRoughnessTexture,f=i.emissionTexture,g=i.occlusionTexture,y=i.normalTexture;return r&&(n=I(r.baseColorFactor),l=r.alphaCutoff??Xe,o&&(R(u,r.metallicFactor,r.roughnessFactor,0),r.emissiveFactor&&(h=r.emissiveFactor)),c=r.isDoubleSided,d=Ce[r.faceCulling??"NotSet"]),{isIntegratedMesh:!0,baseColor:n,textureAlphaCutoff:l,mrrFactors:u,baseColorTexture:m,metallicRoughnessTexture:p,normalTexture:y,occlusionTexture:g,emissionTexture:f,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:s,doubleSided:c,cullFace:d,isGround:this.layer.replacesTerrain,groundTransparencyMode:this._groundTransparencyMode,emissiveBaseColor:h,usePBR:o,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this._renderOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=ce(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const r=this._frustum,s=new Array;let a=!1,o=!1;for(let n=0;n<i;++n){if(!t[n])continue;const i=e[n],l=this._lyrHandleToObjects.get(i);if(l){if(l.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${l.stableNodeId}`);continue}a=!0,l.isLoaded=!0,this._loadedObjects.add(l),this._intersectionHandler.addTile(l),this._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(r)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),o||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),s.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(ce(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let n=0;n<i;++n){const i=e[n];if(t[n])continue;const r=this._lyrHandleToObjects.get(i);if(r){if(!r.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${r.stableNodeId}`);continue}const e=r.isVisible;this._visibleObjects.delete(r),r.isVisible=!1,r.isLoaded=!1,this._loadedObjects.delete(r),this._intersectionHandler.removeTile(r),e&&(this._visibleGeometryChanged(),o||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,r.elevationRange)),this._usedMemory-=r.usedMemory,this._cacheMemory+=r.usedMemory,s.push(r.obb),r.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(ce(i),r)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}a&&this._visibleGeometryChanged(),s.length>0&&this._elevationProvider.notifyObjectsChanged(s),o&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:r,maxElevation:s}=t;return e?r<i.minElevation||s>i.maxElevation:r===i.minElevation||s===i.maxElevation}_getTexture(e,t,i){const r=e&&t.desc.materials?.images?.[e.imageId];if(!r||null==r.data||r.data===ae)return null;const s=t.assets[r.data];if(!s||s.byteCount<1||"U8"!==s.dataType)return null;const a=i.get(r)??this._createTexture(e,r,s,i);return a?new Ie(this._stage.renderView.textures,a.id):null}_createTexture(e,t,i,r){const s=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,a=!!t.mipCount||s>1,o=Te[e.wrapMode??"None"];let n=t.alpha?6408:6407;const l=new Uint8Array(i.data.buffer,0,i.byteCount);let c=null,d=null,h=null;switch(t.format){case"Raw":"R8"===t.pixelFormat?(c=l,n=6403,d=""):"Rg8"===t.pixelFormat||"Ga8"===t.pixelFormat?(c=l,n=33319,d=""):"Rgb8"===t.pixelFormat?(c=l,n=6407,d=""):"Rgba8"===t.pixelFormat&&(c=l,n=6408,d="");break;case"Dxt1":c=l,n=6407,d="image/vnd-ms.dds";break;case"Dxt5":c=l,n=6408,d="image/vnd-ms.dds";break;case"Basis":c=l,n=6407,d="image/ktx2";break;case"Etc1":c=l,n=6407,d="image/ktx";break;case"Png":d="image/png",h=document.createElement("img");break;case"Jpeg":d="image/jpeg",h=document.createElement("img");break;case"Etc2":d="image/ktx",h=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([l],{type:d});h.src=URL.createObjectURL(e),c=h}if(c&&null!=d){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker}:void 0,i=Ze(n,d,t.format),l=new De(c,{mipmap:a,maxAnisotropy:s,encoding:d,wrap:o,pixelFormat:n,internalFormat:i??void 0,immutable:null!=i,compressionOptions:e,noUnpackFlip:!0,width:t.mip0Width,height:t.mip0Height});return this._stage.addTexture(l),r.set(t,l),l}return null}_getBufferViews(e,t){let i,r,s,a,o;for(let c=0;c<e.atrbs.length;c++){const o=e.atrbs[c],n=t.assets[o.assetId];if(!n)continue;const d=n.data.buffer,m=void 0,p=0,f=n.byteCount;try{switch(o.sem){case"Position":3===n.ncomp&&"F32"===n.dataType&&u(n.data)?i=new ie(d,p,m,f):this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+n+")");break;case"Normal":if(3===n.ncomp&&"F32"===n.dataType&&u(n.data)){const e=new ie(d,p,m,f);a=new Uint32Array(e.count),Le(e.typedBuffer,new Int16Array(a.buffer,a.byteOffset,2*a.length))}else this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+n+")");break;case"TexCoord":2===n.ncomp&&"F32"===n.dataType&&u(n.data)?void 0===s&&(s=new te(d,p,m,f).typedBuffer):this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+n+")");break;case"Color":"U8"===n.dataType&&h(n.data)&&(4===n.ncomp?r=new Q(d,p,m,f):3===n.ncomp&&(r=new ee(d,p,m,f))),null==r&&this._dbg(3,"[Unsupported Feature] Unsupported view for Color ("+n+")");break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+o.sem+"). Skipping vertex attribute.")}}catch(l){this._dbg(2,"Error Creating buffer ("+l+"). Skipping vertex attribute.")}}let n=!1;if(null!=e.index&&e.index!==ae){const i=t.assets[e.index];if(i){const e=void 0,t=0,r=i.byteCount;switch(i.dataType){case"U16":1===i.ncomp&&p(i.data)&&(o=new se(i.data.buffer,t,e,r));break;case"U32":1===i.ncomp&&m(i.data)&&(o=new re(i.data.buffer,t,e,r))}n=!o}else n=!0}if(!n&&null==o&&null!=i){const e=i.count;o=o=e<65535?new se(new Uint16Array(e).buffer):new re(new Uint32Array(e).buffer);for(let t=0;t<e;t++)o.set(t,t)}return{positionView:i,colorView:r,texCoord0Data:s,indicesView:o,normalsData:a}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},n),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([y()],Ye.prototype,"freeze",void 0),e([y()],Ye.prototype,"fullOpacity",null),e([y()],Ye.prototype,"opaque",null),e([y()],Ye.prototype,"invisible",null),e([y({readOnly:!0})],Ye.prototype,"ready",null),e([y({type:[oe]})],Ye.prototype,"_modifications",void 0),e([y()],Ye.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([y()],Ye.prototype,"layer",void 0),e([y({readOnly:!0})],Ye.prototype,"visibleAtCurrentScale",null),e([y({readOnly:!0})],Ye.prototype,"_collection",null),e([y()],Ye.prototype,"elevationOffset",null),e([y({readOnly:!0})],Ye.prototype,"visibleElevationRange",null),e([y()],Ye.prototype,"fullExtentInLocalViewSpatialReference",void 0),Ye=e([b("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Ye);const Je=Ye;class Ke{constructor(e,t,i,r,s,a,o,n,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=r,this.vboMemoryUsage=s,this.textureMemoryUsage=a,this.obb=o,this.stableNodeId=n,this.nodeDepth=l,this.elevationRange=c,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const d=O();o?.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const h=o?.radius??-1;this._obbRadius=h,this._obbRadiusSquared=h*h,this._obbShortestHalfsize=o?Math.min(o.halfSizeX,o.halfSizeY,o.halfSizeZ):0,this._mbsCenter=o?o.getCenter(O()):U}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:r,_obbCenterZ:s}=this,a=i-e[0],o=r-e[1],n=s-e[2],l=a*t[0]+o*t[1]+n*t[2];return a*a+o*o+n*n-l*l<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const t=this._obbRadius;if(t<0)return!0;const i=e.center,r=e.radius,s=t+r,a=this._obbCenterX-i[0];if(a>s)return!1;const o=this._obbCenterY-i[1];if(o>s)return!1;const n=this._obbCenterZ-i[2];if(n>s)return!1;const l=a*a+o*o+n*n;if(l>s*s)return!1;if(l<=(this._obbShortestHalfsize+r)**2)return!0;const c=r-t;return c>0&&l<=c*c||(this.obb?.intersectSphere(e)??!0)}}function Qe(e){return Math.round(e/1048.576)/1e3}function et(e){return new Oe(e.center,e.halfSize,x(...e.quaternion))}const tt=new Array;class it{constructor(e,t,i,r,s,a){this.materialPromise=e,this.baseColorTexture=t,this.metallicRoughnessTexture=i,this.emissionTexture=r,this.occlusionTexture=s,this.normalTexture=a}cleanup(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}}export{Je as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{initial as t}from"../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{I3SMeshView3D as o}from"./I3SMeshView3D.js";import{LayerView3D as s}from"./LayerView3D.js";import{ElevationRange as a}from"../support/ElevationRange.js";import{updatingProgress as l}from"../support/updatingProperties.js";import n from"../../layers/LayerView.js";import{isInEffectiveScaleRange as p}from"../../support/layerViewUtils.js";const d=.2;let
|
|
2
|
+
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{initial as t}from"../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{I3SMeshView3D as o}from"./I3SMeshView3D.js";import{LayerView3D as s}from"./LayerView3D.js";import{ElevationRange as a}from"../support/ElevationRange.js";import{updatingProgress as l}from"../support/updatingProperties.js";import n from"../../layers/LayerView.js";import{isInEffectiveScaleRange as p}from"../../support/layerViewUtils.js";const d=.2;let u=class extends(o(s(n))){constructor(){super(...arguments),this.type="integrated-mesh-3d",this.visibleElevationRange=new a(1/0,-1/0),this._elevationContext=1,this._supportsLabeling=!1,this._applySSAO=!has("disable-feature:im-ssao"),this.drapeTargetType=1}get updatingProgressValue(){return this._controller?.updatingProgress??0}get lodFactor(){return this.view?.qualitySettings?.sceneService?.meshLoDFactor??1}get progressiveLoadFactor(){return this.lodFactor>=1?d:1}get visibleAtCurrentScale(){return p(this.layer.effectiveScaleRange,this.view.scale)}get fullOpacity(){return 1}get opaque(){return!0}get invisible(){return!1}get layerPopupEnabledAndHasTemplate(){return!1}initialize(){this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),t),this.view.overlayManager.registerDrapeTarget(this)}destroy(){this.view.overlayManager.unregisterDrapeTarget(this)}get ready(){return this.layer.loaded}_createLayerGraphic(){}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>this._modifications=e.toArray(),t),"modifications")}};e([r()],u.prototype,"layer",void 0),e([r(l)],u.prototype,"updatingProgress",void 0),e([r()],u.prototype,"updatingProgressValue",null),e([r()],u.prototype,"lodFactor",null),e([r({readOnly:!0})],u.prototype,"progressiveLoadFactor",null),e([r({readOnly:!0})],u.prototype,"visibleAtCurrentScale",null),e([r({readOnly:!0})],u.prototype,"visibleElevationRange",void 0),e([r()],u.prototype,"fullOpacity",null),e([r()],u.prototype,"opaque",null),e([r()],u.prototype,"invisible",null),u=e([i("esri.views.3d.layers.IntegratedMeshLayerView3D")],u);const c=u;export{c as default};
|