@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"../../../request.js";import n from"../../../core/Error.js";import{JSONSupport as r}from"../../../core/JSONSupport.js";import i from"../../../core/Logger.js";import{debounce as a,onAbort as o}from"../../../core/promiseUtils.js";import{QueueProcessor as s}from"../../../core/QueueProcessor.js";import{property as c,subclass as l}from"../../../core/accessorSupport/decorators.js";import{ensureClass as u}from"../../../core/accessorSupport/ensureType.js";import d from"../../../geometry/Extent.js";import f from"../../../geometry/Point.js";import p from"../../../geometry/SpatialReference.js";import{isFunctionRaster as m,getPixelSpaceCoverage as h}from"./datasetUtils.js";import{isMultiSliceOrRangeDefinition as g,getSliceIndex as _,createSlices as v,getSliceIds as y}from"./multidimensionalUtils.js";import{clearRegisteredIds as b,getRasterId as x,getBlock as S,putBlock as C,deleteBlock as w,decreaseRefCount as T}from"./RawBlockCache.js";import{convertNoDataToMask as E}from"../formats/pixelRangeUtils.js";import{decode as D}from"../formats/RasterCodec.js";import{convertPixelSize as O}from"../functions/clipUtils.js";import{mosaic as k,approximateTransform as A,getLocalArithmeticNorthRotations as j,compositeBands as M}from"../functions/pixelUtils.js";import{getWorldWidth as N,load as P,projectPoint as F,snapPyramid as I,shiftExtent as L,getWorldWrapCount as R,projectExtent as z,getProjectionOffsetGrid as B,getRasterDatasetAlignmentInfo as V,projectResolution as H}from"../functions/rasterProjectionHelper.js";import{convertToLocalDirections as U,uvComponentToVector as W}from"../functions/vectorFieldUtils.js";import{sanitizeUrl as G}from"../../support/arcgisLayerUrl.js";import{url as K}from"../../support/commonProperties.js";import q from"../../support/DimensionalDefinition.js";import J from"../../support/LOD.js";import Y from"../../support/RasterStorageInfo.js";import X from"../../support/TileInfo.js";let Z=0,Q=class extends r{constructor(){super(...arguments),this._tileFetchQueue=new s({concurrency:32,process:(e,t)=>this.fetchRawTile(e.pyramidLevel,e.row,e.col,{...e.options,signal:t})}),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:`closest`},this.rawBlockRegistryIds=[],this.refresh=a(async e=>{await this._openPromise;let t=await this._refresh(e);return t.dataChanged&&b(this.rasterId,this.rawBlockRegistryIds),t})}normalizeCtorArgs(e){return e?.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:`closest`,tileInfo:X.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){let{rasterInfo:e}=this,t=N(e.spatialReference);return t!=null&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){let{transform:e}=this.rasterInfo;return e==null||e.type===`gcs-shift`}set rasterJobHandler(e){this._set(`rasterJobHandler`,e),m(this)&&this.primaryRasters?.rasters?.forEach(t=>t.rasterJobHandler=e)}get rasterId(){return this.url||`rasterId-${Z++}`}set url(e){this._set(`url`,G(e,i.getLogger(this)))}async open(e){return this._openPromise??=P().then(()=>this._open(e)),this._openPromise}async fetchTile(e,t,r,i={}){let a=i.tileInfo||this.rasterInfo.storageInfo.tileInfo,o=this.getTileExtentFromTileInfo(e,t,r,a);if(!o)throw new n(`imagery-tile:out-of-bounds`,`Level for fetch tile out of range`);return i={noClip:!0,...i},this.fetchPixels(o,a.size[0],a.size[1],i)}async identify(e,t={}){e=u(f,e).clone().normalize();let{multidimensionalDefinition:n,timeExtent:r}=t,{rasterInfo:i}=this,{hasMultidimensionalTranspose:a,multidimensionalInfo:o}=i,{transposedVariableName:s}=t,c=o!=null&&a&&(r!=null||g(n));c&&!s&&(s=n!=null&&n.length>0?n[0].variableName??void 0:o.variables[0].name,t={...t,transposedVariableName:s}),t=this._getRequestOptionsWithSliceId(t);let{spatialReference:l,extent:p}=i,{datumTransformation:h}=t,_=F(e,l,h);if(!p.intersects(_))return{location:_,value:null};if(i.transform!=null){let e=i.transform.inverseTransform(_);if(!i.nativeExtent.intersects(e))return{location:e,value:null};_=e}let v=s!=null&&o!=null&&i.hasMultidimensionalTranspose;if(m(this)){let e=this.primaryRasters.rasters[0];if(v)return e.identify(_,t);let{pixelSize:r}=i,a=r.x*3/2,o=r.y*3/2,s=new d({xmin:_.x-a,xmax:_.x+a,ymin:_.y-o,ymax:_.y+o,spatialReference:l}),c={interpolation:`nearest`,multidimensionalDefinition:n,sliceId:t.sliceId,bandIds:t.bandIds},{pixelBlock:u}=await e.fetchPixels(s,3,3,c),{pixelBlock:f}=await this.fetchPixels(s,3,3,c);if(u==null)return{location:_,value:null};let p=!u.mask||u.mask[4]?u.pixels.map(e=>e[4]):null,m;return f!=null&&(m=!f.mask||f.mask[4]?f.pixels.map(e=>e[4]):void 0),{location:_,value:p,processedValue:m,pyramidLevel:0}}let y=0;if(!v){let{srcResolution:n}=t;if(n)n.spatialReference&&(n=O(new f(n),l)),y=I(n,i,this.ioConfig.sampling).pyramidLevel;else if(y=await this.computeBestPyramidLevelForLocation(e,t),y==null)return{location:_,value:null}}let b=this.identifyPixelLocation(_,y,null,v);if(b===null)return{location:_,value:null};let{row:x,col:S,rowOffset:C,colOffset:w,blockWidth:T}=b,E=await this._fetchRawTile(y,x,S,t);if(!E?.pixels?.length)return{location:_,value:null};let D=C*T+w;return this._processIdentifyResult(E,{srcLocation:_,position:D,pyramidLevel:y,useTransposedTile:!!v,requestSomeSlices:c,identifyOptions:t})}async fetchPixels(e,t,n,r={}){e=L(e),r=this._getRequestOptionsWithSliceId(r);let{_hasNoneOrGCSShiftTransform:i}=this;if(r.requestRawData&&i)return this._fetchPixels(e,t,n,r);let a=N(e.spatialReference),o=R(e);if(a==null||o===0||o===1&&this._isGlobalWrappableSource&&i)return this._fetchPixels(e,t,n,r);if(o>=3)return{extent:e,pixelBlock:null};let s=[],{xmin:c,xmax:l}=e,u=Math.round(a/(l-c)*t),f=u-Math.round((a/2-c)/(l-c)*t),p=0,m=[];for(let i=0;i<=o;i++){let h=i===0?c:-a/2,g=i===o?l-a*i:a/2,_=new d({xmin:h,xmax:g,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),v=i===0?u-f:i===o?t-p:u;p+=v,m.push(v);let y=r.disableWrapAround&&i>0?null:this._fetchPixels(_,v,n,r);s.push(y)}let h=(await Promise.all(s)).map(e=>e?.pixelBlock),g=null,_={width:t,height:n};g=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:h,srcMosaicSize:_,destDimension:null,coefs:null,sampleSpacing:null,interpolation:`nearest`,alignmentInfo:null,blockWidths:m},r)).pixelBlock:k(h,_,{blockWidths:m});let v=z(e,this.rasterInfo.spatialReference,r.datumTransformation);return{extent:e,srcExtent:v,pixelBlock:g}}async fetchRawPixels(e,t,n,r={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};let i=await this._fetchRawTiles(e,t,n,r),{nativeExtent:a,nativePixelSize:o,storageInfo:s}=this.rasterInfo,c=2**e,l=o.x*c,u=o.y*c,f=new d({xmin:a.xmin+l*t.x,xmax:a.xmin+l*(t.x+n.width-1),ymin:a.ymax-u*(t.y+n.height-1),ymax:a.ymax-u*t.y,spatialReference:a.spatialReference});if(!i)return{extent:f,srcExtent:f,pixelBlock:null};let{pixelBlocks:p,mosaicSize:m}=i;if(p.length===1&&p[0]!=null&&p[0].width===n.width&&p[0].height===n.height)return{extent:f,srcExtent:f,pixelBlock:i.pixelBlocks[0]};let h=e>0?s.pyramidBlockWidth:s.blockWidth,g=e>0?s.pyramidBlockHeight:s.blockHeight,_={x:t.x%h,y:t.y%g},v;return v=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:p,srcMosaicSize:m,destDimension:n,clipOffset:_,clipSize:n,coefs:null,sampleSpacing:null,interpolation:r.interpolation,alignmentInfo:null,blockWidths:null},r)).pixelBlock:k(p,m,{clipOffset:_,clipSize:n}),{extent:f,srcExtent:f,pixelBlock:v}}fetchRawTile(e,t,r,i){throw new n(`BaseRaster:read-not-implemented`,`fetchRawTile() is not implemented`)}computeExtent(e){return z(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return this.rasterJobHandler?this.rasterJobHandler.decode({data:e,options:t}):D(e,t)}async request(e,n,r=0){let{customFetchParameters:i}=this.ioConfig,{range:a,query:o,headers:s}=n;r=r??n.retryCount??this.ioConfig.retryCount;let c=a?{Range:`bytes=${a.from}-${a.to}`}:null;try{return await t(e,{...n,query:{...o,...i},headers:{...s,...c}})}catch(t){if(r>0)return r--,this.request(e,n,r);throw t}}getSliceIndex(e){let{multidimensionalInfo:t}=this.rasterInfo;return t==null||e==null||e.length===0?null:_(e,t)}getTileExtentFromTileInfo(e,t,n,r){let i=r.lodAt(e);return i?this.getTileExtent({x:i.resolution,y:i.resolution},t,n,r.origin,r.spatialReference,r.size):null}updateTileInfo(){let{storageInfo:e,spatialReference:t,extent:n,pixelSize:r}=this.rasterInfo,{pyramidResolutions:i}=e;if(!e.tileInfo){let a=[],o=e.maximumPyramidLevel||0,s=(r.x+r.y)/2,c=1/.0254*96*s;for(let e=0;e<=o&&(a.unshift(new J({level:o-e,resolution:s,scale:c})),e!==o);e++)if(i){let t=(i[e].x+i[e].y)/2;c*=t/s,s=t}else s*=2,c*=2;let l=new f({x:n.xmin,y:n.ymax,spatialReference:t});e.tileInfo=new X({origin:l,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:a}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,n=512,r){let{width:i,height:a,nativeExtent:o,pixelSize:s,spatialReference:c}=e,l=new f({x:o.xmin,y:o.ymax,spatialReference:c});r??=Math.max(0,Math.round(Math.log(Math.max(i,a))/Math.LN2-8));let u=this.computeBlockBoundary(o,512,512,{x:o.xmin,y:o.ymax},[s],r);e.storageInfo=new Y({blockWidth:t,blockHeight:n,pyramidBlockWidth:t,pyramidBlockHeight:n,origin:l,firstPyramidLevel:1,maximumPyramidLevel:r,blockBoundary:u})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,n,r,i,a=0,o=2){if(i.length===1&&a>0){i=[...i];let{x:e,y:t}=i[0];for(let n=0;n<a;n++)e*=o,t*=o,i.push({x:e,y:t})}let s=[],{x:c,y:l}=r;for(let r=0;r<i.length;r++){let{x:a,y:o}=i[r];s.push({minCol:Math.floor((e.xmin-c+.1*a)/t/a),maxCol:Math.floor((e.xmax-c-.1*a)/t/a),minRow:Math.floor((l-e.ymax+.1*o)/n/o),maxRow:Math.floor((l-e.ymin-.1*o)/n/o)})}return s}getPyramidPixelSize(e){let{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:n,pyramidScalingFactor:r}=this.rasterInfo.storageInfo;if(e===0)return t;if(n!=null&&n.length)return n[e-1];let i=r**e;return{x:t.x*i,y:t.y*i}}identifyPixelLocation(e,t,n,r){let{spatialReference:i,nativeExtent:a,storageInfo:o}=this.rasterInfo,{maximumPyramidLevel:s,origin:c,transposeInfo:l}=o,u=r&&l!=null?l.tileSize[0]:o.blockWidth,d=r&&l!=null?l.tileSize[1]:o.blockHeight,f=F(e,i,n);if(!a.intersects(f)||t<0||t>s)return null;let{x:p,y:m}=this.getPyramidPixelSize(t),h=(c.y-f.y)/m/d,g=(f.x-c.x)/p/u,_=Math.min(d-1,Math.floor((h-Math.floor(h))*d)),v=Math.min(u-1,Math.floor((g-Math.floor(g))*u));return{pyramidLevel:t,row:Math.floor(h),col:Math.floor(g),rowOffset:_,colOffset:v,blockWidth:u,srcLocation:f}}getTileExtent(e,t,n,r,i,a){let[o,s]=a,c=r.x+n*o*e.x,l=c+o*e.x,u=r.y-t*s*e.y,f=u-s*e.y;return new d({xmin:c,xmax:l,ymin:f,ymax:u,spatialReference:i})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,n){let r=this.rasterInfo.storageInfo.blockBoundary[e];return!r||r.maxRow<t||r.maxCol<n||r.minRow>t||r.minCol>n}updateImageSpaceRasterInfo(e){let{pixelSize:t}=e,{width:n,height:r}=e,i=p.WebMercator;e.spatialReference=i,e.extent=e.nativeExtent=new d({xmin:-.5,ymax:.5,xmax:n-.5,ymin:.5-r,spatialReference:i}),e.isPseudoSpatialReference=!0,e.transform=null,e.pixelSize=new f({x:1,y:1,spatialReference:i});let{extent:a,storageInfo:o}=e;if(o){o.origin=new f({x:a.xmin,y:a.ymax,spatialReference:i});let{pyramidResolutions:n,tileInfo:r}=o;if(n&&n.forEach(e=>{e.x/=t.x,e.y/=t.y}),r){r.origin=o.origin;let t=(e.nativePixelSize.x+e.nativePixelSize.y)/2;r.lods.forEach((e,n)=>{e.resolution=t*2**n,e.scale=96*e.resolution/.0254})}}}async _refresh(e){return{dataChanged:!0}}async _fetchPixels(e,t,n,r={}){let i=R(e);if(i>=2)return{extent:e,pixelBlock:null};let a=this._getSourceDataInfo(e,t,n,r),{pyramidLevel:o,srcResolution:s,srcWidth:c,srcHeight:l,ul:u}=a,{srcExtent:d}=a;if(c===0||l===0)return{extent:e,srcExtent:d,pixelBlock:null};let{rasterInfo:p}=this,m=p.transform,h=m?.type===`gcs-shift`,g=N(e.spatialReference)!=null;(h||!g)&&(i=R(d,h));let _=await this._fetchRawTiles(o,u,{width:c,height:l,wrapCount:i},r);if(!_)return{extent:e,srcExtent:d,pixelBlock:null};d=_.extent;let v=p.storageInfo,y=o>0?v.pyramidBlockWidth:v.blockWidth,b=o>0?v.pyramidBlockHeight:v.blockHeight,{x,y:S}=p.pixelSize;if(o>0){let{pyramidResolutions:e,pyramidScalingFactor:t}=v;if(e!=null&&e[o-1])({x,y:S}=e[o-1]);else{let e=t**o;x*=e,S*=e}}let C=p.spatialReference,w=new f({x,y:S,spatialReference:C}),T=y===c&&b===l&&u.x%y===0&&u.y%b===0,E=new f({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/n,spatialReference:e.spatialReference}),D=!e.spatialReference.equals(C),O=C.isGeographic?1e-9:1e-4,{datumTransformation:M}=r;if(!D&&T&&_.pixelBlocks.length===1&&y===t&&b===n&&$(s,E,O))return{extent:e,srcExtent:d,srcTilePixelSize:w,pixelBlock:_.pixelBlocks[0]};let F=g&&N(d.spatialReference)!=null&&this._hasNoneOrGCSShiftTransform,I=r.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith(`vector`);I&&!this.rasterJobHandler&&await P();let L=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:d,pixelSize:E.toJSON(),datumTransformation:M,rasterTransform:m,hasWrapAround:i>0||F,isAdaptive:this.ioConfig.optimizeProjectionAccuracy!==!1,includeGCSGrid:I},r):B({projectedExtent:e,srcBufferExtent:d,pixelSize:E,datumTransformation:M,rasterTransform:m,hasWrapAround:i>0||F,isAdaptive:!1,includeGCSGrid:I}),z,V=!r.requestRawData,H={rows:L.spacing[0],cols:L.spacing[1]},W=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(o,d.xmin):void 0,{pixelBlocks:G,mosaicSize:K,isPartiallyFilled:q}=_,J=null;if(this.rasterJobHandler){let e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:G,srcMosaicSize:K,destDimension:V?{width:t,height:n}:null,coefs:V?L.coefficients:null,sampleSpacing:V?H:null,projectDirections:I,gcsGrid:I?L.gcsGrid:null,isUV:this.rasterInfo.dataType===`vector-uv`,interpolation:r.interpolation,alignmentInfo:W,blockWidths:null},r);({pixelBlock:z,localNorthDirections:J}=e)}else{let e=k(G,K,{alignmentInfo:W});z=V?A(e,{width:t,height:n},L.coefficients,H,r.interpolation):e,I&&L.gcsGrid&&(J=j({width:t,height:n},L.gcsGrid),z=U(z,this.rasterInfo.dataType,J))}return r.requestRawData||I?{extent:e,srcExtent:d,srcTilePixelSize:w,pixelBlock:z,transformGrid:L,localNorthDirections:J,isPartiallyFilled:q}:{extent:e,srcExtent:e,srcTilePixelSize:w,pixelBlock:z}}async _fetchRawTiles(e,t,n,r){let{origin:i,blockBoundary:a}=this.rasterInfo.storageInfo,{blockWidth:o,blockHeight:s}=this.getBlockWidthHeight(e),{x:c,y:l}=t,{width:u,height:f,wrapCount:p}=n,m=this._getRasterTileAlignmentInfo(e,0);r.buffer&&(c-=r.buffer.cols,l-=r.buffer.rows,u+=r.buffer.cols*2,f+=r.buffer.rows*2);let h=0,g=0,_=0;p&&m!=null&&({worldColumnCountFromOrigin:g,originColumnOffset:_,rightPadding:h}=m,g*m.blockWidth-h>=c+u&&(h=0));let v=Math.floor(c/o),y=Math.floor(l/s),b=Math.floor((c+u+h-1)/o),x=Math.floor((l+f+h-1)/s),S=a[e];if(!S)return null;let{minRow:C,minCol:w,maxCol:T,maxRow:E}=S;if(p===0&&(x<C||b<w||y>E||v>T))return null;let D=[],O=!1,k=this.ioConfig.allowPartialFill==null?r.allowPartialFill:this.ioConfig.allowPartialFill;for(let t=y;t<=x;t++)for(let n=v;n<=b;n++){let i=n;if(!r.disableWrapAround&&p&&m!=null&&g<=n&&(i=n-g-_),t>=C&&i>=w&&E>=t&&T>=i){let n=this._fetchRawTile(e,t,i,r);k?D.push(new Promise(e=>{n.then(t=>e(t)).catch(()=>{O=!0,e(null)})})):D.push(n)}else D.push(Promise.resolve(null))}if(D.length===0)return null;let A=await Promise.all(D),j={height:(x-y+1)*s,width:(b-v+1)*o},{spatialReference:M}=this.rasterInfo,{x:N,y:P}=this.getPyramidPixelSize(e);return{extent:new d({xmin:i.x+v*o*N,xmax:i.x+(b+1)*o*N,ymin:i.y-(x+1)*s*P,ymax:i.y-y*s*P,spatialReference:M}),pixelBlocks:A,mosaicSize:j,isPartiallyFilled:O}}_fetchRawTile(e,t,n,r){let{storageInfo:i}=this.rasterInfo,a=i.transposeInfo!=null&&!!r.transposedVariableName;if(!a){let r=i.blockBoundary[e];if(!r)return Promise.resolve(null);let{minRow:a,minCol:o,maxCol:s,maxRow:c}=r;if(t<a||n<o||t>c||n>s)return Promise.resolve(null)}let s=a?r.transposeVariableName:r.sliceId,c=i.isBsqTile?r.bandIds:null,l=x(this.rasterId,s,c),u=`${e}/${t}/${n}`,d=S(l,r.registryId,u);if(d==null){let a=new AbortController,o=r.bandIds?.slice();if(o?.length&&i.isBsqTile){let i=new Set(o),s=[],c=Array.from(i);for(let i of c)s.push(this._tileFetchQueue.push({pyramidLevel:e,row:t,col:n,options:{...r,bandIds:[i]}},{signal:a.signal}));d=Promise.all(s).then(e=>{if(e.some(e=>e==null))return null;if(c.length!==o.length){let t=[];for(let n of o){let r=e[c.indexOf(n)];t.includes(r)&&(r=r.clone()),t.push(r)}e=t}return this.rasterJobHandler?this.rasterJobHandler.compositeBands({pixelBlocks:e},{signal:a.signal,transferPixelsToWorker:!0}):M(e)})}else d=this._tileFetchQueue.push({pyramidLevel:e,row:t,col:n,options:r},{signal:a.signal});C(l,r.registryId,u,d,a),d.catch(()=>w(l,r.registryId,u))}return r.signal&&o(r,()=>{T(l,r.registryId,u)}),d}_computeMagDirValues(e){let{bandCount:t,dataType:n}=this.rasterInfo;if(!(t===2&&n===`vector-magdir`||n===`vector-uv`)||e?.length!==2||!e[0]?.length)return null;let r=e[0].length;if(n===`vector-magdir`){let t=e[1].map(e=>(e+360)%360);return[e[0],t]}let[i,a]=e,o=[],s=[];for(let e=0;e<r;e++){let[t,n]=W([i[e],a[e]]);o.push(t),s.push(n)}return[o,s]}_getRasterTileAlignmentInfo(e,t){return this._rasterTileAlignmentInfo??=V(this.rasterInfo),this._rasterTileAlignmentInfo.pyramidsInfo==null?null:{startX:t,halfWorldWidth:this._rasterTileAlignmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlignmentInfo.hasGCSSShiftTransform,...this._rasterTileAlignmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,n,r={}){let i={datumTransformation:r.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};r.srcResolution&&(i.srcResolution=r.srcResolution,this._updateSourceDataInfo(e,i));let a=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:o,srcHeight:s,pyramidLevel:c}=i,l=o/t,u=s/n,d=c<a&&l*u>=16,p=c===a&&this._requireTooManySrcTiles(o,s,t,n);if(d||p||o===0||s===0){let o=new f({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/n,spatialReference:e.spatialReference}),s=H(o,this.rasterInfo.spatialReference,e,i.datumTransformation),p=!s||r.srcResolution&&s.x+s.y<r.srcResolution.x+r.srcResolution.y;if(d&&r.srcResolution&&p){let e=Math.round(Math.log(Math.max(l,u))/Math.LN2)-1;if(a-c+3>=e){let t=2**e;s={x:r.srcResolution.x*t,y:r.srcResolution.y*t}}}s&&(i.srcResolution=s,this._updateSourceDataInfo(e,i))}return this._requireTooManySrcTiles(i.srcWidth,i.srcHeight,t,n)&&(i.srcWidth=0,i.srcHeight=0),i}_requireTooManySrcTiles(e,t,n,r){let{tileInfo:i}=this.rasterInfo.storageInfo,a=Math.ceil(e/i.size[0])*Math.ceil(t/i.size[1]),o=e/n,s=t/r;return a>=256*Math.max(1,(n+r)/1024)||o>8||s>8}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;let{rasterInfo:n}=this,r=n.spatialReference,{srcResolution:i,datumTransformation:a}=t,{pyramidLevel:o,pyramidResolution:s,excessiveReading:c}=I(i,n,this.ioConfig.sampling);if(c)return;let l=t.srcExtent||z(e,r,a);if(l==null)return;let u=n.transform;u&&(l=u.inverseTransform(l)),t.srcExtent=l;let{origin:d}=n.storageInfo,{width:f,height:p,ul:m}=h(l,d,s,o);t.pyramidLevel=o,t.pyramidResolution=s,t.srcWidth=f,t.srcHeight=p,t.ul=m}_getRequestOptionsWithSliceId(e){return this.rasterInfo.multidimensionalInfo!=null&&e.sliceId==null&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){let{srcLocation:n,position:r,pyramidLevel:i,useTransposedTile:a}=t,o=e.pixels[0].length/e.width/e.height;if(e.mask&&!e.mask[r])return{location:n,value:null};let{multidimensionalInfo:s}=this.rasterInfo;if(s==null||!a){let t=e.pixels.map(e=>e[r]),a={location:n,value:t,pyramidLevel:i},o=this._computeMagDirValues(t.map(e=>[e]));return o?.length&&(a.magdirValue=o.map(e=>e[0])),a}let c=e.pixels.map(e=>e.slice(r*o,r*o+o)),l=this._computeMagDirValues(c),{requestSomeSlices:u,identifyOptions:d}=t,f=v(s,d.transposedVariableName);if(u){let e=y(f,d.multidimensionalDefinition,d.timeExtent);c=c.map(t=>e.map(e=>t[e])),l=l?.map(t=>e.map(e=>t[e])),f=e.map(e=>f[e])}let p=e.noDataValues||this.rasterInfo.noDataValue,m={pixels:c,pixelType:e.pixelType},h;return p!=null&&(E(m,p),h=m.mask),{location:n,value:null,dataSeries:f.map((e,t)=>{let n={value:h?.[t]===0?null:c.map(e=>e[t]),multidimensionalDefinition:e.multidimensionalDefinition.map(e=>new q({...e,isSlice:!0}))};return l?.length&&(n.magdirValue=[l[0][t],l[1][t]]),n}),pyramidLevel:i}}};e([c()],Q.prototype,`_rasterTileAlignmentInfo`,void 0),e([c()],Q.prototype,`_tileFetchQueue`,void 0),e([c({readOnly:!0})],Q.prototype,`_isGlobalWrappableSource`,null),e([c({readOnly:!0})],Q.prototype,`_hasNoneOrGCSShiftTransform`,null),e([c()],Q.prototype,`_openPromise`,void 0),e([c()],Q.prototype,`rasterJobHandler`,null),e([c({readOnly:!0})],Q.prototype,`rasterId`,null),e([c(K)],Q.prototype,`url`,null),e([c({type:String,json:{write:!0}})],Q.prototype,`datasetName`,void 0),e([c({type:String,json:{write:!0}})],Q.prototype,`datasetFormat`,void 0),e([c()],Q.prototype,`hasUniqueSourceStorageInfo`,void 0),e([c()],Q.prototype,`rasterInfo`,void 0),e([c()],Q.prototype,`ioConfig`,void 0),e([c()],Q.prototype,`sourceJSON`,void 0),e([c()],Q.prototype,`rawBlockRegistryIds`,void 0),Q=e([l(`esri.layers.raster.datasets.BaseRaster`)],Q);function $(e,t,n){return Math.abs(e.x-t.x)<n&&Math.abs(e.y-t.y)<n}export{Q as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../request.js";import n from"../../../core/Error.js";import{JSONSupport as r}from"../../../core/JSONSupport.js";import i from"../../../core/Logger.js";import{debounce as a,onAbort as o}from"../../../core/promiseUtils.js";import{QueueProcessor as s}from"../../../core/QueueProcessor.js";import{property as c,subclass as l}from"../../../core/accessorSupport/decorators.js";import{ensureClass as u}from"../../../core/accessorSupport/ensureType.js";import d from"../../../geometry/Extent.js";import f from"../../../geometry/Point.js";import p from"../../../geometry/SpatialReference.js";import{isFunctionRaster as m,getPixelSpaceCoverage as h}from"./datasetUtils.js";import{isMultiSliceOrRangeDefinition as g,getSliceIndex as _,createSlices as v,getSliceIds as y}from"./multidimensionalUtils.js";import{clearRegisteredIds as b,getRasterId as x,getBlock as S,putBlock as C,deleteBlock as w,decreaseRefCount as T}from"./RawBlockCache.js";import{convertNoDataToMask as E}from"../formats/pixelRangeUtils.js";import{decode as D}from"../formats/RasterCodec.js";import{convertPixelSize as O}from"../functions/clipUtils.js";import{mosaic as k,approximateTransform as A,getLocalArithmeticNorthRotations as j,compositeBands as M}from"../functions/pixelUtils.js";import{getWorldWidth as N,load as P,projectPoint as F,snapPyramid as I,shiftExtent as L,getWorldWrapCount as R,projectExtent as z,getProjectionOffsetGrid as B,getRasterDatasetAlignmentInfo as V,projectResolution as H}from"../functions/rasterProjectionHelper.js";import{convertToLocalDirections as U,uvComponentToVector as W}from"../functions/vectorFieldUtils.js";import{sanitizeUrl as G}from"../../support/arcgisLayerUrl.js";import{url as K}from"../../support/commonProperties.js";import q from"../../support/DimensionalDefinition.js";import J from"../../support/LOD.js";import Y from"../../support/RasterStorageInfo.js";import X from"../../support/TileInfo.js";let Z=0,Q=class extends r{constructor(){super(...arguments),this._tileFetchQueue=new s({concurrency:32,process:(e,t)=>this.fetchRawTile(e.pyramidLevel,e.row,e.col,{...e.options,signal:t})}),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:`closest`},this.rawBlockRegistryIds=[],this.refresh=a(async e=>{await this._openPromise;let t=await this._refresh(e);return t.dataChanged&&b(this.rasterId,this.rawBlockRegistryIds),t})}normalizeCtorArgs(e){return e?.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:`closest`,tileInfo:X.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){let{rasterInfo:e}=this,t=N(e.spatialReference);return t!=null&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){let{transform:e}=this.rasterInfo;return e==null||e.type===`gcs-shift`}set rasterJobHandler(e){this._set(`rasterJobHandler`,e),m(this)&&this.primaryRasters?.rasters?.forEach(t=>t.rasterJobHandler=e)}get rasterId(){return this.url||`rasterId-${Z++}`}set url(e){this._set(`url`,G(e,i.getLogger(this)))}async open(e){return this._openPromise??=P().then(()=>this._open(e)),this._openPromise}async fetchTile(e,t,r,i={}){let a=i.tileInfo||this.rasterInfo.storageInfo.tileInfo,o=this.getTileExtentFromTileInfo(e,t,r,a);if(!o)throw new n(`imagery-tile:out-of-bounds`,`Level for fetch tile out of range`);return i={noClip:!0,...i},this.fetchPixels(o,a.size[0],a.size[1],i)}async identify(e,t={}){e=u(f,e).clone().normalize();let{multidimensionalDefinition:n,timeExtent:r}=t,{rasterInfo:i}=this,{hasMultidimensionalTranspose:a,multidimensionalInfo:o}=i,{transposedVariableName:s}=t,c=o!=null&&a&&(r!=null||g(n));c&&!s&&(s=n!=null&&n.length>0?n[0].variableName??void 0:o.variables[0].name,t={...t,transposedVariableName:s}),t=this._getRequestOptionsWithSliceId(t);let{spatialReference:l,extent:p}=i,{datumTransformation:h}=t,_=F(e,l,h);if(!p.intersects(_))return{location:_,value:null};if(i.transform!=null){let e=i.transform.inverseTransform(_);if(!i.nativeExtent.intersects(e))return{location:e,value:null};_=e}let v=s!=null&&o!=null&&i.hasMultidimensionalTranspose;if(m(this)){let e=this.primaryRasters.rasters[0];if(v)return e.identify(_,t);let{pixelSize:r}=i,a=r.x*3/2,o=r.y*3/2,s=new d({xmin:_.x-a,xmax:_.x+a,ymin:_.y-o,ymax:_.y+o,spatialReference:l}),c={interpolation:`nearest`,multidimensionalDefinition:n,sliceId:t.sliceId,bandIds:t.bandIds},{pixelBlock:u}=await e.fetchPixels(s,3,3,c),{pixelBlock:f}=await this.fetchPixels(s,3,3,c);if(u==null)return{location:_,value:null};let p=!u.mask||u.mask[4]?u.pixels.map(e=>e[4]):null,m;return f!=null&&(m=!f.mask||f.mask[4]?f.pixels.map(e=>e[4]):void 0),{location:_,value:p,processedValue:m,pyramidLevel:0}}let y=0;if(!v){let{srcResolution:n}=t;if(n)n.spatialReference&&(n=O(new f(n),l)),y=I(n,i,this.ioConfig.sampling).pyramidLevel;else if(y=await this.computeBestPyramidLevelForLocation(e,t),y==null)return{location:_,value:null}}let b=this.identifyPixelLocation(_,y,null,v);if(b===null)return{location:_,value:null};let{row:x,col:S,rowOffset:C,colOffset:w,blockWidth:T}=b,E=await this._fetchRawTile(y,x,S,t);if(!E?.pixels?.length)return{location:_,value:null};let D=C*T+w;return this._processIdentifyResult(E,{srcLocation:_,position:D,pyramidLevel:y,useTransposedTile:!!v,requestSomeSlices:c,identifyOptions:t})}async fetchPixels(e,t,n,r={}){e=L(e),r=this._getRequestOptionsWithSliceId(r);let{_hasNoneOrGCSShiftTransform:i}=this;if(r.requestRawData&&i)return this._fetchPixels(e,t,n,r);let a=N(e.spatialReference),o=R(e);if(a==null||o===0||o===1&&this._isGlobalWrappableSource&&i)return this._fetchPixels(e,t,n,r);if(o>=3)return{extent:e,pixelBlock:null};let s=[],{xmin:c,xmax:l}=e,u=Math.round(a/(l-c)*t),f=u-Math.round((a/2-c)/(l-c)*t),p=0,m=[];for(let i=0;i<=o;i++){let h=i===0?c:-a/2,g=i===o?l-a*i:a/2,_=new d({xmin:h,xmax:g,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),v=i===0?u-f:i===o?t-p:u;p+=v,m.push(v);let y=r.disableWrapAround&&i>0?null:this._fetchPixels(_,v,n,r);s.push(y)}let h=(await Promise.all(s)).map(e=>e?.pixelBlock),g=null,_={width:t,height:n};g=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:h,srcMosaicSize:_,destDimension:null,coefs:null,sampleSpacing:null,interpolation:`nearest`,alignmentInfo:null,blockWidths:m},r)).pixelBlock:k(h,_,{blockWidths:m});let v=z(e,this.rasterInfo.spatialReference,r.datumTransformation);return{extent:e,srcExtent:v,pixelBlock:g}}async fetchRawPixels(e,t,n,r={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};let i=await this._fetchRawTiles(e,t,n,r),{nativeExtent:a,nativePixelSize:o,storageInfo:s}=this.rasterInfo,c=2**e,l=o.x*c,u=o.y*c,f=new d({xmin:a.xmin+l*t.x,xmax:a.xmin+l*(t.x+n.width-1),ymin:a.ymax-u*(t.y+n.height-1),ymax:a.ymax-u*t.y,spatialReference:a.spatialReference});if(!i)return{extent:f,srcExtent:f,pixelBlock:null};let{pixelBlocks:p,mosaicSize:m}=i;if(p.length===1&&p[0]!=null&&p[0].width===n.width&&p[0].height===n.height)return{extent:f,srcExtent:f,pixelBlock:i.pixelBlocks[0]};let h=e>0?s.pyramidBlockWidth:s.blockWidth,g=e>0?s.pyramidBlockHeight:s.blockHeight,_={x:t.x%h,y:t.y%g},v;return v=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:p,srcMosaicSize:m,destDimension:n,clipOffset:_,clipSize:n,coefs:null,sampleSpacing:null,interpolation:r.interpolation,alignmentInfo:null,blockWidths:null},r)).pixelBlock:k(p,m,{clipOffset:_,clipSize:n}),{extent:f,srcExtent:f,pixelBlock:v}}fetchRawTile(e,t,r,i){throw new n(`BaseRaster:read-not-implemented`,`fetchRawTile() is not implemented`)}computeExtent(e){return z(this.rasterInfo.extent,e)}decodePixelBlock(e,t,n){return this.rasterJobHandler?this.rasterJobHandler.decode({data:e,options:t},n):D(e,t,n)}async request(e,n,r=0){let{customFetchParameters:i}=this.ioConfig,{range:a,query:o,headers:s}=n;r=r??n.retryCount??this.ioConfig.retryCount;let c=a?{Range:`bytes=${a.from}-${a.to}`}:null;try{return await t(e,{...n,query:{...o,...i},headers:{...s,...c}})}catch(t){if(r>0)return r--,this.request(e,n,r);throw t}}getSliceIndex(e){let{multidimensionalInfo:t}=this.rasterInfo;return t==null||e==null||e.length===0?null:_(e,t)}getTileExtentFromTileInfo(e,t,n,r){let i=r.lodAt(e);return i?this.getTileExtent({x:i.resolution,y:i.resolution},t,n,r.origin,r.spatialReference,r.size):null}updateTileInfo(){let{storageInfo:e,spatialReference:t,extent:n,pixelSize:r}=this.rasterInfo,{pyramidResolutions:i}=e;if(!e.tileInfo){let a=[],o=e.maximumPyramidLevel||0,s=(r.x+r.y)/2,c=1/.0254*96*s;for(let e=0;e<=o&&(a.unshift(new J({level:o-e,resolution:s,scale:c})),e!==o);e++)if(i){let t=(i[e].x+i[e].y)/2;c*=t/s,s=t}else s*=2,c*=2;let l=new f({x:n.xmin,y:n.ymax,spatialReference:t});e.tileInfo=new X({origin:l,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:a}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,n=512,r){let{width:i,height:a,nativeExtent:o,pixelSize:s,spatialReference:c}=e,l=new f({x:o.xmin,y:o.ymax,spatialReference:c});r??=Math.max(0,Math.round(Math.log(Math.max(i,a))/Math.LN2-8));let u=this.computeBlockBoundary(o,t,n,{x:o.xmin,y:o.ymax},[s],r);e.storageInfo=new Y({blockWidth:t,blockHeight:n,pyramidBlockWidth:t,pyramidBlockHeight:n,origin:l,firstPyramidLevel:1,maximumPyramidLevel:r,blockBoundary:u})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,n,r,i,a=0,o=2){if(i.length===1&&a>0){i=[...i];let{x:e,y:t}=i[0];for(let n=0;n<a;n++)e*=o,t*=o,i.push({x:e,y:t})}let s=[],{x:c,y:l}=r;for(let r=0;r<i.length;r++){let{x:a,y:o}=i[r];s.push({minCol:Math.floor((e.xmin-c+.1*a)/t/a),maxCol:Math.floor((e.xmax-c-.1*a)/t/a),minRow:Math.floor((l-e.ymax+.1*o)/n/o),maxRow:Math.floor((l-e.ymin-.1*o)/n/o)})}return s}getPyramidPixelSize(e){let{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:n,pyramidScalingFactor:r}=this.rasterInfo.storageInfo;if(e===0)return t;if(n!=null&&n.length)return n[e-1];let i=r**e;return{x:t.x*i,y:t.y*i}}identifyPixelLocation(e,t,n,r){let{spatialReference:i,nativeExtent:a,storageInfo:o}=this.rasterInfo,{maximumPyramidLevel:s,origin:c,transposeInfo:l}=o,u=r&&l!=null?l.tileSize[0]:o.blockWidth,d=r&&l!=null?l.tileSize[1]:o.blockHeight,f=F(e,i,n);if(!a.intersects(f)||t<0||t>s)return null;let{x:p,y:m}=this.getPyramidPixelSize(t),h=(c.y-f.y)/m/d,g=(f.x-c.x)/p/u,_=Math.min(d-1,Math.floor((h-Math.floor(h))*d)),v=Math.min(u-1,Math.floor((g-Math.floor(g))*u));return{pyramidLevel:t,row:Math.floor(h),col:Math.floor(g),rowOffset:_,colOffset:v,blockWidth:u,srcLocation:f}}getTileExtent(e,t,n,r,i,a){let[o,s]=a,c=r.x+n*o*e.x,l=c+o*e.x,u=r.y-t*s*e.y,f=u-s*e.y;return new d({xmin:c,xmax:l,ymin:f,ymax:u,spatialReference:i})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,n){let r=this.rasterInfo.storageInfo.blockBoundary[e];return!r||r.maxRow<t||r.maxCol<n||r.minRow>t||r.minCol>n}updateImageSpaceRasterInfo(e){let{pixelSize:t}=e,{width:n,height:r}=e,i=p.WebMercator;e.spatialReference=i,e.extent=e.nativeExtent=new d({xmin:-.5,ymax:.5,xmax:n-.5,ymin:.5-r,spatialReference:i}),e.isPseudoSpatialReference=!0,e.transform=null,e.pixelSize=new f({x:1,y:1,spatialReference:i});let{extent:a,storageInfo:o}=e;if(o){o.origin=new f({x:a.xmin,y:a.ymax,spatialReference:i});let{pyramidResolutions:n,tileInfo:r}=o;if(n&&n.forEach(e=>{e.x/=t.x,e.y/=t.y}),r){r.origin=o.origin;let t=(e.nativePixelSize.x+e.nativePixelSize.y)/2;r.lods.forEach((e,n)=>{e.resolution=t*2**n,e.scale=96*e.resolution/.0254})}}}async _refresh(e){return{dataChanged:!0}}async _fetchPixels(e,t,n,r={}){let i=R(e);if(i>=2)return{extent:e,pixelBlock:null};let a=this._getSourceDataInfo(e,t,n,r),{pyramidLevel:o,srcResolution:s,srcWidth:c,srcHeight:l,ul:u}=a,{srcExtent:d}=a;if(c===0||l===0)return{extent:e,srcExtent:d,pixelBlock:null};let{rasterInfo:p}=this,m=p.transform,h=m?.type===`gcs-shift`,g=N(e.spatialReference)!=null;(h||!g)&&(i=R(d,h));let _=await this._fetchRawTiles(o,u,{width:c,height:l,wrapCount:i},r);if(!_)return{extent:e,srcExtent:d,pixelBlock:null};d=_.extent;let v=p.storageInfo,y=o>0?v.pyramidBlockWidth:v.blockWidth,b=o>0?v.pyramidBlockHeight:v.blockHeight,{x,y:S}=p.pixelSize;if(o>0){let{pyramidResolutions:e,pyramidScalingFactor:t}=v;if(e!=null&&e[o-1])({x,y:S}=e[o-1]);else{let e=t**o;x*=e,S*=e}}let C=p.spatialReference,w=new f({x,y:S,spatialReference:C}),T=y===c&&b===l&&u.x%y===0&&u.y%b===0,E=new f({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/n,spatialReference:e.spatialReference}),D=!e.spatialReference.equals(C),O=C.isGeographic?1e-9:1e-4,{datumTransformation:M}=r;if(!D&&T&&_.pixelBlocks.length===1&&y===t&&b===n&&$(s,E,O))return{extent:e,srcExtent:d,srcTilePixelSize:w,pixelBlock:_.pixelBlocks[0]};let F=g&&N(d.spatialReference)!=null&&this._hasNoneOrGCSShiftTransform,I=r.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith(`vector`);I&&!this.rasterJobHandler&&await P();let L=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:d,pixelSize:E.toJSON(),datumTransformation:M,rasterTransform:m,hasWrapAround:i>0||F,isAdaptive:this.ioConfig.optimizeProjectionAccuracy!==!1,includeGCSGrid:I},r):B({projectedExtent:e,srcBufferExtent:d,pixelSize:E,datumTransformation:M,rasterTransform:m,hasWrapAround:i>0||F,isAdaptive:!1,includeGCSGrid:I}),z,V=!r.requestRawData,H={rows:L.spacing[0],cols:L.spacing[1]},W=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(o,d.xmin):void 0,{pixelBlocks:G,mosaicSize:K,isPartiallyFilled:q}=_,J=null;if(this.rasterJobHandler){let e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:G,srcMosaicSize:K,destDimension:V?{width:t,height:n}:null,coefs:V?L.coefficients:null,sampleSpacing:V?H:null,projectDirections:I,gcsGrid:I?L.gcsGrid:null,isUV:this.rasterInfo.dataType===`vector-uv`,interpolation:r.interpolation,alignmentInfo:W,blockWidths:null},r);({pixelBlock:z,localNorthDirections:J}=e)}else{let e=k(G,K,{alignmentInfo:W});z=V?A(e,{width:t,height:n},L.coefficients,H,r.interpolation):e,I&&L.gcsGrid&&(J=j({width:t,height:n},L.gcsGrid),z=U(z,this.rasterInfo.dataType,J))}return r.requestRawData||I?{extent:e,srcExtent:d,srcTilePixelSize:w,pixelBlock:z,transformGrid:L,localNorthDirections:J,isPartiallyFilled:q}:{extent:e,srcExtent:e,srcTilePixelSize:w,pixelBlock:z}}async _fetchRawTiles(e,t,n,r){let{origin:i,blockBoundary:a}=this.rasterInfo.storageInfo,{blockWidth:o,blockHeight:s}=this.getBlockWidthHeight(e),{x:c,y:l}=t,{width:u,height:f,wrapCount:p}=n,m=this._getRasterTileAlignmentInfo(e,0);r.buffer&&(c-=r.buffer.cols,l-=r.buffer.rows,u+=r.buffer.cols*2,f+=r.buffer.rows*2);let h=0,g=0,_=0;p&&m!=null&&({worldColumnCountFromOrigin:g,originColumnOffset:_,rightPadding:h}=m,g*m.blockWidth-h>=c+u&&(h=0));let v=Math.floor(c/o),y=Math.floor(l/s),b=Math.floor((c+u+h-1)/o),x=Math.floor((l+f+h-1)/s),S=a[e];if(!S)return null;let{minRow:C,minCol:w,maxCol:T,maxRow:E}=S;if(p===0&&(x<C||b<w||y>E||v>T))return null;let D=[],O=!1,k=this.ioConfig.allowPartialFill==null?r.allowPartialFill:this.ioConfig.allowPartialFill;for(let t=y;t<=x;t++)for(let n=v;n<=b;n++){let i=n;if(!r.disableWrapAround&&p&&m!=null&&g<=n&&(i=n-g-_),t>=C&&i>=w&&E>=t&&T>=i){let n=this._fetchRawTile(e,t,i,r);k?D.push(new Promise(e=>{n.then(t=>e(t)).catch(()=>{O=!0,e(null)})})):D.push(n)}else D.push(Promise.resolve(null))}if(D.length===0)return null;let A=await Promise.all(D),j={height:(x-y+1)*s,width:(b-v+1)*o},{spatialReference:M}=this.rasterInfo,{x:N,y:P}=this.getPyramidPixelSize(e);return{extent:new d({xmin:i.x+v*o*N,xmax:i.x+(b+1)*o*N,ymin:i.y-(x+1)*s*P,ymax:i.y-y*s*P,spatialReference:M}),pixelBlocks:A,mosaicSize:j,isPartiallyFilled:O}}_fetchRawTile(e,t,n,r){let{storageInfo:i}=this.rasterInfo,a=i.transposeInfo!=null&&!!r.transposedVariableName;if(!a){let r=i.blockBoundary[e];if(!r)return Promise.resolve(null);let{minRow:a,minCol:o,maxCol:s,maxRow:c}=r;if(t<a||n<o||t>c||n>s)return Promise.resolve(null)}let s=a?r.transposeVariableName:r.sliceId,c=i.isBsqTile?r.bandIds:null,l=x(this.rasterId,s,c),u=`${e}/${t}/${n}`,d=S(l,r.registryId,u);if(d==null){let a=new AbortController,o=r.bandIds?.slice();if(o?.length&&i.isBsqTile){let i=new Set(o),s=[],c=Array.from(i);for(let i of c)s.push(this._tileFetchQueue.push({pyramidLevel:e,row:t,col:n,options:{...r,bandIds:[i]}},{signal:a.signal}));d=Promise.all(s).then(e=>{if(e.some(e=>e==null))return null;if(c.length!==o.length){let t=[];for(let n of o){let r=e[c.indexOf(n)];t.includes(r)&&(r=r.clone()),t.push(r)}e=t}return this.rasterJobHandler?this.rasterJobHandler.compositeBands({pixelBlocks:e},{signal:a.signal,transferPixelsToWorker:!0}):M(e)})}else d=this._tileFetchQueue.push({pyramidLevel:e,row:t,col:n,options:r},{signal:a.signal});C(l,r.registryId,u,d,a),d.catch(()=>w(l,r.registryId,u))}return r.signal&&o(r,()=>{T(l,r.registryId,u)}),d}_computeMagDirValues(e){let{bandCount:t,dataType:n}=this.rasterInfo;if(!(t===2&&n===`vector-magdir`||n===`vector-uv`)||e?.length!==2||!e[0]?.length)return null;let r=e[0].length;if(n===`vector-magdir`){let t=e[1].map(e=>(e+360)%360);return[e[0],t]}let[i,a]=e,o=[],s=[];for(let e=0;e<r;e++){let[t,n]=W([i[e],a[e]]);o.push(t),s.push(n)}return[o,s]}_getRasterTileAlignmentInfo(e,t){return this._rasterTileAlignmentInfo??=V(this.rasterInfo),this._rasterTileAlignmentInfo.pyramidsInfo==null?null:{startX:t,halfWorldWidth:this._rasterTileAlignmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlignmentInfo.hasGCSSShiftTransform,...this._rasterTileAlignmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,n,r={}){let i={datumTransformation:r.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};r.srcResolution&&(i.srcResolution=r.srcResolution,this._updateSourceDataInfo(e,i));let a=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:o,srcHeight:s,pyramidLevel:c}=i,l=o/t,u=s/n,d=c<a&&l*u>=16,p=c===a&&this._requireTooManySrcTiles(o,s,t,n);if(d||p||o===0||s===0){let o=new f({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/n,spatialReference:e.spatialReference}),s=H(o,this.rasterInfo.spatialReference,e,i.datumTransformation),p=!s||r.srcResolution&&s.x+s.y<r.srcResolution.x+r.srcResolution.y;if(d&&r.srcResolution&&p){let e=Math.round(Math.log(Math.max(l,u))/Math.LN2)-1;if(a-c+3>=e){let t=2**e;s={x:r.srcResolution.x*t,y:r.srcResolution.y*t}}}s&&(i.srcResolution=s,this._updateSourceDataInfo(e,i))}return this._requireTooManySrcTiles(i.srcWidth,i.srcHeight,t,n)&&(i.srcWidth=0,i.srcHeight=0),i}_requireTooManySrcTiles(e,t,n,r){let{tileInfo:i}=this.rasterInfo.storageInfo,a=Math.ceil(e/i.size[0])*Math.ceil(t/i.size[1]),o=e/n,s=t/r;return a>=256*Math.max(1,(n+r)/1024)||o>8||s>8}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;let{rasterInfo:n}=this,r=n.spatialReference,{srcResolution:i,datumTransformation:a}=t,{pyramidLevel:o,pyramidResolution:s,excessiveReading:c}=I(i,n,this.ioConfig.sampling);if(c)return;let l=t.srcExtent||z(e,r,a);if(l==null)return;let u=n.transform;u&&(l=u.inverseTransform(l)),t.srcExtent=l;let{origin:d}=n.storageInfo,{width:f,height:p,ul:m}=h(l,d,s,o);t.pyramidLevel=o,t.pyramidResolution=s,t.srcWidth=f,t.srcHeight=p,t.ul=m}_getRequestOptionsWithSliceId(e){return this.rasterInfo.multidimensionalInfo!=null&&e.sliceId==null&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){let{srcLocation:n,position:r,pyramidLevel:i,useTransposedTile:a}=t,o=e.pixels[0].length/e.width/e.height;if(e.mask&&!e.mask[r])return{location:n,value:null};let{multidimensionalInfo:s}=this.rasterInfo;if(s==null||!a){let t=e.pixels.map(e=>e[r]),a={location:n,value:t,pyramidLevel:i},o=this._computeMagDirValues(t.map(e=>[e]));return o?.length&&(a.magdirValue=o.map(e=>e[0])),a}let c=e.pixels.map(e=>e.slice(r*o,r*o+o)),l=this._computeMagDirValues(c),{requestSomeSlices:u,identifyOptions:d}=t,f=v(s,d.transposedVariableName);if(u){let e=y(f,d.multidimensionalDefinition,d.timeExtent);c=c.map(t=>e.map(e=>t[e])),l=l?.map(t=>e.map(e=>t[e])),f=e.map(e=>f[e])}let p=e.noDataValues||this.rasterInfo.noDataValue,m={pixels:c,pixelType:e.pixelType},h;return p!=null&&(E(m,p),h=m.mask),{location:n,value:null,dataSeries:f.map((e,t)=>{let n={value:h?.[t]===0?null:c.map(e=>e[t]),multidimensionalDefinition:e.multidimensionalDefinition.map(e=>new q({...e,isSlice:!0}))};return l?.length&&(n.magdirValue=[l[0][t],l[1][t]]),n}),pyramidLevel:i}}};e([c()],Q.prototype,`_rasterTileAlignmentInfo`,void 0),e([c()],Q.prototype,`_tileFetchQueue`,void 0),e([c({readOnly:!0})],Q.prototype,`_isGlobalWrappableSource`,null),e([c({readOnly:!0})],Q.prototype,`_hasNoneOrGCSShiftTransform`,null),e([c()],Q.prototype,`_openPromise`,void 0),e([c()],Q.prototype,`rasterJobHandler`,null),e([c({readOnly:!0})],Q.prototype,`rasterId`,null),e([c(K)],Q.prototype,`url`,null),e([c({type:String,json:{write:!0}})],Q.prototype,`datasetName`,void 0),e([c({type:String,json:{write:!0}})],Q.prototype,`datasetFormat`,void 0),e([c()],Q.prototype,`hasUniqueSourceStorageInfo`,void 0),e([c()],Q.prototype,`rasterInfo`,void 0),e([c()],Q.prototype,`ioConfig`,void 0),e([c()],Q.prototype,`sourceJSON`,void 0),e([c()],Q.prototype,`rawBlockRegistryIds`,void 0),Q=e([l(`esri.layers.raster.datasets.BaseRaster`)],Q);function $(e,t,n){return Math.abs(e.x-t.x)<n&&Math.abs(e.y-t.y)<n}export{Q as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import i from"../../../geometry/Point.js";import{GeospatialPDFWorkerClient as a}from"../../geospatialPDF/GeospatialPDFWorkerClient.js";import o from"./BaseRaster.js";import s from"../../support/PixelBlock.js";import c from"../../support/RasterInfo.js";let l=class extends o{constructor(){super(...arguments),this._workerClient=new a,this._extent=null,this._ctm=null,this._neatlineRing=[],this._width=0,this._height=0,this._tileSize=512,this.datasetFormat=`PDF`,this.frame=null,this.neatlineExtent=null,this.page=1,this.tileType=`Raster`}destroy(){this._workerClient.destroy(),this.neatlineExtent=null,this._extent=null,this._ctm=null,this._neatlineRing=[]}async fetchRawTile(e,t,n,r={}){let i=this._extent,a=this._ctm,o=this.getTileExtentPDF(e,t,n);return o.intersects(i)?d(await this._workerClient.render(o,this._tileSize,this._tileSize,a,this._neatlineRing,r)):null}async _open(e){if(!this.url)throw new t(`geospatial-pdf-raster:open`,`GeospatialPDFRaster requires a url.`);let n=await this._workerClient.loadPDF({url:this.url,page:this.page},e);this.frame=n.frame;let r=this.frame.outerExtentMediabox;if(!r)throw new t(`geospatial-pdf-raster:open`,`Failed to compute Geospatial PDF extent.`);this.neatlineExtent=n.
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import i from"../../../geometry/Point.js";import{GeospatialPDFWorkerClient as a}from"../../geospatialPDF/GeospatialPDFWorkerClient.js";import o from"./BaseRaster.js";import s from"../../support/PixelBlock.js";import c from"../../support/RasterInfo.js";let l=class extends o{constructor(){super(...arguments),this._workerClient=new a,this._extent=null,this._ctm=null,this._neatlineRing=[],this._width=0,this._height=0,this._tileSize=512,this.datasetFormat=`PDF`,this.frame=null,this.neatlineExtent=null,this.page=1,this.tileType=`Raster`}destroy(){this._workerClient.destroy(),this.neatlineExtent=null,this._extent=null,this._ctm=null,this._neatlineRing=[]}async fetchRawTile(e,t,n,r={}){let i=this._extent,a=this._ctm,o=this.getTileExtentPDF(e,t,n);return o.intersects(i)?d(await this._workerClient.render(o,this._tileSize,this._tileSize,a,this._neatlineRing,r)):null}async _open(e){if(!this.url)throw new t(`geospatial-pdf-raster:open`,`GeospatialPDFRaster requires a url.`);let n=await this._workerClient.loadPDF({url:this.url,page:this.page},e);this.frame=n.frame;let r=this.frame.outerExtentMediabox;if(!r)throw new t(`geospatial-pdf-raster:open`,`Failed to compute Geospatial PDF extent.`);this.neatlineExtent=n.neatlineExtent,this._extent=r,this._ctm=this.frame.ctm,this._neatlineRing=this.frame.sourceMediaBoxPolygon.rings[0];let i=f(this.frame.ctm,this._extent);this._width=i[0],this._height=i[1];let a={x:r.width/this._width,y:r.height/this._height},o=new c({width:this._width,height:this._height,pixelType:`u8`,extent:r,pixelSize:a,spatialReference:r.spatialReference,bandCount:3,keyProperties:{DataType:`Processed`}});this.createRemoteDatasetStorageInfo(o,this._tileSize,this._tileSize),this._set(`rasterInfo`,o),this.updateTileInfo()}getTileExtentPDF(e,t,n){let r=this._extent,a=2**e,o=r.width/this._width*a,s=r.height/this._height*a,c=new i({x:r.xmin,y:r.ymax});return this.getTileExtent({x:o,y:s},t,n,c,r.spatialReference,[512,512])}};e([n({type:String,json:{write:!0}})],l.prototype,`datasetFormat`,void 0),e([n({constructOnly:!0})],l.prototype,`page`,void 0),e([n({readOnly:!0})],l.prototype,`tileType`,void 0),l=e([r(`esri.layers.raster.datasets.GeospatialPDFRaster`)],l);const u=l;function d(e){return new s({width:e.width,height:e.height,pixelType:`u8`,pixels:[e.red,e.green,e.blue],mask:e.mask})}function f(e,n){let[r,i,a,o]=e,s=r*o-i*a;if(!Number.isFinite(s)||s===0)throw new t(`geospatial-pdf-raster:open`,`Failed to derive raster dimensions from an invalid PDF CTM.`);let c=10*Math.hypot(o,i)/Math.abs(s),l=10*Math.hypot(a,r)/Math.abs(s),u=Math.max(1,Math.ceil(n.width*c)),d=Math.max(1,Math.ceil(n.height*l));if(!Number.isFinite(u)||!Number.isFinite(d))throw new t(`geospatial-pdf-raster:open`,`PDF CTM produced invalid raster dimensions.`);return[u,d]}export{u as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
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{
|
|
3
|
-
`).slice(0,6).map(e=>Number(e)):null;f.transform=e?.length===6?new
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{throwIfAborted as n,eachAlways as r,createAbortError as i}from"../../../core/promiseUtils.js";import{property as a,subclass as o}from"../../../core/accessorSupport/decorators.js";import s from"../../../geometry/Extent.js";import c from"../../../geometry/SpatialReference.js";import l from"./BaseRaster.js";import u from"./InMemoryRaster.js";import{parsePAMInfo as d}from"./pamParser.js";import{parseHeader as f}from"../formats/JpgPlus.js";import{getFormat as p}from"../formats/RasterCodec.js";import{estimateStatisticsFromHistograms as m}from"../functions/stretchUtils.js";import h from"../transforms/PolynomialTransform.js";const g=`image-aux-raster:open`,_=`The data is not a supported format.`;let v=class extends l{set rasterJobHandler(e){this._set(`rasterJobHandler`,e),this._inMemoryRaster&&(this._inMemoryRaster.rasterJobHandler=e)}async fetchRawTile(e,t,n,r={}){return this._inMemoryRaster?.fetchRawTile(e,t,n,r)}async _open(e){let{data:n,format:r}=await this._fetchData(e),i,{tileGeneration:a}=this.ioConfig,o=a===`immediate`||r!==`jpg`;if(o){let a=await this._decodeFullImage(n,r,e);if(!a)throw new t(g,`The data cannot be decoded.`);i=await this._createRasterSource(a,e)}else{let r=f(n);if(!r)throw new t(g,_);i=await this._createRasterSource(r,e),i.encodedData=n}let{rasterJobHandler:s,ioConfig:c}=this,l=new u({preGenerateTiles:o,rasterJobHandler:s,source:i,ioConfig:{...c,sampling:`closest`,skipStatistics:!0}});await l.open(e),this._set(`rasterInfo`,l.rasterInfo),this._inMemoryRaster=l}async _createRasterSource(e,t){let{spatialReference:n,statistics:r,histograms:i,transform:a}=await this._fetchAuxiliaryData(t),o=!n;o&&(n=new c({wkid:3857})),i?.length&&r==null&&(r=m(i));let{width:l,height:u}=e,d=new s({xmin:-.5,ymin:.5-u,xmax:l-.5,ymax:.5,spatialReference:n}),f=a?a.forwardTransform(d):d,p=!0;if(a){let e=a.forwardCoefficients;p=e&&e[1]===0&&e[2]===0,p&&(a=null,d=f)}let h=[];return`pixels`in e&&h.push(e),{name:this.datasetName,pixelBlocks:h,imageInfo:{width:l,height:u,pixelType:`u8`,bandCount:3},extent:f,nativeExtent:d,transform:a,statistics:r,histograms:i,isPseudoSpatialReference:o,keyProperties:{DataType:`Processed`}}}async _fetchData(e){let{data:n}=await this.request(this.url,{responseType:`array-buffer`,signal:e?.signal}),r=p(n);if(r===`jpg`||r===`png`||r===`gif`||r===`bmp`)this._set(`datasetFormat`,r.toUpperCase());else throw new t(g,_);return{data:n,format:r}}async _decodeFullImage(e,t,r){try{return await this.decodePixelBlock(e,{format:t,canvasUsage:`canvas-only`,cloneSource:!0,skipStatistics:!0},r)}catch{return n(r?.signal),this.decodePixelBlock(e,{format:t,canvasUsage:`no-canvas`,skipStatistics:!0},r)}}async _fetchAuxiliaryData(e){let t=e?.signal,{skipExtensions:n=[],skipMapInfo:a}=this.ioConfig,o=a||n.includes(`aux.xml`)?null:this.request(this.url+`.aux.xml`,{responseType:`xml`,signal:t}),s=this.datasetFormat,c=s===`JPG`?`jgw`:s===`PNG`?`pgw`:s===`BMP`?`bpw`:null,l=a||c==null||n.includes(c)?null:this.request(this.url.slice(0,this.url.lastIndexOf(`.`))+`.`+c,{responseType:`text`,signal:t}),u=await r([o,l]);if(t?.aborted)throw i();let f=d(u[0].value?.data);if(!f.transform){let e=u[1].value?u[1].value.data.split(`
|
|
3
|
+
`).slice(0,6).map(e=>Number(e)):null;f.transform=e?.length===6?new h({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return f}};e([a({type:String,json:{write:!0}})],v.prototype,`datasetFormat`,void 0),e([a()],v.prototype,`rasterJobHandler`,null),v=e([o(`esri.layers.raster.datasets.ImageAuxRaster`)],v);const y=v;export{y as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{assertIsSome as n}from"../../../core/maybe.js";import{urlToObject as r}from"../../../core/urlUtils.js";import{property as i,subclass as a}from"../../../core/accessorSupport/decorators.js";import o from"../../../geometry/Extent.js";import s from"../../../geometry/Point.js";import c from"../../../geometry/SpatialReference.js";import l from"./BaseRaster.js";import{setValidBoundary as u}from"../functions/pixelUtils.js";import d from"../transforms/GCSShiftTransform.js";import f from"../../support/RasterInfo.js";import p from"../../support/RasterStorageInfo.js";import m from"../../support/TileInfo.js";import{TilemapCache as h}from"../../support/TilemapCache.js";import{patchServiceInfo as g,fetchServiceRasterInfo as _}from"../../../rest/imageService/fetchRasterInfo.js";let v=class extends l{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat=`RasterTileServer`,this.tileType=null}async fetchRawTile(e,t,n,r={}){let{storageInfo:i,extent:a}=this.rasterInfo,{transposeInfo:o}=i,s=o!=null&&!!r.transposedVariableName;if(this._slices&&!s&&r.sliceId==null)return null;let c=s?0:i.maximumPyramidLevel-e+this._levelOffset,l=`${this.url}/tile/${c}/${t}/${n}`,d={...this._slices?s?{variable:r.transposedVariableName}:{sliceId:r.sliceId||0}:null,...r.refreshParameters},f,p;if(i.isBsqTile){let e=(r.bandIds?.length?r.bandIds:[0,1,2]).map(e=>this.request(l,{query:{...d,bandId:e},responseType:`array-buffer`,signal:r.signal})),t=await Promise.all(e),n=t.map(e=>e.data.byteLength).reduce((e,t)=>e+t),i=new Uint8Array(n);p=[];let a=0;for(let{data:e}of t)p.push(a),i.set(new Uint8Array(e),a),a+=e.byteLength;f=i.buffer}else f=(await this.request(l,{query:d,responseType:`array-buffer`,signal:r.signal})).data;if(!f)return null;let{tileInfo:m}=i,h=s?o.tileSize:m.size,g=/^(mixed|jp)/i.test(m.format),_=await this.decodePixelBlock(f,{width:h[0],height:h[1],planes:p?.length,offsets:p,pixelType:null,isPoint:this.tileType===`Elevation`,returnInterleaved:s,noDataValue:this.rasterInfo.noDataValue,applyJpegMask:g});if(_==null)return null;let v=i.blockBoundary[e];if(i.compression!==`jpg`||n>v.minCol&&n<v.maxCol&&t>v.minRow&&t<v.maxRow)return _;let{origin:y,blockWidth:b,blockHeight:x}=i,{x:S,y:C}=this.getPyramidPixelSize(e),w=Math.round((a.xmin-y.x)/S)%b,T=Math.round((a.xmax-y.x)/S)%b||b,E=Math.round((y.y-a.ymax)/C)%x,D=Math.round((y.y-a.ymin)/C)%x||x,O=n===v.minCol?w:0,k=t===v.minRow?E:0,A=n===v.maxCol?T:b,j=t===v.maxRow?D:x;return u(_,{x:O,y:k},{width:A-O,height:j-k}),_}getSliceIndex(e){if(!this._slices||e==null||e.length===0)return null;let t=e;for(let e=0;e<this._slices.length;e++){let n=this._slices[e].multidimensionalDefinition;if(n.length===t.length&&!n.some(e=>{let n=t.find(t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName);return!n||(Array.isArray(e.values[0])?`${e.values[0][0]}-${e.values[0][1]}`:e.values[0])!==(Array.isArray(n.values[0])?`${n.values[0][0]}-${n.values[0][1]}`:n.values[0])}))return e}return null}async fetchVariableStatisticsHistograms(e,t){let n=this.request(this.url+`/statistics`,{query:{variable:e,f:`json`},signal:t}).then(e=>e.data?.statistics),r=this.request(this.url+`/histograms`,{query:{variable:e,f:`json`},signal:t}).then(e=>e.data?.histograms),i=await Promise.all([n,r]);return i[0]&&i[0].forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),i[1]?.[0]?.counts?.length||(i[1]=null),{statistics:i[0]||null,histograms:i[1]||null}}async computeBestPyramidLevelForLocation(e,t={}){if(!this._tilemapCache)return 0;let n=this.identifyPixelLocation(e,0,t.datumTransformation);if(n===null)return null;let r=0,{maximumPyramidLevel:i}=this.rasterInfo.storageInfo,a=i-r+this._levelOffset,o=n.srcLocation;for(;a>=0;){try{if(await this._tilemapCache.fetchAvailability(a,n.row,n.col,t)===`available`)break}catch{}if(a--,r++,n=this.identifyPixelLocation(o,r,t.datumTransformation),n===null)return null}return a===-1||n==null?null:r}async _open(e){let i=e?.signal,a=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:`json`},signal:i});a.ssl&&(this.url=this.url.replace(/^http:/i,`https:`));let o=a.data;if(this.sourceJSON=o,!o)throw new t(`imageserverraster:open`,`cannot initialize tiled image service, missing service info`);if(!o.tileInfo)throw new t(`imageserverraster:open`,`use ImageryLayer to open non-tiled image services`);this._fixScaleInServiceInfo();let s=[`jpg`,`jpeg`,`png`,`png8`,`png24`,`png32`,`mixed`];this.tileType=o.cacheType,this.tileType??=s.includes(o.tileInfo.format.toLowerCase())?`Map`:o.tileInfo.format.toLowerCase()===`lerc`?`Elevation`:`Raster`,this.datasetName=o.name?.slice(o.name.indexOf(`/`)+1)??``;let c=this.rasterInfo??await this._fetchRasterInfo({signal:i});if(c==null)throw new t(`image-server-raster:open`,`cannot initialize image service`);g(c,o);let l=this.tileType===`Map`?y(o.tileInfo,o):m.fromJSON(o.tileInfo);n(l);let[u,d]=this._computeMinMaxLOD(c,l),{extent:f,pixelSize:_}=c,v=Math.min(_.x,_.y)*.001;(_.x!==_.y||Math.abs(u.resolution-_.x)>v)&&(_.x=_.y=u.resolution,c.width=Math.ceil((f.xmax-f.xmin)/_.x-.1),c.height=Math.ceil((f.ymax-f.ymin)/_.y-.1));let x=u.level-d.level,[S,C]=l.size,w=[],T=[],{lods:E}=l;E.forEach((e,t)=>{e.level>=d.level&&e.level<=u.level&&w.push({x:e.resolution,y:e.resolution}),t<E.length-1&&T.push(Math.round(10*e.resolution/E[t+1].resolution)/10)}),w.sort((e,t)=>e.x-t.x);let D=this.computeBlockBoundary(f,S,C,l.origin,w,x),O=w.length>1?w.slice(1):null,k;o.transposeInfo&&(k={tileSize:[o.transposeInfo.rows,o.transposeInfo.cols],packetSize:c.keyProperties?._yxs.PacketSize??0});let A=T.length<=1||T.length>=3&&T.slice(0,-1).every(e=>e===T[0])?T[0]??2:Math.round(10/(d.resolution/u.resolution)**(-1/x))/10,j=!!o.bsq&&this.tileType===`Raster`;if(c.storageInfo=new p({blockWidth:l.size[0],blockHeight:l.size[1],pyramidBlockWidth:l.size[0],pyramidBlockHeight:l.size[1],pyramidResolutions:O,pyramidScalingFactor:A,compression:l.format,origin:l.origin,firstPyramidLevel:1,maximumPyramidLevel:x,tileInfo:l,isBsqTile:j,transposeInfo:k,blockBoundary:D}),b(c),this._set(`rasterInfo`,c),o.capabilities.toLowerCase().includes(`tilemap`)){let e={tileInfo:c.storageInfo.tileInfo,parsedUrl:r(this.url),url:this.url,tileServers:[]};this._tilemapCache=new h({layer:e})}}async _fetchRasterInfo(e){let t=this.sourceJSON;if(this.tileType===`Map`){let e=t.fullExtent||t.extent,n=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),r=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),i=c.fromJSON(t.spatialReference||e.spatialReference),a=new s({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:i});return new f({width:n,height:r,bandCount:3,extent:o.fromJSON(e),spatialReference:i,pixelSize:a,pixelType:`u8`,statistics:null,keyProperties:{DataType:`processed`}})}let n={...e,query:{...this.ioConfig.customFetchParameters,f:`json`}},r=_(this.url,this.sourceJSON,n),i=t.hasMultidimensions?this.request(`${this.url}/slices`,n).then(e=>e.data?.slices).catch(()=>null):null,a=await Promise.all([r,i]);return this._slices=a[1],a[0]}_fixScaleInServiceInfo(){let{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_computeMinMaxLOD(e,t){let{pixelSize:n}=e,r=.5/e.width*n.x,{lods:i}=t,a=t.lodAt(Math.max.apply(null,i.map(e=>e.level))),o=t.lodAt(Math.min.apply(null,i.map(e=>e.level))),{tileType:s}=this;if(s===`Map`)return this._levelOffset=i[0].level,[a,o];if(s===`Raster`)return[i.find(e=>e.resolution===n.x)??a,o];let{minScale:c,maxScale:l}=this.sourceJSON,u=a;l>0&&(u=i.find(e=>Math.abs(e.scale-l)<r),u||=i.filter(e=>e.scale>l).sort((e,t)=>e.scale>t.scale?1:-1)[0]??a);let d=o;return c>0&&(d=i.find(e=>Math.abs(e.scale-c)<r)??o,this._levelOffset=d.level-o.level),[u,d]}};e([i({type:String,json:{write:!0}})],v.prototype,`datasetFormat`,void 0),e([i()],v.prototype,`tileType`,void 0),v=e([a(`esri.layers.raster.datasets.ImageServerRaster`)],v);function y(e,t){if(!e)return null;let{minScale:n,maxScale:r,minLOD:i,maxLOD:a}=t;if(i!=null&&a!=null)return m.fromJSON({...e,lods:e.lods.filter(({level:e})=>e!=null&&e>=i&&e<=a)});if(n!==0&&r!==0){let t=e=>Math.round(e*1e4)/1e4,i=n?t(n):1/0,a=r?t(r):-1/0;return m.fromJSON({...e,lods:e.lods.filter(e=>{let n=t(e.scale);return n<=i&&n>=a})})}return m.fromJSON(e)}function b(e){let{extent:t,spatialReference:n}=e;t.xmin>-1&&t.xmax>181&&n?.wkid&&n.isGeographic&&(e.nativeExtent=e.extent,e.transform=new d,e.extent=e.transform.forwardTransform(t))}const x=v;export{x as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{assertIsSome as n}from"../../../core/maybe.js";import{urlToObject as r}from"../../../core/urlUtils.js";import{property as i,subclass as a}from"../../../core/accessorSupport/decorators.js";import o from"../../../geometry/Extent.js";import s from"../../../geometry/Point.js";import c from"../../../geometry/SpatialReference.js";import l from"./BaseRaster.js";import{setValidBoundary as u}from"../functions/pixelUtils.js";import d from"../transforms/GCSShiftTransform.js";import f from"../../support/RasterInfo.js";import p from"../../support/RasterStorageInfo.js";import m from"../../support/TileInfo.js";import{TilemapCache as h}from"../../support/TilemapCache.js";import{patchServiceInfo as g,fetchServiceRasterInfo as _}from"../../../rest/imageService/fetchRasterInfo.js";let v=class extends l{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat=`RasterTileServer`,this.tileType=null}async fetchRawTile(e,t,n,r={}){let{storageInfo:i,extent:a}=this.rasterInfo,{transposeInfo:o}=i,s=o!=null&&!!r.transposedVariableName;if(this._slices&&!s&&r.sliceId==null)return null;let c=s?0:i.maximumPyramidLevel-e+this._levelOffset,l=`${this.url}/tile/${c}/${t}/${n}`,d={...this._slices?s?{variable:r.transposedVariableName}:{sliceId:r.sliceId||0}:null,...r.refreshParameters},f,p;if(i.isBsqTile){let e=(r.bandIds?.length?r.bandIds:[0,1,2]).map(e=>this.request(l,{query:{...d,bandId:e},responseType:`array-buffer`,signal:r.signal})),t=await Promise.all(e),n=t.map(e=>e.data.byteLength).reduce((e,t)=>e+t),i=new Uint8Array(n);p=[];let a=0;for(let{data:e}of t)p.push(a),i.set(new Uint8Array(e),a),a+=e.byteLength;f=i.buffer}else f=(await this.request(l,{query:d,responseType:`array-buffer`,signal:r.signal})).data;if(!f)return null;let{tileInfo:m}=i,h=s?o.tileSize:m.size,g=/^(mixed|jp)/i.test(m.format),_=await this.decodePixelBlock(f,{width:h[0],height:h[1],planes:p?.length,offsets:p,pixelType:null,isPoint:this.tileType===`Elevation`,returnInterleaved:s,noDataValue:this.rasterInfo.noDataValue,applyJpegMask:g},{signal:r.signal});if(_==null)return null;let v=i.blockBoundary[e];if(i.compression!==`jpg`||n>v.minCol&&n<v.maxCol&&t>v.minRow&&t<v.maxRow)return _;let{origin:y,blockWidth:b,blockHeight:x}=i,{x:S,y:C}=this.getPyramidPixelSize(e),w=Math.round((a.xmin-y.x)/S)%b,T=Math.round((a.xmax-y.x)/S)%b||b,E=Math.round((y.y-a.ymax)/C)%x,D=Math.round((y.y-a.ymin)/C)%x||x,O=n===v.minCol?w:0,k=t===v.minRow?E:0,A=n===v.maxCol?T:b,j=t===v.maxRow?D:x;return u(_,{x:O,y:k},{width:A-O,height:j-k}),_}getSliceIndex(e){if(!this._slices||e==null||e.length===0)return null;let t=e;for(let e=0;e<this._slices.length;e++){let n=this._slices[e].multidimensionalDefinition;if(n.length===t.length&&!n.some(e=>{let n=t.find(t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName);return!n||(Array.isArray(e.values[0])?`${e.values[0][0]}-${e.values[0][1]}`:e.values[0])!==(Array.isArray(n.values[0])?`${n.values[0][0]}-${n.values[0][1]}`:n.values[0])}))return e}return null}async fetchVariableStatisticsHistograms(e,t){let n=this.request(this.url+`/statistics`,{query:{variable:e,f:`json`},signal:t}).then(e=>e.data?.statistics),r=this.request(this.url+`/histograms`,{query:{variable:e,f:`json`},signal:t}).then(e=>e.data?.histograms),i=await Promise.all([n,r]);return i[0]&&i[0].forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),i[1]?.[0]?.counts?.length||(i[1]=null),{statistics:i[0]||null,histograms:i[1]||null}}async computeBestPyramidLevelForLocation(e,t={}){if(!this._tilemapCache)return 0;let n=this.identifyPixelLocation(e,0,t.datumTransformation);if(n===null)return null;let r=0,{maximumPyramidLevel:i}=this.rasterInfo.storageInfo,a=i-r+this._levelOffset,o=n.srcLocation;for(;a>=0;){try{if(await this._tilemapCache.fetchAvailability(a,n.row,n.col,t)===`available`)break}catch{}if(a--,r++,n=this.identifyPixelLocation(o,r,t.datumTransformation),n===null)return null}return a===-1||n==null?null:r}async _open(e){let i=e?.signal,a=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:`json`},signal:i});a.ssl&&(this.url=this.url.replace(/^http:/i,`https:`));let o=a.data;if(this.sourceJSON=o,!o)throw new t(`imageserverraster:open`,`cannot initialize tiled image service, missing service info`);if(!o.tileInfo)throw new t(`imageserverraster:open`,`use ImageryLayer to open non-tiled image services`);this._fixScaleInServiceInfo();let s=[`jpg`,`jpeg`,`png`,`png8`,`png24`,`png32`,`mixed`];this.tileType=o.cacheType,this.tileType??=s.includes(o.tileInfo.format.toLowerCase())?`Map`:o.tileInfo.format.toLowerCase()===`lerc`?`Elevation`:`Raster`,this.datasetName=o.name?.slice(o.name.indexOf(`/`)+1)??``;let c=this.rasterInfo??await this._fetchRasterInfo({signal:i});if(c==null)throw new t(`image-server-raster:open`,`cannot initialize image service`);g(c,o);let l=this.tileType===`Map`?y(o.tileInfo,o):m.fromJSON(o.tileInfo);n(l);let[u,d]=this._computeMinMaxLOD(c,l),{extent:f,pixelSize:_}=c,v=Math.min(_.x,_.y)*.001;(_.x!==_.y||Math.abs(u.resolution-_.x)>v)&&(_.x=_.y=u.resolution,c.width=Math.ceil((f.xmax-f.xmin)/_.x-.1),c.height=Math.ceil((f.ymax-f.ymin)/_.y-.1));let x=u.level-d.level,[S,C]=l.size,w=[],T=[],{lods:E}=l;E.forEach((e,t)=>{e.level>=d.level&&e.level<=u.level&&w.push({x:e.resolution,y:e.resolution}),t<E.length-1&&T.push(Math.round(10*e.resolution/E[t+1].resolution)/10)}),w.sort((e,t)=>e.x-t.x);let D=this.computeBlockBoundary(f,S,C,l.origin,w,x),O=w.length>1?w.slice(1):null,k;o.transposeInfo&&(k={tileSize:[o.transposeInfo.rows,o.transposeInfo.cols],packetSize:c.keyProperties?._yxs.PacketSize??0});let A=T.length<=1||T.length>=3&&T.slice(0,-1).every(e=>e===T[0])?T[0]??2:Math.round(10/(d.resolution/u.resolution)**(-1/x))/10,j=!!o.bsq&&this.tileType===`Raster`;if(c.storageInfo=new p({blockWidth:l.size[0],blockHeight:l.size[1],pyramidBlockWidth:l.size[0],pyramidBlockHeight:l.size[1],pyramidResolutions:O,pyramidScalingFactor:A,compression:l.format,origin:l.origin,firstPyramidLevel:1,maximumPyramidLevel:x,tileInfo:l,isBsqTile:j,transposeInfo:k,blockBoundary:D}),b(c),this._set(`rasterInfo`,c),o.capabilities.toLowerCase().includes(`tilemap`)){let e={tileInfo:c.storageInfo.tileInfo,parsedUrl:r(this.url),url:this.url,tileServers:[]};this._tilemapCache=new h({layer:e})}}async _fetchRasterInfo(e){let t=this.sourceJSON;if(this.tileType===`Map`){let e=t.fullExtent||t.extent,n=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),r=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),i=c.fromJSON(t.spatialReference||e.spatialReference),a=new s({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:i});return new f({width:n,height:r,bandCount:3,extent:o.fromJSON(e),spatialReference:i,pixelSize:a,pixelType:`u8`,statistics:null,keyProperties:{DataType:`processed`}})}let n={...e,query:{...this.ioConfig.customFetchParameters,f:`json`}},r=_(this.url,this.sourceJSON,n),i=t.hasMultidimensions?this.request(`${this.url}/slices`,n).then(e=>e.data?.slices).catch(()=>null):null,a=await Promise.all([r,i]);return this._slices=a[1],a[0]}_fixScaleInServiceInfo(){let{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_computeMinMaxLOD(e,t){let{pixelSize:n}=e,r=.5/e.width*n.x,{lods:i}=t,a=t.lodAt(Math.max.apply(null,i.map(e=>e.level))),o=t.lodAt(Math.min.apply(null,i.map(e=>e.level))),{tileType:s}=this;if(s===`Map`)return this._levelOffset=i[0].level,[a,o];if(s===`Raster`)return[i.find(e=>e.resolution===n.x)??a,o];let{minScale:c,maxScale:l}=this.sourceJSON,u=a;l>0&&(u=i.find(e=>Math.abs(e.scale-l)<r),u||=i.filter(e=>e.scale>l).sort((e,t)=>e.scale>t.scale?1:-1)[0]??a);let d=o;return c>0&&(d=i.find(e=>Math.abs(e.scale-c)<r)??o,this._levelOffset=d.level-o.level),[u,d]}};e([i({type:String,json:{write:!0}})],v.prototype,`datasetFormat`,void 0),e([i()],v.prototype,`tileType`,void 0),v=e([a(`esri.layers.raster.datasets.ImageServerRaster`)],v);function y(e,t){if(!e)return null;let{minScale:n,maxScale:r,minLOD:i,maxLOD:a}=t;if(i!=null&&a!=null)return m.fromJSON({...e,lods:e.lods.filter(({level:e})=>e!=null&&e>=i&&e<=a)});if(n!==0&&r!==0){let t=e=>Math.round(e*1e4)/1e4,i=n?t(n):1/0,a=r?t(r):-1/0;return m.fromJSON({...e,lods:e.lods.filter(e=>{let n=t(e.scale);return n<=i&&n>=a})})}return m.fromJSON(e)}function b(e){let{extent:t,spatialReference:n}=e;t.xmin>-1&&t.xmax>181&&n?.wkid&&n.isGeographic&&(e.nativeExtent=e.extent,e.transform=new d,e.extent=e.transform.forwardTransform(t))}const x=v;export{x as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{eachAlways as n}from"../../../core/promiseUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import a from"../../../geometry/Extent.js";import o from"../../../geometry/SpatialReference.js";import s from"./BaseRaster.js";import{getSliceIndex as c}from"./multidimensionalUtils.js";import{clipTile as l,split as u}from"../functions/pixelUtils.js";import{estimateStatisticsHistograms as d,computeStatisticsHistograms as f}from"../functions/stretchUtils.js";import p from"../../support/DimensionalDefinition.js";import m from"../../support/RasterInfo.js";let h=class extends s{constructor(){super(...arguments),this.datasetFormat=`MEMORY`,this.preGenerateTiles=!0,this.source=null}get url(){return``}fetchRawTile(e,t,n,r={}){if(!this.
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{eachAlways as n}from"../../../core/promiseUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import a from"../../../geometry/Extent.js";import o from"../../../geometry/SpatialReference.js";import s from"./BaseRaster.js";import{getSliceIndex as c}from"./multidimensionalUtils.js";import{clipTile as l,split as u}from"../functions/pixelUtils.js";import{estimateStatisticsHistograms as d,computeStatisticsHistograms as f}from"../functions/stretchUtils.js";import p from"../../support/DimensionalDefinition.js";import m from"../../support/RasterInfo.js";let h=class extends s{constructor(){super(...arguments),this._pixelBlockTiles=new Map,this.datasetFormat=`MEMORY`,this.preGenerateTiles=!0,this.source=null}get url(){return``}async fetchRawTile(e,t,n,r={}){let i=`${e}/${t}/${n}`,a=this._pixelBlockTiles.get(i);if(a)return a;if(!this.source)return null;let{rasterInfo:o}=this,[s,c]=o.storageInfo.tileInfo.size,{sliceId:u}=r,{encodedData:d}=this.source;if(d){let a=await this.decodePixelBlock(d,{tileSize:[s,c],tileIndex:[e,t,n],canvasUsage:`canvas-only`,cloneSource:!0,skipStatistics:!0},{signal:r.signal});return a&&this._pixelBlockTiles.set(i,a),a}let{pixelBlocks:f}=this.source,p=u==null?f[0]:f[u];if(p==null)return null;let m={pixelBlock:p,useBilinear:o.dataType!==`thematic`,tileSize:{width:s,height:c},level:e,row:t,col:n};return this.rasterJobHandler?this.rasterJobHandler.clipTile(m,r):l(m)}async _open(e){if(!this.source)throw new t(`in-memory-raster:open`,`source is required to open an in memory raster`);let n=this.source;this.datasetName=n.name;let{pixelBlocks:r,attributeTable:i,statistics:s,histograms:c,nativeExtent:l,transform:u,colormap:d}=n,f=r[0],{width:p,height:h,pixelType:g}=f??n.imageInfo,_=n.extent??new a({xmin:-.5,ymin:.5,xmax:p-.5,ymax:h-.5,spatialReference:new o({wkid:3857})}),v=n.isPseudoSpatialReference??!n.extent,y={x:_.width/p,y:_.height/h},b={...n.keyProperties};n.dataType&&(b.DataType=n.dataType),n.bandInfos&&(b.BandProperties=n.bandInfos.map(e=>e.toJSON())),i&&(b.DataType=`Thematic`);let x=new m({width:p,height:h,pixelType:g,extent:_,nativeExtent:l,attributeTable:i,colormap:d,transform:u,pixelSize:y,spatialReference:_.spatialReference,bandCount:f?.pixels.length??n.imageInfo.bandCount,keyProperties:b,multidimensionalInfo:n.multidimensionalInfo,statistics:s,isPseudoSpatialReference:v,histograms:c});this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(x),this.createRemoteDatasetStorageInfo(x,512,512),this._set(`rasterInfo`,x),this.updateTileInfo(),x.multidimensionalInfo?await this._buildMDimStats(r,x.multidimensionalInfo):this.preGenerateTiles&&f&&(await this._buildInMemoryRaster(f,{width:512,height:512},e),this.source=null)}async _buildInMemoryRaster(e,r,i){let{rasterInfo:a}=this,o=a.storageInfo.maximumPyramidLevel??0,s=a.dataType!==`thematic`,c=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:r,maximumPyramidLevel:o,useBilinear:s},i):Promise.resolve(u(e,r,o,s)),l=a.statistics!=null,f=a.histograms!=null,p=this.ioConfig.skipStatistics||l?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve(d(e)),m=await n([c,p]);if(!m[0].value)throw new t(`in-memory-raster:open`,`failed to build in memory raster`);this._pixelBlockTiles=m[0].value,l||(a.statistics=m[1].value?.statistics),f||(a.histograms=m[1].value?.histograms)}async _buildMDimStats(e,t,n){for(let r=0;r<t.variables.length;r++){let i=t.variables[r];if(i.statistics)continue;let a=i.dimensions.map(e=>new p({variableName:i.name,dimensionName:e.name,values:[e.values?.[0]??e.extent?.[0]],isSlice:!0})),o=c(a,t),s=o==null?null:e[o];if(s==null)continue;let l=this.rasterJobHandler?await this.rasterJobHandler.computeStatisticsHistograms({pixelBlock:s},n):f(s);i.statistics=l.statistics,i.histograms||=l.histograms}}};e([r({type:String,json:{write:!0}})],h.prototype,`datasetFormat`,void 0),e([r({constructOnly:!0})],h.prototype,`preGenerateTiles`,void 0),e([r()],h.prototype,`source`,void 0),e([r()],h.prototype,`url`,null),h=e([i(`esri.layers.raster.datasets.InMemoryRaster`)],h);const g=h;export{g as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import i from"../../../geometry/Extent.js";import a from"../../../geometry/Point.js";import o from"../../../geometry/SpatialReference.js";import s from"./BaseRaster.js";import{parseSpatialReference as c,parsePAMInfo as l}from"./pamParser.js";import{getElement as u,getElementValue as d}from"./xmlUtilities.js";import{isPlatformLittleEndian as f}from"../formats/utils.js";import{estimateStatisticsFromHistograms as p}from"../functions/stretchUtils.js";import m from"../../support/PixelBlock.js";import h from"../../support/RasterInfo.js";import g from"../../support/RasterStorageInfo.js";const _=new Map([[`byte`,`u8`],[`signedbyte`,`s8`],[`int8`,`s8`],[`uint8`,`u8`],[`int16`,`s16`],[`uint16`,`u16`],[`int32`,`s32`],[`uint32`,`u32`],[`float32`,`f32`],[`float64`,`f64`],[`double64`,`f64`]]),v=new Map;v.set(`none`,{blobExtension:`.til`,isOneSegment:!0,decoderFormat:`bip`}),v.set(`lerc`,{blobExtension:`.lrc`,isOneSegment:!1,decoderFormat:`lerc`}),v.set(`deflate`,{blobExtension:`.pzp`,isOneSegment:!0,decoderFormat:`deflate`}),v.set(`jpeg`,{blobExtension:`.pjg`,isOneSegment:!0,decoderFormat:`jpg`}),v.set(`qb3`,{blobExtension:`.pq3`,isOneSegment:!0,decoderFormat:`qb3`});let y=class extends s{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this._isBsq=!1,this.datasetFormat=`MRF`}async fetchRawTile(e,t,n,r={}){let{blockWidth:i,blockHeight:a,blockBoundary:o}=this.rasterInfo.storageInfo,s=o[e];if(!s||s.maxRow<t||s.maxCol<n||s.minRow>t||s.minCol>n)return null;let{bandCount:c,pixelType:l}=this.rasterInfo,{ranges:u,actualTileWidth:d,actualTileHeight:f}=this._getTileLocation(e,t,n);if(!u||u.length===0)return null;if(u.some(e=>e.from>e.to)){let e=new Uint8Array(i*a);return new m({width:i,height:a,pixels:void 0,mask:e,validPixelCount:0})}let{bandIds:p}=this.ioConfig,h=this._getBandSegmentCount(),g=[],_=0;for(_=0;_<h;_++)(!p||p.includes(_))&&g.push(this.request(this._files.data,{range:{from:u[_].from,to:u[_].to},responseType:`array-buffer`,signal:r.signal}));let y=await Promise.all(g),b=y.map(e=>e.data.byteLength).reduce((e,t)=>e+t),x=new Uint8Array(b),S=[],C=0;for(_=0;_<h;_++)S.push(C),x.set(new Uint8Array(y[_].data),C),C+=y[_].data.byteLength;let w=v.get(this.rasterInfo.storageInfo.compression).decoderFormat,T=w===`jpg`&&c===4&&S.length===1,E=await this.decodePixelBlock(x.buffer,{width:i,height:a,format:w,planes:p?.length||c,offsets:S,pixelType:l,canvasUsage:T?`no-canvas`:void 0,decodeJpegAsRgb:!1}
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import i from"../../../geometry/Extent.js";import a from"../../../geometry/Point.js";import o from"../../../geometry/SpatialReference.js";import s from"./BaseRaster.js";import{parseSpatialReference as c,parsePAMInfo as l}from"./pamParser.js";import{getElement as u,getElementValue as d}from"./xmlUtilities.js";import{isPlatformLittleEndian as f}from"../formats/utils.js";import{estimateStatisticsFromHistograms as p}from"../functions/stretchUtils.js";import m from"../../support/PixelBlock.js";import h from"../../support/RasterInfo.js";import g from"../../support/RasterStorageInfo.js";const _=new Map([[`byte`,`u8`],[`signedbyte`,`s8`],[`int8`,`s8`],[`uint8`,`u8`],[`int16`,`s16`],[`uint16`,`u16`],[`int32`,`s32`],[`uint32`,`u32`],[`float32`,`f32`],[`float64`,`f64`],[`double64`,`f64`]]),v=new Map;v.set(`none`,{blobExtension:`.til`,isOneSegment:!0,decoderFormat:`bip`}),v.set(`lerc`,{blobExtension:`.lrc`,isOneSegment:!1,decoderFormat:`lerc`}),v.set(`deflate`,{blobExtension:`.pzp`,isOneSegment:!0,decoderFormat:`deflate`}),v.set(`jpeg`,{blobExtension:`.pjg`,isOneSegment:!0,decoderFormat:`jpg`}),v.set(`qb3`,{blobExtension:`.pq3`,isOneSegment:!0,decoderFormat:`qb3`});let y=class extends s{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this._isBsq=!1,this.datasetFormat=`MRF`}async fetchRawTile(e,t,n,r={}){let{blockWidth:i,blockHeight:a,blockBoundary:o}=this.rasterInfo.storageInfo,s=o[e];if(!s||s.maxRow<t||s.maxCol<n||s.minRow>t||s.minCol>n)return null;let{bandCount:c,pixelType:l}=this.rasterInfo,{ranges:u,actualTileWidth:d,actualTileHeight:f}=this._getTileLocation(e,t,n);if(!u||u.length===0)return null;if(u.some(e=>e.from>e.to)){let e=new Uint8Array(i*a);return new m({width:i,height:a,pixels:void 0,mask:e,validPixelCount:0})}let{bandIds:p}=this.ioConfig,h=this._getBandSegmentCount(),g=[],_=0;for(_=0;_<h;_++)(!p||p.includes(_))&&g.push(this.request(this._files.data,{range:{from:u[_].from,to:u[_].to},responseType:`array-buffer`,signal:r.signal}));let y=await Promise.all(g),b=y.map(e=>e.data.byteLength).reduce((e,t)=>e+t),x=new Uint8Array(b),S=[],C=0;for(_=0;_<h;_++)S.push(C),x.set(new Uint8Array(y[_].data),C),C+=y[_].data.byteLength;let w=v.get(this.rasterInfo.storageInfo.compression).decoderFormat,T=w===`jpg`&&c===4&&S.length===1,E=await this.decodePixelBlock(x.buffer,{width:i,height:a,format:w,planes:p?.length||c,offsets:S,pixelType:l,canvasUsage:T?`no-canvas`:void 0,decodeJpegAsRgb:!1},{signal:r.signal});if(E==null)return null;let{noDataValue:D}=this.rasterInfo;if(D!=null&&w!==`lerc`&&!E.mask&&(D=D[0],D!=null)){let e=E.width*E.height,t=new Uint8Array(e);if(Math.abs(D)>1e24)for(_=0;_<e;_++)Math.abs((E.pixels[0][_]-D)/D)>1e-6&&(t[_]=1);else for(_=0;_<e;_++)E.pixels[0][_]!==D&&(t[_]=1);E.mask=t}let O=0,k=0;if(d!==i||f!==a){let e=E.mask;if(e)for(_=0;_<a;_++)if(k=_*i,_<f)for(O=d;O<i;O++)e[k+O]=0;else for(O=0;O<i;O++)e[k+O]=0;else for(e=new Uint8Array(i*a),E.mask=e,_=0;_<f;_++)for(k=_*i,O=0;O<d;O++)e[k+O]=1}return E}async _open(e){this.datasetName=this.url.slice(this.url.lastIndexOf(`/`)+1);let t=e?e.signal:null,n=await this.request(this.url,{responseType:`xml`,signal:t}),{rasterInfo:r,files:i}=this._parseHeader(n.data),{skipMapInfo:a,skipExtensions:o=[]}=this.ioConfig;if(!o.includes(`aux.xml`)&&!a){let t=await this._fetchAuxiliaryData(e);t!=null&&(r.statistics=t.statistics??r.statistics,r.histograms=t.histograms,t.histograms&&r.statistics==null&&(r.statistics=p(t.histograms)))}a&&this.updateImageSpaceRasterInfo(r),this._set(`rasterInfo`,r),this._files=i;let s=await this.request(i.index,{responseType:`array-buffer`,signal:t});this._storageIndex=b(s.data);let{blockWidth:c,blockHeight:l}=this.rasterInfo.storageInfo,u=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:d,height:f}=this.rasterInfo,m=[],h=this._getBandSegmentCount(),g=0,_=-1;for(;g<this._storageIndex.length;){_++;let e=Math.ceil(d/c/u**_)-1,t=Math.ceil(f/l/u**_)-1;g+=(e+1)*(t+1)*h*4,m.push({maxRow:t,maxCol:e,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=m,_>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=_),this.updateTileInfo()}_getBandSegmentCount(){return this._isBsq?this.rasterInfo.bandCount:1}_getTileLocation(e,t,n){let{blockWidth:r,blockHeight:i,pyramidScalingFactor:a}=this.rasterInfo.storageInfo,{width:o,height:s}=this.rasterInfo,c=this._getBandSegmentCount(),l,u,d,f=0,p=0;for(d=0;d<e;d++)p=a**d,l=Math.ceil(o/r/p),u=Math.ceil(s/i/p),f+=l*u;p=a**e,l=Math.ceil(o/r/p),u=Math.ceil(s/i/p),f+=t*l+n,f*=c*4;let m=this._storageIndex.subarray(f,f+4*c),h=0,g=0,_=[];for(let e=0;e<c;e++)h=m[e*4]*2**32+m[e*4+1],g=h+m[e*4+2]*2**32+m[e*4+3]-1,_.push({from:h,to:g});return{ranges:_,actualTileWidth:n<l-1?r:Math.ceil(o/p)-r*(l-1),actualTileHeight:t<u-1?i:Math.ceil(s/p)-i*(u-1)}}_parseHeader(e){let n=u(e,`MRF_META/Raster`);if(!n)throw new t(`mrf:open`,`not a valid MRF format`);let r=u(n,`Size`),s=parseInt(r.getAttribute(`x`),10),l=parseInt(r.getAttribute(`y`),10),f=parseInt(r.getAttribute(`c`),10),p=(d(n,`Compression`)||`none`).toLowerCase();if(!v.has(p))throw new t(`mrf:open`,`currently does not support compression `+p);let m=d(n,`DataType`)||`UInt8`,y=_.get(m.toLowerCase());if(y==null)throw new t(`mrf:open`,`currently does not support pixel type `+m);let b=u(n,`PageSize`),x=parseInt(b.getAttribute(`x`),10),S=parseInt(b.getAttribute(`y`),10),C=b.getAttribute(`c`),w=C?C===String(f):v.get(p).isOneSegment;this._isBsq=!w;let T=u(n,`DataValues`),E;if(T){let e=T.getAttribute(`NoData`);e!=null&&(E=e.trim().split(` `).map(e=>parseFloat(e)))}if(u(e,`MRF_META/CachedSource`))throw new t(`mrf:open`,`currently does not support MRF referencing other data files`);let D=u(e,`MRF_META/GeoTags`),O=u(D,`BoundingBox`),k=!1,A;if(O!=null){let e=parseFloat(O.getAttribute(`minx`)),t=parseFloat(O.getAttribute(`miny`)),n=parseFloat(O.getAttribute(`maxx`)),r=parseFloat(O.getAttribute(`maxy`)),a=d(D,`Projection`)||``,s=o.WGS84;if(a!==`LOCAL_CS[]`){if(a.toLowerCase().startsWith(`epsg:`)){let e=Number(a.slice(5));!isNaN(e)&&e!==0&&(s=new o({wkid:e}))}else s=c(a)??o.WGS84}else k=!0,s=new o({wkid:3857});A=new i(e,t,n,r),A.spatialReference=s}else k=!0,A=new i({xmin:-.5,ymin:.5-l,xmax:s-.5,ymax:.5,spatialReference:new o({wkid:3857})});let j=u(e,`MRF_META/Rsets`),M=parseInt(j?.getAttribute(`scale`)||`2`,10),N=A.spatialReference,P=new g({origin:new a({x:A.xmin,y:A.ymax,spatialReference:N}),blockWidth:x,blockHeight:S,pyramidBlockWidth:x,pyramidBlockHeight:S,compression:p,pyramidScalingFactor:M}),F=new a({x:A.width/s,y:A.height/l,spatialReference:N}),I=new h({width:s,height:l,extent:A,isPseudoSpatialReference:k,spatialReference:N,bandCount:f,pixelType:y,pixelSize:F,noDataValue:E,storageInfo:P}),L=this._getAuxFullPath(d(n,`DataFile`)),R=this._getAuxFullPath(d(n,`IndexFile`));return{rasterInfo:I,files:{mrf:this.url,index:R||this.url.replace(`.mrf`,`.idx`),data:L||this.url.replace(`.mrf`,v.get(p).blobExtension)}}}_getAuxFullPath(e){return!e||e.includes(`\\`)?null:e.includes(`/`)?e.startsWith(new URL(this.url).origin)?e:null:`${this.url.slice(0,this.url.lastIndexOf(`/`))}/${e}`}async _fetchAuxiliaryData(e){try{let{data:t}=await this.request(this.url+`.aux.xml`,{responseType:`xml`,signal:e?.signal});return l(t)}catch{return null}}};e([n()],y.prototype,`_files`,void 0),e([n()],y.prototype,`_storageIndex`,void 0),e([n()],y.prototype,`_isBsq`,void 0),e([n({type:String,json:{write:!0}})],y.prototype,`datasetFormat`,void 0),y=e([r(`esri.layers.raster.datasets.MRFRaster`)],y);function b(e){if(e.byteLength%16>0)throw Error(`invalid array buffer must be multiples of 16`);let t;if(f){let n=new Uint8Array(e),r=new ArrayBuffer(e.byteLength),i=new Uint8Array(r);for(let t=0;t<e.byteLength/4;t++)for(let e=0;e<4;e++)i[t*4+e]=n[t*4+3-e];t=new Uint32Array(r)}else t=new Uint32Array(e);return t}const x=y;export{x as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import"../../../core/has.js";import n from"../../../core/Logger.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import a from"../../../geometry/Extent.js";import o from"../../../geometry/Point.js";import s from"../../../geometry/SpatialReference.js";import c from"./BaseRaster.js";import{parse as l}from"./DBFParser.js";import{parsePAMInfo as u,parseSpatialReference as d}from"./pamParser.js";import{parseSignature as f,getPyramidIFDs as p,getMaskIFDs as m,parseIFD as h,parseFieldValues as g,isBSQConfig as _,getTagNumericValues as v,getTagFirstNumericValue as y,getImageInfo as b}from"../formats/tiffParser.js";import{tiffTags as x,geoKeys as S}from"../formats/tiffTag.js";import{estimateStatisticsFromHistograms as C}from"../functions/stretchUtils.js";import w from"../transforms/PolynomialTransform.js";import T from"../../support/RasterInfo.js";import E from"../../support/RasterStorageInfo.js";import D from"../../../rest/support/FeatureSet.js";const O=`none-tiled tiff is not optimized for access, convert to COG and retry.`;let k=class extends c{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this._chunkSize=10*1024**2,this.datasetFormat=`TIFF`}async fetchRawTile(e,t,n,r={}){if(!this._headerInfo?.isSupported||this.isBlockOutside(e,t,n))return null;let i=await this._fetchRawTiffTile(e,t,n,!1,r);if(i!=null&&this._headerInfo.hasMaskBand){let a=await this._fetchRawTiffTile(e,t,n,!0,r);a!=null&&a.pixels[0]instanceof Uint8Array&&(i.mask=a.pixels[0])}return i}async _open(e){let r=e?e.signal:null,{data:i}=await this.request(this.url,{range:{from:0,to:this._bufferSize},responseType:`array-buffer`,signal:r});if(!i)throw new t(`tiffraster:open`,`failed to open url `+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf(`/`)+1,this.url.lastIndexOf(`.`));let{littleEndian:a,firstIFDPos:o,isBigTiff:s}=f(i),c=[],l={fileChunk:i,posIFD:o,fileOffset:0};await this._readIFDs(c,l,a,s?8:4,r);let{imageInfo:u,rasterInfo:d}=A(c),h=p(c),g=m(c);if(this._headerInfo={littleEndian:a,isBigTiff:s,ifds:c,pyramidIFDs:h,maskIFDs:g,...u},this._set(`rasterInfo`,d),!u.isSupported)throw new t(`tiffraster:open`,`this tiff is not supported: `+u.message);if(!u.tileWidth||!u.tileHeight)throw new t(`tiffraster:open`,O);d.isPseudoSpatialReference&&n.getLogger(this).warn(`The spatial reference for this tiff is unsupported. Only EPSG spatial reference codes and Esri WKTs are supported.`);let _=c[0].get(`PREDICTOR`)?.values?.[0];if(c[0].get(`SAMPLEFORMAT`)?.values?.[0]===3&&_===2)throw new t(`tiffraster:open`,`unsupported horizontal difference encoding. Predictor=3 is supported for floating point data`);let{skipMapInfo:v,skipExtensions:y=[]}=this.ioConfig;if(!y.includes(`aux.xml`)&&!v){let t=await this._fetchAuxiliaryMetaData(e);t!=null&&j(t,d)}!y.includes(`vat.dbf`)&&d.bandCount===1&&d.pixelType===`u8`&&!v&&(d.attributeTable=await this._fetchAuxiliaryTable(e),d.attributeTable!=null&&(d.keyProperties.DataType=`thematic`)),v&&this.updateImageSpaceRasterInfo(d),this.updateTileInfo()}async _validateOrFetchHeaderBuffer(e,t){let{fileChunk:n,fileOffset:r,posIFD:i}=e;return(i+8>=n.byteLength||i<0)&&(r=i+r,n=(await this.request(this.url,{range:{from:r,to:r+this._bufferSize},responseType:`array-buffer`,signal:t})).data,i=0),{fileChunk:n,fileOffset:r,posIFD:i}}async _readIFDs(e,n,r,i=4,a){if(!n.posIFD)return null;n=await this._validateOrFetchHeaderBuffer(n,a);let o=await this._readIFD(n,r,x,i,a);if(!o?.ifd)throw new t(`tiffraster:open`,`cannot parse tiff header. failed to open url `+this.url);if(e.push(o.ifd),!o.nextIFD)return null;n.posIFD=o.nextIFD-n.fileOffset,await this._readIFDs(e,n,r,i,a)}async _readIFD(e,n,r=x,i=4,a){let{fileChunk:o,posIFD:s,fileOffset:c}=e;if(!e.fileChunk)return null;let l=h(o,n,s,c,r,i);if(l.success){let{ifd:e}=l;if(!e)throw new t(`tiffraster:open`,`cannot parse tiff header. failed to open url `+this.url);if(!this.ioConfig.loadFullMetadata&&r===x&&(!e.has(`TILEWIDTH`)||!e.has(`TILELENGTH`)))throw new t(`tiffraster:open`,O);let i=[];if(e.forEach(e=>{e.values||i.push(e)}),i.length>0&&await this._fillOffsets(i,n,l.nextIFD,a),e.has(`GEOKEYDIRECTORY`)){let t=e.get(`GEOKEYDIRECTORY`),r=t?.values;if(r&&r.length>4){let e=r[0]+`.`+r[1]+`.`+r[2];s=t.valueOffset+6-c;let i=await this._validateOrFetchHeaderBuffer({fileChunk:o,posIFD:s,fileOffset:c},a);t.data=(await this._readIFD(i,n,S,2,a))?.ifd,t.data&&t.data.set(`GEOTIFFVersion`,{id:0,type:2,valueCount:1,valueOffset:null,values:[e]})}}return l}return l.requiredBufferSize?(o=(await this.request(this.url,{range:{from:c,to:c+s+l.requiredBufferSize+8},responseType:`array-buffer`,signal:a})).data,o.byteLength<s+l.requiredBufferSize?null:(e.fileChunk=o,e.fileOffset=c,this._readIFD(e,n,r,i,a))):null}async _fillOffsets(e,t,n,r){let i=e.filter(e=>e.offlineOffsetSize!=null);if(i.length===0)return;let a=i.map(e=>e.offlineOffsetSize),o=Math.min.apply(null,a.map(e=>e[0])),s=Math.max.apply(null,a.map(e=>e[0]+e[1])),c=a.length===1||s-o<=this._bufferSize;if(!c&&a.length>1&&(a.sort((e,t)=>e[0]-t[0]),c=a.reduce((e,t)=>e===t[0]?t[0]+t[1]:0,a[0][0])===s),c){let e=await this._fetchOffsets(o,Math.max(s,o+this._bufferSize),r);i.forEach(n=>g(e,t,n,o));return}let l=i.map(async e=>{let n=e.offlineOffsetSize,i=await this._fetchOffsets(n[0],n[1]+n[0],r);g(i,t,e,n[0])});await Promise.all(l)}async _fetchOffsets(e,t,n){let r=[],i=this._chunkSize,a=Math.ceil((t-e)/i),o=e;for(let e=0;e<a;e++)r.push(this.request(this.url,{range:{from:o,to:e===a-1?t:o+i-1},responseType:`array-buffer`,signal:n})),o+=i;let s=await Promise.all(r);if(a===1)return s[0].data;let c=new Uint8Array(t-e+1);for(let e=0;e<a;e++)c.set(new Uint8Array(s[e].data),e*i);return c.buffer}async _fetchRawTiffTile(e,t,n,r,i={}){let a=this._getTileLocation(e,t,n,r);if(!a)return null;let{ranges:o,actualTileWidth:s,actualTileHeight:c,ifd:l}=a,u=o.map(e=>this.request(this.url,{range:e,responseType:`array-buffer`,signal:i.signal})),d=await Promise.all(u),f=d.map(e=>e.data.byteLength).reduce((e,t)=>e+t),p=d.length===1?d[0].data:new ArrayBuffer(f),m=[0],h=[0];if(d.length>1){let e=new Uint8Array(p);for(let t=0,n=0;t<d.length;t++){let r=d[t].data;e.set(new Uint8Array(r),n),m[t]=n,n+=r.byteLength,h[t]=r.byteLength}}let{blockWidth:g,blockHeight:_}=this.getBlockWidthHeight(e),v=await this.decodePixelBlock(p,{format:`tiff`,customOptions:{headerInfo:this._headerInfo,ifd:l,offsets:m,sizes:h},width:g,height:_,planes:null,pixelType:null});if(v==null)return null;if(s!==g||c!==_){let e=v.mask;if(e)for(let t=0;t<_;t++){let n=t*g;if(t<c)for(let t=s;t<g;t++)e[n+t]=0;else for(let t=0;t<g;t++)e[n+t]=0}else{e=new Uint8Array(g*_),v.mask=e;for(let t=0;t<c;t++){let n=t*g;for(let t=0;t<s;t++)e[n+t]=1}}}return v}_getTileLocation(e,t,n,r=!1){let{firstPyramidLevel:i,blockBoundary:a}=this.rasterInfo.storageInfo,o=e===0?0:e-(i-1),{_headerInfo:s}=this;if(!s)return null;let c=r?s.maskIFDs[o]:o===0?s.ifds[0]:s.pyramidIFDs[o-1];if(!c)return null;let l=_(c,s),u=v(c,`TILEOFFSETS`),d=v(c,`TILEBYTECOUNTS`);if(!u?.length||!d?.length)return null;let{minRow:f,minCol:p,maxRow:m,maxCol:h}=a[o];if(t>m||n>h||t<f||n<p)return null;let g=y(c,`IMAGEWIDTH`),b=y(c,`IMAGELENGTH`),x=y(c,`TILEWIDTH`),S=y(c,`TILELENGTH`),C=[];if(l){let{bandCount:e}=this.rasterInfo;for(let r=0;r<e;r++){let e=r*(m+1)*(h+1)+t*(h+1)+n;C[r]={from:u[e],to:u[e]+d[e]-1}}}else{let e=t*(h+1)+n;C.push({from:u[e],to:u[e]+d[e]-1})}for(let e=0;e<C.length;e++)if(C[e].from==null||!C[e].to||C[e].to<0)return null;return{ranges:C,ifd:c,actualTileWidth:n===h&&g%x||x,actualTileHeight:t===m&&b%S||S}}async _fetchAuxiliaryMetaData(e){try{let{data:t}=await this.request(this.url+`.aux.xml`,{responseType:`xml`,signal:e?.signal});return u(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{let{data:t}=await this.request(this.url+`.vat.dbf`,{responseType:`array-buffer`,signal:e?.signal}),n=l(t);return n?.recordSet?D.fromJSON(n.recordSet):null}catch{return null}}};e([r()],k.prototype,`_files`,void 0),e([r()],k.prototype,`_headerInfo`,void 0),e([r()],k.prototype,`_bufferSize`,void 0),e([r()],k.prototype,`_chunkSize`,void 0),e([r({type:String,json:{write:!0}})],k.prototype,`datasetFormat`,void 0),k=e([i(`esri.layers.raster.datasets.TIFFRaster`)],k);function A(e){let t=b(e),{width:n,height:r,tileWidth:i,tileHeight:c,planes:l,pixelType:u,compression:f,firstPyramidLevel:p,maximumPyramidLevel:m,pyramidBlockWidth:h,pyramidBlockHeight:g,pyramidResolutions:_,tileBoundary:v,affine:y,metadata:x,colormap:S}=t,C=t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid,D=d(C),O=!!t.isPseudoGeographic;D??=(O=!0,new s({wkid:3857}));let k=new a({...t.extent,spatialReference:D}),A=k?new o({x:k.xmin,y:k.ymax,spatialReference:D}):new o({x:0,y:0}),j=new E({blockWidth:i,blockHeight:c,pyramidBlockWidth:h,pyramidBlockHeight:g,compression:f,origin:A,firstPyramidLevel:p,maximumPyramidLevel:m,pyramidResolutions:_,blockBoundary:v}),M=new o({x:(k.xmax-k.xmin)/n,y:(k.ymax-k.ymin)/r,spatialReference:D}),N=x?{BandProperties:x.bandProperties,DataType:x.dataType}:{},P=new T({width:n,height:r,bandCount:l,pixelType:u,pixelSize:M,storageInfo:j,spatialReference:D,isPseudoSpatialReference:O,keyProperties:N,extent:k,colormap:S,statistics:x?x.statistics:null});if(y?.length&&(P.nativeExtent=new a({xmin:-.5,ymin:.5-r,xmax:n-.5,ymax:.5,spatialReference:D}),P.transform=new w({polynomialOrder:1,forwardCoefficients:[y[2]+y[0]/2,y[5]-y[3]/2,y[0],y[3],-y[1],-y[4]]}),P.extent=P.transform.forwardTransform(P.nativeExtent),P.pixelSize=new o({x:(k.xmax-k.xmin)/n,y:(k.ymax-k.ymin)/r,spatialReference:D}),j.origin.x=-.5,j.origin.y=.5),_){let{x:e,y:t}=P.pixelSize;_.forEach(n=>{n.x*=e,n.y*=t})}return{imageInfo:t,rasterInfo:P}}function j(e,t){if(t.statistics=e.statistics??t.statistics,t.histograms=e.histograms,e.histograms&&t.statistics==null&&(t.statistics=C(e.histograms)),e.transform&&t.transform==null){t.transform=e.transform,t.nativeExtent=t.extent;let n=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new o({x:(n.xmax-n.xmin)/t.width,y:(n.ymax-n.ymin)/t.height,spatialReference:t.spatialReference}),t.extent=n}t.isPseudoSpatialReference&&e.spatialReference&&(t.spatialReference=e.spatialReference,t.extent.spatialReference=t.nativeExtent.spatialReference=t.storageInfo.origin.spatialReference=t.spatialReference)}const M=k;export{M as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import"../../../core/has.js";import n from"../../../core/Logger.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import a from"../../../geometry/Extent.js";import o from"../../../geometry/Point.js";import s from"../../../geometry/SpatialReference.js";import c from"./BaseRaster.js";import{parse as l}from"./DBFParser.js";import{parsePAMInfo as u,parseSpatialReference as d}from"./pamParser.js";import{parseSignature as f,getPyramidIFDs as p,getMaskIFDs as m,parseIFD as h,parseFieldValues as g,isBSQConfig as _,getTagNumericValues as v,getTagFirstNumericValue as y,getImageInfo as b}from"../formats/tiffParser.js";import{tiffTags as x,geoKeys as S}from"../formats/tiffTag.js";import{estimateStatisticsFromHistograms as C}from"../functions/stretchUtils.js";import w from"../transforms/PolynomialTransform.js";import T from"../../support/RasterInfo.js";import E from"../../support/RasterStorageInfo.js";import D from"../../../rest/support/FeatureSet.js";const O=`none-tiled tiff is not optimized for access, convert to COG and retry.`;let k=class extends c{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this._chunkSize=10*1024**2,this.datasetFormat=`TIFF`}async fetchRawTile(e,t,n,r={}){if(!this._headerInfo?.isSupported||this.isBlockOutside(e,t,n))return null;let i=await this._fetchRawTiffTile(e,t,n,!1,r);if(i!=null&&this._headerInfo.hasMaskBand){let a=await this._fetchRawTiffTile(e,t,n,!0,r);a!=null&&a.pixels[0]instanceof Uint8Array&&(i.mask=a.pixels[0])}return i}async _open(e){let r=e?e.signal:null,{data:i}=await this.request(this.url,{range:{from:0,to:this._bufferSize},responseType:`array-buffer`,signal:r});if(!i)throw new t(`tiffraster:open`,`failed to open url `+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf(`/`)+1,this.url.lastIndexOf(`.`));let{littleEndian:a,firstIFDPos:o,isBigTiff:s}=f(i),c=[],l={fileChunk:i,posIFD:o,fileOffset:0};await this._readIFDs(c,l,a,s?8:4,r);let{imageInfo:u,rasterInfo:d}=A(c),h=p(c),g=m(c);if(this._headerInfo={littleEndian:a,isBigTiff:s,ifds:c,pyramidIFDs:h,maskIFDs:g,...u},this._set(`rasterInfo`,d),!u.isSupported)throw new t(`tiffraster:open`,`this tiff is not supported: `+u.message);if(!u.tileWidth||!u.tileHeight)throw new t(`tiffraster:open`,O);d.isPseudoSpatialReference&&n.getLogger(this).warn(`The spatial reference for this tiff is unsupported. Only EPSG spatial reference codes and Esri WKTs are supported.`);let _=c[0].get(`PREDICTOR`)?.values?.[0];if(c[0].get(`SAMPLEFORMAT`)?.values?.[0]===3&&_===2)throw new t(`tiffraster:open`,`unsupported horizontal difference encoding. Predictor=3 is supported for floating point data`);let{skipMapInfo:v,skipExtensions:y=[]}=this.ioConfig;if(!y.includes(`aux.xml`)&&!v){let t=await this._fetchAuxiliaryMetaData(e);t!=null&&j(t,d)}!y.includes(`vat.dbf`)&&d.bandCount===1&&d.pixelType===`u8`&&!v&&(d.attributeTable=await this._fetchAuxiliaryTable(e),d.attributeTable!=null&&(d.keyProperties.DataType=`thematic`)),v&&this.updateImageSpaceRasterInfo(d),this.updateTileInfo()}async _validateOrFetchHeaderBuffer(e,t){let{fileChunk:n,fileOffset:r,posIFD:i}=e;return(i+8>=n.byteLength||i<0)&&(r=i+r,n=(await this.request(this.url,{range:{from:r,to:r+this._bufferSize},responseType:`array-buffer`,signal:t})).data,i=0),{fileChunk:n,fileOffset:r,posIFD:i}}async _readIFDs(e,n,r,i=4,a){if(!n.posIFD)return null;n=await this._validateOrFetchHeaderBuffer(n,a);let o=await this._readIFD(n,r,x,i,a);if(!o?.ifd)throw new t(`tiffraster:open`,`cannot parse tiff header. failed to open url `+this.url);if(e.push(o.ifd),!o.nextIFD)return null;n.posIFD=o.nextIFD-n.fileOffset,await this._readIFDs(e,n,r,i,a)}async _readIFD(e,n,r=x,i=4,a){let{fileChunk:o,posIFD:s,fileOffset:c}=e;if(!e.fileChunk)return null;let l=h(o,n,s,c,r,i);if(l.success){let{ifd:e}=l;if(!e)throw new t(`tiffraster:open`,`cannot parse tiff header. failed to open url `+this.url);if(!this.ioConfig.loadFullMetadata&&r===x&&(!e.has(`TILEWIDTH`)||!e.has(`TILELENGTH`)))throw new t(`tiffraster:open`,O);let i=[];if(e.forEach(e=>{e.values||i.push(e)}),i.length>0&&await this._fillOffsets(i,n,l.nextIFD,a),e.has(`GEOKEYDIRECTORY`)){let t=e.get(`GEOKEYDIRECTORY`),r=t?.values;if(r&&r.length>4){let e=r[0]+`.`+r[1]+`.`+r[2];s=t.valueOffset+6-c;let i=await this._validateOrFetchHeaderBuffer({fileChunk:o,posIFD:s,fileOffset:c},a);t.data=(await this._readIFD(i,n,S,2,a))?.ifd,t.data&&t.data.set(`GEOTIFFVersion`,{id:0,type:2,valueCount:1,valueOffset:null,values:[e]})}}return l}return l.requiredBufferSize?(o=(await this.request(this.url,{range:{from:c,to:c+s+l.requiredBufferSize+8},responseType:`array-buffer`,signal:a})).data,o.byteLength<s+l.requiredBufferSize?null:(e.fileChunk=o,e.fileOffset=c,this._readIFD(e,n,r,i,a))):null}async _fillOffsets(e,t,n,r){let i=e.filter(e=>e.offlineOffsetSize!=null);if(i.length===0)return;let a=i.map(e=>e.offlineOffsetSize),o=Math.min.apply(null,a.map(e=>e[0])),s=Math.max.apply(null,a.map(e=>e[0]+e[1])),c=a.length===1||s-o<=this._bufferSize;if(!c&&a.length>1&&(a.sort((e,t)=>e[0]-t[0]),c=a.reduce((e,t)=>e===t[0]?t[0]+t[1]:0,a[0][0])===s),c){let e=await this._fetchOffsets(o,Math.max(s,o+this._bufferSize),r);i.forEach(n=>g(e,t,n,o));return}let l=i.map(async e=>{let n=e.offlineOffsetSize,i=await this._fetchOffsets(n[0],n[1]+n[0],r);g(i,t,e,n[0])});await Promise.all(l)}async _fetchOffsets(e,t,n){let r=[],i=this._chunkSize,a=Math.ceil((t-e)/i),o=e;for(let e=0;e<a;e++)r.push(this.request(this.url,{range:{from:o,to:e===a-1?t:o+i-1},responseType:`array-buffer`,signal:n})),o+=i;let s=await Promise.all(r);if(a===1)return s[0].data;let c=new Uint8Array(t-e+1);for(let e=0;e<a;e++)c.set(new Uint8Array(s[e].data),e*i);return c.buffer}async _fetchRawTiffTile(e,t,n,r,i={}){let a=this._getTileLocation(e,t,n,r);if(!a)return null;let{ranges:o,actualTileWidth:s,actualTileHeight:c,ifd:l}=a,u=o.map(e=>this.request(this.url,{range:e,responseType:`array-buffer`,signal:i.signal})),d=await Promise.all(u),f=d.map(e=>e.data.byteLength).reduce((e,t)=>e+t),p=d.length===1?d[0].data:new ArrayBuffer(f),m=[0],h=[0];if(d.length>1){let e=new Uint8Array(p);for(let t=0,n=0;t<d.length;t++){let r=d[t].data;e.set(new Uint8Array(r),n),m[t]=n,n+=r.byteLength,h[t]=r.byteLength}}let{blockWidth:g,blockHeight:_}=this.getBlockWidthHeight(e),v=await this.decodePixelBlock(p,{format:`tiff`,customOptions:{headerInfo:this._headerInfo,ifd:l,offsets:m,sizes:h},width:g,height:_,planes:null,pixelType:null},{signal:i.signal});if(v==null)return null;if(s!==g||c!==_){let e=v.mask;if(e)for(let t=0;t<_;t++){let n=t*g;if(t<c)for(let t=s;t<g;t++)e[n+t]=0;else for(let t=0;t<g;t++)e[n+t]=0}else{e=new Uint8Array(g*_),v.mask=e;for(let t=0;t<c;t++){let n=t*g;for(let t=0;t<s;t++)e[n+t]=1}}}return v}_getTileLocation(e,t,n,r=!1){let{firstPyramidLevel:i,blockBoundary:a}=this.rasterInfo.storageInfo,o=e===0?0:e-(i-1),{_headerInfo:s}=this;if(!s)return null;let c=r?s.maskIFDs[o]:o===0?s.ifds[0]:s.pyramidIFDs[o-1];if(!c)return null;let l=_(c,s),u=v(c,`TILEOFFSETS`),d=v(c,`TILEBYTECOUNTS`);if(!u?.length||!d?.length)return null;let{minRow:f,minCol:p,maxRow:m,maxCol:h}=a[o];if(t>m||n>h||t<f||n<p)return null;let g=y(c,`IMAGEWIDTH`),b=y(c,`IMAGELENGTH`),x=y(c,`TILEWIDTH`),S=y(c,`TILELENGTH`),C=[];if(l){let{bandCount:e}=this.rasterInfo;for(let r=0;r<e;r++){let e=r*(m+1)*(h+1)+t*(h+1)+n;C[r]={from:u[e],to:u[e]+d[e]-1}}}else{let e=t*(h+1)+n;C.push({from:u[e],to:u[e]+d[e]-1})}for(let e=0;e<C.length;e++)if(C[e].from==null||!C[e].to||C[e].to<0)return null;return{ranges:C,ifd:c,actualTileWidth:n===h&&g%x||x,actualTileHeight:t===m&&b%S||S}}async _fetchAuxiliaryMetaData(e){try{let{data:t}=await this.request(this.url+`.aux.xml`,{responseType:`xml`,signal:e?.signal});return u(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{let{data:t}=await this.request(this.url+`.vat.dbf`,{responseType:`array-buffer`,signal:e?.signal}),n=l(t);return n?.recordSet?D.fromJSON(n.recordSet):null}catch{return null}}};e([r()],k.prototype,`_files`,void 0),e([r()],k.prototype,`_headerInfo`,void 0),e([r()],k.prototype,`_bufferSize`,void 0),e([r()],k.prototype,`_chunkSize`,void 0),e([r({type:String,json:{write:!0}})],k.prototype,`datasetFormat`,void 0),k=e([i(`esri.layers.raster.datasets.TIFFRaster`)],k);function A(e){let t=b(e),{width:n,height:r,tileWidth:i,tileHeight:c,planes:l,pixelType:u,compression:f,firstPyramidLevel:p,maximumPyramidLevel:m,pyramidBlockWidth:h,pyramidBlockHeight:g,pyramidResolutions:_,tileBoundary:v,affine:y,metadata:x,colormap:S}=t,C=t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid,D=d(C),O=!!t.isPseudoGeographic;D??=(O=!0,new s({wkid:3857}));let k=new a({...t.extent,spatialReference:D}),A=k?new o({x:k.xmin,y:k.ymax,spatialReference:D}):new o({x:0,y:0}),j=new E({blockWidth:i,blockHeight:c,pyramidBlockWidth:h,pyramidBlockHeight:g,compression:f,origin:A,firstPyramidLevel:p,maximumPyramidLevel:m,pyramidResolutions:_,blockBoundary:v}),M=new o({x:(k.xmax-k.xmin)/n,y:(k.ymax-k.ymin)/r,spatialReference:D}),N=x?{BandProperties:x.bandProperties,DataType:x.dataType}:{},P=new T({width:n,height:r,bandCount:l,pixelType:u,pixelSize:M,storageInfo:j,spatialReference:D,isPseudoSpatialReference:O,keyProperties:N,extent:k,colormap:S,statistics:x?x.statistics:null});if(y?.length&&(P.nativeExtent=new a({xmin:-.5,ymin:.5-r,xmax:n-.5,ymax:.5,spatialReference:D}),P.transform=new w({polynomialOrder:1,forwardCoefficients:[y[2]+y[0]/2,y[5]-y[3]/2,y[0],y[3],-y[1],-y[4]]}),P.extent=P.transform.forwardTransform(P.nativeExtent),P.pixelSize=new o({x:(k.xmax-k.xmin)/n,y:(k.ymax-k.ymin)/r,spatialReference:D}),j.origin.x=-.5,j.origin.y=.5),_){let{x:e,y:t}=P.pixelSize;_.forEach(n=>{n.x*=e,n.y*=t})}return{imageInfo:t,rasterInfo:P}}function j(e,t){if(t.statistics=e.statistics??t.statistics,t.histograms=e.histograms,e.histograms&&t.statistics==null&&(t.statistics=C(e.histograms)),e.transform&&t.transform==null){t.transform=e.transform,t.nativeExtent=t.extent;let n=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new o({x:(n.xmax-n.xmin)/t.width,y:(n.ymax-n.ymin)/t.height,spatialReference:t.spatialReference}),t.extent=n}t.isPseudoSpatialReference&&e.spatialReference&&(t.spatialReference=e.spatialReference,t.extent.spatialReference=t.nativeExtent.spatialReference=t.storageInfo.origin.spatialReference=t.spatialReference)}const M=k;export{M as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import n from"../../../core/Logger.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import a from"../../../geometry/Extent.js";import{isAxesOrderReversedForWkid as o}from"../../ogc/crsUtils.js";import{getCapabilities as s,describeCoverage as c}from"../../ogc/wcsUtils.js";import l from"./BaseRaster.js";import{convertOleDateTimeToEpoch as u}from"./multidimensionalUtils.js";import{parse as d}from"./multipartParser.js";import{standardizeInterpolations as f}from"./wcsCoverageParser.js";import{getFormat as p}from"../formats/RasterCodec.js";import{clip as m}from"../functions/pixelUtils.js";import h from"../../support/DimensionalDefinition.js";const g=[`nearest neighbor`,`bilinear`,`bicubic`],_=[`nearest`,`linear`,`cubic`],v=`response is not a supported multipart/related mediaType with inline tiff, switching to compatibility mode`,y=new Set([`1.0.0`,`1.1.0`,`1.1.1`,`1.1.2`,`2.0.1`]);let b=class extends l{constructor(){super(...arguments),this.datasetFormat=`WCSServer`,this.tileType=`Raster`}get rasterId(){return`${this.url}-${this.coverageId}-${this.version}`}async fetchRawTile(e,r,i,a={}){if(this.isBlockOutside(e,r,i))return null;let{nativePixelSize:o,spatialReference:s}=this.rasterInfo,c=2**e,l=o.x*c,u=o.y*c,{blockWidth:d,blockHeight:f}=this.getBlockWidthHeight(e),{origin:p}=this.rasterInfo.storageInfo.tileInfo,h=this.getTileExtent({x:l,y:u},r,i,p,s,[d,f]),g=this.rasterInfo.extent,_=h.xmax>g.xmax,v=h.ymin<g.ymin,y=_||v,b=h,x=d,S=f;if(y&&(b=h.clone().intersection(g),b!=null&&(_&&(x=Math.floor((b.xmax-b.xmin)/l),b.xmax=b.xmin+l*x),v&&(S=Math.floor((b.ymax-b.ymin)/u),b.ymin=b.ymax-u*S))),b==null||x<=1||S<=1)return null;let C=await this._getCoverage(b,x,S,c,a);if(!C)return null;let{coverageDescription:w}=this.coverageInfo,{noDataValue:T,multidimensionalInfo:E}=this.rasterInfo,{multidimensionalDefinition:D}=a,O;if(E!=null&&D!=null&&D.length){let e=D[0].variableName;w.version===`2.0`?O=w.rangeType[0].find(t=>t.name===e)?.nilValue:w.version===`1.1`&&(O=w.range.find(t=>t.identifier===e)?.nullValues)}let k=O??T,A=await this.decodePixelBlock(C,{width:x,height:S,planes:null,pixelType:null,tiffNoDataValue:Array.isArray(k)?k[0]:k,matchAllNoData:!0});if(A==null)return null;if(A&&(A.width!==x||A.height!==S)){let e=`The tiff coverage response has unexpected width: ${A.width}, height: ${A.height}, expecting width: ${x}, height: ${S}`;throw n.getLogger(this).error(`wcsraster-fetch`,e),new t(`wcsraster-fetch`,e)}return y?m(A,{x:0,y:0},{width:f,height:f}):A}async _open(e){let{customFetchParameters:n}=this.ioConfig,r=e?.signal,i=await s(this.url,{version:n?.version??this.version,customParameters:n,signal:r});if(this.capabilities=i,!this.version){let e=i.version.slice(0,3);e===`2.0`||e===`1.1`||e===`1.0`?this.version=i.version:(e=i.supportedVersions.find(e=>e===`2.0.1`)||i.supportedVersions.find(e=>e.startsWith(`2.0`))||i.supportedVersions.find(e=>e.startsWith(`1.1`))||i.supportedVersions.find(e=>e.startsWith(`1.0`))||`1.0.0`,this.version=e)}let{version:a}=this;if(!y.has(a))throw new t(`wcsraster-open`,`unsupported WCS version ${a}`);let{gridCoverages:o}=i;if(!o.length)throw new t(`wcsraster-open`,`cannot find rectified grid coverages`);this.coverageId??=o[0].id;let{coverageId:l}=this,u=o.find(e=>e.id===l);if(u==null)throw new t(`wcsraster-open`,`the coverageId ${l} does not exist in capabilities`);let d=await c(this.url,{coverageIds:[l],version:a,customParameters:n,signal:r});if(this.coverageInfo=d[0],a.startsWith(`2.0`)){let{coverageInfo:e}=this;e.lonLatEnvelope=u.lonLatEnvelope,e.supportedInterpolations=f(i.supportedInterpolations),this._patchDimensionValues201(l,r)}this.datasetName=this.coverageInfo.title;let{rasterInfo:p}=this.coverageInfo;if(this.createRemoteDatasetStorageInfo(p,512,512),this._set(`rasterInfo`,p),p.spatialReference==null)throw new t(`wcsraster-open`,`coverage without spatial reference is not supported: ${l}`);let{pixelType:m,bandCount:h}=await this._getPixelTypeAndBandCount(r);p.pixelType=m,p.bandCount===1&&h>1&&(p.bandCount=h),this.updateTileInfo()}async _patchDimensionValues201(e,t){let{coverageInfo:n}=this,r=n.rasterInfo.multidimensionalInfo?.variables,i=y.has(`1.1.2`)?`1.1.2`:y.has(`1.1.1`)?`1.1.1`:y.has(`1.1.0`)?`1.1.0`:null,{customFetchParameters:a}=this.ioConfig;if(r&&i)try{let n=this.url.includes(`/ImageServer/`),o=e.length>8&&e.startsWith(`Coverage`)&&n?e.slice(8):e,s=(await c(this.url,{coverageIds:[o??e],version:i,customParameters:a,signal:t}).catch(()=>{if(o)return c(this.url,{coverageIds:[e],version:i,customParameters:a,signal:t})}))?.[0].rasterInfo.multidimensionalInfo?.variables;if(s)for(let e of r){let t=s.find(({name:t})=>t===e.name);if(t?.dimensions?.length)for(let r=e.dimensions.length-1;r>=0;r--){let i=e.dimensions[r],a=t.dimensions.find(({name:e})=>e===i.name);if(!a){n&&e.dimensions.splice(r,1);continue}a.values&&a.extent?.join(`,`)===i.extent?.join(`,`)&&(e.dimensions[r]={...i,values:a.values})}}}catch{}}async _getPixelTypeAndBandCount(e){let{pixelSize:r,extent:i,multidimensionalInfo:o}=this.rasterInfo,s=i.center,c=new a({xmin:s.x-r.x,xmax:s.x+r.x,ymin:s.y-r.y,ymax:s.y+r.y,spatialReference:i.spatialReference}),l=[];if(o!=null){let e=o.variables[0];l=[],e.dimensions.forEach(t=>{l.push(new h({variableName:e.name,dimensionName:t.name,values:t.hasRegularIntervals?t.extent?.[0]:t.values?.[0],isSlice:!0}))})}let{coverageDescription:u}=this.coverageInfo,d={interpolation:`nearest`,multidimensionalDefinition:l,signal:e},{version:f}=u,{ioConfig:p}=this,m=f===`2.0`&&p.allowAnyMediaType==null||f===`1.1`&&p.use2GridOffsets==null,g;try{g=await this._getCoverage(c,2,2,1,d,!0)}catch(e){if(!m)throw e;if(f===`1.1`){if(e.details?.isResolutionMismatch)p.use2GridOffsets=!0;else throw e}}if(!g&&m&&(f===`2.0`&&(p.allowAnyMediaType=!0),g=await this._getCoverage(c,2,2,1,d),g&&n.getLogger(this).warn(`wcsraster:getcoverage`,v)),!g)throw new t(`wcsraster-open`,`unable to determine pixel type`);let _=await this.decodePixelBlock(g,{width:2,height:2,planes:null,pixelType:null});if(_==null)throw new t(`wcsraster-open`,`unable to determine pixel type`);return{pixelType:_.pixelType,bandCount:_.getPlaneCount()??0}}async _getCoverage(e,r,i,a,o,s=!1){let{coverageDescription:c}=this.coverageInfo,{version:l}=c,u=l===`2.0`?this._getCoverage201Parameters(e,r,i,a,o,c):l===`1.1`?this._getCoverage110Parameters(e,r,i,o,c):this._getCoverage100Parameters(e,r,i,o),f=l===`2.0`?await this.request(this._constructWCS201Url(u),{signal:o.signal,responseType:`array-buffer`}):await this.request(this.url,{query:u,signal:o.signal,responseType:`array-buffer`});if(l===`1.0`)return f.data;if(l===`2.0`&&this.ioConfig.allowAnyMediaType!==!1&&p(f.data)===`tiff`)return s&&(this.ioConfig.allowAnyMediaType=!0,n.getLogger(this).warn(`wcsraster:getcoverage`,v)),f.data;let m=d(f);if(m.isMultipart&&m.data){let e=m.data.find(e=>e.isValidImage);return s&&e?.contentTransferEncoding===`base64`&&n.getLogger(this).warn(`wcsraster:getcoverage`,`response is base64 encoded which may impact layer display performance`),e?.contentData}let h=new Uint8Array(f.data,0,Math.min(f.data.byteLength,2e3)),g=String.fromCharCode.apply(null,h).toLowerCase().includes(`exception`),_=g&&String.fromCharCode.apply(null,h).includes(`A non-zero RESX/RESY or WIDTH/HEIGHT is required but neither was provided`);throw g?new t(`wcsraster:getcoverage`,`server returns an exception`,{isResolutionMismatch:_}):new t(`wcsraster:getcoverage`,`response is not a supported multipart mediaType with inline tiff`)}_getInterpolationIndex(e){return!e||!this.coverageInfo.supportedInterpolations?.includes(e)||e===`nearest`?0:e===`bilinear`?1:e===`cubic`?2:0}_getCoverage100Parameters(e,t,n,r){let i=`${e.xmin},${e.ymin},${e.xmax},${e.ymax}`,a=e.spatialReference.wkid,o=(this.coverageInfo.supportedFormats||[]).find(e=>e.toLowerCase().includes(`tiff`))||`GEOTIFF`,{bandIds:s,interpolation:c}=r,l=this._getInterpolationIndex(c),u=s?s.map(e=>this.coverageInfo.bandNames[e]):null,d=g[l],{multidimensionalDefinition:f}=r,p;if(f!=null&&this.rasterInfo.multidimensionalInfo!=null){let e=f.find(e=>e.dimensionName===`StdTime`)?.values;e&&e.length>0&&(Array.isArray(e[0])&&(e=e[0]),p=e.map(e=>x(e)).join(`,`))}return{service:`WCS`,request:`GetCoverage`,version:this.version,coverage:this.coverageId,format:o,crs:`EPSG:${a}`,bbox:i,width:t,height:n,time:p,interpolation:d,band:u?.join(`,`)}}_getCoverage110Parameters(e,t,n,r,i){let{multidimensionalDefinition:a,bandIds:s,interpolation:c}=r,l=e.spatialReference.wkid,u=`urn:ogc:def:crs:EPSG::${l}`,d=(this.coverageInfo.supportedFormats||[]).find(e=>e.toLowerCase().includes(`tiff`))||`image/tiff`,f=this._getInterpolationIndex(c),p=_[f],m=c==null||this.coverageInfo.supportedInterpolations?.indexOf(c)===0,h=i.domain.spatialDomain,g=h.origin.x<=h.envelope.xmin&&h.origin.y<=h.envelope.ymin,v=e.width/t,y=e.height/n*(g?1:-1),b=g?[e.xmin,e.ymin]:[e.xmin,e.ymax],S=h.useEPSGAxis&&o(l),C=S?`${b[1]},${b[0]}`:`${b[0]},${b[1]}`,w=this.ioConfig.use2GridOffsets,T=S?w?`${y},${v}`:`${y},0,0,${v}`:w?`${v},${y}`:`${v},0,0,${y}`,E=v/2,D=e.xmin+E,O=e.xmax-E,k=Math.abs(y)/2,A=e.ymin+k,j=e.ymax-k,M=S?`${A},${D},${j},${O},${u}`:`${D},${A},${O},${j},${u}`,N=i.range.find(e=>e.axis.some(e=>e.identifier.toLowerCase().includes(`band`))),P=N&&p&&s?m?`${N.identifier}[${N.axis[0].identifier}[${s.join(`,`)}]]`:`${N.identifier}:${p}[${N.axis[0].identifier}[${s.join(`,`)}]]`:null,F;if(a!=null&&a.length)for(let e=0;e<a.length;e++){let t=a[e].values,n=a[e].dimensionName?.toLowerCase(),r=a[e].variableName?.toLowerCase(),o=i.range.find(e=>e.identifier.toLowerCase()===r);if(t.length>0){if(Array.isArray(t[0])&&(t=t[0]),n===`stdtime`)F=t.map(e=>x(e)).join(`,`);else if(o){let e=o.axis.find(e=>e.identifier.toLowerCase()===n);e&&(P=m?o.identifier+`[`+e.identifier+`[`+t.join(`,`)+`]]`:o.identifier+`:`+p+`[`+e.identifier+`[`+t.join(`,`)+`]]`)}}e===a.length-1&&o&&!P&&(P=m?o.identifier:o.identifier+`:`+p)}return{service:`WCS`,request:`GetCoverage`,version:this.version,identifier:this.coverageId,format:d,crs:`EPSG:${l}`,boundingbox:M,gridCS:`urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS`,gridType:`urn:ogc:def:method:WCS:1.1:2dGridIn2dCrs`,gridOrigin:C,gridOffsets:T,gridBaseCRS:u,timeSequence:F,rangeSubset:P}}_getCoverage201Parameters(e,t,n,r,i,a){let{multidimensionalDefinition:o,interpolation:s}=i,c=this._getInterpolationIndex(s),l=null,{supportedInterpolations:u}=this.capabilities;if(u?.length)switch(c){case 0:l=u.find(e=>e.toLowerCase().includes(`nearest`));break;case 1:l=u.find(e=>e.toLowerCase().includes(`linear`));break;case 2:l=u.find(e=>e.toLowerCase().includes(`cubic`)||e.toLowerCase().includes(`quadratic`))}let d=(this.coverageInfo.supportedFormats||[]).find(e=>e.toLowerCase().includes(`tiff`))||`image/tiff`,{bandNames:f}=this.coverageInfo,{boundedBy:p,domainSet:m,rangeType:h}=a,g=+!p.isEastFirst,_=1-g,{axisLabels:v}=p,y=v[g],b=v[_],S=`http://www.opengis.net/def/crs/EPSG/0/${e.spatialReference.wkid}`,C=S,w=[];w.push(`${y}(${e.xmin},${e.xmax})`),w.push(`${b}(${e.ymin},${e.ymax})`);let T=[];if(v.length>2)for(let e=2;e<v.length;e++){let t=m.origin[e];if(v[e].toLowerCase().includes(`time`)){let n=t.toString();p.uomLabels?.[e].toLowerCase().includes(`ole`)&&(T.push(v[e]),n=x(t,!0)),w.push(v[e]+`,http://www.opengis.net(`+n+`)`)}else w.push(v[e]+`,http://www.opengis.net(`+t+`)`)}let E=null;if(o!=null&&o.length){let e=[];h.forEach(t=>t.forEach(t=>e.push(t.name)));let t=[];for(let n=0;n<o.length;n++){let r=v.find(e=>e===o[n].dimensionName),i=e.find(e=>e===o[n].variableName);if(t.includes(i)||t.push(i),r){let e=o[n].values;if(e.length>0){Array.isArray(e[0])&&(e=e[0]);let t=``;t=r.toLowerCase().includes(`time`)?e.map(e=>x(e)).join(`,`):e.join(`,`);let n=w.findIndex(e=>e.startsWith(r+`,http://www.opengis.net`));n===-1&&w.push(r+`,http://www.opengis.net(`+t+`)`),n!==-1&&!w[n].includes(`(`+t+`)`)&&w.splice(n,1,r+`,http://www.opengis.net(`+t+`)`)}}}t.length&&(E=t.join(`,`))}else f?.length>=2&&(E=(i.bandIds?i.bandIds.map(e=>f[e]):f).join(`,`));let D=w.join(`&subset=`),O=!a.domainSet.hasSameAxisLabelsAsBoundedBy&&this.ioConfig.allowScaleFactor!==!1,k=O?null:`${y}(${t}),${b}(${n})`,A=O?1/r:null;return{service:`WCS`,request:`GetCoverage`,version:this.version,coverageId:this.coverageId,rangesubset:E,interpolation:l,scaleSize:k,scaleFactor:A,subset:D,format:d,mediaType:this.ioConfig.allowAnyMediaType?null:`multipart/related`,outputcrs:S,subsettingcrs:C}}_constructWCS201Url(e){let t={...this.ioConfig.customFetchParameters,...e},n=[];return Object.keys(t).forEach(e=>{let r=t[e];if(r!=null){if(e!==`subset`){n.push(`${e}=${encodeURIComponent(r)}`);return}typeof r==`string`&&r.split(`&subset=`).forEach(e=>{e&&n.push(`subset=${encodeURIComponent(e)}`)})}}),`${encodeURI(this.url)}?${n.join(`&`)}`}};e([r({type:String,json:{write:!0}})],b.prototype,`datasetFormat`,void 0),e([r({readOnly:!0})],b.prototype,`tileType`,void 0),e([r({type:String,json:{write:!0}})],b.prototype,`version`,void 0),e([r({type:String,json:{write:!0}})],b.prototype,`coverageId`,void 0),e([r({readOnly:!0})],b.prototype,`rasterId`,null),b=e([i(`esri.layers.raster.datasets.WCSRaster`)],b);function x(e,t=!1){return(t?new Date(u(e)):new Date(e)).toISOString()}export{b as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import n from"../../../core/Logger.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import a from"../../../geometry/Extent.js";import{isAxesOrderReversedForWkid as o}from"../../ogc/crsUtils.js";import{getCapabilities as s,describeCoverage as c}from"../../ogc/wcsUtils.js";import l from"./BaseRaster.js";import{convertOleDateTimeToEpoch as u}from"./multidimensionalUtils.js";import{parse as d}from"./multipartParser.js";import{standardizeInterpolations as f}from"./wcsCoverageParser.js";import{getFormat as p}from"../formats/RasterCodec.js";import{clip as m}from"../functions/pixelUtils.js";import h from"../../support/DimensionalDefinition.js";const g=[`nearest neighbor`,`bilinear`,`bicubic`],_=[`nearest`,`linear`,`cubic`],v=`response is not a supported multipart/related mediaType with inline tiff, switching to compatibility mode`,y=new Set([`1.0.0`,`1.1.0`,`1.1.1`,`1.1.2`,`2.0.1`]);let b=class extends l{constructor(){super(...arguments),this.datasetFormat=`WCSServer`,this.tileType=`Raster`}get rasterId(){return`${this.url}-${this.coverageId}-${this.version}`}async fetchRawTile(e,r,i,a={}){if(this.isBlockOutside(e,r,i))return null;let{nativePixelSize:o,spatialReference:s}=this.rasterInfo,c=2**e,l=o.x*c,u=o.y*c,{blockWidth:d,blockHeight:f}=this.getBlockWidthHeight(e),{origin:p}=this.rasterInfo.storageInfo.tileInfo,h=this.getTileExtent({x:l,y:u},r,i,p,s,[d,f]),g=this.rasterInfo.extent,_=h.xmax>g.xmax,v=h.ymin<g.ymin,y=_||v,b=h,x=d,S=f;if(y&&(b=h.clone().intersection(g),b!=null&&(_&&(x=Math.floor((b.xmax-b.xmin)/l),b.xmax=b.xmin+l*x),v&&(S=Math.floor((b.ymax-b.ymin)/u),b.ymin=b.ymax-u*S))),b==null||x<=1||S<=1)return null;let C=await this._getCoverage(b,x,S,c,a);if(!C)return null;let{coverageDescription:w}=this.coverageInfo,{noDataValue:T,multidimensionalInfo:E}=this.rasterInfo,{multidimensionalDefinition:D}=a,O;if(E!=null&&D!=null&&D.length){let e=D[0].variableName;w.version===`2.0`?O=w.rangeType[0].find(t=>t.name===e)?.nilValue:w.version===`1.1`&&(O=w.range.find(t=>t.identifier===e)?.nullValues)}let k=O??T,A=await this.decodePixelBlock(C,{width:x,height:S,planes:null,pixelType:null,tiffNoDataValue:Array.isArray(k)?k[0]:k,matchAllNoData:!0},{signal:a.signal});if(A==null)return null;if(A&&(A.width!==x||A.height!==S)){let e=`The tiff coverage response has unexpected width: ${A.width}, height: ${A.height}, expecting width: ${x}, height: ${S}`;throw n.getLogger(this).error(`wcsraster-fetch`,e),new t(`wcsraster-fetch`,e)}return y?m(A,{x:0,y:0},{width:f,height:f}):A}async _open(e){let{customFetchParameters:n}=this.ioConfig,r=e?.signal,i=await s(this.url,{version:n?.version??this.version,customParameters:n,signal:r});if(this.capabilities=i,!this.version){let e=i.version.slice(0,3);e===`2.0`||e===`1.1`||e===`1.0`?this.version=i.version:(e=i.supportedVersions.find(e=>e===`2.0.1`)||i.supportedVersions.find(e=>e.startsWith(`2.0`))||i.supportedVersions.find(e=>e.startsWith(`1.1`))||i.supportedVersions.find(e=>e.startsWith(`1.0`))||`1.0.0`,this.version=e)}let{version:a}=this;if(!y.has(a))throw new t(`wcsraster-open`,`unsupported WCS version ${a}`);let{gridCoverages:o}=i;if(!o.length)throw new t(`wcsraster-open`,`cannot find rectified grid coverages`);this.coverageId??=o[0].id;let{coverageId:l}=this,u=o.find(e=>e.id===l);if(u==null)throw new t(`wcsraster-open`,`the coverageId ${l} does not exist in capabilities`);let d=await c(this.url,{coverageIds:[l],version:a,customParameters:n,signal:r});if(this.coverageInfo=d[0],a.startsWith(`2.0`)){let{coverageInfo:e}=this;e.lonLatEnvelope=u.lonLatEnvelope,e.supportedInterpolations=f(i.supportedInterpolations),this._patchDimensionValues201(l,r)}this.datasetName=this.coverageInfo.title;let{rasterInfo:p}=this.coverageInfo;if(this.createRemoteDatasetStorageInfo(p,512,512),this._set(`rasterInfo`,p),p.spatialReference==null)throw new t(`wcsraster-open`,`coverage without spatial reference is not supported: ${l}`);let{pixelType:m,bandCount:h}=await this._getPixelTypeAndBandCount(r);p.pixelType=m,p.bandCount===1&&h>1&&(p.bandCount=h),this.updateTileInfo()}async _patchDimensionValues201(e,t){let{coverageInfo:n}=this,r=n.rasterInfo.multidimensionalInfo?.variables,i=y.has(`1.1.2`)?`1.1.2`:y.has(`1.1.1`)?`1.1.1`:y.has(`1.1.0`)?`1.1.0`:null,{customFetchParameters:a}=this.ioConfig;if(r&&i)try{let n=this.url.includes(`/ImageServer/`),o=e.length>8&&e.startsWith(`Coverage`)&&n?e.slice(8):e,s=(await c(this.url,{coverageIds:[o??e],version:i,customParameters:a,signal:t}).catch(()=>{if(o)return c(this.url,{coverageIds:[e],version:i,customParameters:a,signal:t})}))?.[0].rasterInfo.multidimensionalInfo?.variables;if(s)for(let e of r){let t=s.find(({name:t})=>t===e.name);if(t?.dimensions?.length)for(let r=e.dimensions.length-1;r>=0;r--){let i=e.dimensions[r],a=t.dimensions.find(({name:e})=>e===i.name);if(!a){n&&e.dimensions.splice(r,1);continue}a.values&&a.extent?.join(`,`)===i.extent?.join(`,`)&&(e.dimensions[r]={...i,values:a.values})}}}catch{}}async _getPixelTypeAndBandCount(e){let{pixelSize:r,extent:i,multidimensionalInfo:o}=this.rasterInfo,s=i.center,c=new a({xmin:s.x-r.x,xmax:s.x+r.x,ymin:s.y-r.y,ymax:s.y+r.y,spatialReference:i.spatialReference}),l=[];if(o!=null){let e=o.variables[0];l=[],e.dimensions.forEach(t=>{l.push(new h({variableName:e.name,dimensionName:t.name,values:t.hasRegularIntervals?t.extent?.[0]:t.values?.[0],isSlice:!0}))})}let{coverageDescription:u}=this.coverageInfo,d={interpolation:`nearest`,multidimensionalDefinition:l,signal:e},{version:f}=u,{ioConfig:p}=this,m=f===`2.0`&&p.allowAnyMediaType==null||f===`1.1`&&p.use2GridOffsets==null,g;try{g=await this._getCoverage(c,2,2,1,d,!0)}catch(e){if(!m)throw e;if(f===`1.1`){if(e.details?.isResolutionMismatch)p.use2GridOffsets=!0;else throw e}}if(!g&&m&&(f===`2.0`&&(p.allowAnyMediaType=!0),g=await this._getCoverage(c,2,2,1,d),g&&n.getLogger(this).warn(`wcsraster:getcoverage`,v)),!g)throw new t(`wcsraster-open`,`unable to determine pixel type`);let _=await this.decodePixelBlock(g,{width:2,height:2,planes:null,pixelType:null},{signal:d.signal});if(_==null)throw new t(`wcsraster-open`,`unable to determine pixel type`);return{pixelType:_.pixelType,bandCount:_.getPlaneCount()??0}}async _getCoverage(e,r,i,a,o,s=!1){let{coverageDescription:c}=this.coverageInfo,{version:l}=c,u=l===`2.0`?this._getCoverage201Parameters(e,r,i,a,o,c):l===`1.1`?this._getCoverage110Parameters(e,r,i,o,c):this._getCoverage100Parameters(e,r,i,o),f=l===`2.0`?await this.request(this._constructWCS201Url(u),{signal:o.signal,responseType:`array-buffer`}):await this.request(this.url,{query:u,signal:o.signal,responseType:`array-buffer`});if(l===`1.0`)return f.data;if(l===`2.0`&&this.ioConfig.allowAnyMediaType!==!1&&p(f.data)===`tiff`)return s&&(this.ioConfig.allowAnyMediaType=!0,n.getLogger(this).warn(`wcsraster:getcoverage`,v)),f.data;let m=d(f);if(m.isMultipart&&m.data){let e=m.data.find(e=>e.isValidImage);return s&&e?.contentTransferEncoding===`base64`&&n.getLogger(this).warn(`wcsraster:getcoverage`,`response is base64 encoded which may impact layer display performance`),e?.contentData}let h=new Uint8Array(f.data,0,Math.min(f.data.byteLength,2e3)),g=String.fromCharCode.apply(null,h).toLowerCase().includes(`exception`),_=g&&String.fromCharCode.apply(null,h).includes(`A non-zero RESX/RESY or WIDTH/HEIGHT is required but neither was provided`);throw g?new t(`wcsraster:getcoverage`,`server returns an exception`,{isResolutionMismatch:_}):new t(`wcsraster:getcoverage`,`response is not a supported multipart mediaType with inline tiff`)}_getInterpolationIndex(e){return!e||!this.coverageInfo.supportedInterpolations?.includes(e)||e===`nearest`?0:e===`bilinear`?1:e===`cubic`?2:0}_getCoverage100Parameters(e,t,n,r){let i=`${e.xmin},${e.ymin},${e.xmax},${e.ymax}`,a=e.spatialReference.wkid,o=(this.coverageInfo.supportedFormats||[]).find(e=>e.toLowerCase().includes(`tiff`))||`GEOTIFF`,{bandIds:s,interpolation:c}=r,l=this._getInterpolationIndex(c),u=s?s.map(e=>this.coverageInfo.bandNames[e]):null,d=g[l],{multidimensionalDefinition:f}=r,p;if(f!=null&&this.rasterInfo.multidimensionalInfo!=null){let e=f.find(e=>e.dimensionName===`StdTime`)?.values;e&&e.length>0&&(Array.isArray(e[0])&&(e=e[0]),p=e.map(e=>x(e)).join(`,`))}return{service:`WCS`,request:`GetCoverage`,version:this.version,coverage:this.coverageId,format:o,crs:`EPSG:${a}`,bbox:i,width:t,height:n,time:p,interpolation:d,band:u?.join(`,`)}}_getCoverage110Parameters(e,t,n,r,i){let{multidimensionalDefinition:a,bandIds:s,interpolation:c}=r,l=e.spatialReference.wkid,u=`urn:ogc:def:crs:EPSG::${l}`,d=(this.coverageInfo.supportedFormats||[]).find(e=>e.toLowerCase().includes(`tiff`))||`image/tiff`,f=this._getInterpolationIndex(c),p=_[f],m=c==null||this.coverageInfo.supportedInterpolations?.indexOf(c)===0,h=i.domain.spatialDomain,g=h.origin.x<=h.envelope.xmin&&h.origin.y<=h.envelope.ymin,v=e.width/t,y=e.height/n*(g?1:-1),b=g?[e.xmin,e.ymin]:[e.xmin,e.ymax],S=h.useEPSGAxis&&o(l),C=S?`${b[1]},${b[0]}`:`${b[0]},${b[1]}`,w=this.ioConfig.use2GridOffsets,T=S?w?`${y},${v}`:`${y},0,0,${v}`:w?`${v},${y}`:`${v},0,0,${y}`,E=v/2,D=e.xmin+E,O=e.xmax-E,k=Math.abs(y)/2,A=e.ymin+k,j=e.ymax-k,M=S?`${A},${D},${j},${O},${u}`:`${D},${A},${O},${j},${u}`,N=i.range.find(e=>e.axis.some(e=>e.identifier.toLowerCase().includes(`band`))),P=N&&p&&s?m?`${N.identifier}[${N.axis[0].identifier}[${s.join(`,`)}]]`:`${N.identifier}:${p}[${N.axis[0].identifier}[${s.join(`,`)}]]`:null,F;if(a!=null&&a.length)for(let e=0;e<a.length;e++){let t=a[e].values,n=a[e].dimensionName?.toLowerCase(),r=a[e].variableName?.toLowerCase(),o=i.range.find(e=>e.identifier.toLowerCase()===r);if(t.length>0){if(Array.isArray(t[0])&&(t=t[0]),n===`stdtime`)F=t.map(e=>x(e)).join(`,`);else if(o){let e=o.axis.find(e=>e.identifier.toLowerCase()===n);e&&(P=m?o.identifier+`[`+e.identifier+`[`+t.join(`,`)+`]]`:o.identifier+`:`+p+`[`+e.identifier+`[`+t.join(`,`)+`]]`)}}e===a.length-1&&o&&!P&&(P=m?o.identifier:o.identifier+`:`+p)}return{service:`WCS`,request:`GetCoverage`,version:this.version,identifier:this.coverageId,format:d,crs:`EPSG:${l}`,boundingbox:M,gridCS:`urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS`,gridType:`urn:ogc:def:method:WCS:1.1:2dGridIn2dCrs`,gridOrigin:C,gridOffsets:T,gridBaseCRS:u,timeSequence:F,rangeSubset:P}}_getCoverage201Parameters(e,t,n,r,i,a){let{multidimensionalDefinition:o,interpolation:s}=i,c=this._getInterpolationIndex(s),l=null,{supportedInterpolations:u}=this.capabilities;if(u?.length)switch(c){case 0:l=u.find(e=>e.toLowerCase().includes(`nearest`));break;case 1:l=u.find(e=>e.toLowerCase().includes(`linear`));break;case 2:l=u.find(e=>e.toLowerCase().includes(`cubic`)||e.toLowerCase().includes(`quadratic`))}let d=(this.coverageInfo.supportedFormats||[]).find(e=>e.toLowerCase().includes(`tiff`))||`image/tiff`,{bandNames:f}=this.coverageInfo,{boundedBy:p,domainSet:m,rangeType:h}=a,g=+!p.isEastFirst,_=1-g,{axisLabels:v}=p,y=v[g],b=v[_],S=`http://www.opengis.net/def/crs/EPSG/0/${e.spatialReference.wkid}`,C=S,w=[];w.push(`${y}(${e.xmin},${e.xmax})`),w.push(`${b}(${e.ymin},${e.ymax})`);let T=[];if(v.length>2)for(let e=2;e<v.length;e++){let t=m.origin[e];if(v[e].toLowerCase().includes(`time`)){let n=t.toString();p.uomLabels?.[e].toLowerCase().includes(`ole`)&&(T.push(v[e]),n=x(t,!0)),w.push(v[e]+`,http://www.opengis.net(`+n+`)`)}else w.push(v[e]+`,http://www.opengis.net(`+t+`)`)}let E=null;if(o!=null&&o.length){let e=[];h.forEach(t=>t.forEach(t=>e.push(t.name)));let t=[];for(let n=0;n<o.length;n++){let r=v.find(e=>e===o[n].dimensionName),i=e.find(e=>e===o[n].variableName);if(t.includes(i)||t.push(i),r){let e=o[n].values;if(e.length>0){Array.isArray(e[0])&&(e=e[0]);let t=``;t=r.toLowerCase().includes(`time`)?e.map(e=>x(e)).join(`,`):e.join(`,`);let n=w.findIndex(e=>e.startsWith(r+`,http://www.opengis.net`));n===-1&&w.push(r+`,http://www.opengis.net(`+t+`)`),n!==-1&&!w[n].includes(`(`+t+`)`)&&w.splice(n,1,r+`,http://www.opengis.net(`+t+`)`)}}}t.length&&(E=t.join(`,`))}else f?.length>=2&&(E=(i.bandIds?i.bandIds.map(e=>f[e]):f).join(`,`));let D=w.join(`&subset=`),O=!a.domainSet.hasSameAxisLabelsAsBoundedBy&&this.ioConfig.allowScaleFactor!==!1,k=O?null:`${y}(${t}),${b}(${n})`,A=O?1/r:null;return{service:`WCS`,request:`GetCoverage`,version:this.version,coverageId:this.coverageId,rangesubset:E,interpolation:l,scaleSize:k,scaleFactor:A,subset:D,format:d,mediaType:this.ioConfig.allowAnyMediaType?null:`multipart/related`,outputcrs:S,subsettingcrs:C}}_constructWCS201Url(e){let t={...this.ioConfig.customFetchParameters,...e},n=[];return Object.keys(t).forEach(e=>{let r=t[e];if(r!=null){if(e!==`subset`){n.push(`${e}=${encodeURIComponent(r)}`);return}typeof r==`string`&&r.split(`&subset=`).forEach(e=>{e&&n.push(`subset=${encodeURIComponent(e)}`)})}}),`${encodeURI(this.url)}?${n.join(`&`)}`}};e([r({type:String,json:{write:!0}})],b.prototype,`datasetFormat`,void 0),e([r({readOnly:!0})],b.prototype,`tileType`,void 0),e([r({type:String,json:{write:!0}})],b.prototype,`version`,void 0),e([r({type:String,json:{write:!0}})],b.prototype,`coverageId`,void 0),e([r({readOnly:!0})],b.prototype,`rasterId`,null),b=e([i(`esri.layers.raster.datasets.WCSRaster`)],b);function x(e,t=!1){return(t?new Date(u(e)):new Date(e)).toISOString()}export{b as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../../core/Error.js";import{throwIfAborted as t,throwIfAbortError as n}from"../../../core/promiseUtils.js";import{inflate as r}from"./Zlib.js";async function i(r,i,c){if(!r||r.byteLength<10)throw new e(`imagecanvasdecoder: decode`,`required a valid encoded data as input.`);let{width:d,height:f,format:p}=i,{applyJpegMask:m}=i;if(m&&!(d&&f))throw new e(`imagecanvasdecoder: decode`,`image width and height are needed to apply jpeg mask directly to canvas`);let h=null;p===`jpg`&&m&&d&&f&&(h=await u(r,{width:d,height:f}));try{let e=new Blob([new Uint8Array(r)],{type:l(p)}),u=await createImageBitmap(e);t(c);let{useTiledDecoding:d,tileIndex:f,tileSize:m}=i;if(d&&f==null)return o(u,h,m);if(f!=null&&m!=null)return s(u,f,m);try{return a(u,h)}catch(e){if(n(e),u.width>4096||u.height>4096)return o(u,h);throw e}}catch(t){throw n(t),new e(`imagecanvasdecoder: decode`,`cannot load image`)}}function a(t,n){let{width:r,height:i}=t,a=new OffscreenCanvas(r,i),o=a.getContext(`2d`);if(!o)throw new e(`imagecanvasdecoder: decode`,`cannot create canvas context`);o.drawImage(t,0,0,r,i);let s=c(o.getImageData(0,0,r,i),r,i,n);return a.width=0,a.height=0,s}function o(t,n,r=[2048,2048]){let[i,a]=r,o=new OffscreenCanvas(i,a),s=o.getContext(`2d`,{willReadFrequently:!0});if(!s)throw new e(`imagecanvasdecoder: decode`,`cannot create canvas context`);let{width:c,height:l}=t,u=c*l,d=new Uint8Array(u),f=new Uint8Array(u),p=new Uint8Array(u),m=n==null;n||=new Uint8Array(u);for(let e=0;e<l;e+=a){let r=Math.min(a,l-e);for(let a=0;a<c;a+=i){let o=Math.min(i,c-a);s.clearRect(0,0,o,r),s.drawImage(t,a,e,o,r,0,0,o,r);let{data:l}=s.getImageData(0,0,o,r);for(let t=0;t<r;t++){let r=t*o*4,i=(e+t)*c+a;for(let e=0;e<o;e++,r+=4,i++)d[i]=l[r],f[i]=l[r+1],p[i]=l[r+2],m&&(n[i]=l[r+3])}}}let h={width:c,height:l,pixels:[d,f,p],mask:n,pixelType:`u8`};return o.width=0,o.height=0,console.log(`decodeFullImageTiled: ${c}x${l} using tile ${i}x${a}`,h),h}function s(t,n,r){let[i,a,o]=n,[s,l]=r,u=Math.ceil(t.width/2**i),d=Math.ceil(t.height/2**i),f=Math.ceil(d/l),p=Math.ceil(u/s);if(a>=f||o>=p)return null;let m=new OffscreenCanvas(u,d),h=m.getContext(`2d`);if(!h)throw new e(`imagecanvasdecoder: decode`,`cannot create canvas context`);h.drawImage(t,0,0,u,d);let g=o*s,_=a*l,v=Math.min(s,u-g),y=Math.min(l,d-_),b=c(h.getImageData(g,_,v,y),s,l);return m.width=0,m.height=0,b}function c(e,t,n,r){let i=t*n,a=new Uint8Array(i),o=new Uint8Array(i),s=new Uint8Array(i),c=r==null;r||=new Uint8Array(i);let l={width:t,height:n,pixels:[a,o,s],mask:r,pixelType:`u8`},{width:u,height:d,data:f}=e;if(u===t&&d===n){for(let e=0,t=0;e<i;e++,t+=4)a[e]=f[t],o[e]=f[t+1],s[e]=f[t+2],c&&(r[e]=f[t+3]);return l}for(let e=0;e<d;e++){let n=e*u*4;for(let i=0;i<u;i++){let l=e*t+i;a[l]=f[n+i*4],o[l]=f[n+i*4+1],s[l]=f[n+i*4+2],c&&(r[l]=f[n+i*4+3])}}return l}function l(e){return`image/${e===`jpg`?`jpeg`:e}`}async function u(e,t){try{let n=new Uint8Array(e),r=Math.ceil(n.length/2),i=n.length-2;for(;r<i&&(n[r]!==255||n[r+1]!==217);r++);r+=2;let a=null;return r<n.length-1&&(a=await d(n.subarray(r,-4),t.width*t.height)),a}catch{return null}}async function d(e,t){try{let
|
|
2
|
+
import e from"../../../core/Error.js";import{throwIfAborted as t,throwIfAbortError as n}from"../../../core/promiseUtils.js";import{inflate as r}from"./Zlib.js";async function i(r,i,c){if(!r||r.byteLength<10)throw new e(`imagecanvasdecoder: decode`,`required a valid encoded data as input.`);let{width:d,height:f,format:p}=i,{applyJpegMask:m}=i;if(m&&!(d&&f))throw new e(`imagecanvasdecoder: decode`,`image width and height are needed to apply jpeg mask directly to canvas`);let h=null;p===`jpg`&&m&&d&&f&&(h=await u(r,{width:d,height:f}));try{let e=new Blob([new Uint8Array(r)],{type:l(p)}),u=await createImageBitmap(e);t(c);let{useTiledDecoding:d,tileIndex:f,tileSize:m}=i;if(d&&f==null)return o(u,h,m);if(f!=null&&m!=null)return s(u,f,m);try{return a(u,h)}catch(e){if(n(e),u.width>4096||u.height>4096)return o(u,h);throw e}}catch(t){throw n(t),new e(`imagecanvasdecoder: decode`,`cannot load image`)}}function a(t,n){let{width:r,height:i}=t,a=new OffscreenCanvas(r,i),o=a.getContext(`2d`);if(!o)throw new e(`imagecanvasdecoder: decode`,`cannot create canvas context`);o.drawImage(t,0,0,r,i);let s=c(o.getImageData(0,0,r,i),r,i,n);return a.width=0,a.height=0,s}function o(t,n,r=[2048,2048]){let[i,a]=r,o=new OffscreenCanvas(i,a),s=o.getContext(`2d`,{willReadFrequently:!0});if(!s)throw new e(`imagecanvasdecoder: decode`,`cannot create canvas context`);let{width:c,height:l}=t,u=c*l,d=new Uint8Array(u),f=new Uint8Array(u),p=new Uint8Array(u),m=n==null;n||=new Uint8Array(u);for(let e=0;e<l;e+=a){let r=Math.min(a,l-e);for(let a=0;a<c;a+=i){let o=Math.min(i,c-a);s.clearRect(0,0,o,r),s.drawImage(t,a,e,o,r,0,0,o,r);let{data:l}=s.getImageData(0,0,o,r);for(let t=0;t<r;t++){let r=t*o*4,i=(e+t)*c+a;for(let e=0;e<o;e++,r+=4,i++)d[i]=l[r],f[i]=l[r+1],p[i]=l[r+2],m&&(n[i]=l[r+3])}}}let h={width:c,height:l,pixels:[d,f,p],mask:n,pixelType:`u8`};return o.width=0,o.height=0,console.log(`decodeFullImageTiled: ${c}x${l} using tile ${i}x${a}`,h),h}function s(t,n,r){let[i,a,o]=n,[s,l]=r,u=Math.ceil(t.width/2**i),d=Math.ceil(t.height/2**i),f=Math.ceil(d/l),p=Math.ceil(u/s);if(a>=f||o>=p)return null;let m=new OffscreenCanvas(u,d),h=m.getContext(`2d`);if(!h)throw new e(`imagecanvasdecoder: decode`,`cannot create canvas context`);h.drawImage(t,0,0,u,d);let g=o*s,_=a*l,v=Math.min(s,u-g),y=Math.min(l,d-_),b=c(h.getImageData(g,_,v,y),s,l);return m.width=0,m.height=0,b}function c(e,t,n,r){let i=t*n,a=new Uint8Array(i),o=new Uint8Array(i),s=new Uint8Array(i),c=r==null;r||=new Uint8Array(i);let l={width:t,height:n,pixels:[a,o,s],mask:r,pixelType:`u8`},{width:u,height:d,data:f}=e;if(u===t&&d===n){for(let e=0,t=0;e<i;e++,t+=4)a[e]=f[t],o[e]=f[t+1],s[e]=f[t+2],c&&(r[e]=f[t+3]);return l}for(let e=0;e<d;e++){let n=e*u*4;for(let i=0;i<u;i++){let l=e*t+i;a[l]=f[n+i*4],o[l]=f[n+i*4+1],s[l]=f[n+i*4+2],c&&(r[l]=f[n+i*4+3])}}return l}function l(e){return`image/${e===`jpg`?`jpeg`:e}`}async function u(e,t){try{let n=new Uint8Array(e),r=Math.ceil(n.length/2),i=n.length-2;for(;r<i&&(n[r]!==255||n[r+1]!==217);r++);r+=2;let a=null;return r<n.length-1&&(a=await d(n.subarray(r,-4),t.width*t.height)),a}catch{return null}}async function d(e,t,n){try{let i=await r(e,void 0,n),a=new Uint8Array(t);for(let e=0,t=0;e<i.length;e++)for(let n=7;n>=0;n--)a[t++]=i[e]>>n&1;return a}catch{return null}}export{i as decode,d as decodeBitMask};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../../core/Error.js";import{assertIsSome as t}from"../../../core/maybe.js";import{isAbortError as
|
|
2
|
+
import e from"../../../core/Error.js";import{assertIsSome as t}from"../../../core/maybe.js";import{throwIfAborted as n,isAbortError as r}from"../../../core/promiseUtils.js";import{decode as i}from"./ImageCanvasDecoder.js";import{decode as a}from"./JpgPlus.js";import{load as o,decode as s}from"./Lerc.js";import{decode as c}from"./Lzw.js";import{convertNoDataToMask as l}from"./pixelRangeUtils.js";import{load as u,decode as d}from"./Qb3.js";import{decode as f}from"./Raw.js";import{decodeTileOrStrip as p,decode as m}from"./TiffDecoder.js";import{isPlatformLittleEndian as h}from"./utils.js";import{inflate as g}from"./Zlib.js";import _ from"../../support/PixelBlock.js";import v from"../../support/SimpleBandStatistics.js";async function y(t,n){if(!h)throw new e(`rasterCoded:decode`,`lerc decoder is not supported on big endian platform`);await o();let{width:r,height:i,pixelType:a,statistics:c,depthCount:l,noDataValues:u,bandMasks:d,pixels:f,mask:p,validPixelCount:m}=s(t,{inputOffset:n.offset,returnInterleaved:n.returnInterleaved});return new _({width:r,height:i,pixelType:a.toLowerCase(),pixels:f,mask:p,validPixelCount:m,statistics:c.map(({minValue:e,maxValue:t})=>new v(e,t)),bandMasks:d,depthCount:l,noDataValues:u})}async function b(t,n){await u();let r=d(t);if(!r)throw new e(`rasterCodec:decode`,`failed to decode the input data.`);let{width:i,height:a,pixels:o,pixelType:s}=r;return new _({width:i,height:a,pixelType:s,pixels:o})}async function x(e,n,r){let i=await m(e,{...n,noDataValue:n.tiffNoDataValue,matchAllNoData:n.matchAllNoData},r);return t(i),new _({width:i.width,height:i.height,pixels:i.pixels,pixelType:i.pixelType.toLowerCase(),mask:i.mask,bandMasks:i.bandMasks})}async function S(e,t,n){let r=await p(e,t.customOptions,n),i=new _({width:r.width,height:r.height,pixels:r.pixels,pixelType:r.pixelType.toLowerCase(),mask:r.mask});return t.skipStatistics||i.updateStatistics(),i}function C(e,t){let n=t.pixelType||`u8`,r=_.getPixelArrayConstructor(n),i=n===`u8`?e:new r(e.buffer),a=[],o=t.planes||1;if(o===1)a.push(i);else for(let n=0;n<o;n++){let s=(t.width||1)*(t.height||e.length),c=new r(s);for(let e=0;e<s;e++)c[e]=i[e*o+n];a.push(c)}return new _({width:t.width||1,height:t.height||e.length,pixels:a,pixelType:n})}async function w(e,t,n){return C(await g(new Uint8Array(e),void 0,n),t)}function T(e,t){return C(c(e,t.offset,t.eof,!t.isInputBigEndian),t)}function E(e,t){let n=t.format,{pixelTypeCtor:r}=j(t.pixelType),i=f(e,{width:t.width,height:t.height,pixelType:r,format:n});return new _({width:t.width,height:t.height,pixels:i.pixels,pixelType:t.pixelType,mask:i.mask})}async function D(e,t){let n=await a(e,t);return new _({width:n.width,height:n.height,pixels:n.pixels,pixelType:`u8`,mask:n.mask})}async function O(e,t,n){let r=await i(e,t,n);return new _(r)}async function k(t,n,i){let a=n.format||N(t),o={...n,format:a},{canvasUsage:s}=n;if(s!==`no-canvas`||a===`png`)try{return await O(t,o,i)}catch(t){if(r(t))throw t;if(s===`canvas-only`)throw new e(`rasterCodec:decode`,`failed to decode the input data with canvas for format ${a}`)}return await D(t,o)}function A(t){let n=null;switch(t){case`lerc`:n=y;break;case`jpg`:case`png`:n=k;break;case`bmp`:case`gif`:n=O;break;case`bsq`:case`bip`:n=E;break;case`tiff`:n=x;break;case`deflate`:n=w;break;case`lzw`:n=T;break;case`qb3`:n=b;break;default:n=()=>{throw new e(`rasterCodec:decode`,`unsupported raster format ${t}`)}}return n}function j(e){let t=e?e.toLowerCase():`f32`,n=null,r=null;switch(t){case`u1`:case`u2`:case`u4`:case`u8`:r=255,n=Uint8Array;break;case`u16`:r||=2**16-1,n=Uint16Array;break;case`u32`:r||=2**32-1,n=Uint32Array;break;case`s8`:r||=-128,n=Int8Array;break;case`s16`:r||=0-2**15,n=Int16Array;break;case`s32`:r||=0-2**31,n=Int32Array;break;default:n=Float32Array}return{pixelTypeCtor:n,noDataValue:r}}function M(e,t=`bilinear`){if(!e)return;let{pixels:n,width:r,height:i,mask:a}=e;if(!n||n.length===0)return;let o=r-1,s=i-1,c=[],l=null,u=_.getPixelArrayConstructor(e.pixelType);if(t===`nearest`){for(let e of n){let t=new u(o*s);for(let n=0;n<s;n++){let i=n*r;for(let r=0;r<o;r++)t[n*o+r]=e[i+r]}c.push(t)}if(a!=null){l=new Uint8Array(o*s);for(let e=0;e<s;e++){let t=e*r;for(let n=0;n<o;n++)l[e*o+n]=a[t+n]}}}else{for(let e of n){let t=new u(o*s);for(let n=0;n<s;n++){let i=n*r;for(let a=0;a<o;a++)t[n*o+a]=(e[i+a]+e[i+a+1]+e[i+r+a]+e[i+r+a+1])/4}c.push(t)}if(a){l=new Uint8Array(o*s);for(let e=0;e<s;e++){let t=e*r;for(let n=0;n<o;n++)l[e*o+n]=Math.min.apply(null,[a[t+n],a[t+n+1],a[t+r+n],a[t+r+n+1]])}}}e.width=o,e.height=s,e.mask=l,e.pixels=c}function N(e){if(!e)return;let t=new Uint8Array(e,0,10),n;return t[0]===255&&t[1]===216?n=`jpg`:t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71?n=`png`:t[0]===67&&t[1]===110&&t[2]===116&&t[3]===90&&t[4]===73&&t[5]===109&&t[6]===97&&t[7]===103&&t[8]===101&&t[9]===32||t[0]===76&&t[1]===101&&t[2]===114&&t[3]===99&&t[4]===50&&t[5]===32?n=`lerc`:t[0]===73&&t[1]===73&&t[2]===42&&t[3]===0||t[0]===77&&t[1]===77&&t[2]===0&&t[3]===42||t[0]===73&&t[1]===73&&t[2]===43&&t[3]===0||t[0]===77&&t[1]===77&&t[2]===0&&t[3]===43?n=`tiff`:t[0]===71&&t[1]===73&&t[2]===70?n=`gif`:t[0]===66&&t[1]===77?n=`bmp`:t[0]===81&&t[1]===66&&t[2]===51&&(n=`qb3`),n}async function P(t,r={},i){if(t==null)throw new e(`rasterCodec:decode`,`missing encodeddata parameter.`);let a=r.format?.toLowerCase();if((a===`bsq`||a===`bip`)&&(r.width==null||r.height==null))throw new e(`rasterCodec:decode`,`requires width and height in options parameter.`);if(a===`tiff`&&r.customOptions)return S(t,r,i);if(!a||a!==`bsq`&&a!==`bip`&&a!==`deflate`&&a!==`lzw`){if(a=N(t),!a)throw String.fromCharCode.apply(null,[...new Uint8Array(t,0,10)]).toLowerCase().includes(`error`)?new e(`rasterCodec:decode`,`input data contains error`):new e(`rasterCodec:decode`,`unsupported raster format`);r={...r,format:a}}let o=A(a);r.isPoint&&(r={...r},r.width!=null&&r.width++,r.height!=null&&r.height++);let s,{offsets:c}=r;if(c&&c.length>1){let e=c.map((e,n)=>o(t.slice(e,c[n+1]),r,i)),n=await Promise.all(e);s=n[0],s.pixels=n.map(e=>e.pixels[0]);let a=n.map(e=>e.mask);a.some(e=>e!=null)&&(a.forEach((e,t)=>{a[t]??=new Uint8Array(s.width*s.height).fill(255)}),s.bandMasks=a,s.mask=_.combineBandMasks(a))}else s=await o(t,{...r,offset:c?.[0]??r.offset},i);return n(i),a!==`jpg`&&r.noDataValue!=null&&s.depthCount===1&&l(s,r.noDataValue,{customFloatTolerance:r.tolerance}),r.isPoint&&M(s),!s.statistics?.length&&!r.skipStatistics&&s.updateStatistics(),s}export{P as decode,N as getFormat};
|
|
@@ -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{J as t}from"../../../chunks/Jpg.js";import{load as n,decode as r}from"./Lerc.js";import{decode as i}from"./Lzw.js";import{convertNoDataToMask as a}from"./pixelRangeUtils.js";import{isBSQConfig as o,getTagFirstNumericValue as s,getCompressionType as c,parseHeader as l,checkRequiredArraySize as u,getTagNumericValues as d,getImageInfo as f}from"./tiffParser.js";import{isPlatformLittleEndian as p}from"./utils.js";import{inflate as m}from"./Zlib.js";function h(e,t){let n=`unknown`;return e===3?n=t===64?`f64`:`f32`:e===1?t===1?n=`u1`:t===2?n=`u2`:t===4?n=`u4`:t<=8?n=`u8`:t<=16?n=`u16`:t<=32&&(n=`u32`):e===2&&(t<=8?n=`s8`:t<=16?n=`s16`:t<=32&&(n=`s32`)),n}function g(e){let t=e?e.toLowerCase():`f32`,n=null;switch(t){case`u1`:case`u2`:case`u4`:case`u8`:n=Uint8Array;break;case`u16`:n=Uint16Array;break;case`u32`:n=Uint32Array;break;case`s8`:n=Int8Array;break;case`s16`:n=Int16Array;break;case`s32`:n=Int32Array;break;case`f64`:n=Float64Array;break;default:n=Float32Array}return n}async function _(e,t){return await n(),r(e,{inputOffset:t}).pixels[0]}function v(e,t){if(t%8==0)return e;let n=t>16?32:t>8?16:8;n>8&&(e=b(e,n===32?4:2));let r=n===32?Uint32Array:n===16?Uint16Array:Uint8Array,i=new r(e),a=Math.floor(e.byteLength*8/t+1e-6),o=new r(a),s=(1<<t)-1,c=0,l=0,u=0;for(let e=0;e<a;e++)if(l===0&&(u=i[c++],l=n),l>=t)o[e]=u>>>l-t&s,l-=t;else{let r=t-l,a=(u&s)<<r&s;u=i[c++],l=n-r,a+=u>>>l,o[e]=a}return o.buffer}function y(e,n,r){let i=new t;i.parse(e),i.colorTransform=r===6?-1:0;let a=i.getData(i.width,i.height,n!==1&&n!==4);return new Uint8Array(a.buffer)}function b(e,t){let n=new Uint8Array(e),r=new Uint8Array(n.length);if(t===2)for(let e=0;e<n.length;e+=2)r[e]=n[e+1],r[e+1]=n[e];else if(t===4)for(let e=0;e<n.length;e+=4)r[e]=n[e+3],r[e+1]=n[e+2],r[e+2]=n[e+1],r[e+3]=n[e];else for(let e=0;e<n.length;e+=8)r[e]=n[e+7],r[e+1]=n[e+6],r[e+2]=n[e+5],r[e+3]=n[e+4],r[e+4]=n[e+3],r[e+5]=n[e+2],r[e+6]=n[e+1],r[e+7]=n[e];return r.buffer}async function x(t,n
|
|
2
|
+
import e from"../../../core/Error.js";import"../../../core/has.js";import{J as t}from"../../../chunks/Jpg.js";import{load as n,decode as r}from"./Lerc.js";import{decode as i}from"./Lzw.js";import{convertNoDataToMask as a}from"./pixelRangeUtils.js";import{isBSQConfig as o,getTagFirstNumericValue as s,getCompressionType as c,parseHeader as l,checkRequiredArraySize as u,getTagNumericValues as d,getImageInfo as f}from"./tiffParser.js";import{isPlatformLittleEndian as p}from"./utils.js";import{inflate as m}from"./Zlib.js";function h(e,t){let n=`unknown`;return e===3?n=t===64?`f64`:`f32`:e===1?t===1?n=`u1`:t===2?n=`u2`:t===4?n=`u4`:t<=8?n=`u8`:t<=16?n=`u16`:t<=32&&(n=`u32`):e===2&&(t<=8?n=`s8`:t<=16?n=`s16`:t<=32&&(n=`s32`)),n}function g(e){let t=e?e.toLowerCase():`f32`,n=null;switch(t){case`u1`:case`u2`:case`u4`:case`u8`:n=Uint8Array;break;case`u16`:n=Uint16Array;break;case`u32`:n=Uint32Array;break;case`s8`:n=Int8Array;break;case`s16`:n=Int16Array;break;case`s32`:n=Int32Array;break;case`f64`:n=Float64Array;break;default:n=Float32Array}return n}async function _(e,t){return await n(),r(e,{inputOffset:t}).pixels[0]}function v(e,t){if(t%8==0)return e;let n=t>16?32:t>8?16:8;n>8&&(e=b(e,n===32?4:2));let r=n===32?Uint32Array:n===16?Uint16Array:Uint8Array,i=new r(e),a=Math.floor(e.byteLength*8/t+1e-6),o=new r(a),s=(1<<t)-1,c=0,l=0,u=0;for(let e=0;e<a;e++)if(l===0&&(u=i[c++],l=n),l>=t)o[e]=u>>>l-t&s,l-=t;else{let r=t-l,a=(u&s)<<r&s;u=i[c++],l=n-r,a+=u>>>l,o[e]=a}return o.buffer}function y(e,n,r){let i=new t;i.parse(e),i.colorTransform=r===6?-1:0;let a=i.getData(i.width,i.height,n!==1&&n!==4);return new Uint8Array(a.buffer)}function b(e,t){let n=new Uint8Array(e),r=new Uint8Array(n.length);if(t===2)for(let e=0;e<n.length;e+=2)r[e]=n[e+1],r[e+1]=n[e];else if(t===4)for(let e=0;e<n.length;e+=4)r[e]=n[e+3],r[e+1]=n[e+2],r[e+2]=n[e+1],r[e+3]=n[e];else for(let e=0;e<n.length;e+=8)r[e]=n[e+7],r[e+1]=n[e+6],r[e+2]=n[e+5],r[e+3]=n[e+4],r[e+4]=n[e+3],r[e+5]=n[e+2],r[e+6]=n[e+1],r[e+7]=n[e];return r.buffer}async function x(t,n){let{input:r,isTiffLittleEndian:a,ifd:l,offset:u,size:d}=t,f=p===a,x=s(l,`BITSPERSAMPLE`),S=s(l,`SAMPLESPERPIXEL`)??1,C=s(l,`PHOTOMETRICINTERPRETATION`),w=s(l,`SAMPLEFORMAT`)??1,E=h(w,x),D=c(l);if(D===34887)return await _(r,u);let O=g(E),k,A;switch(D){case 1:k=r.slice(u,u+d),A=new Uint8Array(k);break;case 8:case 32946:A=await m(new Uint8Array(r,u,d),void 0,n),k=A.buffer;break;case 6:A=y(new Uint8Array(r,u,d),S,C),k=A.buffer;break;case 7:{let e=l.get(`JPEGTABLES`).values,t=e.length-2,n=new Uint8Array(t+d-2);for(let r=0;r<t;r++)n[r]=e[r];let i=new Uint8Array(r,u+2,d-2);for(let e=0;e<i.length;e++)n[t+e]=i[e];A=y(n,S,C),k=A.buffer}break;case 5:A=i(r,u,d,a),k=A.buffer;break;default:throw new e(`tiff-reader:decode-data`,`unsupported compression `+D)}k=v(k,x);let j;if(f||x<=8)j=new O(k);else{let e=x>32?8:x>16?4:2;j=new O(b(A.buffer,e))}let M=s(l,`PREDICTOR`)??1,N=s(l,`TILEWIDTH`),P=s(l,`TILELENGTH`);if(M>1&&(D===5||D===8||D===32946)&&N&&P){let e=o(l),t=new O(j.length);t.set(j),j=T(t,P,N,w===3&&M===3,e?1:S)}return j}async function S(e,t,n,r){let i=d(n,`TILEOFFSETS`),a=d(n,`TILEBYTECOUNTS`);if(i==null||a==null)return null;let{width:l,height:u,pixelType:p,tileWidth:m,tileHeight:h}=f([n]),_=o(n,t),v=s(n,`SAMPLESPERPIXEL`)||t.planes,y=l*u,b=s(n,`BITSPERSAMPLE`),S=c(n)===34887,C=g(p),w=[];for(let e=0;e<v;e++)w.push(new C(y));let T=Math.ceil(l/m),E=new Uint8Array(y).fill(255),D=null,O=!1;if(b%8==0){if(S&&_&&v>1){let o=Math.round(i.length/v);for(let s=0;s<o;s++){let o=Math.floor(s/T)*h,c=s%T*m,d=o*l+c;for(let f=0;f<v;f++){let p=s*v+f;a[p]===0?(D=null,O=!0):D=await x({input:e,isTiffLittleEndian:t.littleEndian,ifd:n,offset:i[p],size:a[p]},r);let g=Math.min(m,l-c),_=Math.min(h,u-o),y=w[f];for(let e=0;e<_;e++){let t=d+e*l,n=e*m;for(let e=0;e<g;e++,t++,n++)D?y[t]=D[n]:E[t]=0}}}}else for(let o=0;o<i.length;o++){let s=Math.floor(o/T)*h,c=o%T*m,d=s*l+c;a[o]===0?(D=null,O=!0):D=await x({input:e,isTiffLittleEndian:t.littleEndian,ifd:n,offset:i[o],size:a[o]},r);let f=Math.min(m,l-c),p=Math.min(h,u-s);for(let e=0;e<v;e++){let t=w[e];if(_||S)for(let n=0;n<p;n++){let r=d+n*l,i=m*h*e+n*m;for(let e=0;e<f;e++,r++,i++)D?t[r]=D[i]:E[r]=0}else for(let n=0;n<p;n++){let r=d+n*l,i=n*m*v+e;for(let e=0;e<f;e++,r++,i+=v)D?t[r]=D[i]:E[r]=0}}}}return{width:l,height:u,pixelType:p,pixels:w,mask:O?E:void 0}}async function C(e,t,n,r){let a=p===t.littleEndian,o=d(n,`STRIPOFFSETS`),l=d(n,`STRIPBYTECOUNTS`);if(o==null||l==null)return null;let{width:u,height:h,pixelType:_}=f([n]),b=s(n,`SAMPLESPERPIXEL`)||t.planes,x=s(n,`PHOTOMETRICINTERPRETATION`),S=u*h,C=s(n,`BITSPERSAMPLE`),w=g(_),T=new w(S*b),E=s(n,`ROWSPERSTRIP`),D=c(n),O,k,A,j;if(C%8==0)for(let n=0;n<o.length;n++){let s=E*u*n*b;if(_===`u8`||_===`s8`||a)D===8||D===32946?(A=new Uint8Array(e,o[n],l[n]),A=await m(A,void 0,r),k=A.buffer):D===6?(A=new Uint8Array(e,o[n],l[n]),A=y(A,b,x),k=A.buffer):D===5?(A=i(e,o[n],l[n],t.littleEndian),k=A.buffer):k=e.slice(o[n],o[n]+l[n]),k=v(k,C),O=new w(k);else{switch(D===6||D===8||D===32946?(A=new Uint8Array(e,o[n],l[n]),j=await m(A,void 0,r),k=j.buffer):(k=new ArrayBuffer(l[n]),A=new Uint8Array(e,o[n],l[n]),j=new Uint8Array(k)),_){case`u16`:case`s16`:for(let e=0;e<A.length;e+=2)j[e]=A[e+1],j[e+1]=A[e];break;case`u32`:case`s32`:case`f32`:for(let e=0;e<A.length;e+=4)j[e]=A[e+3],j[e+1]=A[e+2],j[e+2]=A[e+1],j[e+3]=A[e]}k=v(k,C),O=new w(k)}T.set(O,s)}let M=[];if(b===1)M.push(T);else for(let e=0;e<b;e++){let t=new w(S);for(let n=0;n<S;n++)t[n]=T[n*b+e];M.push(t)}return{width:u,height:h,pixelType:_,pixels:M}}function w(e,t,n){if(!(e&&e.length>0&&t&&n))return null;let r,i,a,o=e[0].length,s=e.length,c=new Uint8Array(o);for(let l=0;l<s;l++)if(r=e[l],i=t[l],a=n[l],l===0)for(let e=0;e<o;e++)c[e]=r[e]<i||r[e]>a?0:1;else for(let e=0;e<o;e++)c[e]&&(c[e]=r[e]<i||r[e]>a?0:1);return c}function T(e,t,n,r,i){let a=r?4:1,o=n*a*i;r&&(e=new Uint8Array(e.buffer));for(let n=0;n<t;n++){let t=n*o;for(let n=i;n<o;n++)e[t+n]+=e[t+n-i]}if(!r)return e;let s=new Uint8Array(e.length),c=n*i;for(let n=0;n<t;n++){let t=n*o;for(let n=0;n<c;n++)for(let r=0;r<a;r++)s[t+n*a+r]=e[t+n+(a-r-1)*c]}return new Float32Array(s.buffer)}async function E(e,t,n){let{headerInfo:r,ifd:i,offsets:l,sizes:u}=t,d=[];for(let t=0;t<l.length;t++){+(u[t]===0);let a=await x({input:e,isTiffLittleEndian:r.littleEndian,ifd:i,offset:l[t],size:u[t]||e.byteLength},n);d.push(a)}let f=o(i,r),p=s(i,`BITSPERSAMPLE`),m=h(s(i,`SAMPLEFORMAT`)??1,p),_=s(i,`SAMPLESPERPIXEL`)||r.planes,v=g(m),y=s(i,`TILEWIDTH`),b=s(i,`TILELENGTH`),S=c(i)===34887,C=y*b,T,E=[],D=d[0];for(let e=0;e<_;e++){if(T=new v(C),d.length===_)D=d[e],D.length===C&&(T=D);else if(D.length){if(f||S)T=D.length===C?D:D.slice(C*e,C*(e+1));else for(let t=0;t<C;t++)T[t]=D[t*_+e]}E.push(T)}let O=r.noData?r.noData[0]:t.noDataValue,k=r.metadata?r.metadata.statistics:null,A=k?k.map(e=>e.min):null,j=k?k.map(e=>e.max):null,M={pixelType:m,width:y,height:b,pixels:E,noDataValue:O};return O==null?A&&j&&t.applyMinMaxConstraint&&(M.mask=w(E,A,j)):a(M,O,{matchAllNoData:t?.matchAllNoData}),M}async function D(t,n={},r){let i=n.pyramidLevel||0,o=n.headerInfo||l(t),{ifds:s,noData:c}=o;if(s.length===0)throw new e(`tiff-reader:decode`,`no valid image file directory`);let d=u(o);if(d)throw new e(`tiff-reader:decode`,d);let f=i===-1?s[s.length-1]:s[i],p=c??n.noDataValue,m=o.tileWidth?await S(t,o,f,r):await C(t,o,f,r);if(!m)return m;if(p!=null){let e=c==null&&n?.matchAllNoData;a(m,p,{matchAllNoData:e})}return m}export{D as decode,E as decodeTileOrStrip};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
function e(e){if(e.length<2)return!1;let[t,n]=e.subarray(0,2),r=t&15,i=t>>4;return r!==8||i>7?!1:((t<<8|n)&65535)%31==0}function t(e){return e.length>=2&&e[0]===31&&e[1]===139}function n(n){return t(n)?`gzip`:e(n)?`deflate`:null}async function r(e,t){t??=n(e)??`deflate-raw`;let
|
|
2
|
+
function e(e){if(e.length<2)return!1;let[t,n]=e.subarray(0,2),r=t&15,i=t>>4;return r!==8||i>7?!1:((t<<8|n)&65535)%31==0}function t(e){return e.length>=2&&e[0]===31&&e[1]===139}function n(n){return t(n)?`gzip`:e(n)?`deflate`:null}async function r(e,t,r){t??=n(e)??`deflate-raw`;let i=new Response(e).body,a={signal:r?.signal??void 0},o=i.pipeThrough(new DecompressionStream(t),a),s=await new Response(o).arrayBuffer();return new Uint8Array(s)}export{r as inflate};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../geometry/Extent.js";import t from"../../geometry/Point.js";import n from"../../geometry/operators/support/GeographicTransformation.js";import{decode as r}from"../raster/formats/RasterCodec.js";import{transformPixels as i}from"../raster/functions/pixelTransformUtils.js";import{convertPixelBlockToFeatures as a,compositeBands as o,highlightPixels as s,split as c,clipTile as l,mosaicPixelData as u,mosaic as d,approximateTransform as f,getLocalArithmeticNorthRotations as p}from"../raster/functions/pixelUtils.js";import{create as m}from"../raster/functions/rasterFunctionHelper.js";import{load as h,getProjectionOffsetGrid as g}from"../raster/functions/rasterProjectionHelper.js";import{computeStatisticsHistograms as _,estimateStatisticsHistograms as v}from"../raster/functions/stretchUtils.js";import{convertVectorFieldData as y,sampleVectorField as b,convertToLocalDirections as x}from"../raster/functions/vectorFieldUtils.js";import{readTransform as S}from"../raster/transforms/utils.js";import C from"./PixelBlock.js";import w from"../../renderers/support/RasterSymbolizer.js";import{createFlowMesh as T}from"../../views/2d/engine/flow/dataUtils.js";function E(e){if(!e)return{result:null,transferList:[]};let{pixelBlock:t,transferList:n}=e.getTransferableObject();return{result:t,transferList:n}}class D{convertVectorFieldData(e){let t=C.fromJSON(e.pixelBlock),n=E(y(t,e.type));return Promise.resolve(n)}convertPixelBlockToFeatures(t){let n=a({pixelBlock:C.fromJSON(t.pixelBlock),extent:e.fromJSON(t.extent),fieldNames:t.fieldNames,skipFactor:t.skipFactor,skipSpatialReference:!0,pixelIdOffset:t.pixelIdOffset,imageRowSize:t.imageRowSize});return Promise.resolve(n)}sampleVectorFieldData(e){let t=C.fromJSON(e.pixelBlock),n=E(b(t,e.srcDataType,e.tileSize,e.offset,e.maximumVoidPercentage));return Promise.resolve(n)}transformPixels(e){let t=C.fromJSON(e.pixelBlock),n=i(t,e.transformType,e.transformParameters);return Promise.resolve(E(n))}computeStatisticsHistograms(e){let t=C.fromJSON(e.pixelBlock),n=_(t,{histogramSize:e.histogramSize,includeSkewnessKurtosis:e.includeSkewnessKurtosis});return Promise.resolve(n)}compositeBands(e){let t=e.pixelBlocks.map(e=>e&&C.fromJSON(e)),n=E(o(t));return Promise.resolve(n)}async decode(e){return E(await r(e.data,e.options))}symbolize(t){let n=t.pixelBlock?C.fromJSON(t.pixelBlock):null,r=t.extent?e.fromJSON(t.extent):null,i=E(this.symbolizer.symbolize({...t,pixelBlock:n,extent:r}));return Promise.resolve(i)}highlightPixels(e){let t=C.fromJSON(e.pixelBlock),n=C.fromJSON(e.renderedPixelBlock);return s({pixelBlock:t,renderedPixelBlock:n,highlightOptions:e.highlightOptions}),Promise.resolve(n.toJSON())}async updateSymbolizer(e){this.symbolizer=w.fromJSON(e.symbolizerJSON),e.histograms&&this.symbolizer?.rendererJSON.type===`rasterStretch`&&(this.symbolizer.rendererJSON.histograms=e.histograms)}async updateRasterFunction(e){this.rasterFunction=m(e.rasterFunctionJSON)}async process(n){return E(this.rasterFunction.process({extent:e.fromJSON(n.extent),primaryPixelBlocks:n.primaryPixelBlocks.map(e=>e==null?null:C.fromJSON(e)),primaryPixelSizes:n.primaryPixelSizes?.map(e=>e==null?null:t.fromJSON(e)),primaryRasterIds:n.primaryRasterIds},n.parameters))}stretch(e){let t=E(this.symbolizer.simpleStretch(C.fromJSON(e.srcPixelBlock),e.stretchParams));return Promise.resolve(t)}estimateStatisticsHistograms(e){let t=v(C.fromJSON(e.srcPixelBlock));return Promise.resolve(t)}split(e){let t=c(C.fromJSON(e.srcPixelBlock),e.tileSize,e.maximumPyramidLevel??0,e.useBilinear===!1),n=[],r;return t&&(r=new Map,t.forEach((e,t)=>{if(e){let{pixelBlock:i,transferList:a}=e.getTransferableObject();r.set(t,i),a.forEach(e=>{n.includes(e)||n.push(e)})}})),Promise.resolve({result:r,transferList:n})}clipTile(e){let t=C.fromJSON(e.pixelBlock),n=E(l({...e,pixelBlock:t}));return Promise.resolve(n)}mosaicPixelData(t){let n=t.pixelData.map(t=>({extent:e.fromJSON(t.extent),pixelBlock:t.pixelBlock?C.fromJSON(t.pixelBlock):null})),r=e.fromJSON(t.destExtent),i=E(u(n,r)?.pixelBlock);return Promise.resolve(i)}async mosaicAndTransform(e){let t=e.srcPixelBlocks.map(e=>e?new C(e):null),n=d(t,e.srcMosaicSize,{blockWidths:e.blockWidths,alignmentInfo:e.alignmentInfo,clipOffset:e.clipOffset,clipSize:e.clipSize}),r=n;e.coefs&&(r=f(n,e.destDimension,e.coefs,e.sampleSpacing,e.interpolation));let i;e.projectDirections&&e.gcsGrid&&(i=p(e.destDimension,e.gcsGrid),r=x(r,e.isUV?`vector-uv`:`vector-magdir`,i));let{result:a,transferList:o}=E(r);return{result:{pixelBlock:a,localNorthDirections:i},transferList:o}}async createFlowMesh(e,t){let n={data:new Float32Array(e.flowData.buffer),mask:new Uint8Array(e.flowData.maskBuffer),width:e.flowData.width,height:e.flowData.height},{vertexData:r,indexData:i,pathData:a}=await T(e.meshType,e.simulationSettings,n,e.startInfo,t.signal);return{result:{vertexBuffer:r.buffer,indexBuffer:i.buffer,pathBuffer:a.buffer},transferList:[r.buffer,i.buffer]}}async getProjectionOffsetGrid(t){let r=e.fromJSON(t.projectedExtent),i=e.fromJSON(t.srcBufferExtent),a=null;t.datumTransformationSteps?.length&&(a=new n({steps:t.datumTransformationSteps})),await h();let o=t.rasterTransform?S(t.rasterTransform):null;return g({...t,projectedExtent:r,srcBufferExtent:i,datumTransformation:a,rasterTransform:o})}}export{D as default};
|
|
2
|
+
import e from"../../geometry/Extent.js";import t from"../../geometry/Point.js";import n from"../../geometry/operators/support/GeographicTransformation.js";import{decode as r}from"../raster/formats/RasterCodec.js";import{transformPixels as i}from"../raster/functions/pixelTransformUtils.js";import{convertPixelBlockToFeatures as a,compositeBands as o,highlightPixels as s,split as c,clipTile as l,mosaicPixelData as u,mosaic as d,approximateTransform as f,getLocalArithmeticNorthRotations as p}from"../raster/functions/pixelUtils.js";import{create as m}from"../raster/functions/rasterFunctionHelper.js";import{load as h,getProjectionOffsetGrid as g}from"../raster/functions/rasterProjectionHelper.js";import{computeStatisticsHistograms as _,estimateStatisticsHistograms as v}from"../raster/functions/stretchUtils.js";import{convertVectorFieldData as y,sampleVectorField as b,convertToLocalDirections as x}from"../raster/functions/vectorFieldUtils.js";import{readTransform as S}from"../raster/transforms/utils.js";import C from"./PixelBlock.js";import w from"../../renderers/support/RasterSymbolizer.js";import{createFlowMesh as T}from"../../views/2d/engine/flow/dataUtils.js";function E(e){if(!e)return{result:null,transferList:[]};let{pixelBlock:t,transferList:n}=e.getTransferableObject();return{result:t,transferList:n}}class D{convertVectorFieldData(e){let t=C.fromJSON(e.pixelBlock),n=E(y(t,e.type));return Promise.resolve(n)}convertPixelBlockToFeatures(t){let n=a({pixelBlock:C.fromJSON(t.pixelBlock),extent:e.fromJSON(t.extent),fieldNames:t.fieldNames,skipFactor:t.skipFactor,skipSpatialReference:!0,pixelIdOffset:t.pixelIdOffset,imageRowSize:t.imageRowSize});return Promise.resolve(n)}sampleVectorFieldData(e){let t=C.fromJSON(e.pixelBlock),n=E(b(t,e.srcDataType,e.tileSize,e.offset,e.maximumVoidPercentage));return Promise.resolve(n)}transformPixels(e){let t=C.fromJSON(e.pixelBlock),n=i(t,e.transformType,e.transformParameters);return Promise.resolve(E(n))}computeStatisticsHistograms(e){let t=C.fromJSON(e.pixelBlock),n=_(t,{histogramSize:e.histogramSize,includeSkewnessKurtosis:e.includeSkewnessKurtosis});return Promise.resolve(n)}compositeBands(e){let t=e.pixelBlocks.map(e=>e&&C.fromJSON(e)),n=E(o(t));return Promise.resolve(n)}async decode(e,t){return E(await r(e.data,e.options,{signal:t?.signal}))}symbolize(t){let n=t.pixelBlock?C.fromJSON(t.pixelBlock):null,r=t.extent?e.fromJSON(t.extent):null,i=E(this.symbolizer.symbolize({...t,pixelBlock:n,extent:r}));return Promise.resolve(i)}highlightPixels(e){let t=C.fromJSON(e.pixelBlock),n=C.fromJSON(e.renderedPixelBlock);return s({pixelBlock:t,renderedPixelBlock:n,highlightOptions:e.highlightOptions}),Promise.resolve(n.toJSON())}async updateSymbolizer(e){this.symbolizer=w.fromJSON(e.symbolizerJSON),e.histograms&&this.symbolizer?.rendererJSON.type===`rasterStretch`&&(this.symbolizer.rendererJSON.histograms=e.histograms)}async updateRasterFunction(e){this.rasterFunction=m(e.rasterFunctionJSON)}async process(n){return E(this.rasterFunction.process({extent:e.fromJSON(n.extent),primaryPixelBlocks:n.primaryPixelBlocks.map(e=>e==null?null:C.fromJSON(e)),primaryPixelSizes:n.primaryPixelSizes?.map(e=>e==null?null:t.fromJSON(e)),primaryRasterIds:n.primaryRasterIds},n.parameters))}stretch(e){let t=E(this.symbolizer.simpleStretch(C.fromJSON(e.srcPixelBlock),e.stretchParams));return Promise.resolve(t)}estimateStatisticsHistograms(e){let t=v(C.fromJSON(e.srcPixelBlock));return Promise.resolve(t)}split(e){let t=c(C.fromJSON(e.srcPixelBlock),e.tileSize,e.maximumPyramidLevel??0,e.useBilinear===!1),n=[],r;return t&&(r=new Map,t.forEach((e,t)=>{if(e){let{pixelBlock:i,transferList:a}=e.getTransferableObject();r.set(t,i),a.forEach(e=>{n.includes(e)||n.push(e)})}})),Promise.resolve({result:r,transferList:n})}clipTile(e){let t=C.fromJSON(e.pixelBlock),n=E(l({...e,pixelBlock:t}));return Promise.resolve(n)}mosaicPixelData(t){let n=t.pixelData.map(t=>({extent:e.fromJSON(t.extent),pixelBlock:t.pixelBlock?C.fromJSON(t.pixelBlock):null})),r=e.fromJSON(t.destExtent),i=E(u(n,r)?.pixelBlock);return Promise.resolve(i)}async mosaicAndTransform(e){let t=e.srcPixelBlocks.map(e=>e?new C(e):null),n=d(t,e.srcMosaicSize,{blockWidths:e.blockWidths,alignmentInfo:e.alignmentInfo,clipOffset:e.clipOffset,clipSize:e.clipSize}),r=n;e.coefs&&(r=f(n,e.destDimension,e.coefs,e.sampleSpacing,e.interpolation));let i;e.projectDirections&&e.gcsGrid&&(i=p(e.destDimension,e.gcsGrid),r=x(r,e.isUV?`vector-uv`:`vector-magdir`,i));let{result:a,transferList:o}=E(r);return{result:{pixelBlock:a,localNorthDirections:i},transferList:o}}async createFlowMesh(e,t){let n={data:new Float32Array(e.flowData.buffer),mask:new Uint8Array(e.flowData.maskBuffer),width:e.flowData.width,height:e.flowData.height},{vertexData:r,indexData:i,pathData:a}=await T(e.meshType,e.simulationSettings,n,e.startInfo,t.signal);return{result:{vertexBuffer:r.buffer,indexBuffer:i.buffer,pathBuffer:a.buffer},transferList:[r.buffer,i.buffer]}}async getProjectionOffsetGrid(t){let r=e.fromJSON(t.projectedExtent),i=e.fromJSON(t.srcBufferExtent),a=null;t.datumTransformationSteps?.length&&(a=new n({steps:t.datumTransformationSteps})),await h();let o=t.rasterTransform?S(t.rasterTransform):null;return g({...t,projectedExtent:r,srcBufferExtent:i,datumTransformation:a,rasterTransform:o})}}export{D as default};
|