@arcgis/core 5.2.0-next.155 → 5.2.0-next.157
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/analysis/LineOfSightAnalysis.d.ts +49 -32
- package/analysis/LineOfSightAnalysisObserver.d.ts +19 -3
- package/analysis/LineOfSightAnalysisTarget.d.ts +19 -3
- package/analysis/Viewshed.d.ts +23 -3
- package/analysis/ViewshedAnalysis.d.ts +33 -13
- package/arcade/geometry/operatorsWorkerConnection.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{d994bcf0a65d1c07160f.js → 0320cbd825f9a4222042.js} +1 -1
- package/assets/esri/core/workers/chunks/0590857215c547e63b51.js +1 -0
- package/assets/esri/core/workers/chunks/08fe248e412bb170210d.js +1 -0
- package/assets/esri/core/workers/chunks/0cb50bc2b2125c5fedf2.js +1 -0
- package/assets/esri/core/workers/chunks/1201b8c5852830836eac.js +1 -0
- package/assets/esri/core/workers/chunks/129e04d24ced77c9bb6d.js +1 -0
- package/assets/esri/core/workers/chunks/15e1117a706a98b17ad5.js +1 -0
- package/assets/esri/core/workers/chunks/164e74d586297946a717.js +1 -0
- package/assets/esri/core/workers/chunks/168a523bdc3653081f8a.js +1 -0
- package/assets/esri/core/workers/chunks/{6f4e6022a52de0c54aab.js → 172cfeb5f415e4662432.js} +1 -1
- package/assets/esri/core/workers/chunks/22b01fe31bbf0bdc48db.js +1 -0
- package/assets/esri/core/workers/chunks/27c2da2e779def2ee08b.js +1 -0
- package/assets/esri/core/workers/chunks/{925271bb763607a326ae.js → 2f04b8679c9f15390517.js} +1 -1
- package/assets/esri/core/workers/chunks/35e5762642d1a3a2e375.js +1 -0
- package/assets/esri/core/workers/chunks/{481589c3eddad6e026ad.js → 369780276b2755361f7d.js} +1 -1
- package/assets/esri/core/workers/chunks/{2a226b69d38c72a47a08.js → 3914d96147642a9d4b01.js} +1 -1
- package/assets/esri/core/workers/chunks/{731018c0deffc41ffc97.js → 3e3e076fa5e8d5d5f33f.js} +1 -1
- package/assets/esri/core/workers/chunks/{96b6ea199ad949fef17c.js → 43cf862577bf37344ff4.js} +1 -1
- package/assets/esri/core/workers/chunks/{eb815148ae65388dd733.js → 44918ff37818a7d36d76.js} +1 -1
- package/assets/esri/core/workers/chunks/4932773663469919d10a.js +1 -0
- package/assets/esri/core/workers/chunks/4996869b9cbd8c8ddcfa.js +1 -0
- package/assets/esri/core/workers/chunks/{be5f92e98d09d6e6e38e.js → 4bb1bb3ffb1b71bc43c8.js} +1 -1
- package/assets/esri/core/workers/chunks/4c389472b8cdb0c55154.js +1 -0
- package/assets/esri/core/workers/chunks/4e4f747de424941a0bfa.js +1 -0
- package/assets/esri/core/workers/chunks/4eae066673484986d4c1.js +1 -0
- package/assets/esri/core/workers/chunks/5736feefa261589b6273.js +1 -0
- package/assets/esri/core/workers/chunks/{aeaaff7a4b1a99540f52.js → 5cb26bbaa08114aec5ce.js} +1 -1
- package/assets/esri/core/workers/chunks/{5f4feca26102088ea565.js → 60737732ce495bbdd0fc.js} +1 -1
- package/assets/esri/core/workers/chunks/6f73e41e14817acfaead.js +1 -0
- package/assets/esri/core/workers/chunks/{320e5942a098dd104366.js → 74137ffec5265628c33b.js} +1 -1
- package/assets/esri/core/workers/chunks/7446d0dfebf93e86c098.js +1 -0
- package/assets/esri/core/workers/chunks/{688f2dbf784e66082308.js → 74c866e0b66e61751861.js} +1 -1
- package/assets/esri/core/workers/chunks/7711ae5612f685078fc8.js +1 -0
- package/assets/esri/core/workers/chunks/{5116b569a8dbda4910c8.js → 784a2fba3e18286958d1.js} +1 -1
- package/assets/esri/core/workers/chunks/{916b363c342b61ba5461.js → 787c1a8bda7d745633f2.js} +1 -1
- package/assets/esri/core/workers/chunks/{f6e62d2d279a328cbed7.js → 7bcedf479b07a4b4a234.js} +1 -1
- package/assets/esri/core/workers/chunks/842893e75696428d536f.js +1 -0
- package/assets/esri/core/workers/chunks/{acfa03c65ba3ca6c5685.js → 8715661a838361d4211a.js} +1 -1
- package/assets/esri/core/workers/chunks/8e19629899a5becf8e19.js +1 -0
- package/assets/esri/core/workers/chunks/9215b59c5ccecf9add58.js +1 -0
- package/assets/esri/core/workers/chunks/950d4578dc450467404c.js +1 -0
- package/assets/esri/core/workers/chunks/{68be3fb88ca61f82fb90.js → 95dbbddac6581b9d671f.js} +1 -1
- package/assets/esri/core/workers/chunks/{fafb92ca2c5e4b0b2c23.js → a09d2e1e2540921e4717.js} +1 -1
- package/assets/esri/core/workers/chunks/{900181f68449d8f82eeb.js → aa1ac7954e4f0fefe15b.js} +1 -1
- package/assets/esri/core/workers/chunks/ac24b4370dc7194a3107.js +1 -0
- package/assets/esri/core/workers/chunks/ace2e0a9d9013edd8624.js +1 -0
- package/assets/esri/core/workers/chunks/b1d5d236d5268fcbc74b.js +1 -0
- package/assets/esri/core/workers/chunks/{49ff0985fb307ac193ab.js → b573df59391ca41ee5a7.js} +1 -1
- package/assets/esri/core/workers/chunks/{f3da30d7300b92bd8bb0.js → befa32b9e7b3fbdd431e.js} +1 -1
- package/assets/esri/core/workers/chunks/{6c469b43089767176ced.js → c5ed67fdf261cbb1624b.js} +1 -1
- package/assets/esri/core/workers/chunks/cb4be68cc5085d421615.js +1 -0
- package/assets/esri/core/workers/chunks/{de6081df29183bf80787.js → d65383f4058dc813f40d.js} +1 -1
- package/assets/esri/core/workers/chunks/d6cd0039d6e9c40961e3.js +1 -0
- package/assets/esri/core/workers/chunks/{c598b22f78ccc57f9d6d.js → dfd2dc5cdc97ffba8926.js} +1 -1
- package/assets/esri/core/workers/chunks/e1b7806ab3e1967b15f0.js +1 -0
- package/assets/esri/core/workers/chunks/eaddffcc7004101fc230.js +1 -0
- package/assets/esri/core/workers/chunks/eb2652ec48faa78de3c5.js +1 -0
- package/assets/esri/core/workers/chunks/{c62738f84c914671b143.js → f4a7aa3cdbc0c429c359.js} +1 -1
- package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +4 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.ar.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.bg.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.bs.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.ca.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.cs.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.da.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.de.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.el.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.es.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.et.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.fi.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.fr.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.he.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.hr.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.hu.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.id.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.it.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.ja.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.ko.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.lt.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.lv.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.nl.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.no.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.pl.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.pt-BR.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.ro.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.ru.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.sk.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.sl.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.sr.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.sv.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.th.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.tr.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.uk.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.vi.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.zh-CN.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.zh-HK.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.zh-TW.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ar.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.bg.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.bs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ca.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.cs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.da.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.el.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.es.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.et.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.fi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.fr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.he.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.hr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.hu.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.id.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.it.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ja.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ko.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.lt.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.lv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.nl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.no.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pt-BR.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ro.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ru.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.th.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.tr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.uk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.vi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-CN.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-HK.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-TW.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.ar.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.bg.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.bs.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.ca.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.cs.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.da.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.el.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.es.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.et.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.fi.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.fr.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.he.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.hr.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.hu.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.id.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.it.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.ja.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.ko.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.lt.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.lv.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.nl.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.no.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.pl.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.pt-BR.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.ro.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.ru.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.sk.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.sl.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.sr.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.sv.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.th.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.tr.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.uk.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.vi.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.zh-CN.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.zh-HK.json +1 -1
- package/assets/esri/widgets/Editor/t9n/messages.zh-TW.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.ar.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.bg.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.bs.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.ca.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.cs.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.da.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.el.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.es.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.et.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.fi.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.fr.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.he.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.hr.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.hu.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.id.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.it.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.ja.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.ko.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.lt.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.lv.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.nl.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.no.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.pl.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.pt-BR.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.ro.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.ru.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.sk.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.sl.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.sr.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.sv.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.th.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.tr.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.uk.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.vi.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.zh-CN.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.zh-HK.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.zh-TW.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.ar.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.bg.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.bs.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.ca.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.cs.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.da.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.el.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.es.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.et.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.fi.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.fr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.he.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.hr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.hu.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.id.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.it.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.ja.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.ko.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.lt.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.lv.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.nl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.no.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.pl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.pt-BR.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.ro.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.ru.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.sk.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.sl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.sr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.sv.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.th.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.tr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.uk.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.vi.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.zh-CN.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.zh-HK.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.zh-TW.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.ar.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.bg.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.bs.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.ca.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.cs.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.da.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.el.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.es.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.et.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.fi.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.fr.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.he.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.hr.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.hu.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.id.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.it.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.ja.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.ko.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.lt.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.lv.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.nl.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.no.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.pl.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.pt-BR.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.ro.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.ru.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.sk.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.sl.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.sr.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.sv.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.th.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.tr.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.uk.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.vi.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.zh-CN.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.zh-HK.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.zh-TW.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.ar.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.bg.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.bs.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.ca.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.cs.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.da.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.el.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.es.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.et.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.fi.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.fr.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.he.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.hr.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.hu.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.id.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.it.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.ja.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.ko.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.lt.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.lv.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.nl.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.no.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.pl.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.pt-BR.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.ro.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.ru.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.sk.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.sl.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.sr.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.sv.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.th.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.tr.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.uk.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.vi.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.zh-CN.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.zh-HK.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.zh-TW.json +1 -1
- package/config.d.ts +2 -0
- package/config.js +1 -1
- package/core/ObjectPool.js +1 -1
- package/core/PooledArray.js +1 -1
- package/core/accessorSupport/tracking/SimpleTrackingTarget.js +1 -1
- package/core/workers/WorkerOwner.js +1 -1
- package/core/workers/workerFactory.js +1 -1
- package/core/workers/workers.js +2 -2
- package/core/workers.d.ts +9 -0
- package/geometry/Mesh.js +1 -1
- package/geometry/support/buffer/BufferPool.js +1 -1
- package/geometry/support/coordsUtils.js +1 -1
- package/geometry/support/curves/bezierCurveUtils.js +1 -1
- package/geometry/support/curves/ellipticArc7Utils.js +1 -1
- package/geometry/support/meshUtils/rotate.js +1 -1
- package/kernel.js +1 -1
- package/layers/AnnotationFeatureLayer.d.ts +2 -2
- package/layers/AnnotationFeatureLayer.js +1 -1
- package/layers/CatalogLayer.d.ts +2 -2
- package/layers/CatalogLayer.js +1 -1
- package/layers/DimensionFeatureLayer.d.ts +2 -2
- package/layers/DimensionFeatureLayer.js +1 -1
- package/layers/FeatureLayer.d.ts +2 -2
- package/layers/FeatureLayer.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/LineOfSightLayer.d.ts +10 -8
- package/layers/SubtypeGroupLayer.d.ts +2 -2
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/ViewshedLayer.d.ts +1 -1
- package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +9 -9
- package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
- package/layers/geospatialPDF/LGIDictMapFrame.js +1 -1
- package/layers/geospatialPDF/ViewportMeasureFrame.js +1 -1
- package/layers/geospatialPDF/geospatialPDFParserUtils.js +1 -1
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/sources/parquet/FileProvider.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/mixins/{FeatureLayerReload.d.ts → ReloadableLayer.d.ts} +5 -3
- package/layers/mixins/ReloadableLayer.js +2 -0
- package/layers/orientedImagery/core/coverageUtils.js +1 -1
- package/layers/raster/datasets/BaseRaster.js +1 -1
- package/layers/raster/datasets/GeospatialPDFRaster.js +1 -1
- package/layers/raster/datasets/ImageAuxRaster.js +2 -2
- package/layers/raster/datasets/ImageServerRaster.js +1 -1
- package/layers/raster/datasets/InMemoryRaster.js +1 -1
- package/layers/raster/datasets/MRFRaster.js +1 -1
- package/layers/raster/datasets/TIFFRaster.js +1 -1
- package/layers/raster/datasets/WCSRaster.js +1 -1
- package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
- package/layers/raster/formats/RasterCodec.js +1 -1
- package/layers/raster/formats/TiffDecoder.js +1 -1
- package/layers/raster/formats/Zlib.js +1 -1
- package/layers/support/RasterWorker.js +1 -1
- package/layers/support/kmlUtils.js +1 -1
- package/package.json +2 -2
- package/popup/FeatureModel.js +1 -1
- package/popup/FeaturesModel.js +1 -1
- package/request/process.js +1 -1
- package/request/types.d.ts +7 -0
- package/smartMapping/statistics/support/statsWorker.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/OGCFeatureLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/symbols/support/ElevationInfo.d.ts +4 -3
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueBackground.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
- package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightPlacementController.js +1 -1
- package/views/3d/analysis/LineOfSight/{LineOfSightRootPlugin.js → LineOfSightPlacementRootPlugin.js} +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/analysis/LineOfSight/types.d.ts +14 -3
- package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +39 -13
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/Viewshed/types.d.ts +7 -0
- package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +43 -15
- package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +1 -1
- package/views/3d/support/MemoryController.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
- package/views/3d/webgl-engine/effects/geometry/RenderOccluded.js +1 -1
- package/views/interactive/options/TooltipOptions.d.ts +2 -0
- package/views/interactive/sketch/SketchTooltipOptions.d.ts +2 -0
- package/views/layers/LineOfSightLayerView.d.ts +35 -13
- package/views/layers/SketchLayerView.d.ts +1 -0
- package/views/layers/ViewshedLayerView.d.ts +36 -12
- package/widgets/BatchAttributeForm/inputs/support/DynamicChoiceController.js +1 -1
- package/widgets/HistogramRangeSlider.d.ts +2 -2
- package/widgets/HistogramRangeSlider.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer.js +2 -2
- package/widgets/PanoramicViewer/PanoramicVideoViewerViewModel.js +1 -1
- package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.d.ts +5 -2
- package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/ValuePicker/ValuePickerBaseComponent.d.ts +5 -1
- package/widgets/ValuePicker/ValuePickerCollection.d.ts +2 -0
- package/widgets/ValuePicker/ValuePickerCombobox.d.ts +7 -1
- package/widgets/ValuePicker/ValuePickerLabel.d.ts +7 -1
- package/widgets/ValuePicker/ValuePickerSlider.d.ts +2 -0
- package/widgets/ValuePicker/ValuePickerSliderVisibleElements.d.ts +5 -1
- package/widgets/ValuePicker/ValuePickerVisibleElements.d.ts +5 -1
- package/widgets/ValuePicker/types.d.ts +2 -0
- package/assets/esri/core/workers/chunks/03261b9451e293a0fac8.js +0 -1
- package/assets/esri/core/workers/chunks/0ad0484ffcbe4ad21bd3.js +0 -1
- package/assets/esri/core/workers/chunks/19743dedaa40446259ec.js +0 -1
- package/assets/esri/core/workers/chunks/1c65ab9ed611c322ce27.js +0 -1
- package/assets/esri/core/workers/chunks/1f339247b68b061ab0a4.js +0 -1
- package/assets/esri/core/workers/chunks/251921cd10ecfbc89451.js +0 -1
- package/assets/esri/core/workers/chunks/3252b1fae363bb0129a0.js +0 -1
- package/assets/esri/core/workers/chunks/408e81c8f1eff8a7b379.js +0 -1
- package/assets/esri/core/workers/chunks/50036a323c2e7f155311.js +0 -1
- package/assets/esri/core/workers/chunks/55dcbf296d8d0092e473.js +0 -1
- package/assets/esri/core/workers/chunks/59b216b60464611742d4.js +0 -1
- package/assets/esri/core/workers/chunks/5bfea0c55aca826de536.js +0 -1
- package/assets/esri/core/workers/chunks/60d3056a31d982c9cad0.js +0 -1
- package/assets/esri/core/workers/chunks/6558488ea96620439f34.js +0 -1
- package/assets/esri/core/workers/chunks/6aebf7cfd294e88bf926.js +0 -1
- package/assets/esri/core/workers/chunks/6b43bb78f9839ed43135.js +0 -1
- package/assets/esri/core/workers/chunks/6c83398cf586ecea0eb1.js +0 -1
- package/assets/esri/core/workers/chunks/7267b17de212207142c9.js +0 -1
- package/assets/esri/core/workers/chunks/88c74f3316f1fc253207.js +0 -1
- package/assets/esri/core/workers/chunks/912080c90b5cc2e817cf.js +0 -1
- package/assets/esri/core/workers/chunks/a97d85774f9a417202df.js +0 -1
- package/assets/esri/core/workers/chunks/aff32980d91dab07dfb7.js +0 -1
- package/assets/esri/core/workers/chunks/b1b4066e8d1c0c9656e5.js +0 -1
- package/assets/esri/core/workers/chunks/b6ba66a05030d3815dfd.js +0 -1
- package/assets/esri/core/workers/chunks/bbec9d2e3b75a5c59681.js +0 -1
- package/assets/esri/core/workers/chunks/bf69024804ac51c8f733.js +0 -1
- package/assets/esri/core/workers/chunks/c1254cd131a62750ff6f.js +0 -1
- package/assets/esri/core/workers/chunks/d938987344bce83cc660.js +0 -1
- package/assets/esri/core/workers/chunks/db1ab9b9c8bf5c7635d3.js +0 -1
- package/assets/esri/core/workers/chunks/de02a6a1f4810f99e9bb.js +0 -1
- package/assets/esri/core/workers/chunks/f4f9d08b2df856e3b694.js +0 -1
- package/assets/esri/core/workers/chunks/fd9663952d5a94f3a83f.js +0 -1
- package/layers/mixins/FeatureLayerReload.js +0 -2
- /package/views/3d/analysis/LineOfSight/{lineOfSightPlacementUtils.js → placementUtils.js} +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"../../core/Error.js";import{Loadable as n}from"../../core/Loadable.js";import{open as r}from"../../core/workers.js";import{subclass as i}from"../../core/accessorSupport/decorators.js";import a from"./GeospatialPDFFrame.js";import{parse as o}from"./geospatialPDFParserUtils.js";let s=class extends n{constructor(){super(...arguments),this._connection=null,this._workerHandler=null}load(e){let t=r(`GeospatialPDFLayerWorker`,{...e,strategy:`dedicated`,registryTarget:this}).then(e=>{this._connection=e,this._workerHandler=this._connection.createInvokeProxy()});return this.addResolvingPromise(t),Promise.resolve(this)}destroy(){this._connection?.close(),this._connection=null,this._workerHandler=null,super.destroy()}async loadPDF(e,n={}){await this.load(n);let{geospatialMetadata:r}=await this._workerHandler.loadPDF(e,n),i=o(r,0),s=i.lgiDictFrame??i.vpFrame;if(!s)throw new t(`geospatial-pdf-layer:load`,`pdf does not contain supported LGIDict or VP/Measure.`);let c=new a(s);return{frame:c,sourceSpatialReference:c.spatialReference.toJSON(),
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../core/Error.js";import{Loadable as n}from"../../core/Loadable.js";import{open as r}from"../../core/workers.js";import{subclass as i}from"../../core/accessorSupport/decorators.js";import a from"./GeospatialPDFFrame.js";import{parse as o}from"./geospatialPDFParserUtils.js";let s=class extends n{constructor(){super(...arguments),this._connection=null,this._workerHandler=null}load(e){let t=r(`GeospatialPDFLayerWorker`,{...e,strategy:`dedicated`,registryTarget:this}).then(e=>{this._connection=e,this._workerHandler=this._connection.createInvokeProxy()});return this.addResolvingPromise(t),Promise.resolve(this)}destroy(){this._connection?.close(),this._connection=null,this._workerHandler=null,super.destroy()}async loadPDF(e,n={}){await this.load(n);let{geospatialMetadata:r}=await this._workerHandler.loadPDF(e,n),i=o(r,0),s=i.lgiDictFrame??i.vpFrame;if(!s)throw new t(`geospatial-pdf-layer:load`,`pdf does not contain supported LGIDict or VP/Measure.`);let c=new a(s);return{frame:c,sourceSpatialReference:c.spatialReference.toJSON(),neatlineExtent:c.toExtent()}}async render(e,t,n,r,i,a){let o={sourceExtentAsJSON:e.toJSON(),width:t,height:n,ctm:r,currentRing:i};return this._workerHandler.renderPDF(o,a)}};s=e([i(`esri.layers.geospatialPDF.GeospatialPDFWorkerClient`)],s);export{s as GeospatialPDFWorkerClient};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Error.js";import{fromValues as t}from"../../core/libs/gl-matrix-2/factories/mat2df64.js";import{fromValues as n}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{expandMediaBox as r,createGeoreferencer as i,validateTransform as a,affineTransformationFromGeoreference as o}from"./sharedUtils.js";class s{constructor(e){let t=this.
|
|
2
|
+
import e from"../../core/Error.js";import{fromValues as t}from"../../core/libs/gl-matrix-2/factories/mat2df64.js";import{fromValues as n}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{expandMediaBox as r,createGeoreferencer as i,validateTransform as a,affineTransformationFromGeoreference as o}from"./sharedUtils.js";class s{constructor(e){let t=this._inputValidation(e);this._registration=t.registration,this._projection=t.projection,this._neatline=t.neatline,this.spatialReference=this._projection,this.pairedNeatline=f(this._neatline),this.outerExtentMediaBox=r(t.mediaBox),this.geoControlPoints=u(`geo`,this._registration),this.ctm=t.ctm??c(this.outerExtentMediaBox,this.pairedNeatline,this._registration,this.spatialReference),this._outputValidation()}_inputValidation(n){let{ctm:r,registration:i,projection:a,display:o,neatline:s,mediaBox:c}=n;if(r&&r.length!==6)throw new e(`geospatial-pdf-layer:invalid-frame`,`LGIDict has invalid CTM.`);if(!r&&(!i||i.length<3))throw new e(`geospatial-pdf-layer:invalid-frame`,`LGIDict missing CTM and minimum registration points`);if(!c||c.length!==4)throw new e(`geospatial-pdf-layer:invalid-frame`,`LGIDict missing or invalid MediaBox.`);if(!s||s.length<4||s.length%2!=0)throw new e(`geospatial-pdf-layer:invalid-frame`,`LGIDict missing or invalid amount of neatline points`);return{ctm:r?t(r[0],r[1],r[2],r[3],r[4],r[5]):void 0,registration:i??[],projection:a,display:o,neatline:s,mediaBox:c}}_outputValidation(){if(this.ctm.length!==6)throw new e(`geospatial-pdf-layer:invalid-frame`,`LGIDict missing or invalid CTM`);if(this.pairedNeatline.length<4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Map Frame should have at least 4 neatline points.`);if(this.outerExtentMediaBox.length!==4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Failed to generate outerextent from mediaBox.`);if(!this.ctm&&this.geoControlPoints.length<2)throw new e(`geospatial-pdf-layer:invalid-frame`,`Map Frame should have at least 2 geoControlPoints if defaulting.`)}}function c(e,t,r,s){let c=[],l=[];for(let e of r)e.length<4||(c.push(n(e[0],e[1])),l.push(n(e[2],e[3])));let u=d(e,t,r),f=i(c,l,s,u),p=a(f);return o(p)}function l(t){let n=1/0,r=1/0,i=-1/0,a=-1/0;for(let e=0;e<t.length;e++){let o=t[e];n=Math.min(n,o[0]),r=Math.min(r,o[1]),i=Math.max(i,o[0]),a=Math.max(a,o[1])}if(!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a))throw new e(`geospatial-pdf-layer: invalid-frame`,`Failed to compute extent from registration.`);return{xmin:n,ymin:r,xmax:i,ymax:a}}function u(e,t){let[n,r]=e===`page`?[0,1]:[2,3];return t.filter(e=>e.length>r).map(e=>[e[n],e[r]])}function d(t,n,r){if(t.length===4)return l(t);if(n.length>=6)return l(n);let i=u(`page`,r);if(i.length>=2)return l(i);throw new e(`geospatial-pdf-layer: invalid-frame`,`Cannot build source rectangle from Neatline or Registration points.`)}function f(e){let t=[];for(let n=0;n<e.length;n+=2){let r=e[n],i=e[n+1];Number.isFinite(r)&&Number.isFinite(i)&&t.push([r,i])}return t.length===2&&(t.splice(1,0,[t[1][0],t[0][1]]),t.push([t[0][0],t[2][1]])),t}export{s as LGIDictMapFrame,l as extentFromArray,f as pairNeatline};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Error.js";import{fromValues as t}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import n from"../../geometry/Point.js";import r from"../../geometry/SpatialReference.js";import{projectExecute as i}from"../../geometry/operators/projectOperator.js";import{expandMediaBox as a,validateTransform as o,affineTransformationFromGeoreference as s,createGeoreferencer as c}from"./sharedUtils.js";class l{constructor(e){let{bbox:t,bounds:n,gpts:r,lpts:i,gcs:c,mediaBox:l}=this.
|
|
2
|
+
import e from"../../core/Error.js";import{fromValues as t}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import n from"../../geometry/Point.js";import r from"../../geometry/SpatialReference.js";import{projectExecute as i}from"../../geometry/operators/projectOperator.js";import{expandMediaBox as a,validateTransform as o,affineTransformationFromGeoreference as s,createGeoreferencer as c}from"./sharedUtils.js";class l{constructor(e){let{bbox:t,bounds:n,gpts:r,lpts:i,gcs:c,mediaBox:l}=this._inputValidation(e);this._bbox=t,this._bounds=n,this._gpts=r,this._lpts=i,this._gcs=c,this.spatialReference=_(this._gcs),this.outerExtentMediaBox=a(l),this.geoControlPoints=f(this._gpts,this.spatialReference).map(e=>[e[0],e[1]]);let p=u(this._bbox,this._bounds)??d(this._lpts,this._bbox);this.pairedNeatline=p.map(e=>[e[0],e[1]]),this.neatLine=this.pairedNeatline.flat(),this._georeference=m(this._bbox,this._lpts,this._gpts,this.spatialReference);let h=o(this._georeference);this.ctm=s(h),this._outputValidation()}_inputValidation(t){let{bbox:n,bounds:r,gpts:i,lpts:a,gcs:o,mediaBox:s}=t;if(!n||n.length!==4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Viewport missing or invalid BBox`);if(!s||s.length!==4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Viewport missing or invalid MediaBox`);if(!i||i.length<6||i.length%2!=0)throw new e(`geospatial-pdf-layer:invalid-frame`,`MeasureFrame missing or invalid GPTS`);if(!a||a.length<6||a.length%2!=0)throw new e(`geospatial-pdf-layer:invalid-frame`,`MeasureFrame missing or invalid LPTS`);if(a.length!==i.length)throw new e(`geospatial-pdf-layer: invalid-frame`,`MeasureFrame LPTS and GPTS must be same length`);if(!o?.WKT&&!o?.EPSG)throw new e(`geospatial-pdf-layer:invalid-frame`,`MeasureFrame missing a WKT or EPSG code`);return{bbox:n,bounds:r,gpts:i,lpts:a,gcs:o,mediaBox:s}}_outputValidation(){if(this.outerExtentMediaBox.length!==4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Failed to generate outer extent from mediaBox`);if(this.geoControlPoints.length<2)throw new e(`geospatial-pdf-layer:invalid-frame`,`Map Frame should have at least 2 geoControlPoints`);if(this.pairedNeatline.length<4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Map Frame should have at least 4 neatline points`);if(!this.ctm||this.ctm.length!==6)throw new e(`geospatial-pdf-layer:invalid-frame`,`Missing or invalid Map Frame CTM`)}}function u(e,t){return h(t)?.map(t=>p(e,t.u,t.v))??null}function d(e,t){let n=[];for(let r=0;r<e.length;r+=2){let i=e[r],a=e[r+1];n.push(p(t,i,a))}return n}function f(e,r){let a=[];for(let o=0;o<e.length;o+=2){let s=e[o],c=e[o+1],l=new n({x:c,y:s}),u=i(l,r);a.push(t(u.x,u.y))}return a}function p(e,n,r){let[i,a,o,s]=e;return t(i+n*(o-i),a+r*(s-a))}function m(e,t,n,r){let i=d(t,e),a=f(n,r),o=g(e);return c(i,a,r,o)}function h(e){if(!e||e.length<8||e.length%2!=0)return null;let t=[];for(let n=0;n<e.length;n+=2)t.push({u:e[n],v:e[n+1]});return t}function g(e){let[t,n,r,i]=e;return{xmin:Math.min(t,r),ymin:Math.min(n,i),xmax:Math.max(t,r),ymax:Math.max(n,i)}}function _(t){if(t?.WKT)return new r({wkt:t.WKT});if(t?.EPSG)return new r({wkid:t.EPSG});throw new e(`geospatial-pdf-layer: invalid-frame`,`MeasureFrame missing WKT or EPSG.`)}export{l as ViewportMeasureFrame};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Error.js";import"../../core/has.js";import{LGIDictMapFrame as t}from"./LGIDictMapFrame.js";import{projectionToSpatialReference as
|
|
2
|
+
import e from"../../core/Error.js";import"../../core/has.js";import{LGIDictMapFrame as t,pairNeatline as n,extentFromArray as r}from"./LGIDictMapFrame.js";import{projectionToSpatialReference as i}from"./projectionToWKTUtils.js";import{ViewportMeasureFrame as a}from"./ViewportMeasureFrame.js";function o(n,r=0){let o={mediaBox:y(n.MediaBox),rotate:C(n.Rotate),hasLGIDict:n.LGIDict!=null,hasVP:n.VP!=null};if(o.hasVP){let t=c(n.VP,r);if(!t)throw new e(`geospatial-pdf-layer:invalid frame`,`Failed to parse VP frame at index ${r}`);return{result:o,vpFrame:new a({bbox:t.BBox,bounds:t.Measure?.Bounds,gpts:t.Measure?.GPTS,lpts:t.Measure?.LPTS,gcs:t.Measure?.GCS,mediaBox:y(n.MediaBox)})}}if(o.hasLGIDict){let a=s(n.LGIDict,r);if(!a)throw new e(`geospatial-pdf-layer:invalid frame`,`Failed to parse LGI Dict frame at index ${r}`);if(!a.Projection)throw new e(`geospatial-pdf-layer:parse`,`LGIDict map frame missing Projection.`);let c=i(a.Projection),l;try{l=a.Display?i(a.Display):void 0}catch{l=c}return{result:o,lgiDictFrame:new t({ctm:a.CTM,registration:a.Registration,projection:c,display:l,neatline:a.Neatline,mediaBox:y(n.MediaBox)})}}return{result:o}}function s(e,t){let n=l(e);try{let e=n[0],t=E(e);for(let r of n){let n=E(r);n>t&&(t=n,e=r)}return e}catch{return n[t]}}function c(e,t){return u(e)[t]}function l(e){return e==null?[]:Array.isArray(e)?e.map(e=>d(e)):[d(e)]}function u(e){return e==null?[]:Array.isArray(e)?e.map(e=>f(e)):[f(e)]}function d(e){let t=T(e,`LGIDict map frame must be an object.`);return{CTM:y(t.CTM),Registration:b(t.Registration),Neatline:y(t.Neatline),Projection:h(t.Projection),Display:h(t.Display)}}function f(e){let t=T(e,`Viewport frame must be an object.`),n=p(t.Measure);return{BBox:y(t.BBox),Measure_Raw:t.Measure,Measure:n,Raw:t}}function p(e){if(w(e))return{Bounds:y(e.Bounds),GPTS:y(e.GPTS),LPTS:y(e.LPTS),GCS:m(e.GCS)}}function m(e){if(w(e))return{WKT:x(e.WKT),EPSG:C(e.EPSG)}}function h(e){if(w(e))return{Type:S(e.Type),Units:S(e.Units),Datum:g(e.Datum),Projection_Type:S(e.ProjectionType),Central_Meridian:C(e.CentralMeridian),False_Easting:C(e.FalseEasting),False_Northing:C(e.FalseNorthing),Height:C(e.Height),Hemisphere:S(e.Hemisphere),Latitude_One:C(e.LatitudeOne),Latitude_Two:C(e.LatitudeTwo),Latitude_Of_True_Scale:C(e.LatitudeOfTrueScale),Longitude_One:C(e.LongitudeOne),Longitude_Two:C(e.LongitudeTwo),Longitude_Down_From_Pole:C(e.LongitudeDownFromPole),Orientation:S(e.Orientation),Origin_Height:C(e.OriginHeight),Origin_Latitude:C(e.OriginLatitude),Origin_Longitude:C(e.OriginLongitude),Scale_Factor:C(e.ScaleFactor),Standard_Parallel:C(e.StandardParallel),Standard_Parallel_One:C(e.StandardParallelOne),Standard_Parallel_Two:C(e.StandardParallelTwo),Zone:C(e.Zone),Description:S(e.Description),raw:e}}function g(e){return e==null?null:typeof e==`string`?{kind:`name`,name:S(e),ellipsoid:null,to_WGS84:null,raw:e}:w(e)?{kind:`definition`,name:S(e.Description),ellipsoid:_(e.Ellipsoid),to_WGS84:v(e.ToWGS84),raw:e}:{kind:`unknown`,name:S(e),ellipsoid:null,to_WGS84:null,raw:e}}function _(e){if(w(e))return{semi_Major_Axis:C(e.SemiMajorAxis),inverse_Flattening:C(e.InvFlattening),semi_Minor_Axis:C(e.SemiMinorAxis),description:S(e.Description)}}function v(e){if(w(e))return{dx:C(e.dx)??0,dy:C(e.dy)??0,dz:C(e.dz)??0,rx:C(e.rx)??0,ry:C(e.ry)??0,rz:C(e.rz)??0,sf:C(e.sf)??0}}function y(e){if(!Array.isArray(e))return;let t=[];for(let n of e){let e=C(n);if(e===void 0)return;t.push(e)}return t}function b(e){if(Array.isArray(e))return e.filter(e=>Array.isArray(e)).map(e=>e.map(e=>C(e)).filter(e=>e!==void 0))}function x(e){if(e!=null)return typeof e==`string`?e:String(e)}function S(e){let t=x(e);if(t!==void 0)return t.trim()}function C(e){if(e==null)return;if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(typeof e!=`string`)return;let t=e.trim();if(t===``)return;let n=Number(t);return Number.isFinite(n)?n:void 0}function w(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function T(t,n){if(!w(t))throw new e(`geospatial-pdf-layer:parse`,n);return t}function E(e){let t=e.Neatline;if(!t)return 0;let i=n(t),a=r(i);return(a.xmax-a.xmin)*(a.ymax-a.ymin)}export{o as parse};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{result as n}from"../../../core/asyncUtils.js";import r from"../../../core/Collection.js";import i from"../../../core/Error.js";import has from"../../../core/has.js";import{clone as a}from"../../../core/lang.js";import o from"../../../core/Logger.js";import{destroyMaybe as s,removeMaybe as c,abortMaybe as l}from"../../../core/maybe.js";import{EsriPromiseMixin as u}from"../../../core/Promise.js";import{createAbortError as d,isAbortError as f}from"../../../core/promiseUtils.js";import{initial as p,watch as m,syncAndInitial as h,sync as g}from"../../../core/reactiveUtils.js";import{sqlAnd as _}from"../../../core/sql.js";import{property as v,subclass as y}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as b}from"../../../core/support/UpdatingHandles.js";import{projectAsync as x}from"../../../geometry/projectionUtils.js";import{isHostedAgolService as S}from"../../support/arcgisLayerUrl.js";import{checkServiceCurrentUserSupport as C}from"../../support/featureLayerUtils.js";import{getEffectiveLayerCapabilities as w}from"../../support/layerUtils.js";import T from"../../../rest/support/StatisticDefinition.js";import{FeatureTileDescriptor as E,virtualSnapshotTileId as D,virtualDisplayFilterHighlightTileId as O}from"../../../views/3d/layers/support/FeatureTileDescriptor.js";import{FeatureTileFetcher3D as k}from"../../../views/3d/layers/support/FeatureTileFetcher3D.js";import{FeatureTileFetcher3DDebugger as A}from"../../../views/3d/layers/support/FeatureTileFetcher3DDebugger.js";import{debugFlags as j}from"../../../views/3d/support/debugFlags.js";let M=class extends u(t){get dataUpdating(){return this._tileFetcher?.dataUpdating??!1}set extent(e){if(e!=null&&!e.spatialReference.equals(this.layerView.view.spatialReference)){o.getLogger(this).error(`#extent=`,`extent needs to be in the same spatial reference as the view`);return}let t=this._get(`extent`);if(t===e||t!=null&&e&&t.equals(e))return;let n=e==null?null:e.clone();this._set(`extent`,n)}get updating(){return!!(this._tileFetcher?.updating||this._fetchDataInfoPromise!=null||this.mode===`tiles`&&this.layerView.view.featureTiles?.updating||this._updatingHandles?.updating)}get updatingTotal(){return this.updating&&this._tileFetcher!=null?this._tileFetcher.updatingTotal:0}get updatingRemaining(){return this.updating&&this._tileFetcher!=null?this._tileFetcher.updatingRemaining:0}get expectedFeatureDiff(){return this.updating&&this._tileFetcher!=null?this._tileFetcher.expectedFeatureDiff:0}get usedMemory(){return this._tileFetcher?.usedMemory??0}get usedMemoryPerFeature(){return this._tileFetcher?.usedMemoryPerFeature??0}get maximumNumberOfFeaturesExceeded(){return!!(this._tileFetcher!=null&&this._tileFetcher.maximumNumberOfFeaturesExceeded)}get snappingComplexityExceeded(){return this._tileFetcher?.snappingComplexityExceeded??!0}get maximumNumberOfFeatures(){return this.displayFeatureLimit?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){e!==this.maximumNumberOfFeatures&&this._overrideIfSome(`maximumNumberOfFeatures`,e)}get hasMaximumNumberOfFeaturesOverride(){return this._isOverridden(`maximumNumberOfFeatures`)}get hasAllFeatures(){return this.serviceDataCount===I.noServiceDataCount&&this.mode===`snapshot`&&this.hasAllFeaturesInView||this.serviceDataCount===this.graphics.length}get hasAllFeaturesInView(){let e=this.context.effectiveDisplayFilter?.where||null,t=e!=null&&e!==`1=1`;return this.mode===`tiles`&&t?!1:this._tileFetcher?.showsAllFeatures??!1}get hasFullGeometries(){return this._tileFetcher?.hasFullGeometries??!1}get mode(){let e=this.layerView.layer;if(e.type===`feature`&&e.infoFor3D!=null)return`snapshot`;if(e.type===`catalog-footprint`||this._forceTilesMode)return`tiles`;let t=this.layerView.view;if(t.qualitySettings?.graphics3D?.snapshotAvailable===!1||this.serviceDataCount===I.noServiceDataCount||this._snapshotLimitExceeded||this.maximumNumberOfFeaturesExceeded||t.quality<1)return`tiles`;let n=(t&&t.featureTiles)?.tilingScheme;if(e&&e.minScale&&this.serviceDataExtent&&n){let t=this._approximateExtentSizeAtScale(e.minScale,n);if((this.serviceDataExtent.width/t+this.serviceDataExtent.height/t)/2>I.maxSnapshotMinScaleFactor)return`tiles`}return!this.maximumNumberOfFeatures||this.serviceDataCount<=this.maximumNumberOfFeatures?`snapshot`:`tiles`}get maxTotalSnapshotVertices(){let e=this._get(`maxTotalSnapshotVertices`)||0,t=this.mode===`snapshot`&&this._tileFetcher?.totalVertices||0;return Math.max(e,t)}_approximateExtentSizeAtScale(e,t){let n=this.layerView.view,r=Math.ceil((n.width/t.pixelSize+n.height/t.pixelSize)/2),i=t.levels[0];return r*((i.tileSize[0]/(i.scale/e)+i.tileSize[1]/(i.scale/e))/2)}get tileDescriptors(){if(this.mode===`snapshot`){let e=new E(0,0,0,null,D);return new r([e])}let e=this.layerView.view.featureTiles;if(!e)return new r;let t=e.tiles;if(this.layerView.displayFilterEnabled&&this.layerView.effectiveDisplayFilterClause!=null&&this.layerView.effectiveDisplayFilterClause!==`1=1`&&this.layerView.highlightIds?.length>0){let e=new E(0,0,0,this.layerView.view.featureTiles?.tilingScheme,O);return new r([...t,e])}return t}get test(){}constructor(e){super(e),this.type=`feature-tile-3d`,this._updatingHandles=new b,this.serviceDataExtent=null,this.serviceDataCount=I.noServiceDataCount,this._snapshotLimitExceeded=!1,this.displayFeatureLimit=null,this._forceTilesMode=!1,this._suspended=!1,this._tileFetcher=null,this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null,this._lifeCycleAbortController=new AbortController}initialize(){this._updatingHandles.add(()=>this.displayFeatureLimit,e=>this._updatingHandles.addPromise(this._updateSnapshotLimit(e,null,this._lifeCycleAbortController.signal))),this._updatingHandles.add(()=>this.mode,()=>this._modeChanged(),p),this._updatingHandles.add(()=>this.mode,(e,t)=>{e===`tiles`&&t===`snapshot`&&(this._forceTilesMode=!0)},p),this.addResolvingPromise(Promise.resolve().then(()=>this._verifyCapabilities()).then(()=>this._updatingHandles.addPromise(this._fetchServiceDataInfo())).then(()=>this._initializeTileFetcher()))}_verifyCapabilities(){let e=this.layerView.layer;if(e.type!==`ogc-feature`&&!w(e)?.operations.supportsQuery)throw new i(`graphicscontroller:query-capability-required`,`Service requires query capabilities to be used as a feature layer`,{layer:e})}destroy(){this._cancelFetchServiceDataInfo(),this._tileFetcher=s(this._tileFetcher),this._tilesHandle=c(this._tilesHandle),this._lifeCycleAbortController=l(this._lifeCycleAbortController),this._updatingHandles.destroy(),this._set(`_updatingHandles`,null)}suspend(){this._suspended||(this._suspended=!0,this._tileFetcher!=null&&this._tileFetcher.suspend())}resume(){this._suspended&&(this._suspended=!1,this._tileFetcher!=null&&this._tileFetcher.resume())}restart(){let e=()=>{this._tileFetcher!=null&&this._tileFetcher.restart()};this._updatingHandles.consumePromise(this._fetchServiceDataInfo().then(e,e))}refetch(){this._refetch({resetForceTilesMode:!1})}getMissingAttributesForFeature(e){return this._tileFetcher?.getMissingAttributesForFeature(e)}_refetch(e){let t=()=>{this._tileFetcher!=null&&(e.resetForceTilesMode&&(this._forceTilesMode=!1),this._tileFetcher.refetch())};this._updatingHandles.consumePromise(this._fetchServiceDataInfo().then(t,t))}_initializeTileFetcher(){let e=this.layerView.view;if(!e)return;let{layerView:t,tileDescriptors:n}=this,r=t.layer,i=new k({context:this.context,filterExtent:this.extent,tileDescriptors:n,features:this.graphics});this._tileFetcher=i,this._suspended?i.suspend():i.resume(),e&&this.addHandles(m(()=>e.quality,e=>i.memoryFactor=e,h));let a=this.context.geometryType===`polygon`?`polygonLodFactor`:this.context.geometryType===`polyline`?`polylineLodFactor`:null;a&&this.addHandles(m(()=>this.layerView.view?.qualitySettings?.graphics3D?.[a],e=>i.lodFactor=e||1,p)),r.type!==`ogc-feature`&&this._updatingHandles.add(()=>r.createQueryVersion,()=>this._dataFilterChanged()),this._updatingHandles.add(()=>this.layerView.effectiveDisplayFilter,()=>this._effectiveDisplayFilterChanged()),this._updatingHandles.add(()=>this.layerView.highlightIds,()=>this._displayFilterHighlightIdsChanged()),this._updatingHandles.add(()=>t.availableFields,(e,t)=>this._availableFieldsChanged(t,e)),this._updatingHandles.add(()=>t.requiredFields,(e,t)=>this._requiredFieldsChanged(t,e)),`customParameters`in r&&this._updatingHandles.add(()=>r.customParameters,()=>this.restart()),this.addHandles([r.on(`apply-edits`,e=>this._applyEdits(e)),m(()=>this.extent,e=>i.filterExtent=e,g),m(()=>this.tileDescriptors,e=>i.tileDescriptors=e,g),m(()=>this.maximumNumberOfFeatures,e=>{i.maximumNumberOfFeatures=e,i.useTileCount=this.serviceDataCount>e},h),m(()=>this.serviceDataCount,e=>{i.useTileCount=e>this.maximumNumberOfFeatures},h),m(()=>({featureTiles:e.featureTiles,show:j.FEATURE_TILE_FETCH_SHOW_TILES}),({show:t,featureTiles:n})=>{t&&i&&n?i.debugger??=new A(i,n.tilingScheme.toTileInfo(),e):i.debugger=s(i.debugger)},p)]),this._supportsExceedsLimitQuery||this._updatingHandles.add(()=>this.maxTotalSnapshotVertices,()=>this._updatingHandles.addPromise(this._updateSnapshotLimit(this.displayFeatureLimit,null,this._lifeCycleAbortController.signal)))}_modeChanged(){switch(this.mode){case`tiles`:this._tilesHandle||=this.layerView.view.enableFeatureTiles();break;default:o.getLogger(this).warn(`Unhandled feature layer mode `+this.mode);case`snapshot`:this._tilesHandle!=null&&(this._tilesHandle.remove(),this._tilesHandle=null)}}_dataFilterChanged(){this._set(`maxTotalSnapshotVertices`,0),this.notifyChange(`maxTotalSnapshotVertices`),this._refetch({resetForceTilesMode:!0})}_effectiveDisplayFilterChanged(){this.mode!==`snapshot`&&this._refetch({resetForceTilesMode:!1})}_displayFilterHighlightIdsChanged(){this.mode!==`snapshot`&&this._tileFetcher!=null&&this._tileFetcher.refetchDisplayFilterHighlightTile()}_applyEdits(e){let t=this.layerView.layer;this._tileFetcher!=null&&this._tileFetcher.applyEdits(e).then(e=>{if(e){if(!this._lifeCycleAbortController)throw d();e.exceededTransferLimit&&`refresh`in t?t.refresh():(e.deletedFeatures.length||e.updatedFeatures.length||e.addedFeatures.length)&&this._updatingHandles.consumePromise(this._updateServiceDataExtent(this._lifeCycleAbortController.signal))}}).catch(e=>{if(!f(e))throw e})}_availableFieldsChanged(e,t){this._tileFetcher!=null&&F(this._tileFetcher.availableFields,t)&&this._refetch({resetForceTilesMode:!1})}_requiredFieldsChanged(e,t){this._tileFetcher!=null&&F(this._tileFetcher.availableFields,t)&&this.restart()}_createVertexLimitExceededQuery(e){let t=this.layerView.layer,n=t.createQuery();return n.returnGeometry=!1,n.outStatistics=[new T({statisticType:`exceedslimit`,maxVertexCount:e,outStatisticFieldName:`exceedslimit`,maxPointCount:1e8,maxRecordCount:1e8})],t.capabilities?.query.supportsCacheHint&&(n.cacheHint=!0),n}_createDataInfoQuery(){let e=this.layerView.layer,t=this.layerView,n=e.createQuery();return n.returnGeometry=!1,n.outSpatialReference=this.layerView.view.spatialReference,e.capabilities?.query.supportsCacheHint&&(n.cacheHint=!0),t.effectiveDisplayFilter&&(n.where=_(n.where,t.effectiveDisplayFilter.where)),n}_fullExtentIsAccurate(){let e=this.layerView.layer;if(`definitionExpression`in e&&e.definitionExpression)return!1;switch(e.type){case`feature`:case`catalog-footprint`:case`oriented-imagery`:return S(e.url);case`csv`:case`geojson`:case`ogc-feature`:case`wfs`:return!0;default:return}}async _updateServiceDataExtent(e){try{await this._tryUpdateServiceDataExtent(e)}catch(e){f(e)||this._set(`serviceDataExtent`,a(this.layerView.fullExtentInLocalViewSpatialReference)??null)}}async _tryUpdateServiceDataExtent(e){let t=this.layerView,n=t.layer,r=n.capabilities?.query.supportsExtent??!1,i=a(t.fullExtentInLocalViewSpatialReference),o=n.fullExtent,s=this._fullExtentIsAccurate(),c=this.serviceDataCount;if(r&&c<=I.maxFeatureCountForExtent&&(!i||!s)&&`queryExtent`in n){let t=this._createDataInfoQuery(),r=await n.queryExtent(t,{timeout:I.queryExtentTimeout,signal:e});this._set(`serviceDataExtent`,r.extent)}else if(i)this._set(`serviceDataExtent`,i);else if(o!=null){let e=o.spatialReference?await x(o,t.view.spatialReference):null;this._set(`serviceDataExtent`,e??null)}else this._set(`serviceDataExtent`,null)}async _updateServiceDataCount(e){let t=this.layerView.layer;if(!(`queryFeatureCount`in t)||!has(`featurelayer-snapshot-enabled`)){this._set(`serviceDataCount`,I.noServiceDataCount);return}let r=await n(t.queryFeatureCount(this._createDataInfoQuery(),{timeout:I.queryStatisticsTimeout,signal:e}));if(r.ok===!0)this._set(`serviceDataCount`,r.value);else{if(f(r.error))throw r.error;this._set(`serviceDataCount`,I.noServiceDataCount)}}get _supportsExceedsLimitQuery(){let e=this.layerView.layer;return e.capabilities!=null&&e.capabilities.operations&&e.capabilities.operations.supportsExceedsLimitStatistics}get _minimumNumberOfVerticesForGeometry(){switch(this.layerView.layer.geometryType){case`point`:return 1;case`multipoint`:return 1;case`polygon`:return 4;case`polyline`:return 2;case`multipatch`:case`mesh`:return 3;case null:case void 0:return 0;default:return 0}}async _updateSnapshotLimit(e,t,r){if(e?.averageSymbolComplexity==null){this._snapshotLimitExceeded=!1;return}let{maximumTotalNumberOfVertices:i,averageSymbolComplexity:a}=e,{verticesPerFeature:o,verticesPerCoordinate:s}=a,c=o<=0,l=this._minimumNumberOfVerticesForGeometry>1;if(!c&&!l){this._snapshotLimitExceeded=!1;return}o!==0&&t!=null&&await t;let u=Math.min(i,N),d=this.serviceDataCount,p=d!==I.noServiceDataCount,m=Math.ceil(p?(u-d*o)/(s||1):u/(s||1));if(l&&(m=Math.min(m,P)),p&&this._minimumNumberOfVerticesForGeometry*d>m){this._snapshotLimitExceeded=!0;return}if(!this._supportsExceedsLimitQuery||!has(`featurelayer-snapshot-enabled`)){this._snapshotLimitExceeded=this.maxTotalSnapshotVertices>m;return}let h=await n(this.layerView.layer.queryFeatures(this._createVertexLimitExceededQuery(m),{timeout:I.queryStatisticsTimeout,signal:r}));if(h.ok===!1){if(f(h.error))throw h.error;this._snapshotLimitExceeded=!1;return}let g=h.value.features[0];this._snapshotLimitExceeded=g?.attributes?!!g.attributes.exceedslimit:!1}async _fetchServiceDataInfo(){this._cancelFetchServiceDataInfo(),await C(this.layerView.layer);let e=new AbortController,t=e.signal,n=this._updateServiceDataCount(t),r=Promise.allSettled([n,this._updateSnapshotLimit(this.displayFeatureLimit,n,t)]),i=r.then(()=>this._updateServiceDataExtent(t)).catch(e=>{f(e)||o.getLogger(this).error(`#fetchServiceDataInfo()`,e)}).then(()=>{i===this._fetchDataInfoPromise&&(this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null),e=null});return e&&(this._fetchDataInfoPromise=i),this._fetchDataInfoAbortController=e,r.then(()=>{},()=>{})}_cancelFetchServiceDataInfo(){let e=this._fetchDataInfoAbortController;e&&(this._fetchDataInfoAbortController=null,this._fetchDataInfoPromise=null,e.abort())}get performanceInfo(){return{storedFeatures:this._tileFetcher?.storedFeatures??0,totalFeatures:this._tileFetcher?.totalFeatures??0,totalVertices:this._tileFetcher?.totalVertices??0,missingTiles:this._tileFetcher?.missingTiles??0}}};e([v({readOnly:!0})],M.prototype,`type`,void 0),e([v({constructOnly:!0})],M.prototype,`graphics`,void 0),e([v({constructOnly:!0})],M.prototype,`layerView`,void 0),e([v({constructOnly:!0})],M.prototype,`context`,void 0),e([v({readOnly:!0})],M.prototype,`dataUpdating`,null),e([v()],M.prototype,`extent`,null),e([v()],M.prototype,`updating`,null),e([v({readOnly:!0})],M.prototype,`_updatingHandles`,void 0),e([v()],M.prototype,`updatingTotal`,null),e([v()],M.prototype,`updatingRemaining`,null),e([v()],M.prototype,`expectedFeatureDiff`,null),e([v()],M.prototype,`usedMemory`,null),e([v()],M.prototype,`usedMemoryPerFeature`,null),e([v()],M.prototype,`maximumNumberOfFeaturesExceeded`,null),e([v()],M.prototype,`snappingComplexityExceeded`,null),e([v({readOnly:!0})],M.prototype,`serviceDataExtent`,void 0),e([v({readOnly:!0})],M.prototype,`serviceDataCount`,void 0),e([v()],M.prototype,`_snapshotLimitExceeded`,void 0),e([v()],M.prototype,`displayFeatureLimit`,void 0),e([v({type:Number})],M.prototype,`maximumNumberOfFeatures`,null),e([v({readOnly:!0})],M.prototype,`hasAllFeatures`,null),e([v({readOnly:!0})],M.prototype,`hasAllFeaturesInView`,null),e([v({readOnly:!0})],M.prototype,`hasFullGeometries`,null),e([v()],M.prototype,`_forceTilesMode`,void 0),e([v({readOnly:!0})],M.prototype,`mode`,null),e([v({readOnly:!0})],M.prototype,`maxTotalSnapshotVertices`,null),e([v({readOnly:!0})],M.prototype,`tileDescriptors`,null),e([v()],M.prototype,`_tileFetcher`,void 0),e([v()],M.prototype,`_fetchDataInfoPromise`,void 0),M=e([y(`esri.layers.graphics.controllers.FeatureTileController3D`)],M);const N=1e6,P=5e6;function F(e,t){if(!t)return!1;for(let n of t)if(!e.has(n))return!0;return!1}class I{static{this.noServiceDataCount=1/0}static{this.maxSnapshotMinScaleFactor=5}static reset(){I.maxFeatureCountForExtent=1e4,I.queryStatisticsTimeout=12e3,I.queryExtentTimeout=1e4}}I.reset();export{M as FeatureTileController3D,I as FeatureTileController3DConstants};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{result as n}from"../../../core/asyncUtils.js";import r from"../../../core/Collection.js";import i from"../../../core/Error.js";import has from"../../../core/has.js";import{clone as a}from"../../../core/lang.js";import o from"../../../core/Logger.js";import{destroyMaybe as s,removeMaybe as c,abortMaybe as l}from"../../../core/maybe.js";import{EsriPromiseMixin as u}from"../../../core/Promise.js";import{createAbortError as d,isAbortError as f}from"../../../core/promiseUtils.js";import{initial as p,watch as m,syncAndInitial as h,sync as g}from"../../../core/reactiveUtils.js";import{sqlAnd as _}from"../../../core/sql.js";import{property as v,subclass as y}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as b}from"../../../core/support/UpdatingHandles.js";import{projectAsync as x}from"../../../geometry/projectionUtils.js";import{isHostedAgolService as S}from"../../support/arcgisLayerUrl.js";import{checkServiceCurrentUserSupport as C}from"../../support/featureLayerUtils.js";import{getEffectiveLayerCapabilities as w}from"../../support/layerUtils.js";import T from"../../../rest/support/StatisticDefinition.js";import{FeatureTileDescriptor as E,virtualSnapshotTileId as D,virtualDisplayFilterHighlightTileId as O}from"../../../views/3d/layers/support/FeatureTileDescriptor.js";import{FeatureTileFetcher3D as k}from"../../../views/3d/layers/support/FeatureTileFetcher3D.js";import{FeatureTileFetcher3DDebugger as A}from"../../../views/3d/layers/support/FeatureTileFetcher3DDebugger.js";import{debugFlags as j}from"../../../views/3d/support/debugFlags.js";let M=class extends u(t){get dataUpdating(){return this._tileFetcher?.dataUpdating??!1}set extent(e){if(e!=null&&!e.spatialReference.equals(this.layerView.view.spatialReference)){o.getLogger(this).error(`#extent=`,`extent needs to be in the same spatial reference as the view`);return}let t=this._get(`extent`);if(t===e||t!=null&&e&&t.equals(e))return;let n=e==null?null:e.clone();this._set(`extent`,n)}get updating(){return!!(this._tileFetcher?.updating||this._fetchDataInfoPromise!=null||this.mode===`tiles`&&this.layerView.view.featureTiles?.updating||this._updatingHandles?.updating)}get updatingTotal(){return this.updating&&this._tileFetcher!=null?this._tileFetcher.updatingTotal:0}get updatingRemaining(){return this.updating&&this._tileFetcher!=null?this._tileFetcher.updatingRemaining:0}get expectedFeatureDiff(){return this.updating&&this._tileFetcher!=null?this._tileFetcher.expectedFeatureDiff:0}get usedMemory(){return this._tileFetcher?.usedMemory??0}get usedMemoryPerFeature(){return this._tileFetcher?.usedMemoryPerFeature??0}get maximumNumberOfFeaturesExceeded(){return!!(this._tileFetcher!=null&&this._tileFetcher.maximumNumberOfFeaturesExceeded)}get snappingComplexityExceeded(){return this._tileFetcher?.snappingComplexityExceeded??!0}get maximumNumberOfFeatures(){return this.displayFeatureLimit?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){e!==this.maximumNumberOfFeatures&&this._overrideIfSome(`maximumNumberOfFeatures`,e)}get hasMaximumNumberOfFeaturesOverride(){return this._isOverridden(`maximumNumberOfFeatures`)}get hasAllFeatures(){return this.serviceDataCount===I.noServiceDataCount&&this.mode===`snapshot`&&this.hasAllFeaturesInView||this.serviceDataCount===this.graphics.length}get hasAllFeaturesInView(){let e=this.context.effectiveDisplayFilter?.where||null,t=e!=null&&e!==`1=1`;return this.mode===`tiles`&&t?!1:this._tileFetcher?.showsAllFeatures??!1}get hasFullGeometries(){return this._tileFetcher?.hasFullGeometries??!1}get mode(){let e=this.layerView.layer;if(e.type===`feature`&&e.infoFor3D!=null)return`snapshot`;if(e.type===`catalog-footprint`||this._forceTilesMode)return`tiles`;let t=this.layerView.view;if(t.qualitySettings?.graphics3D?.snapshotAvailable===!1||this.serviceDataCount===I.noServiceDataCount||this._snapshotLimitExceeded||this.maximumNumberOfFeaturesExceeded||t.quality<1)return`tiles`;let n=(t&&t.featureTiles)?.tilingScheme;if(e&&e.minScale&&this.serviceDataExtent&&n){let t=this._approximateExtentSizeAtScale(e.minScale,n);if((this.serviceDataExtent.width/t+this.serviceDataExtent.height/t)/2>I.maxSnapshotMinScaleFactor)return`tiles`}return!this.maximumNumberOfFeatures||this.serviceDataCount<=this.maximumNumberOfFeatures?`snapshot`:`tiles`}get maxTotalSnapshotVertices(){let e=this._get(`maxTotalSnapshotVertices`)||0,t=this.mode===`snapshot`&&this._tileFetcher?.totalVertices||0;return Math.max(e,t)}_approximateExtentSizeAtScale(e,t){let n=this.layerView.view,r=Math.ceil((n.width/t.pixelSize+n.height/t.pixelSize)/2),i=t.levels[0];return r*((i.tileSize[0]/(i.scale/e)+i.tileSize[1]/(i.scale/e))/2)}get tileDescriptors(){if(this.mode===`snapshot`){let e=new E(0,0,0,null,D);return new r([e])}let e=this.layerView.view.featureTiles;if(!e)return new r;let t=e.tiles;if(this.layerView.displayFilterEnabled&&this.layerView.effectiveDisplayFilterClause!=null&&this.layerView.effectiveDisplayFilterClause!==`1=1`&&this.layerView.highlightIds?.length>0){let e=new E(0,0,0,this.layerView.view.featureTiles?.tilingScheme,O);return new r([...t,e])}return t}get test(){}constructor(e){super(e),this.type=`feature-tile-3d`,this._updatingHandles=new b,this.serviceDataExtent=null,this.serviceDataCount=I.noServiceDataCount,this._snapshotLimitExceeded=!1,this.displayFeatureLimit=null,this._forceTilesMode=!1,this._suspended=!1,this._tileFetcher=null,this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null,this._lifeCycleAbortController=new AbortController}initialize(){this._updatingHandles.add(()=>this.displayFeatureLimit,e=>this._updatingHandles.addPromise(this._updateSnapshotLimit(e,null,this._lifeCycleAbortController.signal))),this._updatingHandles.add(()=>this.mode,()=>this._modeChanged(),p),this._updatingHandles.add(()=>this.mode,(e,t)=>{e===`tiles`&&t===`snapshot`&&(this._forceTilesMode=!0)},p),this.addResolvingPromise(Promise.resolve().then(()=>this._verifyCapabilities()).then(()=>this._updatingHandles.addPromise(this._fetchServiceDataInfo())).then(()=>this._initializeTileFetcher()))}_verifyCapabilities(){let e=this.layerView.layer;if(e.type!==`ogc-feature`&&!w(e)?.operations.supportsQuery)throw new i(`graphicscontroller:query-capability-required`,`Service requires query capabilities to be used as a feature layer`,{layer:e})}destroy(){this._cancelFetchServiceDataInfo(),this._tileFetcher=s(this._tileFetcher),this._tilesHandle=c(this._tilesHandle),this._lifeCycleAbortController=l(this._lifeCycleAbortController),this._updatingHandles.destroy(),this._set(`_updatingHandles`,null)}suspend(){this._suspended||(this._suspended=!0,this._tileFetcher!=null&&this._tileFetcher.suspend())}resume(){this._suspended&&(this._suspended=!1,this._tileFetcher!=null&&this._tileFetcher.resume())}restart(){let e=()=>{this._tileFetcher!=null&&this._tileFetcher.restart()};this._updatingHandles.consumePromise(this._fetchServiceDataInfo().then(e,e))}refetch(){this._refetch({resetForceTilesMode:!1})}getMissingAttributesForFeature(e){return this._tileFetcher?.getMissingAttributesForFeature(e)}_refetch(e){let t=()=>{this._tileFetcher!=null&&(e.resetForceTilesMode&&(this._forceTilesMode=!1),this._tileFetcher.refetch())};this._updatingHandles.consumePromise(this._fetchServiceDataInfo().then(t,t))}_initializeTileFetcher(){let e=this.layerView.view;if(!e)return;let{layerView:t,tileDescriptors:n}=this,r=t.layer,i=new k({context:this.context,filterExtent:this.extent,tileDescriptors:n,features:this.graphics});this._tileFetcher=i,this._suspended?i.suspend():i.resume(),e&&this.addHandles(m(()=>e.quality,e=>i.memoryFactor=e,h));let a=this.context.geometryType===`polygon`?`polygonLodFactor`:this.context.geometryType===`polyline`?`polylineLodFactor`:null;a&&this.addHandles(m(()=>this.layerView.view?.qualitySettings?.graphics3D?.[a],e=>i.lodFactor=e||1,p)),r.type!==`ogc-feature`&&this._updatingHandles.add(()=>r.createQueryVersion,()=>this._dataFilterChanged()),this._updatingHandles.add(()=>this.layerView.effectiveDisplayFilter,()=>this._effectiveDisplayFilterChanged()),this._updatingHandles.add(()=>this.layerView.highlightIds,()=>this._displayFilterHighlightIdsChanged()),this._updatingHandles.add(()=>t.availableFields,(e,t)=>this._availableFieldsChanged(t,e)),this._updatingHandles.add(()=>t.requiredFields,(e,t)=>this._requiredFieldsChanged(t,e)),`customParameters`in r&&this._updatingHandles.add(()=>r.customParameters,()=>this.restart()),this.addHandles([r.on(`apply-edits`,e=>this._applyEdits(e)),m(()=>this.extent,e=>i.filterExtent=e,g),m(()=>this.tileDescriptors,e=>i.tileDescriptors=e,g),m(()=>this.maximumNumberOfFeatures,e=>{i.maximumNumberOfFeatures=e,i.useTileCount=this.serviceDataCount>e},h),m(()=>this.serviceDataCount,e=>{i.useTileCount=e>this.maximumNumberOfFeatures},h),m(()=>({featureTiles:e.featureTiles,show:j.FEATURE_TILE_FETCH_SHOW_TILES}),({show:t,featureTiles:n})=>{t&&i&&n?i.debugger??=new A(i,n.tilingScheme.toTileInfo(),e):i.debugger=s(i.debugger)},p)]),this._supportsExceedsLimitQuery||this._updatingHandles.add(()=>this.maxTotalSnapshotVertices,()=>this._updatingHandles.addPromise(this._updateSnapshotLimit(this.displayFeatureLimit,null,this._lifeCycleAbortController.signal)))}_modeChanged(){switch(this.mode){case`tiles`:this._tilesHandle||=this.layerView.view.enableFeatureTiles();break;default:o.getLogger(this).warn(`Unhandled feature layer mode `+this.mode);case`snapshot`:this._tilesHandle!=null&&(this._tilesHandle.remove(),this._tilesHandle=null)}}_dataFilterChanged(){this._set(`maxTotalSnapshotVertices`,0),this.notifyChange(`maxTotalSnapshotVertices`),this._refetch({resetForceTilesMode:!0})}_effectiveDisplayFilterChanged(){this.mode!==`snapshot`&&this._refetch({resetForceTilesMode:!1})}_displayFilterHighlightIdsChanged(){this.mode!==`snapshot`&&this._tileFetcher!=null&&this._tileFetcher.refetchDisplayFilterHighlightTile()}_applyEdits(e){let t=this.layerView.layer;this._tileFetcher!=null&&this._tileFetcher.applyEdits(e).then(e=>{if(e){if(!this._lifeCycleAbortController)throw d();e.exceededTransferLimit&&`refresh`in t?t.refresh():(e.deletedFeatures.length||e.updatedFeatures.length||e.addedFeatures.length)&&this._updatingHandles.consumePromise(this._updateServiceDataExtent(this._lifeCycleAbortController.signal))}}).catch(e=>{if(!f(e))throw e})}_availableFieldsChanged(e,t){this._tileFetcher!=null&&F(this._tileFetcher.availableFields,t)&&this._refetch({resetForceTilesMode:!1})}_requiredFieldsChanged(e,t){this._tileFetcher!=null&&F(this._tileFetcher.availableFields,t)&&this.restart()}_createVertexLimitExceededQuery(e){let t=this.layerView.layer,n=t.createQuery();return n.returnGeometry=!1,n.outStatistics=[new T({statisticType:`exceedslimit`,maxVertexCount:e,outStatisticFieldName:`exceedslimit`,maxPointCount:1e8,maxRecordCount:1e8})],t.capabilities?.query.supportsCacheHint&&(n.cacheHint=!0),n}_createDataInfoQuery(){let e=this.layerView.layer,t=this.layerView,n=e.createQuery();return n.returnGeometry=!1,n.outSpatialReference=this.layerView.view.spatialReference,e.capabilities?.query.supportsCacheHint&&(n.cacheHint=!0),t.effectiveDisplayFilter&&(n.where=_(n.where,t.effectiveDisplayFilter.where)),n}_fullExtentIsAccurate(){let e=this.layerView.layer;if(`definitionExpression`in e&&e.definitionExpression)return!1;switch(e.type){case`feature`:case`catalog-footprint`:case`oriented-imagery`:return S(e.url);case`csv`:case`geojson`:case`ogc-feature`:case`wfs`:return!0;default:return}}async _updateServiceDataExtent(e){try{await this._tryUpdateServiceDataExtent(e)}catch(e){f(e)||this._set(`serviceDataExtent`,a(this.layerView.fullExtentInLocalViewSpatialReference)??null)}}async _tryUpdateServiceDataExtent(e){let t=this.layerView,n=t.layer,r=n.capabilities?.query.supportsExtent??!1,i=a(t.fullExtentInLocalViewSpatialReference),o=n.fullExtent,s=this._fullExtentIsAccurate(),c=this.serviceDataCount;if(r&&c<=I.maxFeatureCountForExtent&&(!i||!s)&&`queryExtent`in n){let t=this._createDataInfoQuery(),r=await n.queryExtent(t,{timeout:I.queryExtentTimeout,signal:e});this._set(`serviceDataExtent`,r.extent)}else if(i)this._set(`serviceDataExtent`,i);else if(o!=null){let e=o.spatialReference?await x(o,t.view.spatialReference):null;this._set(`serviceDataExtent`,e??null)}else this._set(`serviceDataExtent`,null)}async _updateServiceDataCount(e){let t=this.layerView.layer;if(!(`queryFeatureCount`in t)||!has(`featurelayer-snapshot-enabled`)){this._set(`serviceDataCount`,I.noServiceDataCount);return}let r=await n(t.queryFeatureCount(this._createDataInfoQuery(),{timeout:I.queryStatisticsTimeout,signal:e}));if(r.ok===!0)this._set(`serviceDataCount`,r.value);else{if(f(r.error))throw r.error;this._set(`serviceDataCount`,I.noServiceDataCount)}}get _supportsExceedsLimitQuery(){let e=this.layerView.layer;return e.capabilities!=null&&e.capabilities.operations&&e.capabilities.operations.supportsExceedsLimitStatistics}get _minimumNumberOfVerticesForGeometry(){switch(this.layerView.layer.geometryType){case`point`:return 1;case`multipoint`:return 1;case`polygon`:return 4;case`polyline`:return 2;case`multipatch`:case`mesh`:return 3;case null:case void 0:return 0;default:return 0}}async _updateSnapshotLimit(e,t,r){if(e?.averageSymbolComplexity==null){this._snapshotLimitExceeded=!1;return}let{maximumTotalNumberOfVertices:i,averageSymbolComplexity:a}=e,{verticesPerFeature:o,verticesPerCoordinate:s}=a,c=o<=0,l=this._minimumNumberOfVerticesForGeometry>1;if(!c&&!l){this._snapshotLimitExceeded=!1;return}o!==0&&t!=null&&await t;let u=Math.min(i,N),d=this.serviceDataCount,p=d!==I.noServiceDataCount,m=Math.ceil(p?(u-d*o)/(s||1):u/(s||1));if(l&&(m=Math.min(m,P)),p&&this._minimumNumberOfVerticesForGeometry*d>m){this._snapshotLimitExceeded=!0;return}if(!this._supportsExceedsLimitQuery||!has(`featurelayer-snapshot-enabled`)){this._snapshotLimitExceeded=this.maxTotalSnapshotVertices>m;return}let h=await n(this.layerView.layer.queryFeatures(this._createVertexLimitExceededQuery(m),{timeout:I.queryStatisticsTimeout,signal:r}));if(h.ok===!1){if(f(h.error))throw h.error;this._snapshotLimitExceeded=!1;return}let g=h.value.features[0];this._snapshotLimitExceeded=g?.attributes?!!g.attributes.exceedslimit:!1}async _fetchServiceDataInfo(){this._cancelFetchServiceDataInfo(),await C(this.layerView.layer);let e=new AbortController,t=e.signal,n=this._updateServiceDataCount(t),r=Promise.allSettled([n,this._updateSnapshotLimit(this.displayFeatureLimit,n,t)]),i=r.then(()=>this._updateServiceDataExtent(t)).catch(e=>{f(e)||o.getLogger(this).error(`#fetchServiceDataInfo()`,e)}).then(()=>{i===this._fetchDataInfoPromise&&(this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null),e=null});return e&&(this._fetchDataInfoPromise=i),this._fetchDataInfoAbortController=e,r.then(()=>{},()=>{})}_cancelFetchServiceDataInfo(){let e=this._fetchDataInfoAbortController;e&&(this._fetchDataInfoAbortController=null,this._fetchDataInfoPromise=null,e.abort())}get performanceInfo(){return{storedFeatures:this._tileFetcher?.storedFeatures??0,totalFeatures:this._tileFetcher?.totalFeatures??0,totalVertices:this._tileFetcher?.totalVertices??0,missingTiles:this._tileFetcher?.missingTiles??0}}};e([v({readOnly:!0})],M.prototype,`type`,void 0),e([v({constructOnly:!0})],M.prototype,`graphics`,void 0),e([v({constructOnly:!0})],M.prototype,`layerView`,void 0),e([v({constructOnly:!0})],M.prototype,`context`,void 0),e([v({readOnly:!0})],M.prototype,`dataUpdating`,null),e([v()],M.prototype,`extent`,null),e([v()],M.prototype,`updating`,null),e([v({readOnly:!0})],M.prototype,`_updatingHandles`,void 0),e([v()],M.prototype,`updatingTotal`,null),e([v()],M.prototype,`updatingRemaining`,null),e([v()],M.prototype,`expectedFeatureDiff`,null),e([v()],M.prototype,`usedMemory`,null),e([v()],M.prototype,`usedMemoryPerFeature`,null),e([v()],M.prototype,`maximumNumberOfFeaturesExceeded`,null),e([v()],M.prototype,`snappingComplexityExceeded`,null),e([v({readOnly:!0})],M.prototype,`serviceDataExtent`,void 0),e([v({readOnly:!0})],M.prototype,`serviceDataCount`,void 0),e([v()],M.prototype,`_snapshotLimitExceeded`,void 0),e([v()],M.prototype,`displayFeatureLimit`,void 0),e([v({type:Number})],M.prototype,`maximumNumberOfFeatures`,null),e([v({readOnly:!0})],M.prototype,`hasAllFeatures`,null),e([v({readOnly:!0})],M.prototype,`hasAllFeaturesInView`,null),e([v({readOnly:!0})],M.prototype,`hasFullGeometries`,null),e([v()],M.prototype,`_forceTilesMode`,void 0),e([v({readOnly:!0})],M.prototype,`mode`,null),e([v({readOnly:!0})],M.prototype,`maxTotalSnapshotVertices`,null),e([v({readOnly:!0})],M.prototype,`tileDescriptors`,null),e([v()],M.prototype,`_tileFetcher`,void 0),e([v()],M.prototype,`_fetchDataInfoPromise`,void 0),M=e([y(`esri.layers.graphics.controllers.FeatureTileController3D`)],M);const N=has(`esri-tests-maximum-vertices-for-snapshot`)??1e6,P=5e6;function F(e,t){if(!t)return!1;for(let n of t)if(!e.has(n))return!0;return!1}class I{static{this.noServiceDataCount=1/0}static{this.maxSnapshotMinScaleFactor=5}static reset(){I.maxFeatureCountForExtent=1e4,I.queryStatisticsTimeout=12e3,I.queryExtentTimeout=1e4}}I.reset();export{M as FeatureTileController3D,I as FeatureTileController3DConstants};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{insertSortedStableTopN as e}from"../../../core/arrayUtils.js";import{importLazily as t}from"../../../core/importUtils.js";import{clone as n}from"../../../core/lang.js";import r from"../../../geometry/SpatialReference.js";import{polygonCentroid as i,extentCentroid as a}from"../../../geometry/support/centroid.js";import{getPolygonExtent as o,getGeometryExtent as s,expandExtent as c}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as l}from"../../../geometry/support/quantizationUtils.js";import{isValid as u,equals as d}from"../../../geometry/support/spatialReferenceUtils.js";import{closestPointOnCurve as f}from"../../../geometry/support/curves/closestPointOnCurve.js";import{getEndpoint as p,isCoordinate as m,cloneCurve as h}from"../../../geometry/support/curves/curveUtils.js";import g from"./AttributesBuilder.js";import{cleanFromGeometryEngine as _,getGeometry as v,transformCentroid as y}from"./geometryUtils.js";import{project as b}from"./projectionSupport.js";import{getDateInNumber as x}from"./queryUtils.js";import{SnappingCandidateEdge as S,SnappingCandidateVertex as C}from"./SnappingCandidate.js";import{isDateField as w,isDateOnlyField as T,isTimestampOffsetField as E,isStringField as D,isTimeOnlyField as O}from"../../support/fieldUtils.js";import k from"../../../rest/support/AutoIntervalBinParameters.js";import A from"../../../rest/support/DateBinParameters.js";import{unitsDict as j}from"../../../rest/support/DateBinUtils.js";import M from"../../../rest/support/FixedBoundariesBinParameters.js";import N from"../../../rest/support/FixedIntervalBinParameters.js";import{calculateStringStatistics as P,calculateStatistics as F,processSummaryStatisticsResult as I,calculateUniqueValuesCount as L,createUVResult as R,calculateClassBreaks as z,resolveCBResult as B,calculateHistogram as V,calculatePercentile as H,binIndex as U,getBinParams as W,isNullCountSupported as G,getAttributeComparator as K}from"../../../statistics/utils.js";import{utc as q}from"../../../time/constants.js";import{DateTime as J}from"luxon";const Y=t(()=>import(`../../../geometry/operators/json/convexHullOperator.js`));class X{constructor(e,t,n){this.items=e,this.query=t,this.geometryType=n.geometryType,this.hasZ=!!t.returnZ&&n.hasZ,this.hasM=!!t.returnM&&n.hasM,this.fieldsIndex=n.fieldsIndex,this.spatialReference=n.spatialReference,this.featureAdapter=n.featureAdapter,this.featureIdInfo=n.featureIdInfo}get size(){return this.items.length}createQueryResponseForCount(){let e=new g(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);let{groupByFieldsForStatistics:t,having:n,outStatistics:r}=this.query;if(!t?.length)return 1;let i=new Map,a=new Map,o=new Set;for(let s of r){let{statisticType:r}=s,c=r===`exceedslimit`?void 0:s.onStatisticField;if(!a.has(c)){let n=[];for(let r of t){let t=this._getAttributeValues(e,r,this.items,i);n.push(t)}a.set(c,this._calculateUniqueValues(n,this.items,e.returnDistinctValues))}let l=a.get(c);for(let t in l){let{data:r,items:i}=l[t],a=r.join(`,`);(!n||e.validateItems(i,n))&&o.add(a)}}return o.size}async createQueryResponse(){let e;if(e=this.query.outStatistics?this.query.outStatistics.some(e=>e.statisticType===`exceedslimit`)?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items):this._createFeatureQueryResponse(this.query),this.query.returnQueryGeometry){let t=this.query.geometry;u(this.query.outSR)&&!d(t.spatialReference,this.query.outSR)?e.queryGeometry=_({spatialReference:this.query.outSR,...b(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=_({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t,n){let r=this.featureAdapter,{point:i}=e,a=typeof e.distance==`number`?e.distance:e.distance.x,o=typeof e.distance==`number`?e.distance:e.distance.y;function s(e,t){let n=(e-i.x)/a,r=(t-i.y)/o;return n*n+r*r}let c={candidates:[]},l=this.geometryType===`esriGeometryPolygon`,u=this.geometryType===`esriGeometryPolyline`||this.geometryType===`esriGeometryPoint`,d=this._getPointCreator(t,this.spatialReference,n),g=new Q(null,0),_=new Q(null,0),v={x:0,y:0,z:0};for(let e of this.items){let t=r.getObjectId(e),n=r.getGeometryWithCurves?.(e);if(n!=null){b(n,t);continue}let i=r.getGeometry(e);if(i!=null){y(i,t);continue}}return c.candidates.sort((e,t)=>e.distance-t.distance),c;function y(t,n){let{coords:r,stride:a}=t,o=t.isPoint?te:t.lengths;if(g.coords=r,_.coords=r,e.returnEdge){let e=0;for(let t=0;t<o.length;t++){let r=o[t],u=e;for(let t=0;t<r;t++,e+=a){if(!l&&t===r-1||(g.coordsIndex=e,_.coordsIndex=t===r-1?u:e+a,!ee(v,i,g,_)))continue;let o=s(v.x,v.y);o<=1&&c.candidates.push(new S(n,d(v),Math.sqrt(o),d(g),d(_)))}}}if(e.vertexMode===`all`){let e=0;for(let t=0;t<o.length;t++){let r=o[t],i=e,u=_;u.coordsIndex=i;for(let t=0;t<r;t++,e+=a){if(g.coordsIndex=e,l&&t===r-1&&g.x===u.x&&g.y===u.y)continue;let i=s(g.x,g.y);i<=1&&c.candidates.push(new C(n,d(g),Math.sqrt(i)))}}}else if(u&&e.vertexMode===`ends`){let e=0,t=[];for(let n=0;n<o.length;n++){t.push(e);let r=o[n];e+=r*a,r>1&&t.push(e-a)}for(let e of t){g.coordsIndex=e;let t=s(g.x,g.y);t<=1&&c.candidates.push(new C(n,d(g),Math.sqrt(t)))}}}function b(t,n){let{candidates:r}=c,a={x:0,y:0,z:0};if(e.returnEdge){let e=[i.x,i.y],o=new Q(e,0),c=new Q(e,0);for(let{segments:i}of t.parts)for(let{start:t,curve:l}of i){let{curvePoint:i}=f(t,l,e),u=s(...i);if(u>1)continue;[a.x,a.y]=i,o.coords=t,c.coords=p(l);let g=m(l)?null:h(l);r.push(new S(n,d(a),Math.sqrt(u),d(o),d(c),!1,g))}}function o(e){a.x=t.vertexXY[e*2],a.y=t.vertexXY[e*2+1];let i=s(a.x,a.y);i>1||(a.z=t.vertexZ?.[e]??0,r.push(new C(n,d(a),Math.sqrt(i))))}if(e.vertexMode===`all`){let{vertexCount:e}=t;for(let t=0;t<e;++t)o(t);return}if(e.vertexMode===`ends`)switch(t.type){case`point`:o(0);break;case`polyline`:for(let e=0;e<t.partCount;++e){let n=t.partOffsets[e],r=t.partOffsets[e+1]-1;o(n),r!==n&&o(r)}}}}_getPointCreator(e,t,n){let r=n!=null&&!d(t,n)?e=>b(e,t,n):e=>e,{hasZ:i}=this;return i&&e?({x:e,y:t,z:n})=>r({x:e,y:t,z:n}):({x:e,y:t})=>r({x:e,y:t,z:0})}async createSummaryStatisticsResponse(e){let{field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,minValue:o,maxValue:s,scale:c,timeZone:l,outStatisticTypes:u}=e,d=this.fieldsIndex.get(t),f=w(d)||T(d)||E(d),p=await this._getDataValues({field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,scale:c,timeZone:l},this.items),m=G({normalizationType:i,normalizationField:r,minValue:o,maxValue:s}),h={value:.5,fieldType:d?.type},g=D(d)?P({values:p,supportsNullCount:m,percentileParams:h,outStatisticTypes:u}):F({values:p,minValue:o,maxValue:s,useSampleStdDev:!i,supportsNullCount:m,percentileParams:h,outStatisticTypes:u});return I(g,u,f)}async createUniqueValuesResponse(e){let{field:t,valueExpression:n,domains:r,returnAllCodedValues:i,scale:a,timeZone:o}=e,s=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:n,scale:a,timeZone:o},this.items,!1),c=L(s);return R(c,r,i,e.fieldDelimiter)}async createClassBreaksResponse(e){let{field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numClasses:u,scale:d,timeZone:f}=e,p=await this._getDataValues({field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,scale:d,timeZone:f},this.items),m=z(p,{field:t,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numClasses:u});return B(m,o)}async createHistogramResponse(e){let{field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numBins:u,scale:d,timeZone:f}=e,p=await this._getDataValues({field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,scale:d,timeZone:f},this.items);return V(p,{field:t,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numBins:u})}_sortFeatures(e,t,n){if(e.length>1&&t?.length)for(let r of t.slice().reverse()){let{compare:t,fieldOrExpression:i,fieldInfo:a}=$(r,this.fieldsIndex);e.sort((e,r)=>t(n(e,i,a),n(r,i,a)))}}_topNFeatures(t,n,r,i){if(t.length>1&&n?.length){let a=n.map(e=>{let{compare:t,fieldOrExpression:n,fieldInfo:r}=$(e,this.fieldsIndex);return(e,a)=>t(i(e,n,r),i(a,n,r))}).reduceRight((e,t)=>(n,r)=>{let i=t(n,r);return i!==0&&!Number.isNaN(i)?i:e(n,r)}),o=[];for(let n of t)e(o,n,r,a);return o}return t.slice(0,r)}_createFeatureQueryResponse(e){let{items:t,geometryType:n,hasM:r,hasZ:i,featureIdInfo:a,spatialReference:o}=this,{outFields:s,outSR:c,quantizationParameters:u,resultRecordCount:d,resultOffset:f,returnZ:p,returnM:m}=e,h=d!=null&&t.length>(f||0)+d,g=s&&(s.includes(`*`)?[...this.fieldsIndex.fields]:s.map(e=>this.fieldsIndex.get(e)));return{exceededTransferLimit:h,features:this._createFeatures(e,t),fields:g,geometryType:n,hasM:r&&m,hasZ:i&&p,objectIdFieldName:a.type===`object-id`?a.fieldName:null,spatialReference:_(c||o),transform:u&&l(u)||null}}_createFeatures(e,t){let n=new g(e,this.featureAdapter,this.fieldsIndex),{hasM:r,hasZ:i}=this,{orderByFields:a,quantizationParameters:o,returnGeometry:s,returnCentroid:c,maxAllowableOffset:u,resultOffset:d,resultRecordCount:f,returnZ:p=!1,returnM:m=!1}=e,h=i&&p,_=r&&m,b,x=d||0,S=f==null?null:x+f;S!=null&&S<=5e3&&S<t.length?b=this._topNFeatures(t,a,S,(e,t,r)=>n.getFieldValue(e,t,r)):(b=[...t],this._sortFeatures(b,a,(e,t,r)=>n.getFieldValue(e,t,r))),(x>0||S!=null)&&(b=b.slice(x,S??void 0));let C=[],w=0;if(!this.geometryType||!s&&!c)for(let e of b){let t=n.getAttributes(e);t&&(C[w++]=this._addFeatureJSONMetadata(e,{attributes:t}))}else{let e=l(o)??void 0,t=this.geometryType===`esriGeometryPolygon`||this.geometryType===`esriGeometryPolyline`;if(s&&!c)for(let r of b){let i=this.featureAdapter.getGeometry(r),a=this._addFeatureJSONMetadata(r,{attributes:n.getAttributes(r),geometry:v(this.geometryType,i,u,e,h,_)});t&&i&&!a.geometry&&(a.centroid=y(this,this.featureAdapter.getCentroid(r,this),e)),C[w++]=a}else if(!s&&c)for(let t of b)C[w++]=this._addFeatureJSONMetadata(t,{attributes:n.getAttributes(t),centroid:y(this,this.featureAdapter.getCentroid(t,this),e)});else for(let t of b)C[w++]=this._addFeatureJSONMetadata(t,{attributes:n.getAttributes(t),centroid:y(this,this.featureAdapter.getCentroid(t,this),e),geometry:v(this.geometryType,this.featureAdapter.getGeometry(t),u,e,h,_)})}return C}_addFeatureJSONMetadata(e,t){let n=this.featureAdapter.getMetadata?.(e);return n!==void 0&&(t.metadata=n),t}_createExceedsLimitQueryResponse(){let e=!1,t=1/0,n=1/0,r=1/0;for(let e of this.query.outStatistics??[])if(e.statisticType===`exceedslimit`){t=e.maxPointCount==null?1/0:e.maxPointCount,n=e.maxRecordCount==null?1/0:e.maxRecordCount,r=e.maxVertexCount==null?1/0:e.maxVertexCount;break}return e=this.geometryType===`esriGeometryPoint`?this.items.length>t:this.items.length>n||this.items.reduce((e,t)=>e+(this.featureAdapter.getGeometry(t)?.size??0),0)>r,{fields:[{name:`exceedslimit`,type:`esriFieldTypeInteger`,alias:`exceedslimit`,sqlType:`sqlTypeInteger`,domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,n={attributes:{}}){let r=[],i=new Map,a=new Map,o=new Map,s=new Map,c=new g(e,this.featureAdapter,this.fieldsIndex),l=e.outStatistics,{groupByFieldsForStatistics:u,having:d,orderByFields:f,resultRecordCount:p}=e,m=u?.length,h=!!m,_=h?u[0]:null,v=h&&!this.fieldsIndex.get(_);for(let f of l??[]){let{outStatisticFieldName:l,statisticType:p}=f,g=f,y=p===`exceedslimit`?void 0:f.onStatisticField,b=p===`percentile_disc`||p===`percentile_cont`,x=p===`EnvelopeAggregate`||p===`CentroidAggregate`||p===`ConvexHullAggregate`,S=h&&m===1&&(y===_||v)&&p===`count`;if(h){if(!o.has(y)){let e=[];for(let n of u){let r=this._getAttributeValues(c,n,t,i);e.push(r)}o.set(y,this._calculateUniqueValues(e,t,!x&&c.returnDistinctValues))}let n=o.get(y);if(!n)continue;let r=Object.keys(n);for(let a of r){let{count:r,data:o,items:f,itemPositions:p}=n[a],m=o.join(`,`);if(!d||c.validateItems(f,d)){let n=s.get(m)||{attributes:{}};if(e.returnAggIds&&(n.aggregateIds=f.map(e=>this.featureAdapter.getObjectId(e)).filter(e=>e!=null)),x){n.aggregateGeometries||={};let{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(g,f);n.aggregateGeometries[t]=e}else{let e=null;if(S)e=r;else{let n=this._getAttributeValues(c,y,t,i),r=p.map(e=>n[e]);e=b&&`statisticParameters`in g?this._getPercentileValue(g,r):this._getStatisticValue(g,r,null,c.returnDistinctValues)}n.attributes[l]=e}let a=0;u.forEach((e,t)=>n.attributes[this.fieldsIndex.get(e)?e:`EXPR_${++a}`]=o[t]),s.set(m,n)}}}else if(x){n.aggregateGeometries||={};let{aggregateGeometries:e,outStatisticFieldName:r}=await this._getAggregateGeometry(g,t);n.aggregateGeometries[r]=e}else{let e=this._getAttributeValues(c,y,t,i);n.attributes[l]=b&&`statisticParameters`in g?this._getPercentileValue(g,e):this._getStatisticValue(g,e,a,c.returnDistinctValues)}let C=(p===`min`||p===`max`)&&(D(this.fieldsIndex.get(y))||this._isAnyDateField(y))?this.fieldsIndex.get(y)?.type:null;r.push({name:l,alias:l,type:C||`esriFieldTypeDouble`})}let y=h?Array.from(s.values()):[n];return this._sortFeatures(y,f,(e,t)=>e.attributes[t]),p&&(y.length=Math.min(p,y.length)),{fields:r,features:y}}_isAnyDateField(e){let t=this.fieldsIndex.get(e);return w(t)||T(t)||E(t)||O(t)}async _getAggregateGeometry(e,t){let{statisticType:n,outStatisticFieldName:r}=e,{featureAdapter:s,spatialReference:c,geometryType:l}=this,u=t.map(e=>v(l,s.getGeometry(e))),d={aggregateGeometries:null,outStatisticFieldName:null},{convexHullExecuteMany:f}=await Y.getImportPromise(),[p]=f(u,{merge:!0});if(p&&p.rings[0].length<=3&&(p=null),n===`EnvelopeAggregate`)d.aggregateGeometries={...p?o(p):Z(u),spatialReference:c},d.outStatisticFieldName=r||`extent`;else if(n===`CentroidAggregate`){let[e,t]=p?i(p):a(Z(u));d.aggregateGeometries={x:e,y:t,spatialReference:c},d.outStatisticFieldName=r||`centroid`}else n===`ConvexHullAggregate`&&(d.aggregateGeometries=p&&{...p,spatialReference:c},d.outStatisticFieldName=r||`convexHull`);return d}_getStatisticValue(e,t,n,r){let{onStatisticField:i,statisticType:a}=e,o=null;return o=n?.has(i)?n.get(i):D(this.fieldsIndex.get(i))||this._isAnyDateField(i)?P({values:t,returnDistinct:r}):F({values:r?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),n&&n.set(i,o),o[a===`var`?`variance`:a]}_getPercentileValue(e,t){let{onStatisticField:n,statisticParameters:r,statisticType:i}=e,{value:a,orderBy:o}=r,s={value:a,orderBy:o,fieldType:this.fieldsIndex.get(n)?.type,isDiscrete:i===`percentile_disc`};return H(t,s)}_getAttributeValues(e,t,n,r){if(r.has(t))return r.get(t);let i=this.fieldsIndex.get(t),a=n.map(n=>e.getFieldValue(n,t,i));return r.set(t,a),a}_calculateUniqueValues(e,t,n){let r={},i=t.length;for(let a=0;a<i;a++){let i=t[a],o=[];for(let t of e)o.push(t[a]);let s=o.join(`,`);r[s]==null?r[s]={count:1,data:o,items:[i],itemPositions:[a]}:(n||r[s].count++,r[s].items.push(i),r[s].itemPositions.push(a))}return r}async _getDataValues(e,t,i=!0){let a=new g(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:o,scale:s,timeZone:c}=e,l=r.fromJSON(this.query.outSR||this.spatialReference);return o?a.getExpressionValues(t,o,{viewingMode:`map`,scale:s,spatialReference:l},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},c):a.getDataValues(t,n(e),i)}_calculateHistogramBins(e,t,n){if(t.min==null&&t.max==null)return[];let r=t.intervals,i=t.min??0,a=t.max??0,o=r.map(([e,t])=>({minValue:e,maxValue:t,count:0,items:[]}));for(let t=0;t<e.length;t++){let s=e[t],c=n[t];if(s!=null&&s>=i&&s<=a){let e=U(r,s);e>-1&&(o[e].count++,o[e].items.push(c))}}return o}async createQueryBinsResponse(e){let t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);let{value:n,outAlias:r,valueType:i}=t,a=[],o=[{name:r??n,alias:r??n,type:i??`esriFieldTypeString`},{name:`bin`,alias:`bin`,type:`esriFieldTypeInteger`}],s=new g(e,this.featureAdapter,this.fieldsIndex),c=new Map,l=[...this.items];this._sortFeatures(l,[n],(e,t,n)=>s.getFieldValue(e,t,n));let u=this._getAttributeValues(s,n,l,c),d=this._calculateUniqueValues([u],l,s.returnDistinctValues);for(let t in d){let{items:i}=d[t],s=await this._createBinsResponse(e,i);if(a.push(...s.features.map(e=>({...e,attributes:{...e.attributes,[r??n]:t}}))),s.fields)for(let e of s.fields)o.some(t=>t.name===e.name)||o.push(e)}return{fields:o,features:a}}async _createBinsResponse(e,t){let n=e.bin;switch(t??=this.items,n.type){case`autoIntervalBin`:return this._createAutoIntervalBinsResponse(k.fromJSON(n),e,t);case`dateBin`:return this._createDateBinsResponse(A.fromJSON(n),e,t);case`fixedBoundariesBin`:return this._createFixedBoundariesBinsResponse(M.fromJSON(n),e,t);case`fixedIntervalBin`:return this._createFixedIntervalBinsResponse(N.fromJSON(n),e,t)}}async _createAutoIntervalBinsResponse(e,t,n){let{field:r,normalizationField:i,numBins:a,normalizationType:o,normalizationTotal:s,start:c,end:l}=e,u=await this._getDataValues({field:e.field||e.expression,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},n),d=W(u,{field:r,normalizationField:i,normalizationType:o,normalizationTotal:s,numBins:a,minValue:x(o?e.normalizationMinValue:c,!1),maxValue:x(o?e.normalizationMaxValue:l,!1)}),f=this._calculateHistogramBins(u,d,n);return this._createFeaturesFromHistogramBins(f,t)}async _createDateBinsResponse(e,t,n){let{field:r,interval:i,start:a,end:o,snapToData:s,returnFullIntervalBin:c,offset:l,firstDayOfWeek:u}=e,d=i.unit,f=await this._getDataValues({field:r||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},n),p=O(this.fieldsIndex.get(r)),m=j.toJSON(d),h=f.filter(Boolean).sort((e,t)=>e-t),g=a==null?h[0]:x(a,p),_=o==null?h[h.length-1]:x(o,p),v=[];if(g!=null&&_!=null){let e={zone:t.outTimeReference?.ianaTimeZone??q},n={[l?.unit?j.toJSON(l.unit):`milliseconds`]:l?.value||0},r=J.fromMillis(g,e).minus(n),a=J.fromMillis(_,e).minus(n),o=typeof u==`number`&&u>=1&&u<=7?u:7,d=(e,t)=>{let n=(e.weekday-t+7)%7;return e.minus({days:n}).startOf(`day`)},f=(e,t)=>d(e,t).plus({days:7});if(s===`last`){let e=m===`week`?f(a,o):a;for(;e>r;){let t=e.minus({[m]:i.value});if(t<r){v.unshift([c?t.plus(n).toMillis():r.plus(n).toMillis(),e.plus(n).toMillis()]);break}v.unshift([t.plus(n).toMillis(),e.plus(n).toMillis()]),e=t}}else{let e=s===`first`?r:m===`week`?d(r,o):r.startOf(m);for(;e<=a;){let t=e.plus({[m]:i.value});if(t>a){v.push([e.plus(n).toMillis(),c?t.plus(n).toMillis():a.plus(n).toMillis()]);break}v.push([e.plus(n).toMillis(),t.plus(n).toMillis()]),e=t}}}let y=this._calculateHistogramBins(f,{intervals:v,min:g,max:_},n);return this._createFeaturesFromHistogramBins(y,t)}async _createFixedBoundariesBinsResponse(e,t,n){let{field:r}=e,i=await this._getDataValues({field:r||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},n),a=O(this.fieldsIndex.get(r)),o=e.boundaries.map(e=>x(e,a)).sort((e,t)=>e-t),s=[];for(let e=0;e<o.length-1;e++)s.push([o[e],o[e+1]]);let c={intervals:s,min:o.at(0),max:o.at(-1)},l=this._calculateHistogramBins(i,c,n);return this._createFeaturesFromHistogramBins(l,t)}async _createFixedIntervalBinsResponse(e,t,n){let{field:r,interval:i,normalizationType:a,start:o,end:s}=e,c=await this._getDataValues({field:r||e.expression,normalizationField:e.normalizationField,normalizationType:a,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},n),l=O(this.fieldsIndex.get(r)),u=W(c,{field:r,classificationMethod:`defined-interval`,definedInterval:i,minValue:x(a?e.normalizationMinValue:o,l),maxValue:x(a?e.normalizationMaxValue:s,l)},!0),d=this._calculateHistogramBins(c,u,n);return this._createFeaturesFromHistogramBins(d,t)}async _createFeaturesFromHistogramBins(e,t){let{upperBoundaryAlias:n,lowerBoundaryAlias:r}=t,i=r||`lowerBoundary`,a=n||`upperBoundary`,o=[],s=[{name:i,alias:i,type:`esriFieldTypeDouble`},{name:a,alias:a,type:`esriFieldTypeDouble`}],c=t.bin?.stackBy?.value,l=t.bin?.stackBy?.outAlias;c&&s.push({name:`bin`,alias:`bin`,type:`esriFieldTypeInteger`},{name:l??c,alias:l??c,type:`esriFieldTypeString`});let u=0,d=t.bin.type===`dateBin`,f=t.outTimeReference?.ianaTimeZone;for(let n of e){let{minValue:e,maxValue:r,items:p}=n,m={attributes:{}};m.attributes[i]=d&&f&&e!=null?J.fromMillis(e,{zone:f}).toISO():e,t.bin.hideUpperBound||(m.attributes[a]=d&&f&&r!=null?J.fromMillis(r,{zone:f}).toISO():r),t.returnAggIds&&(m.aggregateIds=p.map(e=>this.featureAdapter.getObjectId(e)).filter(e=>e!=null));let h;if(c?(h=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[c],orderByFields:[c]},p),m.attributes.bin=++u,t.bin.jsonStyle===`flat`?o.push(...h.features.map(({attributes:{EXPR_1:e,...t},...n})=>({...n,attributes:l??e?{...t,[l??e]:e,...m.attributes}:{...t,...m.attributes}}))):(m.stackedAttributes=h.features.map(({attributes:{EXPR_1:e,...t}})=>l??e?{...t,[l??e]:e}:t),o.push(m))):(t.bin?.splitBy&&(m.attributes.bin=++u),h=await this._createStatisticsQueryResponse(t,p,m),o.push(m)),h.fields)for(let e of h.fields)s.some(t=>t.name===e.name)||s.push(e)}return t.binOrder===`desc`&&o.reverse(),{fields:s,features:o}}}function Z(e){let t=s(e[0]);for(let n of e.slice(1))c(t,s(n));return t}function ee(e,t,n,r){let i=r.x-n.x,a=r.y-n.y,o=t.x-n.x,s=t.y-n.y,c=i*i+a*a;if(c===0)return!1;let l=o*i+s*a,u=Math.min(1,Math.max(0,l/c));return e.x=n.x+i*u,e.y=n.y+a*u,!0}class Q{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}const te=[1];function $(e,t){let n=e.split(` `),r=n[0],i=t.get(r),a=n[1]?n[1].toLowerCase()===`desc`:!1;return{compare:K(i?.type,a,`case-insensitive`),fieldOrExpression:r,fieldInfo:i}}export{X as QueryEngineResult};
|
|
2
|
+
import{insertSortedStableTopN as e}from"../../../core/arrayUtils.js";import{importLazily as t}from"../../../core/importUtils.js";import{clone as n}from"../../../core/lang.js";import r from"../../../geometry/SpatialReference.js";import{polygonCentroid as i,extentCentroid as a}from"../../../geometry/support/centroid.js";import{getPolygonExtent as o,getGeometryExtent as s,expandExtent as c}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as l}from"../../../geometry/support/quantizationUtils.js";import{isValid as u,equals as d}from"../../../geometry/support/spatialReferenceUtils.js";import{closestPointOnCurve as f}from"../../../geometry/support/curves/closestPointOnCurve.js";import{getEndpoint as p,isCoordinate as m,cloneCurve as h}from"../../../geometry/support/curves/curveUtils.js";import g from"./AttributesBuilder.js";import{cleanFromGeometryEngine as _,getGeometry as v,transformCentroid as y}from"./geometryUtils.js";import{project as b}from"./projectionSupport.js";import{getDateInNumber as x}from"./queryUtils.js";import{SnappingCandidateEdge as S,SnappingCandidateVertex as C}from"./SnappingCandidate.js";import{isDateField as w,isDateOnlyField as T,isTimestampOffsetField as E,isStringField as D,isTimeOnlyField as O}from"../../support/fieldUtils.js";import k from"../../../rest/support/AutoIntervalBinParameters.js";import A from"../../../rest/support/DateBinParameters.js";import{unitsDict as j}from"../../../rest/support/DateBinUtils.js";import M from"../../../rest/support/FixedBoundariesBinParameters.js";import N from"../../../rest/support/FixedIntervalBinParameters.js";import{isNullCountSupported as P,calculateStringStatistics as F,calculateStatistics as I,processSummaryStatisticsResult as L,calculateUniqueValuesCount as R,createUVResult as z,calculateClassBreaks as B,resolveCBResult as V,calculateHistogram as H,calculatePercentile as U,binIndex as W,getBinParams as G,getAttributeComparator as K}from"../../../statistics/utils.js";import{utc as q}from"../../../time/constants.js";import{DateTime as J}from"luxon";const Y=t(()=>import(`../../../geometry/operators/json/convexHullOperator.js`));class X{constructor(e,t,n){this.items=e,this.query=t,this.geometryType=n.geometryType,this.hasZ=!!t.returnZ&&n.hasZ,this.hasM=!!t.returnM&&n.hasM,this.fieldsIndex=n.fieldsIndex,this.spatialReference=n.spatialReference,this.featureAdapter=n.featureAdapter,this.featureIdInfo=n.featureIdInfo}get size(){return this.items.length}createQueryResponseForCount(){let e=new g(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);let{groupByFieldsForStatistics:t,having:n,outStatistics:r}=this.query;if(!t?.length)return 1;let i=new Map,a=new Map,o=new Set;for(let s of r){let{statisticType:r}=s,c=r===`exceedslimit`?void 0:s.onStatisticField;if(!a.has(c)){let n=[];for(let r of t){let t=this._getAttributeValues(e,r,this.items,i);n.push(t)}a.set(c,this._calculateUniqueValues(n,this.items,e.returnDistinctValues))}let l=a.get(c);for(let t in l){let{data:r,items:i}=l[t],a=r.join(`,`);(!n||e.validateItems(i,n))&&o.add(a)}}return o.size}async createQueryResponse(){let e;if(e=this.query.outStatistics?this.query.outStatistics.some(e=>e.statisticType===`exceedslimit`)?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items):this._createFeatureQueryResponse(this.query),this.query.returnQueryGeometry){let t=this.query.geometry;u(this.query.outSR)&&!d(t.spatialReference,this.query.outSR)?e.queryGeometry=_({spatialReference:this.query.outSR,...b(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=_({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t,n){let r=this.featureAdapter,{point:i}=e,a=typeof e.distance==`number`?e.distance:e.distance.x,o=typeof e.distance==`number`?e.distance:e.distance.y;function s(e,t){let n=(e-i.x)/a,r=(t-i.y)/o;return n*n+r*r}let c={candidates:[]},l=this.geometryType===`esriGeometryPolygon`,u=this.geometryType===`esriGeometryPolyline`||this.geometryType===`esriGeometryPoint`,d=this._getPointCreator(t,this.spatialReference,n),g=new Q(null,0),_=new Q(null,0),v={x:0,y:0,z:0};for(let e of this.items){let t=r.getObjectId(e),n=r.getGeometryWithCurves?.(e);if(n!=null){b(n,t);continue}let i=r.getGeometry(e);if(i!=null){y(i,t);continue}}return c.candidates.sort((e,t)=>e.distance-t.distance),c;function y(t,n){let{coords:r,stride:a}=t,o=t.isPoint?te:t.lengths;if(g.coords=r,_.coords=r,e.returnEdge){let e=0;for(let t=0;t<o.length;t++){let r=o[t],u=e;for(let t=0;t<r;t++,e+=a){if(!l&&t===r-1||(g.coordsIndex=e,_.coordsIndex=t===r-1?u:e+a,!ee(v,i,g,_)))continue;let o=s(v.x,v.y);o<=1&&c.candidates.push(new S(n,d(v),Math.sqrt(o),d(g),d(_)))}}}if(e.vertexMode===`all`){let e=0;for(let t=0;t<o.length;t++){let r=o[t],i=e,u=_;u.coordsIndex=i;for(let t=0;t<r;t++,e+=a){if(g.coordsIndex=e,l&&t===r-1&&g.x===u.x&&g.y===u.y)continue;let i=s(g.x,g.y);i<=1&&c.candidates.push(new C(n,d(g),Math.sqrt(i)))}}}else if(u&&e.vertexMode===`ends`){let e=0,t=[];for(let n=0;n<o.length;n++){t.push(e);let r=o[n];e+=r*a,r>1&&t.push(e-a)}for(let e of t){g.coordsIndex=e;let t=s(g.x,g.y);t<=1&&c.candidates.push(new C(n,d(g),Math.sqrt(t)))}}}function b(t,n){let{candidates:r}=c,a={x:0,y:0,z:0};if(e.returnEdge){let e=[i.x,i.y],o=new Q(e,0),c=new Q(e,0);for(let{segments:i}of t.parts)for(let{start:t,curve:l}of i){let{curvePoint:i}=f(t,l,e),u=s(...i);if(u>1)continue;[a.x,a.y]=i,o.coords=t,c.coords=p(l);let g=m(l)?null:h(l);r.push(new S(n,d(a),Math.sqrt(u),d(o),d(c),!1,g))}}function o(e){a.x=t.vertexXY[e*2],a.y=t.vertexXY[e*2+1];let i=s(a.x,a.y);i>1||(a.z=t.vertexZ?.[e]??0,r.push(new C(n,d(a),Math.sqrt(i))))}if(e.vertexMode===`all`){let{vertexCount:e}=t;for(let t=0;t<e;++t)o(t);return}if(e.vertexMode===`ends`)switch(t.type){case`point`:o(0);break;case`polyline`:for(let e=0;e<t.partCount;++e){let n=t.partOffsets[e],r=t.partOffsets[e+1]-1;o(n),r!==n&&o(r)}}}}_getPointCreator(e,t,n){let r=n!=null&&!d(t,n)?e=>b(e,t,n):e=>e,{hasZ:i}=this;return i&&e?({x:e,y:t,z:n})=>r({x:e,y:t,z:n}):({x:e,y:t})=>r({x:e,y:t,z:0})}async createSummaryStatisticsResponse(e){let{field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,minValue:o,maxValue:s,scale:c,timeZone:l,outStatisticTypes:u}=e,d=this.fieldsIndex.get(t),f=w(d)||T(d)||E(d),p=await this._getDataValues({field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,scale:c,timeZone:l},this.items),m=P({normalizationType:i,normalizationField:r,minValue:o,maxValue:s}),h={value:.5,fieldType:d?.type},g=D(d)?F({values:p,supportsNullCount:m,percentileParams:h,outStatisticTypes:u}):I({values:p,minValue:o,maxValue:s,useSampleStdDev:!i,supportsNullCount:m,percentileParams:h,outStatisticTypes:u});return L(g,u,f)}async createUniqueValuesResponse(e){let{field:t,valueExpression:n,domains:r,returnAllCodedValues:i,scale:a,timeZone:o}=e,s=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:n,scale:a,timeZone:o},this.items,!1),c=R(s);return z(c,r,i,e.fieldDelimiter)}async createClassBreaksResponse(e){let{field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numClasses:u,scale:d,timeZone:f}=e,p=await this._getDataValues({field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,scale:d,timeZone:f},this.items),m=B(p,{field:t,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numClasses:u});return V(m,o)}async createHistogramResponse(e){let{field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numBins:u,scale:d,timeZone:f}=e,p=await this._getDataValues({field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,scale:d,timeZone:f},this.items);return H(p,{field:t,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numBins:u})}_sortFeatures(e,t,n){if(e.length>1&&t?.length)for(let r of t.slice().reverse()){let{compare:t,fieldOrExpression:i,fieldInfo:a}=$(r,this.fieldsIndex);e.sort((e,r)=>t(n(e,i,a),n(r,i,a)))}}_topNFeatures(t,n,r,i){if(t.length>1&&n?.length){let a=n.map(e=>{let{compare:t,fieldOrExpression:n,fieldInfo:r}=$(e,this.fieldsIndex);return(e,a)=>t(i(e,n,r),i(a,n,r))}).reduceRight((e,t)=>(n,r)=>{let i=t(n,r);return i!==0&&!Number.isNaN(i)?i:e(n,r)}),o=[];for(let n of t)e(o,n,r,a);return o}return t.slice(0,r)}_createFeatureQueryResponse(e){let{items:t,geometryType:n,hasM:r,hasZ:i,featureIdInfo:a,spatialReference:o}=this,{outFields:s,outSR:c,quantizationParameters:u,resultRecordCount:d,resultOffset:f,returnZ:p,returnM:m}=e,h=d!=null&&t.length>(f||0)+d,g=s&&(s.includes(`*`)?[...this.fieldsIndex.fields]:s.map(e=>this.fieldsIndex.get(e)));return{exceededTransferLimit:h,features:this._createFeatures(e,t),fields:g,geometryType:n,hasM:r&&m,hasZ:i&&p,objectIdFieldName:a.type===`object-id`?a.fieldName:null,spatialReference:_(c||o),transform:u&&l(u)||null}}_createFeatures(e,t){let n=new g(e,this.featureAdapter,this.fieldsIndex),{hasM:r,hasZ:i}=this,{orderByFields:a,quantizationParameters:o,returnGeometry:s,returnCentroid:c,maxAllowableOffset:u,resultOffset:d,resultRecordCount:f,returnZ:p=!1,returnM:m=!1}=e,h=i&&p,_=r&&m,b,x=d||0,S=f==null?null:x+f;S!=null&&S<=5e3&&S<t.length?b=this._topNFeatures(t,a,S,(e,t,r)=>n.getFieldValue(e,t,r)):(b=[...t],this._sortFeatures(b,a,(e,t,r)=>n.getFieldValue(e,t,r))),(x>0||S!=null)&&(b=b.slice(x,S??void 0));let C=[],w=0;if(!this.geometryType||!s&&!c)for(let e of b){let t=n.getAttributes(e);t&&(C[w++]=this._addFeatureJSONMetadata(e,{attributes:t}))}else{let e=l(o)??void 0,t=this.geometryType===`esriGeometryPolygon`||this.geometryType===`esriGeometryPolyline`;if(s&&!c)for(let r of b){let i=this.featureAdapter.getGeometry(r),a=this._addFeatureJSONMetadata(r,{attributes:n.getAttributes(r),geometry:v(this.geometryType,i,u,e,h,_)});t&&i&&!a.geometry&&(a.centroid=y(this,this.featureAdapter.getCentroid(r,this),e)),C[w++]=a}else if(!s&&c)for(let t of b)C[w++]=this._addFeatureJSONMetadata(t,{attributes:n.getAttributes(t),centroid:y(this,this.featureAdapter.getCentroid(t,this),e)});else for(let t of b)C[w++]=this._addFeatureJSONMetadata(t,{attributes:n.getAttributes(t),centroid:y(this,this.featureAdapter.getCentroid(t,this),e),geometry:v(this.geometryType,this.featureAdapter.getGeometry(t),u,e,h,_)})}return C}_addFeatureJSONMetadata(e,t){let n=this.featureAdapter.getMetadata?.(e);return n!==void 0&&(t.metadata=n),t}_createExceedsLimitQueryResponse(){let e=!1,t=1/0,n=1/0,r=1/0;for(let e of this.query.outStatistics??[])if(e.statisticType===`exceedslimit`){t=e.maxPointCount==null?1/0:e.maxPointCount,n=e.maxRecordCount==null?1/0:e.maxRecordCount,r=e.maxVertexCount==null?1/0:e.maxVertexCount;break}return e=this.geometryType===`esriGeometryPoint`?this.items.length>t:this.items.length>n||this.items.reduce((e,t)=>e+(this.featureAdapter.getGeometry(t)?.size??0),0)>r,{fields:[{name:`exceedslimit`,type:`esriFieldTypeInteger`,alias:`exceedslimit`,sqlType:`sqlTypeInteger`,domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,n={attributes:{}}){let r=[],i=new Map,a=new Map,o=new Map,s=new Map,c=new g(e,this.featureAdapter,this.fieldsIndex),l=e.outStatistics,{groupByFieldsForStatistics:u,having:d,orderByFields:f,resultRecordCount:p}=e,m=u?.length,h=!!m,_=h?u[0]:null,v=h&&!this.fieldsIndex.get(_);for(let f of l??[]){let{outStatisticFieldName:l,statisticType:p}=f,g=f,y=p===`exceedslimit`?void 0:f.onStatisticField,b=p===`percentile_disc`||p===`percentile_cont`,x=p===`EnvelopeAggregate`||p===`CentroidAggregate`||p===`ConvexHullAggregate`,S=h&&m===1&&(y===_||v)&&p===`count`;if(h){if(!o.has(y)){let e=[];for(let n of u){let r=this._getAttributeValues(c,n,t,i);e.push(r)}o.set(y,this._calculateUniqueValues(e,t,!x&&c.returnDistinctValues))}let n=o.get(y);if(!n)continue;let r=Object.keys(n);for(let a of r){let{count:r,data:o,items:f,itemPositions:p}=n[a],m=o.join(`,`);if(!d||c.validateItems(f,d)){let n=s.get(m)||{attributes:{}};if(e.returnAggIds&&(n.aggregateIds=f.map(e=>this.featureAdapter.getObjectId(e)).filter(e=>e!=null)),x){n.aggregateGeometries||={};let{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(g,f);n.aggregateGeometries[t]=e}else{let e=null;if(S)e=r;else{let n=this._getAttributeValues(c,y,t,i),r=p.map(e=>n[e]);e=b&&`statisticParameters`in g?this._getPercentileValue(g,r):this._getStatisticValue(g,r,null,c.returnDistinctValues)}n.attributes[l]=e}let a=0;u.forEach((e,t)=>n.attributes[this.fieldsIndex.get(e)?e:`EXPR_${++a}`]=o[t]),s.set(m,n)}}}else if(x){n.aggregateGeometries||={};let{aggregateGeometries:e,outStatisticFieldName:r}=await this._getAggregateGeometry(g,t);n.aggregateGeometries[r]=e}else{let e=this._getAttributeValues(c,y,t,i);n.attributes[l]=b&&`statisticParameters`in g?this._getPercentileValue(g,e):this._getStatisticValue(g,e,a,c.returnDistinctValues)}let C=(p===`min`||p===`max`)&&(D(this.fieldsIndex.get(y))||this._isAnyDateField(y))?this.fieldsIndex.get(y)?.type:null;r.push({name:l,alias:l,type:C||`esriFieldTypeDouble`})}let y=h?Array.from(s.values()):[n];return this._sortFeatures(y,f,(e,t)=>e.attributes[t]),p&&(y.length=Math.min(p,y.length)),{fields:r,features:y}}_isAnyDateField(e){let t=this.fieldsIndex.get(e);return w(t)||T(t)||E(t)||O(t)}async _getAggregateGeometry(e,t){let{statisticType:n,outStatisticFieldName:r}=e,{featureAdapter:s,spatialReference:c,geometryType:l}=this,u=t.map(e=>v(l,s.getGeometry(e))),d={aggregateGeometries:null,outStatisticFieldName:null},{convexHullExecuteMany:f}=await Y.getImportPromise(),[p]=f(u,{merge:!0});if(p&&p.rings[0].length<=3&&(p=null),n===`EnvelopeAggregate`)d.aggregateGeometries={...p?o(p):Z(u),spatialReference:c},d.outStatisticFieldName=r||`extent`;else if(n===`CentroidAggregate`){let[e,t]=p?i(p):a(Z(u));d.aggregateGeometries={x:e,y:t,spatialReference:c},d.outStatisticFieldName=r||`centroid`}else n===`ConvexHullAggregate`&&(d.aggregateGeometries=p&&{...p,spatialReference:c},d.outStatisticFieldName=r||`convexHull`);return d}_getStatisticValue(e,t,n,r){let{onStatisticField:i,statisticType:a}=e,o=null;return o=n?.has(i)?n.get(i):D(this.fieldsIndex.get(i))||this._isAnyDateField(i)?F({values:t,returnDistinct:r}):I({values:r?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),n&&n.set(i,o),o[a===`var`?`variance`:a]}_getPercentileValue(e,t){let{onStatisticField:n,statisticParameters:r,statisticType:i}=e,{value:a,orderBy:o}=r,s={value:a,orderBy:o,fieldType:this.fieldsIndex.get(n)?.type,isDiscrete:i===`percentile_disc`};return U(t,s)}_getAttributeValues(e,t,n,r){if(r.has(t))return r.get(t);let i=this.fieldsIndex.get(t),a=n.map(n=>e.getFieldValue(n,t,i));return r.set(t,a),a}_calculateUniqueValues(e,t,n){let r={},i=t.length;for(let a=0;a<i;a++){let i=t[a],o=[];for(let t of e)o.push(t[a]);let s=o.join(`,`);r[s]==null?r[s]={count:1,data:o,items:[i],itemPositions:[a]}:(n||r[s].count++,r[s].items.push(i),r[s].itemPositions.push(a))}return r}async _getDataValues(e,t,i=!0){let a=new g(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:o,scale:s,timeZone:c}=e,l=r.fromJSON(this.query.outSR||this.spatialReference);return o?a.getExpressionValues(t,o,{viewingMode:`map`,scale:s,spatialReference:l},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},c):a.getDataValues(t,n(e),i)}_calculateHistogramBins(e,t,n){if(t.min==null&&t.max==null)return[];let r=t.intervals,i=t.min??0,a=t.max??0,o=r.map(([e,t])=>({minValue:e,maxValue:t,count:0,items:[]}));for(let t=0;t<e.length;t++){let s=e[t],c=n[t];if(s!=null&&s>=i&&s<=a){let e=W(r,s);e>-1&&(o[e].count++,o[e].items.push(c))}}return o}async createQueryBinsResponse(e){let t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);let{value:n,outAlias:r,valueType:i}=t,a=[],o=[{name:r??n,alias:r??n,type:i??`esriFieldTypeString`},{name:`bin`,alias:`bin`,type:`esriFieldTypeInteger`}],s=new g(e,this.featureAdapter,this.fieldsIndex),c=new Map,l=[...this.items];this._sortFeatures(l,[n],(e,t,n)=>s.getFieldValue(e,t,n));let u=this._getAttributeValues(s,n,l,c),d=this._calculateUniqueValues([u],l,s.returnDistinctValues);for(let t in d){let{items:i}=d[t],s=await this._createBinsResponse(e,i);if(a.push(...s.features.map(e=>({...e,attributes:{...e.attributes,[r??n]:t}}))),s.fields)for(let e of s.fields)o.some(t=>t.name===e.name)||o.push(e)}return{fields:o,features:a}}async _createBinsResponse(e,t){let n=e.bin;switch(t??=this.items,n.type){case`autoIntervalBin`:return this._createAutoIntervalBinsResponse(k.fromJSON(n),e,t);case`dateBin`:return this._createDateBinsResponse(A.fromJSON(n),e,t);case`fixedBoundariesBin`:return this._createFixedBoundariesBinsResponse(M.fromJSON(n),e,t);case`fixedIntervalBin`:return this._createFixedIntervalBinsResponse(N.fromJSON(n),e,t)}}async _createAutoIntervalBinsResponse(e,t,n){let{field:r,normalizationField:i,numBins:a,normalizationType:o,normalizationTotal:s,start:c,end:l}=e,u=await this._getDataValues({field:e.field||e.expression,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},n),d=G(u,{field:r,normalizationField:i,normalizationType:o,normalizationTotal:s,numBins:a,minValue:x(o?e.normalizationMinValue:c,!1),maxValue:x(o?e.normalizationMaxValue:l,!1)}),f=this._calculateHistogramBins(u,d,n);return this._createFeaturesFromHistogramBins(f,t)}async _createDateBinsResponse(e,t,n){let{field:r,interval:i,start:a,end:o,snapToData:s,returnFullIntervalBin:c,offset:l,firstDayOfWeek:u}=e,d=i.unit,f=await this._getDataValues({field:r||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},n),p=O(this.fieldsIndex.get(r)),m=j.toJSON(d),h=f.filter(Boolean).sort((e,t)=>e-t),g=a==null?h[0]:x(a,p),_=o==null?h[h.length-1]:x(o,p),v=[];if(g!=null&&_!=null){let e={zone:t.outTimeReference?.ianaTimeZone??q},n={[l?.unit?j.toJSON(l.unit):`milliseconds`]:l?.value||0},r=J.fromMillis(g,e).minus(n),a=J.fromMillis(_,e).minus(n),o=typeof u==`number`&&u>=1&&u<=7?u:7,d=(e,t)=>{let n=(e.weekday-t+7)%7;return e.minus({days:n}).startOf(`day`)},f=(e,t)=>d(e,t).plus({days:7});if(s===`last`){let e=m===`week`?f(a,o):a;for(;e>r;){let t=e.minus({[m]:i.value});if(t<r){v.unshift([c?t.plus(n).toMillis():r.plus(n).toMillis(),e.plus(n).toMillis()]);break}v.unshift([t.plus(n).toMillis(),e.plus(n).toMillis()]),e=t}}else{let e=s===`first`?r:m===`week`?d(r,o):r.startOf(m);for(;e<=a;){let t=e.plus({[m]:i.value});if(t>a){v.push([e.plus(n).toMillis(),c?t.plus(n).toMillis():a.plus(n).toMillis()]);break}v.push([e.plus(n).toMillis(),t.plus(n).toMillis()]),e=t}}}let y=this._calculateHistogramBins(f,{intervals:v,min:g,max:_},n);return this._createFeaturesFromHistogramBins(y,t)}async _createFixedBoundariesBinsResponse(e,t,n){let{field:r}=e,i=await this._getDataValues({field:r||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},n),a=O(this.fieldsIndex.get(r)),o=e.boundaries.map(e=>x(e,a)).sort((e,t)=>e-t),s=[];for(let e=0;e<o.length-1;e++)s.push([o[e],o[e+1]]);let c={intervals:s,min:o.at(0),max:o.at(-1)},l=this._calculateHistogramBins(i,c,n);return this._createFeaturesFromHistogramBins(l,t)}async _createFixedIntervalBinsResponse(e,t,n){let{field:r,interval:i,normalizationType:a,start:o,end:s}=e,c=await this._getDataValues({field:r||e.expression,normalizationField:e.normalizationField,normalizationType:a,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},n),l=O(this.fieldsIndex.get(r)),u=G(c,{field:r,classificationMethod:`defined-interval`,definedInterval:i,minValue:x(a?e.normalizationMinValue:o,l),maxValue:x(a?e.normalizationMaxValue:s,l)},!0),d=this._calculateHistogramBins(c,u,n);return this._createFeaturesFromHistogramBins(d,t)}async _createFeaturesFromHistogramBins(e,t){let{upperBoundaryAlias:n,lowerBoundaryAlias:r}=t,i=r||`lowerBoundary`,a=n||`upperBoundary`,o=[],s=[{name:i,alias:i,type:`esriFieldTypeDouble`},{name:a,alias:a,type:`esriFieldTypeDouble`}],c=t.bin?.stackBy?.value,l=t.bin?.stackBy?.outAlias;c&&s.push({name:`bin`,alias:`bin`,type:`esriFieldTypeInteger`},{name:l??c,alias:l??c,type:`esriFieldTypeString`});let u=0,d=t.bin.type===`dateBin`,f=t.outTimeReference?.ianaTimeZone;for(let n of e){let{minValue:e,maxValue:r,items:p}=n,m={attributes:{}};m.attributes[i]=d&&f&&e!=null?J.fromMillis(e,{zone:f}).toISO():e,t.bin.hideUpperBound||(m.attributes[a]=d&&f&&r!=null?J.fromMillis(r,{zone:f}).toISO():r),t.returnAggIds&&(m.aggregateIds=p.map(e=>this.featureAdapter.getObjectId(e)).filter(e=>e!=null));let h;if(c?(h=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[c],orderByFields:[c]},p),m.attributes.bin=++u,t.bin.jsonStyle===`flat`?o.push(...h.features.map(({attributes:{EXPR_1:e,...t},...n})=>({...n,attributes:l??e?{...t,[l??e]:e,...m.attributes}:{...t,...m.attributes}}))):(m.stackedAttributes=h.features.map(({attributes:{EXPR_1:e,...t}})=>l??e?{...t,[l??e]:e}:t),o.push(m))):(t.bin?.splitBy&&(m.attributes.bin=++u),h=await this._createStatisticsQueryResponse(t,p,m),o.push(m)),h.fields)for(let e of h.fields)s.some(t=>t.name===e.name)||s.push(e)}return t.binOrder===`desc`&&o.reverse(),{fields:s,features:o}}}function Z(e){let t=s(e[0]);for(let n of e.slice(1))c(t,s(n));return t}function ee(e,t,n,r){let i=r.x-n.x,a=r.y-n.y,o=t.x-n.x,s=t.y-n.y,c=i*i+a*a;if(c===0)return!1;let l=o*i+s*a,u=Math.min(1,Math.max(0,l/c));return e.x=n.x+i*u,e.y=n.y+a*u,!0}class Q{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}const te=[1];function $(e,t){let n=e.split(` `),r=n[0],i=t.get(r),a=n[1]?n[1].toLowerCase()===`desc`:!1;return{compare:K(i?.type,a,`case-insensitive`),fieldOrExpression:r,fieldInfo:i}}export{X as QueryEngineResult};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import n from"../../../../request.js";import r from"../../../../core/Error.js";import{EventEmitter as i}from"../../../../core/Evented.js";import has from"../../../../core/has.js";import{QueueProcessor as a}from"../../../../core/QueueProcessor.js";import{isBlobProtocol as o}from"../../../../core/urlUtils.js";import{createParquetFile as s,readMetadata as c}from"../../../parquet.js";import{ParquetFileInfo as l}from"./ParquetFileInfo.js";import{parseFileStatisticsMap as u}from"./ParquetFileStatistics.js";const d=`_spatial.json`,f=new a({concurrency:12,process:async e=>{let{data:t}=await n(e.url,e.options);return t}});let p=1;class m{constructor(e,t=()=>{}){this._geometryInfo=e,this._getCustomParameters=t,this.events=new i}async destroy(){await this.clear()}async clear(){if(this._infos){let e=await this._infos;for(let t of e.values())t.destroy();e.clear(),this._infos=null}}async getMetadata(){let n={stack:[],error:void 0,hasError:!1};try{let t=(await this._getParquetFileNames()).at(0);if(!t)return null;let r=e(n,await s(t,{provider:this}),!1);return c(r)}catch(e){n.error=e,n.hasError=!0}finally{t(n)}}getGeometryInfo(){return this._geometryInfo}async getFiles(){let e=await this._getInfoMap();return Array.from(e.values())}async updateGeometryInfo(e){if(this._geometryInfo)throw Error(`GeometryInfo already set`);await this.clear(),this._geometryInfo=e}async fetchLength(e){let{byteLength:t,cacheTag:n}=await this._fetchLengthAndTag(e);if(!has(`parquetlayer-cache-enabled`))return t;try{await this._createOrResetCache(e,n)}catch{}return t}async fetchRange(e,t,n,r){let i={fileId:e,requestId:p++,range:{start:t,end:n+1}};this.events.emit(`rangeRead`,{...i,phase:`start`});try{let a=await this._fetchRangeWithCache(e,t,n,r);return this.events.emit(`rangeRead`,{...i,phase:`complete`}),a}catch(e){throw this.events.emit(`rangeRead`,{...i,phase:`error`}),e}}_getCacheFileName(e){return e}async _requestStatistics(e){let{data:t}=await n(e,{responseType:`json`,query:this._getCustomParameters()});return t}async _fetchRange(e,t,n,i){let a={url:e,options:{responseType:`array-buffer`,query:this._getCustomParameters()??{},cacheMode:`no-store`,useQueue:!0,headers:{range:`bytes=${t}-${n}`}}},o=await f.push(a),s=n-t+1;if(o.byteLength!==s)throw new r(`InvalidRangeRequest`,`request returned ${o.byteLength} bytes for range ${t}-${n}, expected ${s}.`);return o}async _fetchLengthAndTag(e){if(o(e)){let{data:t}=await n(e,{responseType:`blob`});return{byteLength:t.size,cacheTag:null}}let t=await this._requestHead(e),r=t.headers.get(`Content-Length`);if(r==null)throw Error(`Unable to parse content length`);let i=t.headers.get(`etag`)??t.headers.get(`Last-Modified`);return{byteLength:parseInt(r,10),cacheTag:i}}async _getInfoMap(){return this._infos||=this._fetchParquetFiles(),this._infos}async _updateParquetFileInfos(e){let t=await this._getInfoMap(),n=new Set(e);for(let e of n)if(!t.get(e)){let n=t.size,r=await l.create(this.getGeometryInfo(),this,e,n,null);t.set(e,r)}for(let e of t.keys())if(!n.has(e))throw Error(`Deletion not supported`)}async _getFileStatistics(e){this._statistics||=this._fetchStatistics();let t=await this._statistics,n=g(e);return t.get(n)}async _fetchParquetFiles(){let e=(await this._getParquetFileNames()).map(async(e,t)=>{let n=t,r=await this._getFileStatistics(e);return l.create(this.getGeometryInfo(),this,e,n,r)}),t=await Promise.all(e),n=new Map;for(let e of t)n.set(e.url,e);return n}async _fetchStatistics(){let e=await this._getStatisticsFileName();if(e==null)return new Map;let t=await this._resolveFileUrl(e),n=await this._requestStatistics(t);return u(n)}async _requestHead(e){let{data:t}=await n(e,{responseType:`native`,method:`head`,query:this._getCustomParameters()});return t}async _openCache(e){return caches.open(this._getCacheName(e))}async _fetchRangeWithCache(e,t,n,r){if(!has(`parquetlayer-cache-enabled`))return this._fetchRange(e,t,n,r);let i=new URL(this._getCacheFileName(e));i.searchParams.append(`range`,`${t}-${n}`);try{let a=await this._openCache(e),o=await a.match(i);if(o)return await o.arrayBuffer();let s=await this._fetchRange(e,t,n,r);return await a.put(i,new Response(s,{headers:{"Content-Type":`application/octet-stream`,"Content-Length":s.byteLength.toString()}})),s}catch{return this._fetchRange(e,t,n,r)}}_getCacheName(e){return`parquet.v1:${this._getCacheFileName(e)}`}async _createOrResetCache(e,t){let n=this._getCacheName(e),r=new URL(this._getCacheFileName(e));if(r.searchParams.append(`metadata`,`true`),t==null){await caches.delete(n);return}let i=await caches.open(n);(await(await i.match(r))?.json())?.tag!==t&&(await caches.delete(n),i=await caches.open(n));let a=JSON.stringify({tag:t});await i.put(r,new Response(a,{headers:{"Content-Type":`application/json`,"Content-Length":a.length.toString()}}))}}function h(e){let t=e.split(/[?#]/)[0];return t===d||t.endsWith(d)}function g(e){return e.split(/[?#]/)[0].split(`/`).at(-1)??e}export{m as FileProvider,h as isStatisticsFileName,d as spatialFileName};
|
|
2
|
+
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import n from"../../../../request.js";import r from"../../../../core/Error.js";import{EventEmitter as i}from"../../../../core/Evented.js";import has from"../../../../core/has.js";import{QueueProcessor as a}from"../../../../core/QueueProcessor.js";import{isBlobProtocol as o}from"../../../../core/urlUtils.js";import{createParquetFile as s,readMetadata as c}from"../../../parquet.js";import{ParquetFileInfo as l}from"./ParquetFileInfo.js";import{parseFileStatisticsMap as u}from"./ParquetFileStatistics.js";const d=`_spatial.json`,f=new a({concurrency:12,process:async e=>{let{data:t}=await n(e.url,e.options);return t}});let p=1;class m{constructor(e,t=()=>{}){this._geometryInfo=e,this._getCustomParameters=t,this.events=new i}async destroy(){await this.clear()}async clear(){if(this._infos){let e=await this._infos;for(let t of e.values())t.destroy();e.clear(),this._infos=null}}async getMetadata(){let n={stack:[],error:void 0,hasError:!1};try{let t=(await this._getParquetFileNames()).at(0);if(!t)return null;let r=e(n,await s(t,{provider:this}),!1);return c(r)}catch(e){n.error=e,n.hasError=!0}finally{t(n)}}getGeometryInfo(){return this._geometryInfo}async getFiles(){let e=await this._getInfoMap();return Array.from(e.values())}async updateGeometryInfo(e){if(this._geometryInfo)throw Error(`GeometryInfo already set`);await this.clear(),this._geometryInfo=e}async fetchLength(e){let{byteLength:t,cacheTag:n}=await this._fetchLengthAndTag(e);if(!has(`parquetlayer-cache-enabled`))return t;try{await this._createOrResetCache(e,n)}catch{}return t}async fetchRange(e,t,n,r){let i={fileId:e,requestId:p++,range:{start:t,end:n+1}};this.events.emit(`rangeRead`,{...i,phase:`start`});try{let a=await this._fetchRangeWithCache(e,t,n,r);return this.events.emit(`rangeRead`,{...i,phase:`complete`}),a}catch(e){throw this.events.emit(`rangeRead`,{...i,phase:`error`}),e}}_getCacheFileName(e){return e}async _requestStatistics(e){let{data:t}=await n(e,{responseType:`json`,maxUrlLength:0,query:this._getCustomParameters()});return t}async _fetchRange(e,t,n,i){let a={url:e,options:{responseType:`array-buffer`,query:this._getCustomParameters()??{},cacheMode:`no-store`,maxUrlLength:0,useQueue:!0,headers:{range:`bytes=${t}-${n}`}}},o=await f.push(a),s=n-t+1;if(o.byteLength!==s)throw new r(`InvalidRangeRequest`,`request returned ${o.byteLength} bytes for range ${t}-${n}, expected ${s}.`);return o}async _fetchLengthAndTag(e){if(o(e)){let{data:t}=await n(e,{responseType:`blob`});return{byteLength:t.size,cacheTag:null}}let t=await this._requestHead(e),r=t.headers.get(`Content-Length`);if(r==null)throw Error(`Unable to parse content length`);let i=t.headers.get(`etag`)??t.headers.get(`Last-Modified`);return{byteLength:parseInt(r,10),cacheTag:i}}async _getInfoMap(){return this._infos||=this._fetchParquetFiles(),this._infos}async _updateParquetFileInfos(e){let t=await this._getInfoMap(),n=new Set(e);for(let e of n)if(!t.get(e)){let n=t.size,r=await l.create(this.getGeometryInfo(),this,e,n,null);t.set(e,r)}for(let e of t.keys())if(!n.has(e))throw Error(`Deletion not supported`)}async _getFileStatistics(e){this._statistics||=this._fetchStatistics();let t=await this._statistics,n=g(e);return t.get(n)}async _fetchParquetFiles(){let e=(await this._getParquetFileNames()).map(async(e,t)=>{let n=t,r=await this._getFileStatistics(e);return l.create(this.getGeometryInfo(),this,e,n,r)}),t=await Promise.all(e),n=new Map;for(let e of t)n.set(e.url,e);return n}async _fetchStatistics(){let e=await this._getStatisticsFileName();if(e==null)return new Map;let t=await this._resolveFileUrl(e),n=await this._requestStatistics(t);return u(n)}async _requestHead(e){let{data:t}=await n(e,{responseType:`native`,method:`head`,maxUrlLength:0,query:this._getCustomParameters()});return t}async _openCache(e){return caches.open(this._getCacheName(e))}async _fetchRangeWithCache(e,t,n,r){if(!has(`parquetlayer-cache-enabled`))return this._fetchRange(e,t,n,r);let i=new URL(this._getCacheFileName(e));i.searchParams.append(`range`,`${t}-${n}`);try{let a=await this._openCache(e),o=await a.match(i);if(o)return await o.arrayBuffer();let s=await this._fetchRange(e,t,n,r);return await a.put(i,new Response(s,{headers:{"Content-Type":`application/octet-stream`,"Content-Length":s.byteLength.toString()}})),s}catch{return this._fetchRange(e,t,n,r)}}_getCacheName(e){return`parquet.v1:${this._getCacheFileName(e)}`}async _createOrResetCache(e,t){let n=this._getCacheName(e),r=new URL(this._getCacheFileName(e));if(r.searchParams.append(`metadata`,`true`),t==null){await caches.delete(n);return}let i=await caches.open(n);(await(await i.match(r))?.json())?.tag!==t&&(await caches.delete(n),i=await caches.open(n));let a=JSON.stringify({tag:t});await i.put(r,new Response(a,{headers:{"Content-Type":`application/json`,"Content-Length":a.length.toString()}}))}}function h(e){let t=e.split(/[?#]/)[0];return t===d||t.endsWith(d)}function g(e){return e.split(/[?#]/)[0].split(`/`).at(-1)??e}export{m as FileProvider,h as isStatisticsFileName,d as spatialFileName};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{toConst as n}from"../../../../core/compilerUtils.js";import r from"../../../../core/Error.js";import i from"../../../../core/Handles.js";import has from"../../../../core/has.js";import a from"../../../../core/Logger.js";import{onAbortOrThrow as o,throwIfAborted as s}from"../../../../core/promiseUtils.js";import{QueueProcessor as c}from"../../../../core/QueueProcessor.js";import{parseWhereClause as l}from"../../../../core/sql.js";import{getMetersPerUnitForSR as u}from"../../../../core/units.js";import d from"../../../../geometry/SpatialReference.js";import{set as f,create as p,expandWithAABB as m,expandWithRect as ee,negativeInfinity as h}from"../../../../geometry/support/aaBoundingBox.js";import{copy as te,negativeInfinity as g,create as ne,expandWithRect as re}from"../../../../geometry/support/aaBoundingRect.js";import{isWebMercator as _,isWGS84 as v}from"../../../../geometry/support/spatialReferenceUtils.js";import{normalizeColumnPath as y,readParquetFileAttribute as b}from"../../../parquet.js";import{convertToGeometry as x}from"../../featureConversionUtils.js";import{getFieldNamesFromStatistics as S}from"../../data/attributeSupport.js";import{getQueryResultExtent as C,getQueryBoundingRects as w,QueryEngine as T}from"../../data/QueryEngine.js";import{queryCapabilities as ie}from"../../data/QueryEngineCapabilities.js";import{QueryEngineResult as E}from"../../data/QueryEngineResult.js";import{normalizeQueryLike as D}from"../../data/queryUtils.js";import{createFileProvider as O}from"../parquet/createFileProvider.js";import{readFieldStatistic as k}from"../parquet/ParquetFileStatistics.js";import{createDrawingInfo as ae}from"./clientSideDefaults.js";import{getParquetFileId as oe,getParquetRowId as se,getParquetObjectId as ce}from"./parquetIdUtils.js";import A from"../../../support/Field.js";import j from"../../../support/FieldsIndex.js";import{isNumericField as M}from"../../../support/fieldUtils.js";import{fromParquetGeometryEncodingJSON as N}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as P,fromParquetJSONGeometryType as F,toParquetJSONGeometryType as I}from"../../../support/parquetUtils.js";import{loadParquetModule as L}from"../../../../libs/librust-parquet/loadParquetModule.js";import{utc as R}from"../../../../time/constants.js";import{FeatureStoreQueryAdapter as z}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as B}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as V}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as H}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as U}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const W=new z,G=`__OBJECTID`,K=8e3;class le{constructor(e,t){this._files=e,this._createFileStream=t,this._fileIndex=0,this._streamIndex=0,this._streams=[],this._pending=new Set,this._resolvedCount=0}async next(e){for(await this._fill(e);this._pending.size>0;){s(e),await this._fill(e);let t=await ue(this._pending);if(this._pending.delete(t.read),this._resolvedCount++,t.chunk!=null)return t.chunk}return null}async _fill(e){for(this._removeDone();this._pending.size<8;){let t=this._getOrCreateNextStream(e);if(t==null)return;this._pending.add(t.read(e))}}_getOrCreateNextStream(e){let t=this._resolvedCount>=8?8:2;if(this._fileIndex<this._files.length&&this._streams.length<t){let t=this._files[this._fileIndex++],n=new de(t.id,this._createFileStream(t,e));return this._streams.push(n),n}return this._getNextStream()}_getNextStream(){let e=this._streams.length;for(let t=0;t<e;t++){let n=(this._streamIndex+t)%e,r=this._streams[n];if(r.canRead)return this._streamIndex=(n+1)%e,r}return null}_removeDone(){let e=this._streamIndex;for(let t=this._streams.length-1;t>=0;t--)this._streams[t].done&&(this._streams.splice(t,1),t<e&&e--);this._streamIndex=this._streams.length>0?e%this._streams.length:0}}function ue(e){return Promise.race(Array.from(e,async e=>({read:e,chunk:await e})))}class de{constructor(e,t){this._fileId=e,this._stream=t,this._readCount=0,this._reachedEnd=!1}get canRead(){return!this._reachedEnd}get done(){return this._reachedEnd&&this._readCount===0}async read(e){this._readCount++;try{let t=await(await this._stream).next(e);return t==null?(this._reachedEnd=!0,null):{fileId:this._fileId,chunk:t}}finally{this._readCount--}}}class fe{constructor(){this._hasZ=!1,this._hasM=!1,this._queue=new c({concurrency:4,process:(e,t)=>this._executeQuery(e,t)}),this._streams=new Map,this._streamIdCounter=0,this._indexMap={},this._handles=new i}async load(e){let t=e.spatialReference?d.fromJSON(e.spatialReference):void 0;if(t&&!t.isWGS84&&!t.isWebMercator)throw new r(`parquet:unsupported-projection`,`Only WGS84 and Web Mercator are supported`);this._customParameters=e.customParameters,this._loadParameters=e,await this._updateProvider(O(e.provider,null,()=>this._customParameters));let n=await this._provider.getMetadata(),i=await P(n,{fields:e.fields?.map(e=>A.fromJSON(e)),geometryEncoding:e.geometryEncoding?N(e.geometryEncoding):null,geometryType:e.geometryType?F(e.geometryType):null,displayOptimization:e.displayOptimization,spatialReference:t});if(this._hasZ=!!n?.hasZ,this._hasM=!!n?.hasM,!i.fields)throw new r(`parquet:unsupported`,`Fields must be defined`);let o;if(i.spatialReference&&i.geometryType){if(!i.spatialReference)throw new r(`parquet:unsupported`,`SpatialReference must be defined`);if(!i.spatialReference.isGeographic&&!i.spatialReference.isWebMercator)throw new r(`parquet:unsupported-projection`,`Only WGS84 and Web Mercator are supported`);i.spatialReference.isGeographic&&!i.spatialReference.isWGS84&&(a.getLogger(`parquet:unsupported-projection`).warn(`Found a geographic projection that is not WGS84. Handling as WGS84.`,{spatialReference:i.spatialReference}),i.spatialReference=d.WGS84),o={geometry:i.geometryEncoding?{geometryType:I(i.geometryType),spatialReference:i.spatialReference.toJSON(),encoding:i.geometryEncoding.toJSON()}:null,displayOptimization:i.displayOptimization}}this.setCustomParameters(e.customParameters),this._displayOptimization=i.displayOptimization,await this._provider.updateGeometryInfo(o),this._capabilities=$(await this._getFileStatistics(),this._hasZ,this._hasM);let s=await this._provider.getFiles();if(!s.length)return{layerDefinition:{},capabilities:$(null,this._hasZ,this._hasM)};let c=await s[0].file;i.file=c;let{fields:l}=i;if(l==null)throw new r(`parquet-layer:missing-metadata`,`Unable to create parquet source: cannot infer fields`,l);l.push(new A({name:G,type:`oid`,alias:G}));for(let e of l){let t=c.getColumnId(e.name);t!=null&&(this._indexMap[e.name]=t)}let u=j.fromLayerJSON({fields:l.map(e=>e.toJSON()),dateFieldsTimeReference:{timeZoneIANA:`UTC`}});this._fieldsIndex=u;let f=I(i.geometryType??`point`);return this._metadata=H.createFeature({fieldsIndex:u.toJSON(),geometryType:f,hasZ:this._hasZ,hasM:this._hasM,featureIdInfo:{type:`object-id`,fieldName:G},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:i.spatialReference,outSpatialReference:null,attributeSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:R}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:f,featureIdInfo:{type:`object-id`,fieldName:G},hasM:this._hasM,hasZ:this._hasZ,spatialReference:i.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},this._fullExtent=n?.extent?n.extent:await this._tryDeriveParquetFullExtent(i),{capabilities:this._capabilities,layerDefinition:{fields:i.fields?.map(e=>e.toJSON()),drawingInfo:ae(f),extent:this._fullExtent??void 0,geometryType:f,hasZ:this._hasZ,hasM:this._hasM,geometryEncoding:i.geometryEncoding?.toJSON(),displayOptimization:i.displayOptimization}}}destroy(){this._provider.destroy(),this._queue.destroy();for(let{handle:e}of this._streams.values())e.remove();this._streams.clear(),this._indexMap={},this._handles.removeAll()}async reload(e){this.destroy(),await this.load(e)}set remoteClient(e){this._source=e.createInvokeProxy(``)}setCustomParameters(e){this._customParameters=e}getIndexMap(){return this._indexMap}async updateFileProvider(e){this._loadParameters={...this._loadParameters,provider:e};let t=O(e,this._provider.getGeometryInfo(),()=>this._customParameters);await this._updateProvider(t)}async getDiagnosticsSnapshot(){let e=await this._provider.getFiles();return{files:await Promise.all(e.map(e=>e.getDiagnosticsSnapshot()))}}async getColumnIndex(e){return(await this._getFileInfoById(e.fileId)).getColumnIndex(e.rowGroupIndex,e.columnIndex)}async getOffsetIndex(e){return(await this._getFileInfoById(e.fileId)).getOffsetIndex(e.rowGroupIndex,e.columnIndex)}async queryFeatures(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),we(n)||(n.resultRecordCount=n.resultRecordCount?Math.min(n.resultRecordCount,K):K,n.resultOffset=n.resultOffset??0),n.outStatistics?this._queryStatistics(n,t):(n.returnDistinctValues&&(n.returnGeometry=void 0),(await this._enqueueQuery(n,t)).createQueryResponse())}async queryFeatureCount(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),!q(n)&&!n.returnDistinctValues&&!n.groupByFieldsForStatistics?.length&&!n.outStatistics?.length?this._getFeatureCount():(n.returnDistinctValues||(n.outFields=void 0),n.returnGeometry=void 0,(await this._enqueueQuery(n,t)).createQueryResponseForCount())}async queryObjectIds(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),q(n)?(n.resultRecordCount=n.resultRecordCount?Math.min(n.resultRecordCount,8e3):8e3,n.resultOffset=n.resultOffset??0,n.returnGeometry=void 0,n.outFields=void 0,n.returnDistinctValues=void 0,(await this._enqueueQuery(n,t)).items.map(e=>e.getObjectId())):Array.from({length:await this._getFeatureCount()},(e,t)=>t)}async queryAttributeBins(e,t={}){throw new r(`parquet:unsupported`,`queryAttributeBins not supported.`)}async queryExtent(e,t){let r=await D(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),this._fullExtent&&!q(r))return{count:await this._getFeatureCount(),extent:this._fullExtent};let i=n(this._metadata.spatialReference);r.returnGeometry=!0,r.outFields=void 0;let a=f(p(),h),o=p(),s=await this._enqueueQuery(r,t),c=0;for(let e of s.items)e.getBounds(o)&&(m(a,o),c+=1);let l=C(a,i,r.outSR?n(r.outSR):i.toJSON(),i,!1);return{count:c,extent:l}}async queryStream(e,t){if(!t.signal)throw Error(`InternalError: AbortSignal must be passed`);let n=await this._getCandidateFiles(e),r=new le(n,async(t,n)=>{let r=await t.file,i=await this._createParquetDisplayQuery(r,t.id,e);return r.executeQuery(i,K,n)}),i=this._streamIdCounter++,a=o(t.signal,e=>{let t=this._streams.get(i);t!=null&&(t.handle.remove(),this._streams.delete(i))});return this._streams.set(i,{stream:r,handle:a}),i}async getStreamNext(e,t){if(!t.signal)throw Error(`InternalError: AbortSignal must be passed`);let n=this._streams.get(e);if(!n)return{result:null};let r=await n.stream.next(t.signal);if(r==null)return n.handle.remove(),this._streams.delete(e),{result:null};let i=r.chunk.serialize().buffer,a={fileId:r.fileId,buffer:i};return i instanceof ArrayBuffer?{result:a,transferList:[i]}:{result:a}}async getStreamNextFeatures(e,t){let{result:n}=await this.getStreamNext(e,t);if(n==null)return null;let r=(await L()).ParquetChunk.deserialize(new Uint8Array(n.buffer)),i=new U(this._metadata,this._indexMap,r,n.fileId),a=[];for(;i.next();){let e=x(i.readGeometryWorldSpace(),i.geometryType,i.hasZ,i.hasM),t=i.readAttributes();a.push({attributes:t,geometry:e})}return{features:a}}async createPatch(e,t,n,r,i){if(!i.signal)throw Error(`InternalError: AbortSignal must be passed`);return(await(await(await this._getFileInfoById(e)).file).createChunkPatch(t,n,r,i.signal)).serialize().buffer}async _updateProvider(e){let t=this._provider;this._handles.removeAll(),this._provider=e,this._handles.add([e.events.on(`rangeRead`,e=>{this._source.onRangeRead(e)}),e.events.on(`sourceChanged`,async()=>{await this.reload(this._loadParameters),await this._source.onSourceChange()})]),await t?.destroy()}async _getCandidateFiles(e){let t=await this._provider.getFiles(),n=await this._getSpatialFilePruning(e);if(n==null)return t;let r=t.filter(e=>this._mayIncludeFileForSpatialPruning(e,n));return n.type===`xz`?Ce(r,n):r}async _queryStatistics(e,t){let n=await D({...e},null,this._queryEngineParams.spatialReference);if(n.returnGeometry=void 0,ve(n,this._fieldsIndex)){let e=await this._getStatisticsFromFiles(n);if(e)return e}return(await this._enqueueQuery(n,t)).createQueryResponse()}async _getStatisticsFromFiles(e){let t=await this._provider.getFiles(),n={},r=[];for(let i of e.outStatistics??[]){let e=xe(i,t);if(!e.available)return null;n[i.outStatisticFieldName]=e.value,r.push(be(i,this._fieldsIndex))}return{fields:r,features:[{attributes:n}]}}async _getSpatialFilePruning(e){if(e.type!==`tile`&&(e.type!==`arcade`||e.extent==null))return null;let t=this._displayOptimization?.index;if(t==null)return null;let n=e.outSpatialReference.wkid;if(t.wkid==null||n==null)return null;let r=t.wkid,i=await L();switch(t.type){case`xz`:return{type:`xz`,fieldName:y(t.code),intersects:(a,o)=>i.queryIntersectsXZStatistics(t.fullExtent,e.extent,n,r,t.maxLevel,a,o)};case`z`:return{type:`xy`,xFieldName:y(t.xColumn),yFieldName:y(t.yColumn),intersects:(t,a,o,s)=>i.queryIntersectsXYStatistics(e.extent,n,r,t,a,o,s)}}}_mayIncludeFileForSpatialPruning(e,t){switch(t.type){case`xz`:{let n=Z(e,t);return n?.type===`null-only`?!1:n?.type!==`bounds`||t.intersects(n.minValue,n.maxValue)}case`xy`:{let n=e.statistics.statistics.get(t.xFieldName),r=e.statistics.statistics.get(t.yFieldName);return n?.type===`null-only`||r?.type===`null-only`?!1:n?.type!==`bounds`||r?.type!==`bounds`||t.intersects(n.minValue,n.maxValue,r.minValue,r.maxValue)}}}async _tryDeriveParquetFullExtent(n){if(!n.spatialReference)return null;if(this._fullExtent==null&&n.geometryEncoding?.type===`location`){let r=await this._provider.getFiles(),{xField:i,yField:a}=n.geometryEncoding,o=f(p(),h),s=!1;for(let n of r){let r=await n.file;for(let n of r.rowGroups()){let r={stack:[],error:void 0,hasError:!1};try{let t=e(r,n.columnDescriptorForAttribute(i),!1),c=e(r,n.columnDescriptorForAttribute(a),!1),l=k(t),u=k(c);if(l?.type===`bounds`&&u?.type===`bounds`){let e=[l.minValue,u.minValue,l.maxValue,u.maxValue];ee(o,e),s=!0}n.free()}catch(e){r.error=e,r.hasError=!0}finally{t(r)}}}return s?{xmin:o[0],ymin:o[1],xmax:o[3],ymax:o[4],spatialReference:n.spatialReference?.toJSON()}:null}return null}async _getFileInfoById(e){let t=await this._provider.getFiles();for(let n of t)if(n.id===e)return n;throw Error(`InternalError: File ${e} does not exist`)}async _getFileStatistics(){return{featureCount:await this._getFeatureCount(),byteLength:await this._getByteLength()}}async _getFile(e){return(await this._getFileInfoById(e)).file}async _createParquetQuery(e,t,n,r,i){let a=(await L()).Query.new();n!=null&&a.setPreFilterStart(n),r!=null&&a.setPreFilterCount(r),i!=null&&a.setPostFilterCount(i);let o=await this._getRequiredFields(e);a.setOutFields(o),(e.geometry||e.returnGeometry)&&a.setReturnGeometry(!0),a.setReturnZ(!!e.returnZ),a.setReturnM(!!e.returnM);let s=this._tryGetGeneralizedGeometryResolution(e);s!=null&&a.setSourceResolution(s);let c=e.geometry?.spatialReference??this._queryEngineParams.spatialReference,l=c.wkid;if(e.geometry&&(_(c)||v(c))){let t=te(ne(),g);for(let n of w(e.geometry))re(t,n);a.setOutSpatialReference(l),a.setExtent({xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3]})}if(e.where){let{id:n,file:r}=t;await this._setWhereClause(a,await r,n,e.where)}return a}async _createParquetDisplayQuery(e,t,n){let r=(await L()).Query.new();if(n.type===`tile`){r.setExtent(n.extent),r.setQuantizationTransform(n.transform);let e=this._sourceResolution(n.resolution,n.outSpatialReference);e!=null&&r.setSourceResolution(e)}else n.type===`arcade`&&n.extent!=null&&r.setExtent(n.extent);return r.setOutFields(n.outFields.filter(e=>this._indexMap[e]!=null)),r.setOutSpatialReference(n.outSpatialReference.wkid),r.setReturnGeometry(n.returnGeometry),r.setReturnZ(n.returnZ),r.setReturnM(n.returnM),n.where&&await this._setWhereClause(r,e,t,n.where),r}async _getFeatureCount(){return(await this._provider.getFiles()).map(e=>e.statistics.rowCount).reduce((e,t)=>e+t,0)}async _getByteLength(){return(await this._provider.getFiles()).map(e=>e.statistics.byteSize).reduce((e,t)=>e+t,0)}_validateQuery(e){if(!this._capabilities.query.supportsStatistics&&e.outStatistics)throw new r(`parquet:unsupported`,`Statistics queries are not supported`,{query:e});if(!this._capabilities.query.supportsOrderBy&&e.orderByFields?.length)throw new r(`parquet:unsupported`,`Queries using orderBy are not supported`,{query:e});if(!this._capabilities.query.supportsDistinct&&e.returnDistinctValues)throw new r(`parquet:unsupported`,`Queries using returnDistinctValues are not supported`,{query:e})}async _setWhereClause(e,t,n,i){let a=this._indexMap,o=this._fieldsIndex,s={getAttribute(e,r){let i=a[r];if(i==null){if(o.get(r)?.name===`__OBJECTID`){let t=e.row+e.rowGroupStart;return ce(n,t)}return null}let s=o.get(r);return b(t,e.rowGroup,e.row,i,s.type)}},c=await l(i,this._fieldsIndex);if(!c.isStandardized)throw new r(`sql-parse-error`,`expression is not standardized`);let u=(e,t,n)=>c.testFeatureCompiled({rowGroup:e,row:t,rowGroupStart:n},s,null),d=c.fieldNames.map(e=>o.get(e)).filter(e=>e&&this._indexMap[e?.name]!=null);e.setWhere(i),e.setWhereEvaluator(u),e.setWhereFields(d.map(e=>e.name))}async*_streamFeatures(e,t,n,r,i){let a=await this._provider.getFiles(),o=0;for(let s of a){let a=o,c=o+s.statistics.rowCount;if(o+=s.statistics.rowCount,t!=null&&t>=c)continue;let l=t==null?null:Math.max(t-a,0),u=n;if(n!=null){let e=t??0,r=e+n;u=Math.max(Math.min(r,c)-Math.max(e,a),0)}if(u===0)continue;let d=await this._createParquetQuery(e,s,l,u,r),f=await(await s.file).executeQuery(d,K),p=async()=>{let e=await f.next(i);if(!e)return null;let t=new U(this._metadata,this._indexMap,e,s.id);return X([new B(t,null,0,!1)],this._queryEngineParams)},m=await p();for(;m!=null;)yield m,m=await p()}}async _queryFeaturesWithQueryEnginePagination(e,t){let n=[],r=this._streamFeatures(e,null,null,null,t),i=await r.next();for(;!i.done;){let a=await i.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(let e of a)n.push(e);i=await r.next()}return n}async _queryFeaturesWithUpfrontPagination(e,t){let n=e.resultOffset??0,r=e.resultRecordCount??K,i,a,o;ge(e)?_e(e)||(o=n+r):(n&&=(i=n,0),a=e.resultRecordCount);let s=[],c=this._streamFeatures(e,i,a,o,t),l=await c.next();for(;!l.done&&r>0;){let i=await l.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(let e of i){if(n>0){n--;continue}if(s.push(e),--r<=0)return s}l=await c.next()}return s}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){if(e.objectIds?.length){let n=new Map;for(let t of e.objectIds){let e=oe(t),r=se(t),i=n.get(e);i||(i=[],n.set(e,i)),i.push(r)}let r=[];for(let[i,a]of n.entries()){let n=await this._executeFileIdQuery(e,i,a,t);for(let e of n)r.push(e)}return new E(r,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:W,featureIdInfo:this._queryEngineParams.featureIdInfo})}if(e.where===`1=1`&&(e.where=null),e.resultOffset??=0,e.resultRecordCount??=await this._getFeatureCount(),e.resultRecordCount>2e7&&!(this._displayOptimization&&e.geometry))throw new r(`parquet:cannot-execute-query`,`Unable to execute query, dataset is too large.`);let n=!!e.orderByFields?.length||!!e.outStatistics?.length||!!e.returnDistinctValues,i=n?await this._queryFeaturesWithQueryEnginePagination(e,t):await this._queryFeaturesWithUpfrontPagination(e,t);return n||(e.resultOffset=0),new E(i,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:W,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(e,t,n,r){let i=await this._getRequiredFields(e),a=(await L()).Query.new();a.setOutFields(i),a.setReturnGeometry(!!e.returnGeometry),a.setReturnZ(!!e.returnZ),a.setReturnM(!!e.returnM),a.setIds(new Uint32Array(n));let o=await(await this._getFile(t)).executeQuery(a,K,r),s=await o.next(r),c=0,l=[];for(;s!=null;){let e=new U(this._metadata,this._indexMap,s,t),n=new B(e,null,c++,!1);l.push(n),s=await o.next(r)}return X(l,this._queryEngineParams).executeQueryForOpaqueFeatures(e,r)}async _getRequiredFields(e){let t=new Set;if(e.outStatistics)for(let n of S(this._fieldsIndex,e.outStatistics,e.groupByFieldsForStatistics))t.add(n);else if(e.outFields)for(let n of e.outFields)t.add(n);return(t.has(`*`)?this._fieldsIndex.fields.map(e=>e.name):Array.from(t)).filter(e=>this._indexMap[e]!=null)}_tryGetGeneralizedGeometryResolution(e){if(!this._displayOptimization)return null;let t=e.outSR??this._queryEngineParams.spatialReference;if(!_(t)&&!v(t))return null;let n=e.quantizationParameters?.tolerance??e.maxAllowableOffset;return n?this._sourceResolution(n,t):null}_sourceResolution(e,t){let n=this._queryEngineParams.spatialReference,r=u(t)/u(n)*e;return!Number.isFinite(r)||r<=0?null:r}}function pe(e){switch(e){case`fullText`:case`having`:case`timeExtent`:case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:case`objectIds`:case`where`:case`geometry`:case`resultOffset`:case`resultRecordCount`:return!0;default:return!1}}function me(e){switch(e){case`fullText`:case`having`:case`timeExtent`:case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:case`objectIds`:case`where`:case`geometry`:return!0;default:return!1}}function he(e){switch(e){case`fullText`:case`having`:case`timeExtent`:return!0;case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:return!1;case`objectIds`:case`where`:case`resultOffset`:case`geometry`:case`resultRecordCount`:return!1}return!1}function q(e){for(let t in e){let n=t;if(pe(n)&&e[n]!==null)return!0}return!1}function ge(e){for(let t in e){let n=t;if(me(n)&&e[n]!==null)return!0}return!1}function _e(e){for(let t in e){let n=t;if(he(n)&&e[n]!==null)return!0}return!1}function ve(e,t){return!!e.outStatistics?.length&&!q(e)&&!e.groupByFieldsForStatistics?.length&&!e.orderByFields?.length&&!e.returnDistinctValues&&!e.returnAggIds&&e.outStatistics.every(e=>ye(e,t))}function ye(e,t){switch(e.statisticType){case`count`:return e.onStatisticField===`1`||t.get(e.onStatisticField)!=null;case`min`:case`max`:{let n=t.get(e.onStatisticField);return n!=null&&M(n)}default:return!1}}function be(e,t){let n=e.statisticType===`exceedslimit`?null:t.get(e.onStatisticField),r=(e.statisticType===`min`||e.statisticType===`max`)&&n?.type===`esriFieldTypeDate`?n.type:`esriFieldTypeDouble`;return{name:e.outStatisticFieldName,alias:e.outStatisticFieldName,type:r}}function xe(e,t){switch(e.statisticType){case`count`:return J(e,t);case`min`:return Y(e,t,Math.min);case`max`:return Y(e,t,Math.max);default:return{available:!1,value:null}}}function J(e,t){if(e.statisticType!==`count`)return{available:!1,value:null};if(e.onStatisticField===`1`)return{available:!0,value:t.reduce((e,t)=>e+t.statistics.rowCount,0)};let n=0;for(let r of t){let t=r.statistics.statistics.get(e.onStatisticField);if(t==null||t.nullCount==null)return{available:!1,value:null};n+=r.statistics.rowCount-t.nullCount}return{available:!0,value:n}}function Y(e,t,n){if(e.statisticType!==`min`&&e.statisticType!==`max`)return{available:!1,value:null};let r=null,i=e.statisticType===`min`?`minValue`:`maxValue`;for(let a of t){let t=a.statistics.statistics.get(e.onStatisticField);if(t==null)return{available:!1,value:null};switch(t.type){case`null-only`:continue;case`unknown`:return{available:!1,value:null};case`bounds`:{let e=Se(t[i]);if(e==null)return{available:!1,value:null};r=r==null?e:n(r,e);break}}}return{available:!0,value:r}}function Se(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function X(e,t){let n=new V;for(let t of e)n.insert(t);return new T({...t,featureStore:n})}function Z(e,t){return e.statistics.statistics.get(t.fieldName)??null}function Ce(e,t){return e.slice().sort((e,n)=>{let r=Q(e,t),i=Q(n,t);return r===i?0:r<i?-1:1})}function Q(e,t){let n=Z(e,t);return n?.type===`bounds`?n.maxValue-n.minValue:1/0}function $(e,t,n){let r=e?.featureCount,i=!1;return r!=null&&r<has(`parquetlayer-full-query-feature-count`)&&(i=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:n,supportsTrueCurve:!1,supportsZ:t},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{...ie,maxRecordCount:K,supportsOrderBy:i,supportsDistinct:!0,supportsStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1}},queryAttributeBins:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}function we(e){return!!e.objectIds?.length||!!e.outStatistics||!!e.orderByFields?.length||!!e.returnDistinctValues}export{fe as default};
|
|
2
|
+
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{toConst as n}from"../../../../core/compilerUtils.js";import r from"../../../../core/Error.js";import i from"../../../../core/Handles.js";import has from"../../../../core/has.js";import a from"../../../../core/Logger.js";import{onAbortOrThrow as o,throwIfAborted as s}from"../../../../core/promiseUtils.js";import{QueueProcessor as c}from"../../../../core/QueueProcessor.js";import{parseWhereClause as l}from"../../../../core/sql.js";import{getMetersPerUnitForSR as u}from"../../../../core/units.js";import d from"../../../../geometry/SpatialReference.js";import{set as f,create as p,expandWithAABB as m,expandWithRect as ee,negativeInfinity as h}from"../../../../geometry/support/aaBoundingBox.js";import{copy as te,create as g,expandWithRect as ne,negativeInfinity as re}from"../../../../geometry/support/aaBoundingRect.js";import{isWebMercator as _,isWGS84 as v}from"../../../../geometry/support/spatialReferenceUtils.js";import{normalizeColumnPath as y,readParquetFileAttribute as b}from"../../../parquet.js";import{convertToGeometry as x}from"../../featureConversionUtils.js";import{getFieldNamesFromStatistics as S}from"../../data/attributeSupport.js";import{getQueryResultExtent as C,getQueryBoundingRects as w,QueryEngine as T}from"../../data/QueryEngine.js";import{queryCapabilities as ie}from"../../data/QueryEngineCapabilities.js";import{QueryEngineResult as E}from"../../data/QueryEngineResult.js";import{normalizeQueryLike as D}from"../../data/queryUtils.js";import{createFileProvider as O}from"../parquet/createFileProvider.js";import{readFieldStatistic as k}from"../parquet/ParquetFileStatistics.js";import{createDrawingInfo as ae}from"./clientSideDefaults.js";import{getParquetFileId as oe,getParquetRowId as se,getParquetObjectId as ce}from"./parquetIdUtils.js";import A from"../../../support/Field.js";import j from"../../../support/FieldsIndex.js";import{isNumericField as M}from"../../../support/fieldUtils.js";import{fromParquetGeometryEncodingJSON as N}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as P,fromParquetJSONGeometryType as F,toParquetJSONGeometryType as I}from"../../../support/parquetUtils.js";import{loadParquetModule as L}from"../../../../libs/librust-parquet/loadParquetModule.js";import{utc as R}from"../../../../time/constants.js";import{FeatureStoreQueryAdapter as z}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as B}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as V}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as H}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as U}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const W=new z,G=`__OBJECTID`,K=8e3;class le{constructor(e,t){this._files=e,this._createFileStream=t,this._fileIndex=0,this._streamIndex=0,this._streams=[],this._pending=new Set,this._resolvedCount=0}async next(e){for(await this._fill(e);this._pending.size>0;){s(e),await this._fill(e);let t=await ue(this._pending);if(this._pending.delete(t.read),this._resolvedCount++,t.chunk!=null)return t.chunk}return null}async _fill(e){for(this._removeDone();this._pending.size<8;){let t=this._getOrCreateNextStream(e);if(t==null)return;this._pending.add(t.read(e))}}_getOrCreateNextStream(e){let t=this._resolvedCount>=8?8:2;if(this._fileIndex<this._files.length&&this._streams.length<t){let t=this._files[this._fileIndex++],n=new de(t.id,this._createFileStream(t,e));return this._streams.push(n),n}return this._getNextStream()}_getNextStream(){let e=this._streams.length;for(let t=0;t<e;t++){let n=(this._streamIndex+t)%e,r=this._streams[n];if(r.canRead)return this._streamIndex=(n+1)%e,r}return null}_removeDone(){let e=this._streamIndex;for(let t=this._streams.length-1;t>=0;t--)this._streams[t].done&&(this._streams.splice(t,1),t<e&&e--);this._streamIndex=this._streams.length>0?e%this._streams.length:0}}function ue(e){return Promise.race(Array.from(e,async e=>({read:e,chunk:await e})))}class de{constructor(e,t){this._fileId=e,this._stream=t,this._readCount=0,this._reachedEnd=!1}get canRead(){return!this._reachedEnd}get done(){return this._reachedEnd&&this._readCount===0}async read(e){this._readCount++;try{let t=await(await this._stream).next(e);return t==null?(this._reachedEnd=!0,null):{fileId:this._fileId,chunk:t}}finally{this._readCount--}}}class fe{constructor(){this._hasZ=!1,this._hasM=!1,this._queue=new c({concurrency:4,process:(e,t)=>this._executeQuery(e,t)}),this._streams=new Map,this._streamIdCounter=0,this._indexMap={},this._handles=new i}async load(e){let t=e.spatialReference?d.fromJSON(e.spatialReference):void 0;if(t&&!t.isWGS84&&!t.isWebMercator)throw new r(`parquet:unsupported-projection`,`Only WGS84 and Web Mercator are supported`);this._customParameters=e.customParameters,this._loadParameters=e,await this._updateProvider(O(e.provider,null,()=>this._customParameters));let n=await this._provider.getMetadata(),i=await P(n,{fields:e.fields?.map(e=>A.fromJSON(e)),geometryEncoding:e.geometryEncoding?N(e.geometryEncoding):null,geometryType:e.geometryType?F(e.geometryType):null,displayOptimization:e.displayOptimization,spatialReference:t});if(this._hasZ=!!n?.hasZ,this._hasM=!!n?.hasM,!i.fields)throw new r(`parquet:unsupported`,`Fields must be defined`);let o;if(i.spatialReference&&i.geometryType){if(!i.spatialReference)throw new r(`parquet:unsupported`,`SpatialReference must be defined`);if(!i.spatialReference.isGeographic&&!i.spatialReference.isWebMercator)throw new r(`parquet:unsupported-projection`,`Only WGS84 and Web Mercator are supported`);i.spatialReference.isGeographic&&!i.spatialReference.isWGS84&&(a.getLogger(`parquet:unsupported-projection`).warn(`Found a geographic projection that is not WGS84. Handling as WGS84.`,{spatialReference:i.spatialReference}),i.spatialReference=d.WGS84),o={geometry:i.geometryEncoding?{geometryType:I(i.geometryType),spatialReference:i.spatialReference.toJSON(),encoding:i.geometryEncoding.toJSON()}:null,displayOptimization:i.displayOptimization}}this.setCustomParameters(e.customParameters),this._displayOptimization=i.displayOptimization,await this._provider.updateGeometryInfo(o),this._capabilities=$(await this._getFileStatistics(),this._hasZ,this._hasM);let s=await this._provider.getFiles();if(!s.length)return{layerDefinition:{},capabilities:$(null,this._hasZ,this._hasM)};let c=await s[0].file;i.file=c;let{fields:l}=i;if(l==null)throw new r(`parquet-layer:missing-metadata`,`Unable to create parquet source: cannot infer fields`,l);l.push(new A({name:G,type:`oid`,alias:G}));for(let e of l){let t=c.getColumnId(e.name);t!=null&&(this._indexMap[e.name]=t)}let u=j.fromLayerJSON({fields:l.map(e=>e.toJSON()),dateFieldsTimeReference:{timeZoneIANA:`UTC`}});this._fieldsIndex=u;let f=I(i.geometryType??`point`);return this._metadata=H.createFeature({fieldsIndex:u.toJSON(),geometryType:f,hasZ:this._hasZ,hasM:this._hasM,featureIdInfo:{type:`object-id`,fieldName:G},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:i.spatialReference,outSpatialReference:null,attributeSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:R}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:f,featureIdInfo:{type:`object-id`,fieldName:G},hasM:this._hasM,hasZ:this._hasZ,spatialReference:i.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},this._fullExtent=n?.extent?n.extent:await this._tryDeriveParquetFullExtent(i),{capabilities:this._capabilities,layerDefinition:{fields:i.fields?.map(e=>e.toJSON()),drawingInfo:ae(f),extent:this._fullExtent??void 0,geometryType:f,hasZ:this._hasZ,hasM:this._hasM,geometryEncoding:i.geometryEncoding?.toJSON(),displayOptimization:i.displayOptimization}}}destroy(){this._provider.destroy(),this._queue.destroy();for(let{handle:e}of this._streams.values())e.remove();this._streams.clear(),this._indexMap={},this._handles.removeAll()}async reload(e){this.destroy(),await this.load(e)}set remoteClient(e){this._source=e.createInvokeProxy(``)}setCustomParameters(e){this._customParameters=e}getIndexMap(){return this._indexMap}async updateFileProvider(e){this._loadParameters={...this._loadParameters,provider:e};let t=O(e,this._provider.getGeometryInfo(),()=>this._customParameters);await this._updateProvider(t)}async getDiagnosticsSnapshot(){let e=await this._provider.getFiles();return{files:await Promise.all(e.map(e=>e.getDiagnosticsSnapshot()))}}async getColumnIndex(e){return(await this._getFileInfoById(e.fileId)).getColumnIndex(e.rowGroupIndex,e.columnIndex)}async getOffsetIndex(e){return(await this._getFileInfoById(e.fileId)).getOffsetIndex(e.rowGroupIndex,e.columnIndex)}async queryFeatures(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),we(n)||(n.resultRecordCount=n.resultRecordCount?Math.min(n.resultRecordCount,K):K,n.resultOffset=n.resultOffset??0),n.outStatistics?this._queryStatistics(n,t):(n.returnDistinctValues&&(n.returnGeometry=void 0),(await this._enqueueQuery(n,t)).createQueryResponse())}async queryFeatureCount(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),!q(n)&&!n.returnDistinctValues&&!n.groupByFieldsForStatistics?.length&&!n.outStatistics?.length?this._getFeatureCount():(n.returnDistinctValues||(n.outFields=void 0),n.returnGeometry=void 0,(await this._enqueueQuery(n,t)).createQueryResponseForCount())}async queryObjectIds(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),q(n)?(n.resultRecordCount=n.resultRecordCount?Math.min(n.resultRecordCount,8e3):8e3,n.resultOffset=n.resultOffset??0,n.returnGeometry=void 0,n.outFields=void 0,n.returnDistinctValues=void 0,(await this._enqueueQuery(n,t)).items.map(e=>e.getObjectId())):Array.from({length:await this._getFeatureCount()},(e,t)=>t)}async queryAttributeBins(e,t={}){throw new r(`parquet:unsupported`,`queryAttributeBins not supported.`)}async queryExtent(e,t){let r=await D(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),this._fullExtent&&!q(r))return{count:await this._getFeatureCount(),extent:this._fullExtent};let i=n(this._metadata.spatialReference);r.returnGeometry=!0,r.outFields=void 0;let a=f(p(),h),o=p(),s=await this._enqueueQuery(r,t),c=0;for(let e of s.items)e.getBounds(o)&&(m(a,o),c+=1);let l=C(a,i,r.outSR?n(r.outSR):i.toJSON(),i,!1);return{count:c,extent:l}}async queryStream(e,t){if(!t.signal)throw Error(`InternalError: AbortSignal must be passed`);let n=await this._getCandidateFiles(e),r=new le(n,async(t,n)=>{let r=await t.file,i=await this._createParquetDisplayQuery(r,t.id,e);return r.executeQuery(i,K,n)}),i=this._streamIdCounter++,a=o(t.signal,e=>{let t=this._streams.get(i);t!=null&&(t.handle.remove(),this._streams.delete(i))});return this._streams.set(i,{stream:r,handle:a}),i}async getStreamNext(e,t){if(!t.signal)throw Error(`InternalError: AbortSignal must be passed`);let n=this._streams.get(e);if(!n)return{result:null};let r=await n.stream.next(t.signal);if(r==null)return n.handle.remove(),this._streams.delete(e),{result:null};let i=r.chunk.serialize().buffer,a={fileId:r.fileId,buffer:i};return i instanceof ArrayBuffer?{result:a,transferList:[i]}:{result:a}}async getStreamNextFeatures(e,t){let{result:n}=await this.getStreamNext(e,t);if(n==null)return null;let r=(await L()).ParquetChunk.deserialize(new Uint8Array(n.buffer)),i=new U(this._metadata,this._indexMap,r,n.fileId),a=[];for(;i.next();){let e=x(i.readGeometryWorldSpace(),i.geometryType,i.hasZ,i.hasM),t=i.readAttributes();a.push({attributes:t,geometry:e})}return{features:a}}async createPatch(e,t,n,r,i){if(!i.signal)throw Error(`InternalError: AbortSignal must be passed`);return(await(await(await this._getFileInfoById(e)).file).createChunkPatch(t,n,r,i.signal)).serialize().buffer}async _updateProvider(e){let t=this._provider;this._handles.removeAll(),this._provider=e,this._handles.add([e.events.on(`rangeRead`,e=>{this._source.onRangeRead(e)}),e.events.on(`sourceChanged`,async()=>{await this.reload(this._loadParameters),await this._source.onSourceChange()})]),await t?.destroy()}async _getCandidateFiles(e){let t=await this._provider.getFiles(),n=await this._getSpatialFilePruning(e);if(n==null)return t;let r=t.filter(e=>this._mayIncludeFileForSpatialPruning(e,n));return n.type===`xz`?Ce(r,n):r}async _queryStatistics(e,t){let n=await D({...e},null,this._queryEngineParams.spatialReference);if(n.returnGeometry=void 0,ve(n,this._fieldsIndex)){let e=await this._getStatisticsFromFiles(n);if(e)return e}return(await this._enqueueQuery(n,t)).createQueryResponse()}async _getStatisticsFromFiles(e){let t=await this._provider.getFiles(),n={},r=[];for(let i of e.outStatistics??[]){let e=xe(i,t);if(!e.available)return null;n[i.outStatisticFieldName]=e.value,r.push(be(i,this._fieldsIndex))}return{fields:r,features:[{attributes:n}]}}async _getSpatialFilePruning(e){if(e.type!==`tile`&&(e.type!==`arcade`||e.extent==null))return null;let t=this._displayOptimization?.index;if(t==null)return null;let n=e.outSpatialReference.wkid;if(t.wkid==null||n==null)return null;let r=t.wkid,i=await L();switch(t.type){case`xz`:return{type:`xz`,fieldName:y(t.code),intersects:(a,o)=>i.queryIntersectsXZStatistics(t.fullExtent,e.extent,n,r,t.maxLevel,a,o)};case`z`:return{type:`xy`,xFieldName:y(t.xColumn),yFieldName:y(t.yColumn),intersects:(t,a,o,s)=>i.queryIntersectsXYStatistics(e.extent,n,r,t,a,o,s)}}}_mayIncludeFileForSpatialPruning(e,t){switch(t.type){case`xz`:{let n=Z(e,t);return n?.type===`null-only`?!1:n?.type!==`bounds`||t.intersects(n.minValue,n.maxValue)}case`xy`:{let n=e.statistics.statistics.get(t.xFieldName),r=e.statistics.statistics.get(t.yFieldName);return n?.type===`null-only`||r?.type===`null-only`?!1:n?.type!==`bounds`||r?.type!==`bounds`||t.intersects(n.minValue,n.maxValue,r.minValue,r.maxValue)}}}async _tryDeriveParquetFullExtent(n){if(!n.spatialReference)return null;if(this._fullExtent==null&&n.geometryEncoding?.type===`location`){let r=await this._provider.getFiles(),{xField:i,yField:a}=n.geometryEncoding,o=f(p(),h),s=!1;for(let n of r){let r=await n.file;for(let n of r.rowGroups()){let r={stack:[],error:void 0,hasError:!1};try{let t=e(r,n.columnDescriptorForAttribute(i),!1),c=e(r,n.columnDescriptorForAttribute(a),!1),l=k(t),u=k(c);if(l?.type===`bounds`&&u?.type===`bounds`){let e=[l.minValue,u.minValue,l.maxValue,u.maxValue];ee(o,e),s=!0}n.free()}catch(e){r.error=e,r.hasError=!0}finally{t(r)}}}return s?{xmin:o[0],ymin:o[1],xmax:o[3],ymax:o[4],spatialReference:n.spatialReference?.toJSON()}:null}return null}async _getFileInfoById(e){let t=await this._provider.getFiles();for(let n of t)if(n.id===e)return n;throw Error(`InternalError: File ${e} does not exist`)}async _getFileStatistics(){return{featureCount:await this._getFeatureCount(),byteLength:await this._getByteLength()}}async _getFile(e){return(await this._getFileInfoById(e)).file}async _createParquetQuery(e,t,n,r,i){let a=(await L()).Query.new();n!=null&&a.setPreFilterStart(n),r!=null&&a.setPreFilterCount(r),i!=null&&a.setPostFilterCount(i);let o=await this._getRequiredFields(e);a.setOutFields(o),(e.geometry||e.returnGeometry)&&a.setReturnGeometry(!0),a.setReturnZ(!!e.returnZ),a.setReturnM(!!e.returnM);let s=this._tryGetGeneralizedGeometryResolution(e);s!=null&&a.setSourceResolution(s);let c=e.geometry?.spatialReference??this._queryEngineParams.spatialReference,l=c.wkid;if(e.geometry&&(_(c)||v(c))){let t=te(g(),re);for(let n of w(e.geometry))ne(t,n);a.setOutSpatialReference(l),a.setExtent({xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3]})}if(e.where){let{id:n,file:r}=t;await this._setWhereClause(a,await r,n,e.where)}return a}async _createParquetDisplayQuery(e,t,n){let r=(await L()).Query.new();if(n.type===`tile`){r.setExtent(n.extent),r.setQuantizationTransform(n.transform);let e=this._sourceResolution(n.resolution,n.outSpatialReference);e!=null&&r.setSourceResolution(e)}else n.type===`arcade`&&n.extent!=null&&r.setExtent(n.extent);return r.setOutFields(n.outFields.filter(e=>this._indexMap[e]!=null)),r.setOutSpatialReference(n.outSpatialReference.wkid),r.setReturnGeometry(n.returnGeometry),r.setReturnZ(n.returnZ),r.setReturnM(n.returnM),n.where&&await this._setWhereClause(r,e,t,n.where),r}async _getFeatureCount(){return(await this._provider.getFiles()).map(e=>e.statistics.rowCount).reduce((e,t)=>e+t,0)}async _getByteLength(){return(await this._provider.getFiles()).map(e=>e.statistics.byteSize).reduce((e,t)=>e+t,0)}_validateQuery(e){if(!this._capabilities.query.supportsStatistics&&e.outStatistics)throw new r(`parquet:unsupported`,`Statistics queries are not supported`,{query:e});if(!this._capabilities.query.supportsOrderBy&&e.orderByFields?.length)throw new r(`parquet:unsupported`,`Queries using orderBy are not supported`,{query:e});if(!this._capabilities.query.supportsDistinct&&e.returnDistinctValues)throw new r(`parquet:unsupported`,`Queries using returnDistinctValues are not supported`,{query:e})}async _setWhereClause(e,t,n,i){let a=this._indexMap,o=this._fieldsIndex,s={getAttribute(e,r){let i=a[r];if(i==null){if(o.get(r)?.name===`__OBJECTID`){let t=e.row+e.rowGroupStart;return ce(n,t)}return null}let s=o.get(r);return b(t,e.rowGroup,e.row,i,s.type)}},c=await l(i,this._fieldsIndex);if(!c.isStandardized)throw new r(`sql-parse-error`,`expression is not standardized`);let u=(e,t,n)=>c.testFeatureCompiled({rowGroup:e,row:t,rowGroupStart:n},s,null),d=c.fieldNames.map(e=>o.get(e)).filter(e=>e&&this._indexMap[e?.name]!=null);e.setWhere(i),e.setWhereEvaluator(u),e.setWhereFields(d.map(e=>e.name))}async*_streamFeatures(e,t,n,r,i){let a=await this._provider.getFiles(),o=0;for(let s of a){let a=o,c=o+s.statistics.rowCount;if(o+=s.statistics.rowCount,t!=null&&t>=c)continue;let l=t==null?null:Math.max(t-a,0),u=n;if(n!=null){let e=t??0,r=e+n;u=Math.max(Math.min(r,c)-Math.max(e,a),0)}if(u===0)continue;let d=await this._createParquetQuery(e,s,l,u,r),f=await(await s.file).executeQuery(d,K),p=async()=>{let e=await f.next(i);if(!e)return null;let t=new U(this._metadata,this._indexMap,e,s.id);return X([new B(t,null,0,!1)],this._queryEngineParams)},m=await p();for(;m!=null;)yield m,m=await p()}}async _queryFeaturesWithQueryEnginePagination(e,t){let n=[],r=this._streamFeatures(e,null,null,null,t),i=await r.next();for(;!i.done;){let a=await i.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(let e of a)n.push(e);i=await r.next()}return n}async _queryFeaturesWithUpfrontPagination(e,t){let n=e.resultOffset??0,r=e.resultRecordCount??K,i,a,o;ge(e)?_e(e)||(o=n+r):(n&&=(i=n,0),a=e.resultRecordCount);let s=[],c=this._streamFeatures(e,i,a,o,t),l=await c.next();for(;!l.done&&r>0;){let i=await l.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(let e of i){if(n>0){n--;continue}if(s.push(e),--r<=0)return s}l=await c.next()}return s}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){if(e.objectIds?.length){let n=new Map;for(let t of e.objectIds){let e=oe(t),r=se(t),i=n.get(e);i||(i=[],n.set(e,i)),i.push(r)}let r=[];for(let[i,a]of n.entries()){let n=await this._executeFileIdQuery(e,i,a,t);for(let e of n)r.push(e)}return new E(r,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:W,featureIdInfo:this._queryEngineParams.featureIdInfo})}if(e.where===`1=1`&&(e.where=null),e.resultOffset??=0,e.resultRecordCount??=await this._getFeatureCount(),e.resultRecordCount>2e7&&!(this._displayOptimization&&e.geometry))throw new r(`parquet:cannot-execute-query`,`Unable to execute query, dataset is too large.`);let n=!!e.orderByFields?.length||!!e.outStatistics?.length||!!e.returnDistinctValues,i=n?await this._queryFeaturesWithQueryEnginePagination(e,t):await this._queryFeaturesWithUpfrontPagination(e,t);return n||(e.resultOffset=0),new E(i,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:W,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(e,t,n,r){let i=await this._getRequiredFields(e),a=(await L()).Query.new();a.setOutFields(i),a.setReturnGeometry(!!e.returnGeometry),a.setReturnZ(!!e.returnZ),a.setReturnM(!!e.returnM),a.setIds(new Uint32Array(n));let o=await(await this._getFile(t)).executeQuery(a,K,r),s=await o.next(r),c=0,l=[];for(;s!=null;){let e=new U(this._metadata,this._indexMap,s,t),n=new B(e,null,c++,!1);l.push(n),s=await o.next(r)}return X(l,this._queryEngineParams).executeQueryForOpaqueFeatures(e,r)}async _getRequiredFields(e){let t=new Set;if(e.outStatistics)for(let n of S(this._fieldsIndex,e.outStatistics,e.groupByFieldsForStatistics))t.add(n);else if(e.outFields)for(let n of e.outFields)t.add(n);return(t.has(`*`)?this._fieldsIndex.fields.map(e=>e.name):Array.from(t)).filter(e=>this._indexMap[e]!=null)}_tryGetGeneralizedGeometryResolution(e){if(!this._displayOptimization)return null;let t=e.outSR??this._queryEngineParams.spatialReference;if(!_(t)&&!v(t))return null;let n=e.quantizationParameters?.tolerance??e.maxAllowableOffset;return n?this._sourceResolution(n,t):null}_sourceResolution(e,t){let n=this._queryEngineParams.spatialReference,r=u(t)/u(n)*e;return!Number.isFinite(r)||r<=0?null:r}}function pe(e){switch(e){case`fullText`:case`having`:case`timeExtent`:case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:case`objectIds`:case`where`:case`geometry`:case`resultOffset`:case`resultRecordCount`:return!0;default:return!1}}function me(e){switch(e){case`fullText`:case`having`:case`timeExtent`:case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:case`objectIds`:case`where`:case`geometry`:return!0;default:return!1}}function he(e){switch(e){case`fullText`:case`having`:case`timeExtent`:return!0;case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:return!1;case`objectIds`:case`where`:case`resultOffset`:case`geometry`:case`resultRecordCount`:return!1}return!1}function q(e){for(let t in e){let n=t;if(pe(n)&&e[n]!==null)return!0}return!1}function ge(e){for(let t in e){let n=t;if(me(n)&&e[n]!==null)return!0}return!1}function _e(e){for(let t in e){let n=t;if(he(n)&&e[n]!==null)return!0}return!1}function ve(e,t){return!!e.outStatistics?.length&&!q(e)&&!e.groupByFieldsForStatistics?.length&&!e.orderByFields?.length&&!e.returnDistinctValues&&!e.returnAggIds&&e.outStatistics.every(e=>ye(e,t))}function ye(e,t){switch(e.statisticType){case`count`:return e.onStatisticField===`1`||t.get(e.onStatisticField)!=null;case`min`:case`max`:{let n=t.get(e.onStatisticField);return n!=null&&M(n)}default:return!1}}function be(e,t){let n=e.statisticType===`exceedslimit`?null:t.get(e.onStatisticField),r=(e.statisticType===`min`||e.statisticType===`max`)&&n?.type===`esriFieldTypeDate`?n.type:`esriFieldTypeDouble`;return{name:e.outStatisticFieldName,alias:e.outStatisticFieldName,type:r}}function xe(e,t){switch(e.statisticType){case`count`:return J(e,t);case`min`:return Y(e,t,Math.min);case`max`:return Y(e,t,Math.max);default:return{available:!1,value:null}}}function J(e,t){if(e.statisticType!==`count`)return{available:!1,value:null};if(e.onStatisticField===`1`)return{available:!0,value:t.reduce((e,t)=>e+t.statistics.rowCount,0)};let n=0;for(let r of t){let t=r.statistics.statistics.get(e.onStatisticField);if(t==null||t.nullCount==null)return{available:!1,value:null};n+=r.statistics.rowCount-t.nullCount}return{available:!0,value:n}}function Y(e,t,n){if(e.statisticType!==`min`&&e.statisticType!==`max`)return{available:!1,value:null};let r=null,i=e.statisticType===`min`?`minValue`:`maxValue`;for(let a of t){let t=a.statistics.statistics.get(e.onStatisticField);if(t==null)return{available:!1,value:null};switch(t.type){case`null-only`:continue;case`unknown`:return{available:!1,value:null};case`bounds`:{let e=Se(t[i]);if(e==null)return{available:!1,value:null};r=r==null?e:n(r,e);break}}}return{available:!0,value:r}}function Se(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function X(e,t){let n=new V;for(let t of e)n.insert(t);return new T({...t,featureStore:n})}function Z(e,t){return e.statistics.statistics.get(t.fieldName)??null}function Ce(e,t){return e.slice().sort((e,n)=>{let r=Q(e,t),i=Q(n,t);return r===i?0:r<i?-1:1})}function Q(e,t){let n=Z(e,t);return n?.type===`bounds`?n.maxValue-n.minValue:1/0}function $(e,t,n){let r=e?.featureCount,i=!1;return r!=null&&r<has(`parquetlayer-full-query-feature-count`)&&(i=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:n,supportsTrueCurve:!1,supportsZ:t},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{...ie,maxRecordCount:K,supportsOrderBy:i,supportsDistinct:!0,supportsStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1}},queryAttributeBins:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}function we(e){return!!e.objectIds?.length||!!e.outStatistics||!!e.orderByFields?.length||!!e.returnDistinctValues}export{fe as default};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* ReloadableLayer is a mixin that adds support for reloading layer's schema and properties.
|
|
3
3
|
*
|
|
4
4
|
* @since 5.2
|
|
5
5
|
*/
|
|
6
|
-
export abstract class
|
|
6
|
+
export abstract class ReloadableLayer {
|
|
7
7
|
constructor(...args: any[]);
|
|
8
8
|
/**
|
|
9
|
-
* Indicates if the layer is in the process of reloading its properties and schema after a call to
|
|
9
|
+
* Indicates if the layer is in the process of reloading its properties and schema after a call to [reload()](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/ReloadableLayer/#reload).
|
|
10
10
|
*
|
|
11
11
|
* @since 5.2
|
|
12
|
+
* @see [reload()](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/ReloadableLayer/#reload)
|
|
12
13
|
*/
|
|
13
14
|
get reloading(): boolean;
|
|
14
15
|
/**
|
|
@@ -21,6 +22,7 @@ export abstract class FeatureLayerReload {
|
|
|
21
22
|
* @returns `true` when the layer is successfully updated with data from the portal item or service;
|
|
22
23
|
* `false` when the layer is not updated, not loaded, or does not reference a service.
|
|
23
24
|
* @since 5.2
|
|
25
|
+
* @see [reloading](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/ReloadableLayer/#reloading)
|
|
24
26
|
*/
|
|
25
27
|
reload(): Promise<boolean>;
|
|
26
28
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{__decorate as e}from"tslib";import{abortHandle as t}from"../../core/handleUtils.js";import{debounce as n,throwIfAbortError as r}from"../../core/promiseUtils.js";import{property as i,subclass as a}from"../../core/accessorSupport/decorators.js";import{getOwningPortalUrl as o}from"../support/layerUtils.js";import s from"../../portal/Portal.js";import c from"../../portal/PortalItem.js";const l=`reload`,u=u=>{let d=u,f=class extends d{constructor(...e){super(...e),this._loadTimestamp=0,this._pendingReloadCount=0,this._serviceItemModified=null,this._debounceReload=n(async()=>{if(this.destroyed||!this.loaded||!this.canReload())return!1;let e=new AbortController;this.addHandles(t(e),l);try{let t=null,n;if(this.portalItem?.id&&this.portalItem.id===this.serviceItemId)n=await this.reloadFromPortal({supportedTypes:this.supportedPortalItemTypes},{signal:e.signal});else{let r=await this._shouldReloadFromServiceItem(e.signal);n=r.updated,t=r.modified}return n&&await this.reloadFromService(e.signal),e.signal.throwIfAborted(),t!=null&&(this._serviceItemModified=t),n}finally{this.removeHandles(l)}}),this.when().then(()=>{this._loadTimestamp=Date.now()},()=>{})}get reloading(){return this._pendingReloadCount>0}reload(){return this.destroyed||!this.loaded||!this.canReload()?Promise.resolve(!1):(this._pendingReloadCount++,this._debounceReload().finally(()=>{this._pendingReloadCount--}))}canReload(){return this.url!=null}async _shouldReloadFromServiceItem(e){let{serviceItemId:t,url:n}=this;if(!t||!n)return{modified:null,updated:!0};try{let r=await o(n,{signal:e});if(!r)return{modified:null,updated:!0};let i=new s({url:r}),a=new c({apiKey:this.apiKey,id:t,portal:i});await a.load({signal:e});let l=a.modified?.getTime();if(l==null)return{modified:null,updated:!0};let u=this._serviceItemModified;return{modified:l,updated:u==null?l>this._loadTimestamp:u<l}}catch(e){return r(e),{modified:null,updated:!0}}}};return e([i({clonable:!1})],f.prototype,`_pendingReloadCount`,void 0),e([i({readOnly:!0})],f.prototype,`reloading`,null),f=e([a(`esri.layers.mixins.ReloadableLayer`)],f),f};export{u as ReloadableLayer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{deg2rad as e}from"../../../core/mathUtils.js";import{throwIfAborted as t}from"../../../core/promiseUtils.js";import{create as n}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{zeros as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transpose as i}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{sub as a,add as o,length as s,dot as c}from"../../../core/libs/gl-matrix-2/math/vec3.js";import l from"../../../geometry/Circle.js";import u from"../../../geometry/Mesh.js";import d from"../../../geometry/Multipoint.js";import f from"../../../geometry/Polygon.js";import{projectAsync as p}from"../../../geometry/projectionUtils.js";import m from"../../../geometry/SpatialReference.js";import{polygonCentroidPoint as h}from"../../../geometry/support/centroid.js";import{earth as g}from"../../../geometry/support/Ellipsoid.js";import _ from"../../../geometry/support/MeshComponent.js";import{createSphere as v}from"../../../geometry/support/meshUtils.js";import y from"../../../geometry/support/MeshVertexAttributes.js";import{create as b,fromArray as x,intersectRay as S}from"../../../geometry/support/plane.js";import{isWebMercator as C}from"../../../geometry/support/spatialReferenceUtils.js";import{getMetersPerUnitOfSR as w}from"./utils.js";import{convertToSRUnits as T,getWebMercatorScalingFactor as E,createRotationMatrixFromHPR as D,transformMat3 as O,scaleAndAddWithFactor as k,scaleWithFactor as A,computeHFOVAndVFOV as j,projectiveTransform as M}from"../transformations/utils.js";const N=Math.PI/180;function P(e,t,n){let r=T(e,t.spatialReference);return r.cameraHeight=(t.z??r.cameraHeight)-n,e.isSpherical?z(r,t):F(r,t)}function F(e,t){let{horizontalFieldOfView:n,verticalFieldOfView:r,cameraHeading:i}=e,a=E(t.y,t.spatialReference),o=e.cameraPitch,s=e.cameraRoll??0,c=150;n>150&&(o=90,s=0,c=5);let l=Math.ceil(n/c),u=I(l,i,n),d=K(e)*a,p=new f({spatialReference:t?.spatialReference});p.imageID=e.objectId;let m=null;for(let i of u)m=L(i,o,e.cameraHeight,t,d,a,r,n,l,p,s,e.nearDistance);return m.imageID=e.objectId,{polygon:p,frustum:m}}function I(e,t,n){let r=[];if(e%2==0)for(let i=0;i<e/2;i++)r.push(t-n/e*(i+.5),t+n/e*(i+.5));else{r.push(t);for(let i=1;i<e/2;i++)r.push(t-n/e*i,t+n/e*i)}return r.sort(),r}function L(e,t,s,c,l,u,d,f,p,m,h=0,g=0){let _=i(n(),D([e,t,h??0])),v=U({cameraHeight:s,cameraPitch:t,farDistance:l,location:c,horizontalFieldOfView:f,nearDistance:g,verticalFieldOfView:d},_),y=O([0,0,-1],_),{x:b,y:x}=c,S=k([b,x,c.z??s],y,l,u),C=2*Math.tan(d*N/2)*l,w=2*Math.tan(f/p*N/2)*l,T=O([0,1,0],_),E=O([1,0,0],_),j=A(T,C/2,u),M=A(E,w/2,u),P=a(r(),j,M),F=o(r(),j,M),I=R([o(r(),S,P),o(r(),S,F),a(r(),S,P),a(r(),S,F)],s,c,u);return I.push(I[0]),m.addRing(I),v}function R(e,t,n,r){return e.map(e=>W(e,t,n,r))}function z(e,t){let{farDistance:n,objectId:r,nearDistance:i,cameraHeight:a}=e,o=E(t.y,t.spatialReference),s=new l({center:t.clone(),radius:n*o});if(s.imageID=r,i){let e=new l({center:t.clone(),radius:i*o});s.addRing(e.rings[0])}let c=t.clone();c.z=(t.z??a)-n*o;let u=v(c,{size:2*n*o});return u.imageID=r,{polygon:s,frustum:u}}function B(e,t){return e.contains(t)}function V(e,t){let r=T(e,e.location.spatialReference);if(t.z==null)return!1;let{horizontalFieldOfView:a,location:o,nearDistance:l=0,verticalFieldOfView:u}=r,d=K(r);if(a==null||u==null||d<=0)return!1;let f=E(o.y,o.spatialReference),p=o.z??0,m=[(t.x-o.x)/f,(t.y-o.y)/f,t.z-p];if(r.isSpherical){let e=s(m);return l<=e&&e<=d}let h=i(n(),D([r.cameraHeading,r.cameraPitch,r.cameraRoll??0])),g=O([0,0,-1],h),_=c(m,g);return _>0&&_>=l&&_<=d}function H(e,t){return Math.sign(e)!==Math.sign(t)}function U(e,t,n){let{cameraHeight:i,cameraPitch:s,farDistance:c,location:l,horizontalFieldOfView:d,nearDistance:f,verticalFieldOfView:p}=e,m=l.z??i,h=m-i,g=q(l),_=!(s+p/2>=90),v=2*Math.tan(p*N/2)*f,b=2*Math.tan(d*N/2)*f,x=2*Math.tan(p*N/2)*c,S=2*Math.tan(d*N/2)*c,C,w=[0,0,-1];w=O(w,t),C=k([l.x,l.y,m],w,c,g),_&&(C[2]=h);let T=k([l.x,l.y,m],w,f,g),E=[0,1,0];E=O(E,t);let D=[1,0,0];D=O(D,t);let j=[],M=[];f?(M=[{faces:[4,0,3,4,7,3]},{faces:[5,1,2,5,6,2]},{faces:[4,0,1,4,5,1]},{faces:[6,2,3,6,7,3]}],j=j.concat(o(r(),T,a(r(),A(E,v/2,g),A(D,b/2,g)))),j=j.concat(o(r(),T,o(r(),A(E,v/2,g),A(D,b/2,g)))),j=j.concat(a(r(),T,a(r(),A(E,v/2,g),A(D,b/2,g)))),j=j.concat(a(r(),T,o(r(),A(E,v/2,g),A(D,b/2,g))))):(j=[l.x,l.y,m],M=[{faces:[0,1,2,0,2,3,0,3,4,0,4,1]}]),j=j.concat(o(r(),C,a(r(),A(E,x/2,g),A(D,S/2,g)))),j=j.concat(o(r(),C,o(r(),A(E,x/2,g),A(D,S/2,g)))),j=j.concat(a(r(),C,a(r(),A(E,x/2,g),A(D,S/2,g)))),j=j.concat(a(r(),C,o(r(),A(E,x/2,g),A(D,S/2,g))));let P=new y({position:Float64Array.from(j)});return new u({vertexAttributes:P,components:M,spatialReference:l.spatialReference})}function W(e,t,n,i){{let o=n.z??t,s=o-t,c=Math.sqrt((e[2]-o)**2+(Math.sqrt((e[0]-n.x)**2+(e[1]-n.y)**2)/i)**2)*i,l=A(a(r(),[e[0],e[1],e[2]],[n.x,n.y,o]),1/c,1/i),u=t/(o-e[2]),d={x:(1-u)*n.x+u*e[0],y:(1-u)*n.y+u*e[1],z:(1-u)*o+u*e[2]},f=Math.sqrt((d.z-o)**2+(Math.sqrt((d.x-n.x)**2+(d.y-n.y)**2)/i)**2)*i,p=A(a(r(),[d.x,d.y,d.z],[n.x,n.y,o]),1/f,1/i);return H(l[0],p[0])&&H(l[1],p[1])&&H(l[2],p[2])||e[2]>=s?[e[0],e[1],s]:[d.x,d.y,d.z]}}function G(e){let{spatialReference:t,x:n,y:r}=e.geometry,{cameraHeading:i,cameraPitch:a,farDistance:o,nearDistance:s}=e,c=q(e.geometry),l=new f({spatialReference:t}),u=Math.abs(1.44*o*c),d=Math.abs(1.44*s*c);(a<20||i==null)&&(d=u);let p=[];return p[0]={x:n+u*Math.sin((i-45)*N),y:r+u*Math.cos((i-45)*N)},p[1]={x:n+u*Math.sin((i+45)*N),y:r+u*Math.cos((i+45)*N)},p[2]={x:n+d*Math.sin((i+135)*N),y:r+d*Math.cos((i+135)*N)},p[3]={x:n+d*Math.sin((i+225)*N),y:r+d*Math.cos((i+225)*N)},l.addRing([[p[0].x,p[0].y,0],[p[1].x,p[1].y,0],[p[2].x,p[2].y,0],[p[3].x,p[3].y,0],[p[0].x,p[0].y,0]]),l}function K(t){let{cameraHeight:n,cameraPitch:r,farDistance:i,location:a,verticalFieldOfView:o}=t;return i??(r+o/2>=90?20/w(a.spatialReference):n/Math.cos(e(r)))}function q(e){return e&&C(e?.spatialReference)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*e.y/g.radius))):1}function ee(e,t){let n=1+t/100;if(e.declaredClass===`esri.geometry.Circle`){let{radius:t,center:r}=e,i=t*n,a=new l({radius:i,center:r});return e.rings.length>1&&a.addRing(e.rings[1]),a}if(e.declaredClass===`esri.geometry.Polygon`){let t=new f({spatialReference:e.spatialReference}),i=h(e);if(i){let o=[];for(let t=0;t<e.rings[0].length;t++){let s=Math.sqrt((i.x-e.rings[0][t][0])**2+(i.y-e.rings[0][t][1])**2),c=A(a(r(),[e.rings[0][t][0],e.rings[0][t][1],0],[i.x,i.y,0]),1/s,1),l=k([i.x,i.y,0],c,s*n,1);o.push({x:l[0],y:l[1]})}t.addRing([[o[0].x,o[0].y,0],[o[1].x,o[1].y,0],[o[2].x,o[2].y,0],[o[3].x,o[3].y,0],[o[0].x,o[0].y,0]])}return t}return e}async function te(e,t,n){let{cameraHeight:r,cameraLocation:i,cameraPitch:a,frustumVertices:o,horizontalFieldOfView:s,imageHeight:c,imageWidth:l,inSRS:u,outSRS:d,verticalFieldOfView:f,cameraRoll:p,options:h}=n,g=new m(u),_=new m(d),v=j(s,f,p??0),y=o.length>15;return a+v.vfov/2>=90?await oe(o,e,l,c,g,_,y,h):await ne(o,e,t,i,r,y,g,_,h)}async function ne(e,t,n,r,i,a,o,s,c){let l=re(e,t,n,r,i);if(!l)return;let{farPlane:d,nearPlane:f}=l,p=await J([...f?.vertexPositions??e.slice(0,3),...d.vertexPositions],o,s,c),m=$(p);return new u({vertexAttributes:new y({position:p}),components:Q(a?X(m,!0):Z(m,!0)),spatialReference:s})}function re(e,t,n,r,i){let a=Y(e),o=Y(e,`near`);if(!a)return;let s=t.length;for(let e=0;e<s;e++){let t=Array.from(n[e]),s=[t[0]-r[0],t[1]-r[1],t[2]-(r[2]??i)];ae(r,s,e,o),ie(r,s,e,a)}return{farPlane:a,nearPlane:o}}function ie(e,t,n,i){let{coefficients:a,vertexPositions:o}=i,s=r();S(a,{origin:e,direction:t},s)&&o.splice(n*3,3,...s)}function ae(e,t,n,i){if(!i)return;let a=r();S(i.coefficients,{origin:e,direction:t},a)&&i.vertexPositions.splice(n*3,3,...a)}async function oe(e,t,n,r,i,a,o,s){let c=o?[]:[e[0],e[1],e[2]],l,d=[];for(let i of t)o?(l=M([i[0],i[1],1],[[0,0,1],[n,0,1],[n,r,1],[0,r,1]],[[e[0],e[1],e[2]],[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]]]),c=c.concat(...l),l=M([i[0],i[1],1],[[0,0,1],[n,0,1],[n,r,1],[0,r,1]],[[e[12],e[13],e[14]],[e[15],e[16],e[17]],[e[18],e[19],e[20]],[e[21],e[22],e[23]]]),d=d.concat(...l)):(l=M([i[0],i[1],1],[[0,0,1],[n,0,1],[n,r,1],[0,r,1]],[[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]],[e[12],e[13],e[14]]]),c=c.concat(...l));c=c.concat(d);let f=await J(c,i,a,s),p=$(f);return new u({vertexAttributes:new y({position:f}),components:Q(o?X(p,!0):Z(p,!0)),spatialReference:a})}async function J(e,n,r,i){if(n.equals(r))return e;let a=e.reduce((e,t,n)=>{let r=Math.floor(n/3);return e[r]||(e[r]=[]),e[r].push(t),e},[]),{points:o}=await p(new d({points:a,spatialReference:n}),r,i);return t(i),o.flat()}function Y(e,t=`far`){let n=b(),r;switch(t){case`far`:if(r=Array.from(e.length===15?e.slice(3):e.slice(12)),x(n,r,!1))return{coefficients:n,vertexPositions:r};break;case`near`:return r=Array.from(e.slice(0,12)),e.length===15||!x(n,r,!1)?void 0:{coefficients:n,vertexPositions:r}}}const X=(e,t=!1)=>{if(t&&e-2<=4||e<=4||e%2!=0)throw Error(`Invalid number of vertices`);let n=[],r=e/2,i=Math.round((t?e-2:e)/2);for(let a=0;a<i;a++){let i=a+r,o=t?i+1:i,s=o%e,c=(t?i:o+1)%e;n.push({faces:new Uint32Array([a,c,s,a,a+1,s])})}return n};function Z(e,t=!1){if(e<3||t&&e-1<3)throw Error(`Invalid number of vertices`);let n=[],r=t?e-2:e-1;for(let e=0;e<r;e++)n.push({faces:new Uint32Array([0,e+1,e+2])});return n}const Q=e=>e.map(e=>new _(e)),$=e=>e.length/3;export{V as checkIfFrustumContainsSelectedPoint,B as checkIfPolygonContainsSelectedPoint,G as computePolygonForInspection,P as createCoveragePolygon,R as limitZToGround,J as projectVertices,ee as resizePolygon,te as updateFrustum};
|
|
2
|
+
import{deg2rad as e}from"../../../core/mathUtils.js";import{throwIfAborted as t}from"../../../core/promiseUtils.js";import{create as n}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{zeros as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transpose as i}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{sub as a,add as o,length as s,dot as c}from"../../../core/libs/gl-matrix-2/math/vec3.js";import l from"../../../geometry/Circle.js";import u from"../../../geometry/Mesh.js";import d from"../../../geometry/Multipoint.js";import f from"../../../geometry/Polygon.js";import{projectAsync as p}from"../../../geometry/projectionUtils.js";import m from"../../../geometry/SpatialReference.js";import{polygonCentroidPoint as h}from"../../../geometry/support/centroid.js";import{earth as g}from"../../../geometry/support/Ellipsoid.js";import _ from"../../../geometry/support/MeshComponent.js";import{createSphere as v}from"../../../geometry/support/meshUtils.js";import y from"../../../geometry/support/MeshVertexAttributes.js";import{create as b,fromArray as x,intersectRay as S}from"../../../geometry/support/plane.js";import{isWebMercator as C}from"../../../geometry/support/spatialReferenceUtils.js";import{getMetersPerUnitOfSR as w}from"./utils.js";import{convertToSRUnits as T,getWebMercatorScalingFactor as E,createRotationMatrixFromHPR as D,transformMat3 as O,scaleAndAddWithFactor as k,scaleWithFactor as A,computeHFOVAndVFOV as j,projectiveTransform as M}from"../transformations/utils.js";const N=Math.PI/180;function P(e,t,n){let r=T(e,t.spatialReference);return r.cameraHeight=(t.z??r.cameraHeight)-n,e.isSpherical?te(r,t):F(r,t)}function F(e,t){let{horizontalFieldOfView:n,verticalFieldOfView:r,cameraHeading:i}=e,a=E(t.y,t.spatialReference),o=e.cameraPitch,s=e.cameraRoll??0,c=150;n>150&&(o=90,s=0,c=5);let l=Math.ceil(n/c),u=I(l,i,n),d=V(e)*a,p=new f({spatialReference:t?.spatialReference});p.imageID=e.objectId;let m=null;for(let i of u)m=ee(i,o,e.cameraHeight,t,d,a,r,n,l,p,s,e.nearDistance);return m.imageID=e.objectId,{polygon:p,frustum:m}}function I(e,t,n){let r=[];if(e%2==0)for(let i=0;i<e/2;i++)r.push(t-n/e*(i+.5),t+n/e*(i+.5));else{r.push(t);for(let i=1;i<e/2;i++)r.push(t-n/e*i,t+n/e*i)}return r.sort(),r}function ee(e,t,s,c,l,u,d,f,p,m,h=0,g=0){let _=i(n(),D([e,t,h??0])),v=re({cameraHeight:s,cameraPitch:t,farDistance:l,location:c,horizontalFieldOfView:f,nearDistance:g,verticalFieldOfView:d},_),y=O([0,0,-1],_),{x:b,y:x}=c,S=k([b,x,c.z??s],y,l,u),C=2*Math.tan(d*N/2)*l,w=2*Math.tan(f/p*N/2)*l,T=O([0,1,0],_),E=O([1,0,0],_),j=A(T,C/2,u),M=A(E,w/2,u),P=a(r(),j,M),F=o(r(),j,M),I=L([o(r(),S,P),o(r(),S,F),a(r(),S,P),a(r(),S,F)],s,c,u);return I.push(I[0]),m.addRing(I),v}function L(e,t,n,r){return e.map(e=>ie(e,t,n,r))}function te(e,t){let{farDistance:n,objectId:r,nearDistance:i,cameraHeight:a}=e,o=E(t.y,t.spatialReference),s=new l({center:t.clone(),radius:n*o});if(s.imageID=r,i){let e=new l({center:t.clone(),radius:i*o});s.addRing(e.rings[0])}let c=t.clone();c.z=(t.z??a)-n*o;let u=v(c,{size:2*n*o});return u.imageID=r,{polygon:s,frustum:u}}function ne(e,t){return e.contains(t)}function R({cameraHeading:e,cameraPitch:t,cameraRoll:r,farDistance:a,horizontalFieldOfView:o,nearDistance:s,vectorToPoint:l,verticalFieldOfView:u}){let d=i(n(),D([e,t,r])),f=O([1,0,0],d),p=O([0,1,0],d),m=O([0,0,-1],d),h=c(l,f),g=c(l,p),_=c(l,m);if(_<=0||_<s||_>a)return!1;let v=_*Math.tan(o*N/2),y=_*Math.tan(u*N/2);return Math.abs(h)<=v&&Math.abs(g)<=y}function z(e,t){let n=T(e,e.location.spatialReference);if(t.z==null)return!1;let{horizontalFieldOfView:r,location:i,nearDistance:a,verticalFieldOfView:o}=n,c=V(n);if(r==null||o==null||!Number.isFinite(a)||a<0||!Number.isFinite(c)||c<=0)return!1;let l=E(i.y,i.spatialReference),u=i.z??0,d=[(t.x-i.x)/l,(t.y-i.y)/l,t.z-u];if(n.isSpherical){let e=s(d);return a<=e&&e<=c}let f={vectorToPoint:d,verticalFieldOfView:o,nearDistance:a,farDistance:c};if(r>150){let e=Math.ceil(r/5),t=r/e;return I(e,n.cameraHeading,r).some(e=>R({...f,cameraHeading:e,cameraPitch:90,cameraRoll:0,horizontalFieldOfView:t}))}return R({...f,cameraHeading:n.cameraHeading,cameraPitch:n.cameraPitch,cameraRoll:n.cameraRoll??0,horizontalFieldOfView:r})}function B(e,t){return Math.sign(e)!==Math.sign(t)}function re(e,t,n){let{cameraHeight:i,cameraPitch:s,farDistance:c,location:l,horizontalFieldOfView:d,nearDistance:f,verticalFieldOfView:p}=e,m=l.z??i,h=m-i,g=H(l),_=!(s+p/2>=90),v=2*Math.tan(p*N/2)*f,b=2*Math.tan(d*N/2)*f,x=2*Math.tan(p*N/2)*c,S=2*Math.tan(d*N/2)*c,C,w=[0,0,-1];w=O(w,t),C=k([l.x,l.y,m],w,c,g),_&&(C[2]=h);let T=k([l.x,l.y,m],w,f,g),E=[0,1,0];E=O(E,t);let D=[1,0,0];D=O(D,t);let j=[],M=[];f?(M=[{faces:[4,0,3,4,7,3]},{faces:[5,1,2,5,6,2]},{faces:[4,0,1,4,5,1]},{faces:[6,2,3,6,7,3]}],j=j.concat(o(r(),T,a(r(),A(E,v/2,g),A(D,b/2,g)))),j=j.concat(o(r(),T,o(r(),A(E,v/2,g),A(D,b/2,g)))),j=j.concat(a(r(),T,a(r(),A(E,v/2,g),A(D,b/2,g)))),j=j.concat(a(r(),T,o(r(),A(E,v/2,g),A(D,b/2,g))))):(j=[l.x,l.y,m],M=[{faces:[0,1,2,0,2,3,0,3,4,0,4,1]}]),j=j.concat(o(r(),C,a(r(),A(E,x/2,g),A(D,S/2,g)))),j=j.concat(o(r(),C,o(r(),A(E,x/2,g),A(D,S/2,g)))),j=j.concat(a(r(),C,a(r(),A(E,x/2,g),A(D,S/2,g)))),j=j.concat(a(r(),C,o(r(),A(E,x/2,g),A(D,S/2,g))));let P=new y({position:Float64Array.from(j)});return new u({vertexAttributes:P,components:M,spatialReference:l.spatialReference})}function ie(e,t,n,i){{let o=n.z??t,s=o-t,c=Math.sqrt((e[2]-o)**2+(Math.sqrt((e[0]-n.x)**2+(e[1]-n.y)**2)/i)**2)*i,l=A(a(r(),[e[0],e[1],e[2]],[n.x,n.y,o]),1/c,1/i),u=t/(o-e[2]),d={x:(1-u)*n.x+u*e[0],y:(1-u)*n.y+u*e[1],z:(1-u)*o+u*e[2]},f=Math.sqrt((d.z-o)**2+(Math.sqrt((d.x-n.x)**2+(d.y-n.y)**2)/i)**2)*i,p=A(a(r(),[d.x,d.y,d.z],[n.x,n.y,o]),1/f,1/i);return B(l[0],p[0])&&B(l[1],p[1])&&B(l[2],p[2])||e[2]>=s?[e[0],e[1],s]:[d.x,d.y,d.z]}}function ae(e){let{spatialReference:t,x:n,y:r}=e.geometry,{cameraHeading:i,cameraPitch:a,farDistance:o,nearDistance:s}=e,c=H(e.geometry),l=new f({spatialReference:t}),u=Math.abs(1.44*o*c),d=Math.abs(1.44*s*c);(a<20||i==null)&&(d=u);let p=[];return p[0]={x:n+u*Math.sin((i-45)*N),y:r+u*Math.cos((i-45)*N)},p[1]={x:n+u*Math.sin((i+45)*N),y:r+u*Math.cos((i+45)*N)},p[2]={x:n+d*Math.sin((i+135)*N),y:r+d*Math.cos((i+135)*N)},p[3]={x:n+d*Math.sin((i+225)*N),y:r+d*Math.cos((i+225)*N)},l.addRing([[p[0].x,p[0].y,0],[p[1].x,p[1].y,0],[p[2].x,p[2].y,0],[p[3].x,p[3].y,0],[p[0].x,p[0].y,0]]),l}function V(t){let{cameraHeight:n,cameraPitch:r,farDistance:i,location:a,verticalFieldOfView:o}=t;return i??(r+o/2>=90?20/w(a.spatialReference):n/Math.cos(e(r)))}function H(e){return e&&C(e?.spatialReference)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*e.y/g.radius))):1}function U(e,t){let n=1+t/100;if(e.declaredClass===`esri.geometry.Circle`){let{radius:t,center:r}=e,i=t*n,a=new l({radius:i,center:r});return e.rings.length>1&&a.addRing(e.rings[1]),a}if(e.declaredClass===`esri.geometry.Polygon`){let t=new f({spatialReference:e.spatialReference}),i=h(e);if(i){let o=[];for(let t=0;t<e.rings[0].length;t++){let s=Math.sqrt((i.x-e.rings[0][t][0])**2+(i.y-e.rings[0][t][1])**2),c=A(a(r(),[e.rings[0][t][0],e.rings[0][t][1],0],[i.x,i.y,0]),1/s,1),l=k([i.x,i.y,0],c,s*n,1);o.push({x:l[0],y:l[1]})}t.addRing([[o[0].x,o[0].y,0],[o[1].x,o[1].y,0],[o[2].x,o[2].y,0],[o[3].x,o[3].y,0],[o[0].x,o[0].y,0]])}return t}return e}async function W(e,t,n){let{cameraHeight:r,cameraLocation:i,cameraPitch:a,frustumVertices:o,horizontalFieldOfView:s,imageHeight:c,imageWidth:l,inSRS:u,outSRS:d,verticalFieldOfView:f,cameraRoll:p,options:h}=n,g=new m(u),_=new m(d),v=j(s,f,p??0),y=o.length>15;return a+v.vfov/2>=90?await se(o,e,l,c,g,_,y,h):await G(o,e,t,i,r,y,g,_,h)}async function G(e,t,n,r,i,a,o,s,c){let l=K(e,t,n,r,i);if(!l)return;let{farPlane:d,nearPlane:f}=l,p=await J([...f?.vertexPositions??e.slice(0,3),...d.vertexPositions],o,s,c),m=$(p);return new u({vertexAttributes:new y({position:p}),components:Q(a?X(m,!0):Z(m,!0)),spatialReference:s})}function K(e,t,n,r,i){let a=Y(e),o=Y(e,`near`);if(!a)return;let s=t.length;for(let e=0;e<s;e++){let t=Array.from(n[e]),s=[t[0]-r[0],t[1]-r[1],t[2]-(r[2]??i)];oe(r,s,e,o),q(r,s,e,a)}return{farPlane:a,nearPlane:o}}function q(e,t,n,i){let{coefficients:a,vertexPositions:o}=i,s=r();S(a,{origin:e,direction:t},s)&&o.splice(n*3,3,...s)}function oe(e,t,n,i){if(!i)return;let a=r();S(i.coefficients,{origin:e,direction:t},a)&&i.vertexPositions.splice(n*3,3,...a)}async function se(e,t,n,r,i,a,o,s){let c=o?[]:[e[0],e[1],e[2]],l,d=[];for(let i of t)o?(l=M([i[0],i[1],1],[[0,0,1],[n,0,1],[n,r,1],[0,r,1]],[[e[0],e[1],e[2]],[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]]]),c=c.concat(...l),l=M([i[0],i[1],1],[[0,0,1],[n,0,1],[n,r,1],[0,r,1]],[[e[12],e[13],e[14]],[e[15],e[16],e[17]],[e[18],e[19],e[20]],[e[21],e[22],e[23]]]),d=d.concat(...l)):(l=M([i[0],i[1],1],[[0,0,1],[n,0,1],[n,r,1],[0,r,1]],[[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]],[e[12],e[13],e[14]]]),c=c.concat(...l));c=c.concat(d);let f=await J(c,i,a,s),p=$(f);return new u({vertexAttributes:new y({position:f}),components:Q(o?X(p,!0):Z(p,!0)),spatialReference:a})}async function J(e,n,r,i){if(n.equals(r))return e;let a=e.reduce((e,t,n)=>{let r=Math.floor(n/3);return e[r]||(e[r]=[]),e[r].push(t),e},[]),{points:o}=await p(new d({points:a,spatialReference:n}),r,i);return t(i),o.flat()}function Y(e,t=`far`){let n=b(),r;switch(t){case`far`:if(r=Array.from(e.length===15?e.slice(3):e.slice(12)),x(n,r,!1))return{coefficients:n,vertexPositions:r};break;case`near`:return r=Array.from(e.slice(0,12)),e.length===15||!x(n,r,!1)?void 0:{coefficients:n,vertexPositions:r}}}const X=(e,t=!1)=>{if(t&&e-2<=4||e<=4||e%2!=0)throw Error(`Invalid number of vertices`);let n=[],r=e/2,i=Math.round((t?e-2:e)/2);for(let a=0;a<i;a++){let i=a+r,o=t?i+1:i,s=o%e,c=(t?i:o+1)%e;n.push({faces:new Uint32Array([a,c,s,a,a+1,s])})}return n};function Z(e,t=!1){if(e<3||t&&e-1<3)throw Error(`Invalid number of vertices`);let n=[],r=t?e-2:e-1;for(let e=0;e<r;e++)n.push({faces:new Uint32Array([0,e+1,e+2])});return n}const Q=e=>e.map(e=>new _(e)),$=e=>e.length/3;export{z as checkIfFrustumContainsSelectedPoint,ne as checkIfPolygonContainsSelectedPoint,ae as computePolygonForInspection,P as createCoveragePolygon,L as limitZToGround,J as projectVertices,U as resizePolygon,W as updateFrustum};
|