@arcgis/core 5.2.0-next.156 → 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/{925271bb763607a326ae.js → 2f04b8679c9f15390517.js} +1 -1
- package/assets/esri/core/workers/chunks/35e5762642d1a3a2e375.js +1 -0
- package/assets/esri/core/workers/chunks/{544070198d2ca556103a.js → 44918ff37818a7d36d76.js} +1 -1
- package/assets/esri/core/workers/chunks/{be5f92e98d09d6e6e38e.js → 4bb1bb3ffb1b71bc43c8.js} +1 -1
- package/assets/esri/core/workers/chunks/{1aa4f5394a596e544aeb.js → 4eae066673484986d4c1.js} +1 -1
- package/assets/esri/core/workers/chunks/{5f4feca26102088ea565.js → 60737732ce495bbdd0fc.js} +1 -1
- package/assets/esri/core/workers/chunks/{916b363c342b61ba5461.js → 787c1a8bda7d745633f2.js} +1 -1
- package/assets/esri/core/workers/chunks/{acfa03c65ba3ca6c5685.js → 8715661a838361d4211a.js} +1 -1
- package/assets/esri/core/workers/chunks/9215b59c5ccecf9add58.js +1 -0
- package/assets/esri/core/workers/chunks/{fafb92ca2c5e4b0b2c23.js → a09d2e1e2540921e4717.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/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.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/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/ImageryTileLayer.js +1 -1
- package/layers/LineOfSightLayer.d.ts +10 -8
- package/layers/ViewshedLayer.d.ts +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/raster/datasets/BaseRaster.js +1 -1
- package/layers/raster/datasets/ImageAuxRaster.js +2 -2
- package/layers/raster/datasets/InMemoryRaster.js +1 -1
- package/layers/support/kmlUtils.js +1 -1
- package/package.json +2 -2
- 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/3d/analysis/LineOfSight/types.d.ts +14 -3
- package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +39 -13
- package/views/3d/analysis/Viewshed/types.d.ts +7 -0
- package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +43 -15
- 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/assets/esri/core/workers/chunks/bac8c32665e982896ecc.js +0 -1
- package/assets/esri/core/workers/chunks/d9b1aed88b205689cec6.js +0 -1
- package/assets/esri/core/workers/chunks/de02a6a1f4810f99e9bb.js +0 -1
- package/assets/esri/core/workers/chunks/f4f9d08b2df856e3b694.js +0 -1
package/core/workers/workers.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../Error.js";import{handlesGroup as
|
|
2
|
+
import{deprecatedPropertyValue as e}from"../deprecate.js";import t from"../Error.js";import{handlesGroup as n}from"../handleUtils.js";import has from"../has.js";import r from"../Logger.js";import{getOrCreateMapValue as i}from"../MapUtils.js";import{throwIfAborted as a}from"../promiseUtils.js";import o from"./Connection.js";import{register as s}from"./connectionRegistry.js";import{registry as c}from"./registry.js";import l from"./RemoteClient.js";import u from"./WorkerOwner.js";function d(){let e=has(`min-workers-pool-size`)??2,t=has(`max-workers-pool-size`)??8,n=has(`host-browser`)&&navigator.hardwareConcurrency!==void 0?navigator.hardwareConcurrency-1:t;return Math.min(Math.max(e,n),t)}const f=[],p=new Map;let m=d(),h=0;function g(){m=d();h=0;p.clear()}function _(){E()}async function v(e,t={},n){let r=new o,{registryTarget:i,...a}=t;await r.open(e,a,n);i&&s(i,r);return r}async function y(n,a={}){if(typeof n!=`string`)throw new t(`workers:undefined-module`,`modulePath is missing`);let o=a.strategy||`distributed`;has(`host-webworker`)&&!has(`esri-workers`)&&(o=`local`);let s=a.isESM??!1;!s&&!Object.hasOwn(c,n)&&e(r.getLogger(`esri.core.workers`),`isESM`,`false`,{replacement:"Call `open` using the `isESM` option value `true`, and author the worker as an ES module.",see:`https://developers.arcgis.com/javascript/latest/references/core/core/workers/#open`,version:`5.2`,warnOnce:!0});let l=i(p,n,()=>new D(n,s));switch(o){case`local`:return b(l,a);default:return x(l,a)}}async function b({modulePath:e},t){let n=await l.loadWorker(e);n||=await import(
|
|
3
3
|
/* @vite-ignore */
|
|
4
4
|
/* webpackIgnore: true */
|
|
5
|
-
e);
|
|
5
|
+
e);a(t.signal);let r=t.client||n;return await v([l.connect(n,t.schedule)],{...t,client:r})}async function x(e,t){await E();a(t.signal);let r=[];return v(S(e,t.strategy===`dedicated`?1:t.maxNumWorkers&&t.maxNumWorkers>0?Math.min(t.maxNumWorkers,m):m,t.signal,r),t,()=>n(r).remove())}function*S(e,t,n,r){let i=new Set;for(let a=0;a<t;a++){let t=e.getNextProxyId(e=>!i.has(e));if(t==null)break;i.add(t);r.push(e.useProxy(t));yield f[t].open(e.modulePath,e.isESM,{signal:n})}}function C(){if(w){T.abort();w=null}for(let e=0;e<f.length;e++)f[e]&&f[e].terminate();f.length=0;g()}let w=null,T;async function E(){if(w)return w;T=new AbortController;let e=[];for(let t=0;t<m;t++){let n=u.create(t).then(e=>{f[t]=e;return e});e.push(n)}w=Promise.all(e);return w}class D{constructor(e,t){this.modulePath=e;this.isESM=t;this._proxyUseCount=new Map}useProxy(e){this._proxyUseCount.set(e,this._getProxyUseCount(e)+1);return{remove:()=>this._unuseProxy(e)}}getNextProxyId(e){let t=Array.from(this._proxyUseCount.keys()),n,r=h;h=(h+1)%m;for(let i=0;i<t.length;i++){let a=t[(r+i)%t.length];if(!e(a))continue;t.length===m&&(n??=a);if(this._getProxyUseCount(a)===0)return a}if(n!=null)return n;for(let t=0;t<m;t++){let n=(t+r)%m;if(e(n)&&!this._proxyUseCount.has(n))return n}}_unuseProxy(e){this._proxyUseCount.set(e,Math.max(0,this._getProxyUseCount(e)-1))}_getProxyUseCount(e){return this._proxyUseCount.get(e)??0}}export{o as Connection,l as RemoteClient,_ as initialize,y as open,v as openWithPorts,C as terminate};
|
package/core/workers.d.ts
CHANGED
|
@@ -41,6 +41,15 @@ export type OpenStrategy = "distributed" | "dedicated" | "local";
|
|
|
41
41
|
export interface OpenOptions extends AbortOptions {
|
|
42
42
|
/** The objects defining the API accessible from the module. */
|
|
43
43
|
client?: any;
|
|
44
|
+
/**
|
|
45
|
+
* Indicates whether the module is an ES module.
|
|
46
|
+
* Set to `true` when loading a custom ES module worker.
|
|
47
|
+
* The default is `false` for backward compatibility with legacy AMD custom workers. Loading custom workers this way is deprecated.
|
|
48
|
+
*
|
|
49
|
+
* @default false
|
|
50
|
+
* @since 5.2
|
|
51
|
+
*/
|
|
52
|
+
isESM?: boolean;
|
|
44
53
|
/**
|
|
45
54
|
* Indicates how to load the module. See the table below for a list of possible values.
|
|
46
55
|
*
|
package/geometry/Mesh.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{ClonableMixin as t}from"../core/Clonable.js";import{LoadableMixin as n}from"../core/Loadable.js";import r from"../core/Logger.js";import{EsriPromiseMixin as i}from"../core/Promise.js";import{throwIfAborted as a,isPromiseLike as o,whenOrAbort as s}from"../core/promiseUtils.js";import{watch as c}from"../core/reactiveUtils.js";import{property as l,subclass as u}from"../core/accessorSupport/decorators.js";import{fromValues as d}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import f from"./Geometry.js";import p from"./Point.js";import m from"./Polygon.js";import{create as h,
|
|
2
|
+
import{__decorate as e}from"tslib";import{ClonableMixin as t}from"../core/Clonable.js";import{LoadableMixin as n}from"../core/Loadable.js";import r from"../core/Logger.js";import{EsriPromiseMixin as i}from"../core/Promise.js";import{throwIfAborted as a,isPromiseLike as o,whenOrAbort as s}from"../core/promiseUtils.js";import{watch as c}from"../core/reactiveUtils.js";import{property as l,subclass as u}from"../core/accessorSupport/decorators.js";import{fromValues as d}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import f from"./Geometry.js";import p from"./Point.js";import m from"./Polygon.js";import{create as h,zero as g,fromBuffer as _}from"./support/aaBoundingBox.js";import{composeAxes as v,create as y}from"./support/axisAngleDegrees.js";import b from"./support/MeshComponent.js";import{componentNotFoundMessage as x,meshNotLoadedMessage as S,invalidLocationMessage as C,invalidPolygonMessage as w,InvalidLocationError as T}from"./support/meshErrors.js";import E from"./support/MeshGeoreferencedVertexSpace.js";import D from"./support/MeshLocalVertexSpace.js";import O from"./support/MeshTransform.js";import k from"./support/MeshVertexAttributes.js";import{vertexSpaceOriginToPoint as A,isRelativeVertexSpace as j}from"./support/meshVertexSpaceUtils.js";import{centerAt as M}from"./support/meshUtils/centerAt.js";import{computeMeshExtent as N}from"./support/meshUtils/extent.js";import{loadExternal as P}from"./support/meshUtils/loadExternal.js";import{addMeshMaterialCloneContext as F,addMeshTextureCloneContext as I,getMeshCloneContext as L}from"./support/meshUtils/meshCloneUtils.js";import{Metadata as R}from"./support/meshUtils/Metadata.js";import{convertUnitGeometry as z,createUnitSizeBox as B,extractSingleFaceOfBox as V,createUnitSizeSphere as H,createUnitSizeCylinder as U,convertPlaneSizeParameter as W,createUnitSizePlane as G}from"./support/meshUtils/primitives.js";import{rotate as K}from"./support/meshUtils/rotate.js";import{scale as q}from"./support/meshUtils/scale.js";import{polygonToRenderInfoNotElevationAligned as J}from"../views/3d/support/renderInfoUtils/polygon.js";var Y;const X={base:null,key:`type`,defaultKeyValue:`georeferenced`,typeMap:{georeferenced:E,local:D}};let Z=Y=class extends t(n(i(f))){constructor(e){super(e),this.components=null,this.vertexSpace=new E,this.transform=null,this.metadata=new R,this.hasZ=!0,this.hasM=!1,this.vertexAttributes=new k,this.type=`mesh`}initialize(){(this.metadata.externalSources.length===0||this.vertexAttributes.position.length)&&(this.loadStatus=`loaded`),this.when(()=>{this.addHandles(c(()=>({vertexAttributes:this.vertexAttributes,components:this.components?.map(e=>e.clone())}),()=>this._clearSources(),{once:!0,sync:!0}))}).catch(()=>{})}get hasExtent(){return this.loaded?this.vertexAttributes.position.length>0&&(!this.components||this.components.length>0):this.metadata.displaySource?.extent!=null}get _transformedExtent(){let{spatialReference:e,vertexSpace:t}=this,n=this;return N({get transform(){return n.transform},vertexSpace:t,spatialReference:e,untransformedBounds:this._untransformedBounds})}get _untransformedBounds(){let{vertexAttributes:{position:e},components:t}=this;return e.length===0||t?.length===0?h(g):_(e)}get origin(){let e=A(this.vertexSpace,this.spatialReference);if(e!=null)return e;let{center:t,zmin:n}=this._transformedExtent;return new p({x:t.x,y:t.y,z:n,spatialReference:this.spatialReference})}get extent(){return!this.loaded&&this.metadata?.displaySource?.extent!=null?this.metadata.displaySource.extent.clone():this._transformedExtent}addComponent(e){this._checkIfLoaded(`addComponent()`)&&(this.components||=[],this.components.push(b.from(e)),this.notifyChange(`components`))}removeComponent(e){if(this._checkIfLoaded(`removeComponent()`)){if(this.components){let t=this.components.indexOf(e);if(t!==-1){this.components.splice(t,1),this.notifyChange(`components`);return}}r.getLogger(this).error(`removeComponent()`,x)}}rotate(e,t,n,r){return v(e,t,n,Q),K(this,Q,r),this}offset(e,t,n){if(!this._checkIfLoaded(`offset()`))return this;let{vertexSpace:r,vertexAttributes:i}=this,a=i?.position;if(!a)return this;if(j(r)){let[i,a,o]=r.origin;r.origin=d(i+e,a+t,o+n)}else{for(let r=0;r<a.length;r+=3)a[r]+=e,a[r+1]+=t,a[r+2]+=n;this.vertexAttributesChanged()}return this}scale(e,t){return this._checkIfLoaded(`scale()`)&&q(this,e,t),this}centerAt(e,t){return this._checkIfLoaded(`centerAt()`)&&M(this,e,t),this}load(e){let{metadata:{displaySource:t}}=this;return t&&this.addResolvingPromise(P(this,t,e)),Promise.resolve(this)}addExternalSources(e){this.metadata.externalSources.addMany(e)}updateDisplaySource(e){this.metadata.displaySource=e}clone(e){return super.clone(F(I(e)))}cloneShallow(){return new Y({components:this.components,spatialReference:this.spatialReference,vertexAttributes:this.vertexAttributes,vertexSpace:this.vertexSpace.clone(),transform:this.transform,metadata:this.metadata})}vertexAttributesChanged(){this.notifyChange(`vertexAttributes`)}async toBinaryGLTF(e){let[{toBinaryGLTF:t}]=await Promise.all([import(`./support/meshUtils/exporters/gltf/gltfexport.js`),this.load(e)]);return a(e),await t(this,e)}get usedMemory(){return this.components?this.components.reduce((e,t)=>e+t.memoryUsage,this.vertexAttributes.usedMemory):this.vertexAttributes.usedMemory}_clearSources(){this.metadata.clearSources()}_checkIfLoaded(e){return this.loaded?!0:(r.getLogger(this).error(e,S),!1)}static createBox(e,t){if(!(e instanceof p))return r.getLogger(this.prototype).error(`.createBox()`,C),null;let n=new Y(z(B(),e,t));return t?.imageFace&&t.imageFace!==`all`?V(n,t.imageFace):n}static createSphere(e,t){return e instanceof p?new Y(z(H(t?.densificationFactor||0),e,t)):(r.getLogger(this.prototype).error(`.createSphere()`,C),null)}static createCylinder(e,t){return e instanceof p?new Y(z(U(t?.densificationFactor||0),e,t)):(r.getLogger(this.prototype).error(`.createCylinder()`,C),null)}static createPlane(e,t){if(!(e instanceof p))return r.getLogger(this.prototype).error(`.createPlane()`,C),null;let n=t?.facing??`up`,i=W(n,t?.size);return new Y(z(G(n),e,{...t,size:i}))}static createFromPolygon(e,t){if(!(e instanceof m))return r.getLogger(this.prototype).error(`.createFromPolygon()`,w),null;let n=J(e,{method:`earcut`}),i=o(n)?null:n,a=i?.positions??[],s=i?.polygonIndices??[];return new Y({vertexAttributes:new k({position:a}),components:[new b({faces:s,shading:`flat`,material:t?.material??null})],spatialReference:e.spatialReference,vertexSpace:new E})}static async createFromGLTF(e,t,n){if(!(e instanceof p)){let e=new T;throw r.getLogger(this.prototype).error(`.createfromGLTF()`,e.message),e}let{loadGLTFMesh:i}=await s(import(`./support/meshUtils/loadGLTFMesh.js`),n);return new Y((await i(e,t,n)).mesh)}};e([l({type:[b],json:{write:!0}})],Z.prototype,`components`,void 0),e([l({nonNullable:!0,types:X,constructOnly:!0,json:{write:!0},clonable:(e,t)=>L(t)?.vertexSpace??e.clone(t)})],Z.prototype,`vertexSpace`,void 0),e([l({type:O,clonable:(e,t)=>{let n=L(t);return n&&`transform`in n?n.transform:e?.clone()??e},json:{write:!0}})],Z.prototype,`transform`,void 0),e([l({constructOnly:!0,type:R,clonable:(e,t)=>L(t)?.metadata??e.clone()})],Z.prototype,`metadata`,void 0),e([l()],Z.prototype,`hasExtent`,null),e([l()],Z.prototype,`_transformedExtent`,null),e([l()],Z.prototype,`_untransformedBounds`,null),e([l()],Z.prototype,`origin`,null),e([l({readOnly:!0,json:{read:!1}})],Z.prototype,`extent`,null),e([l({readOnly:!0,json:{read:!1,write:!0,default:!0}})],Z.prototype,`hasZ`,void 0),e([l({readOnly:!0,json:{read:!1,write:!0,default:!1}})],Z.prototype,`hasM`,void 0),e([l({type:k,nonNullable:!0,json:{write:!0},clonable:(e,t)=>L(t)?.vertexAttributes??e.clone(t)})],Z.prototype,`vertexAttributes`,void 0),Z=Y=e([u(`esri.geometry.Mesh`)],Z);const Q=y();export{Z as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{floatEqualRelative as e,floatEqualAbsolute as t}from"../../../core/mathUtils.js";import{exactEquals as n}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{expandPointInPlace as r,containsXY as i,expandXInPlace as a,expandYInPlace as o}from"../aaBoundingRect.js";import{
|
|
2
|
+
import{floatEqualRelative as e,floatEqualAbsolute as t}from"../../../core/mathUtils.js";import{exactEquals as n}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{expandPointInPlace as r,containsXY as i,expandXInPlace as a,expandYInPlace as o}from"../aaBoundingRect.js";import{findClosestAndFurthestCurveParametersToPoint as s,distance2 as c,interpolateSegment as l}from"./mathUtils.js";const u=[0,0];function d(e){let t=1-e,n=t*t,r=e*e;return[n*t,3*e*n,3*r*t,r*e]}function f(e,t,n,r,i){let[a,o,s,c]=d(i);return[e[0]*a+t[0]*o+n[0]*s+r[0]*c,e[1]*a+t[1]*o+n[1]*s+r[1]*c]}function p(e,t,n,r,i){let[a,o,s,c]=d(i);return e*a+t*o+n*s+r*c}function m(e,t,n){let r=e,[i,a,o]=t.b;return f(r,a,o,i,n)}function h(e,t){let[[r,i],a,o]=t.b,s=[r,i];return n(s,o)?n(s,a)?n(s,e)?null:[r-e[0],i-e[1]]:[r-a[0],i-a[1]]:[r-o[0],i-o[1]]}function g(e,t,n){let r=e,[i,a,o]=t.b,s=l([0,0],r,a,n),c=l(u,a,o,n),d=l([0,0],o,i,n),f=l([0,0],s,c,n),p=l([0,0],c,d,n);return[{b:[l([],f,p,n),s,f]},{b:[[...i],p,d]}]}function _(n,r,i){let a=n,[o,c,l]=r.b,u=s(i,[.1,.5,.9],e=>{let t=1-e,[n,r]=f(a,c,l,o,e);return[n,r,3*t*t*(c[0]-a[0])+6*t*e*(l[0]-c[0])+3*e*e*(o[0]-l[0]),3*t*t*(c[1]-a[1])+6*t*e*(l[1]-c[1])+3*e*e*(o[1]-l[1]),6*t*(l[0]-2*c[0]+a[0])+6*e*(o[0]-2*l[0]+c[0]),6*t*(l[1]-2*c[1]+a[1])+6*e*(o[1]-2*l[1]+c[1])]}).map(e=>Math.min(1,Math.max(0,e)));u.push(0,1);let d=1/0,p=u.map(e=>{let t=f(a,c,l,o,e),[n,r]=t,s=i[0]-n,u=i[1]-r,p=Math.sqrt(s*s+u*u);return d=Math.min(p,d),{t:e,curvePoint:t,distance:p}}),m=[];for(let n of p){let{t:r,distance:i}=n;e(i,d)&&!m.some(({t:e})=>t(e,r))&&m.push(n)}return m}function v(e,t,n){let s=t,[c,l,u]=n.b;if(r(e,s),r(e,c),i(e,l[0],l[1])&&i(e,u[0],u[1]))return e;for(let t of y(s[0],l[0],u[0],c[0]))t>0&&t<1&&a(e,p(s[0],l[0],u[0],c[0],t));for(let t of y(s[1],l[1],u[1],c[1]))t>0&&t<1&&o(e,p(s[1],l[1],u[1],c[1],t));return e}function y(e,t,n,r){let i=3*(-e+3*(t-n)+r),a=6*(e-2*t+n),o=3*(t-e);if(i===0)return a===0?[]:[-o/a];let s=Math.sqrt(a*a-4*i*o);return[(-a+s)/(2*i),(-a-s)/(2*i)]}function b(e,t,n){let r=0,i=[t];for(let t=0;t<16;t++){let t=e,a=[];for(let e of i)a.push(...g(t,e,.5)),t=e.b[0];i=a,t=e,r=0;let o=0;for(let e of i){let[n,i,a]=e.b,s=Math.sqrt(c(t,n)),l=Math.sqrt(c(t,i)),u=Math.sqrt(c(i,a)),d=Math.sqrt(c(a,n)),f=l+u+d;r+=(s+f)/2,o+=s,t=n}if(r-o<n)return r}return r}export{v as bezierCurveExtent,b as bezierCurveLength,h as calculateBezierCurveTangent,_ as closestPointsOnBezierCurve,m as interpolateBezierCurve,f as interpolateCubicBezier,p as interpolateCubicBezier1D,g as splitBezierCurve};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{set as e,invert as t,transpose as n,multiply as r}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{transformMat3 as a,exactEquals as o,normalize as s,add as c}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{expandPointInPlace as l}from"../aaBoundingRect.js";import{cloneCurve as u}from"./curveUtils.js";import{angularRangeWrap as d,angularRangeOriented as f,angularRange as p,wrapAtan2 as m,
|
|
2
|
+
import{set as e,invert as t,transpose as n,multiply as r}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{transformMat3 as a,exactEquals as o,normalize as s,add as c}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{expandPointInPlace as l}from"../aaBoundingRect.js";import{cloneCurve as u}from"./curveUtils.js";import{angularRangeWrap as d,angularRangeOriented as f,angularRange as p,wrapAtan2 as m,findClosestAndFurthestCurveParametersToPoint as h,distance2 as g,intersectLineLine as _,angularDistanceAlongOrientedArc as v}from"./mathUtils.js";class y{constructor(e,t,n,r,i,a,o,s,c){this.cx=e,this.cy=t,this.a=n,this.b=r,this.cosR=i,this.sinR=a,this.u1=o,this.u2=s,this.isInvalid=c}}function b(e,t){let[n,r,i,a,o,s,c]=t.a,[l,u]=e,[d,p]=n,[h,g]=r,_=s*c,v=Math.cos(o),b=Math.sin(o),[x,S]=f(m(1/_*(u-g)*v-1/_*(l-h)*b,1/s*(u-g)*b+1/s*(l-h)*v),Math.atan2(1/_*(p-g)*v-1/_*(d-h)*b,1/s*(p-g)*b+1/s*(d-h)*v),i,a);return new y(h,g,s,_,v,b,x,S,s===0||_===0)}function x(e,t){let{a:n,b:r,cosR:i,sinR:a,cx:o,cy:s}=e,c=Math.cos(t),l=Math.sin(t);return[n*c*i-r*l*a+o,n*c*a+r*l*i+s]}function S(e,t){let{u1:n,u2:r}=e;return x(e,n*(1-t)+r*t)}function C(e,t){let[n,r]=t.a[0],{a:i,b:a,cx:l,cy:u,cosR:d,sinR:f,isInvalid:p,u1:m,u2:h}=b(e,t);if(p){let[t,i]=e;return o([t,i],[n,r])?null:[n-t,r-i]}let g=Math.sqrt(i*i-a*a),_=[l+g*d,u+g*f],v=[l-g*d,u-g*f],y=[n-_[0],r-_[1]],x=[n-v[0],r-v[1]];s(y,y),s(x,x);let[S,C]=c(y,y,x);return h>m?[-C,S]:[C,S]}function w(e,t,n){if(n<0||n>1)return[];if(n===0||n===1)return[u(t)];let[r,[i,a],o,s,c,l,d]=t.a,{u1:f,u2:p}=e,m=S(e,n),h=f*(1-n)+p*n,g=+(Math.abs(h-f)<Math.PI),_=+(Math.abs(p-h)<Math.PI);return[{a:[[...m],[i,a],g,s,c,l,d]},{a:[[...r],[i,a],_,s,c,l,d]}]}function T(e,t){let{a:n,b:r,cosR:i,sinR:a,u1:o,u2:s}=e,c=Math.PI/6,l=[1*c,2*c,4*c,5*c,7*c,8*c,10*c,11*c],u=h(t,l,t=>{let o=Math.cos(t),s=Math.sin(t),[c,l]=x(e,t);return[c,l,-n*i*s-r*a*o,-n*a*s+r*i*o,-n*i*o+r*a*s,-n*a*o-r*i*s]}),f=p(o,s),m=new Set(u.map(e=>d(f,e)).filter(e=>e>f.min&&e<f.max));m.add(o),m.add(s);let g=1/0,_,v;for(let n of m){let r=x(e,n),[i,a]=r,c=t[0]-i,l=t[1]-a,u=c*c+l*l;u<g&&(_=(n-o)/(s-o),v=r,g=u)}return{t:_,curvePoint:v,distance:Math.sqrt(g)}}function E(e,t,n){let r=b(t,n),{a:i,b:a,u1:o,u2:s,cosR:c,sinR:u,isInvalid:f}=r,m=n.a[0];if(l(e,t),l(e,m),f)return e;let h=Math.atan2(-a*u,i*c),g=h+Math.PI,_=Math.atan2(a*c,i*u),v=_+Math.PI,y=p(o,s);for(let t of[h,g,_,v].map(e=>d(y,e)))t>y.min&&t<y.max&&l(e,x(r,t));return e}function D(e,t,n){let[r,i,a,o,s,c,l]=t.a,u=b(e,t),{u1:d,u2:f,isInvalid:p}=u,m=f-d;if(p)return Math.sqrt(g(e,r));let h=[0,0],v=0,y=[S(u,0),S(u,.25),S(u,.5),S(u,.75),S(u,1)];for(let e=0;e<14;e++){let e=y.length-1,t=m/(e*2),r=[];for(let n=0;n<e;n++)r.push(y[n]),r.push(x(u,d+(n*2+1)*t));r.push(y[y.length-1]),y=r,v=0;let a=0;for(let e=1;e<y.length;e++){let t=y[e-1],n=y[e];if(v+=Math.sqrt(g(t,n)),e>1){let r=y[e-2],o=_(h,r,t,i,n);a+=o?Math.sqrt(g(t,o)):Math.abs(n[0]-t[0])+Math.abs(n[1]-t[1])}else a+=v}if(a-v<n)return v}return v}const O=i(),k=i(),A=i(),j=i();function M(i,o,s){let[c,l,u,d,f,p,h]=o.a,{cosR:_,sinR:v,a:y,b:x,cx:S,cy:C}=b(i,o),w=a([0,0],c,s),T=a([0,0],l,s),E=s[0]*s[4]<0?1-d:d;{let t=y*y*v*v+x*x*_*_,n=2*(x*x-y*y)*v*_,r=y*y*_*_+x*x*v*v,i=-2*t*S-n*C,a=-n*S-2*r*C,o=t*S*S+n*S*C+r*C*C-y*y*x*x;e(O,t,n/2,i/2,n/2,r,a/2,i/2,a/2,o)}if(t(k,s),k==null){let e=a([0,0],i,s);return{a:[w,T,u,d,m(w[1],w[0]),Math.sqrt(g(w,e))/2,0]}}n(A,k),r(j,r(j,A,O),k);{let e=j[0],t=2*j[1],n=j[4],r=2*j[2],i=2*j[5],a=j[8],o=t*t-4*e*n,s=2*(e*i*i+n*r*r-t*r*i+o*a),c=Math.sqrt((e-n)**2+t*t),l=-Math.sqrt(s*(e+n+c))/o,d=-Math.sqrt(s*(e+n-c))/o;return{a:[w,T,u,E,.5*m(-t,n-e),l,d/l]}}}function N(e,t){let[n,r]=e,[i,[a,o],s,c,l,u,d]=t.a,[f,p]=i;if(d<1e-8||u===0){t.a=[i,[0,0],0,0,0,0,0];return}let m=u*d,h=Math.cos(l),g=Math.sin(l);function _(e,t){let n=(e*h+t*g)/u,r=(t*h-e*g)/m;return n*n+r*r}let y=_(n-a,r-o),b=_(f-a,p-o);if(y===1&&b===1)return;if(Math.hypot(f-n,p-r)<1e-8){s?t.a=[i,[0,0],0,0,0,0,0]:t.a[5]=u*Math.sqrt(y);return}let x=(h*(n-f)+g*(r-p))/2,S=(-g*(n-f)+h*(r-p))/2,C=x*x,w=S*S,T=C/(u*u)+w/(m*m);if(T>1){let e=Math.sqrt(T);u*=e,m*=e}let E=u*u,D=m*m,O=E*w+D*C,k=Math.sqrt((E*D-O)/O);isFinite(k)||(k=0),!s==!c&&(k=-k);let A=k*S*u/m,j=-(k*x*m)/u;a=h*A-g*j+(n+f)/2,o=g*A+h*j+(r+p)/2;let M=Math.atan2(r-o,n-a),N=Math.atan2(p-o,f-a);s=+(v(M,N,c)<=Math.PI),t.a[1].splice(0,2,a,o),t.a[2]=s,t.a.splice(5,2,u,m/u)}export{y as DerivedEllipse,C as calculateEllipticArc7Tangent,T as closestPointOnEllipse,b as deriveEllipse,E as ellipticArcExtent,D as ellipticArcLength,S as interpolateEllipse,N as normalizeEllipticArcAfterEndpointChange,w as splitEllipticArc7,M as transformEllipticArc};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../../core/Logger.js";import{fromMat4 as t}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromRotationTranslationScaleOrigin as r,multiply as i,getScale as a,scale as o,getTranslation as s,fromRotation as c}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{setAxisAngle as u}from"../../../core/libs/gl-matrix-2/math/quat.js";import{create as d}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{set as f,inverse as p,transformMat3 as m,transformMat4 as h}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as g,
|
|
2
|
+
import e from"../../../core/Logger.js";import{fromMat4 as t}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromRotationTranslationScaleOrigin as r,multiply as i,getScale as a,scale as o,getTranslation as s,fromRotation as c}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{setAxisAngle as u}from"../../../core/libs/gl-matrix-2/math/quat.js";import{create as d}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{set as f,inverse as p,transformMat3 as m,transformMat4 as h}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as g,create as _,ONES as v}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import y from"../../Point.js";import{getSphericalPCPF as b}from"../../spatialReferenceEllipsoidUtils.js";import{computeTranslationToOriginAndRotation as x}from"../../projection/computeTranslationToOriginAndRotation.js";import{projectPointToVector as S}from"../../projection/projectPointToVector.js";import{angleRad as C,axis as w,fromMatrix as T,create as E}from"../axisAngleDegrees.js";import D from"../MeshTransform.js";import{isMeshWithRelativeVertexSpace as O}from"../meshVertexSpaceUtils.js";import{performGlobalOperation as k}from"./geographicUtils.js";import{logProjectionError as A,loadProjectErrorMessage as j,projectToPCPF as M,projectNormalToPCPF as N,projectTangentToPCPF as P,projectFromPCPF as F,projectNormalFromPCPF as I,projectTangentFromPCPF as L}from"./projection.js";import{projectPointToVertexSpace as R}from"./vertexSpaceConversion.js";const z=()=>e.getLogger(`esri.geometry.support.meshUtils.rotate`);function B(e,t,n){if(!e.vertexAttributes?.position||t[3]===0)return;let{spatialReference:r,vertexSpace:i}=e,a=n?.origin??e.origin;O(e)?V(e,t,a):k(i,r)?H(e,t,a):U(e,t,a)}function V(e,t,n){e.transform??=new D;let{vertexSpace:c,transform:l,spatialReference:d}=e,[m,h,b]=c.origin,x=new y({x:m,y:h,z:b,spatialReference:d}),S=G;if(x.equals(n))f(S,0,0,0);else if(!R(S,n,e)){A(z(),n.spatialReference,d,j);return}u(Z,w(t),C(t));let E=r(K,Z,g,v,S),{localMatrix:O}=l,k=i(K,E,O);l.scale=a(_(),k),o(k,k,p(G,l.scale));let M=l.rotationAxis;l.rotation=T(k),l.rotationAngle===0&&(l.rotationAxis=M),l.translation=s(_(),k)}function H(e,n,r){let i=e.spatialReference,a=b(i),o=X;if(!S(r,o,a)&&(A(z(),r.spatialReference,a,`Falling back to mesh origin`),!S(e.origin,o,a))){A(z(),e.origin.spatialReference,a);return}let s=e.vertexAttributes.position,c=e.vertexAttributes.normal,l=e.vertexAttributes.tangent,u=new Float64Array(s.length),d=c==null?null:new Float32Array(c.length),f=l==null?null:new Float32Array(l.length);x(a,o,J,a),t(Y,J);let p=q;if(m(w(q),w(n),Y),p[3]=n[3],!M(s,i,u,a)){A(z(),i,a);return}if(c!=null&&d!=null&&!N(c,s,i,u,a,d)){A(z(),i,a);return}if(l!=null&&f!=null&&!P(l,s,i,u,a,f)){A(z(),i,a);return}if(W(u,p,3,o),!F(u,a,s,i)){A(z(),a,i);return}if(c!=null&&d!=null&&(W(d,p,3),!I(d,s,i,u,a,c))){A(z(),a,i);return}if(l!=null&&f!=null&&(W(f,p,4),!L(f,s,i,u,a,l))){A(z(),a,i);return}e.vertexAttributesChanged()}function U(e,t,n){let r=X;if(!S(n,r,e.spatialReference)){let t=e.origin;r[0]=t.x,r[1]=t.y,r[2]=t.z,A(z(),n.spatialReference,e.spatialReference,j);return}W(e.vertexAttributes.position,t,3,r),W(e.vertexAttributes.normal,t,3),W(e.vertexAttributes.tangent,t,4),e.vertexAttributesChanged()}function W(e,t,n,r=g){if(e!=null){c(J,C(t),w(t));for(let t=0;t<e.length;t+=n){for(let n=0;n<3;n++)G[n]=e[t+n]-r[n];h(G,G,J);for(let n=0;n<3;n++)e[t+n]=G[n]+r[n]}}}const G=_(),K=l(),q=E(),J=l(),Y=n(),X=_(),Z=d();export{B as rotate};
|
package/kernel.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"./core/has.js";import{addQueryParameter as e}from"./core/urlUtils.js";Symbol.dispose??=Symbol(`Symbol.dispose`),Symbol.asyncDispose??=Symbol(`Symbol.asyncDispose`);const t=`5.2`;let n=`5.2`;n=`5.2.0-next.
|
|
2
|
+
import"./core/has.js";import{addQueryParameter as e}from"./core/urlUtils.js";Symbol.dispose??=Symbol(`Symbol.dispose`),Symbol.asyncDispose??=Symbol(`Symbol.asyncDispose`);const t=`5.2`;let n=`5.2`;n=`5.2.0-next.157`;let r;function i(e){r=e}function a(t){let n=r?.findCredential(t);return n?.token?e(t,`token`,n.token):t}globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}});export{a as addTokenParameter,n as fullVersion,r as id,i as setId,t as version};
|
|
@@ -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"../PopupTemplate.js";import{ClonableMixin as n}from"../core/Clonable.js";import r from"../core/Error.js";import i from"../core/Logger.js";import{removeMaybe as a}from"../core/maybe.js";import{MultiOriginJSONSupportMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as s,throwIfAbortError as ee}from"../core/promiseUtils.js";import{watch as c}from"../core/reactiveUtils.js";import{property as l,subclass as u}from"../core/accessorSupport/decorators.js";import{ensureClass as d}from"../core/accessorSupport/ensureType.js";import f from"../graphic/ImageryTileGraphicOrigin.js";import p from"./Layer.js";import{ArcGISService as m}from"./mixins/ArcGISService.js";import{BlendLayer as h}from"./mixins/BlendLayer.js";import{CustomParametersMixin as te}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as g}from"./mixins/OperationalLayer.js";import{PortalLayer as _}from"./mixins/PortalLayer.js";import{RasterJobHandlerMixin as v}from"./mixins/RasterJobHandlerMixin.js";import{RasterPresetRendererMixin as y}from"./mixins/RasterPresetRendererMixin.js";import{RefreshableLayer as b}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as x}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as S}from"./mixins/TemporalLayer.js";import{TiledImagery as C}from"./mixins/TiledImagery.js";import{isFunctionRaster as w,getPrimaryRasters as T}from"./raster/datasets/datasetUtils.js";import E from"./raster/datasets/FunctionRaster.js";import D from"./raster/datasets/RasterFactory.js";import{getPrimaryRasterUrls as O,create as k}from"./raster/functions/rasterFunctionHelper.js";import{legendEnabled as A,screenSizePerspectiveEnabled as j}from"./support/commonProperties.js";import M from"./support/Field.js";import{getServicePixelValueField as N,getRawServicePixelValueField as P,getRasterAttributeTableFields as F,getMagnitudeField as I,getDirectionField as L,getMultidimensionalFields as R,commonRasterFieldNames as z,setDefaultRasterFieldFormats as B}from"./support/rasterFieldUtils.js";import V from"./support/RasterFunction.js";import{getRasterJobHandler as H,releaseRasterJobHandler as U}from"./support/rasterJobHelper.js";import W from"./support/TileInfo.js";import{logInvalidElevationInfoWarning as G,elevationModeUnsupportedMessage as K,featureExpressionUnsupportedMessage as q}from"../support/elevationInfoUtils.js";import{createPopupTemplate as J}from"../support/popupUtils.js";import Y from"../symbols/support/ElevationInfo.js";import{addLayerUnsupportedError as X}from"../webdoc/support/unsupportedErrors.js";let Z=class extends h(x(g(_(y(te(C(v(S(m(b(o(n(p))))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.charts=null,this.graphicOrigin=new f(this),this.legendEnabled=!0,this.isReference=null,this.listMode=`show`,this.sourceJSON=null,this.version=null,this.type=`imagery-tile`,this.operationalLayerType=`ArcGISTiledImageServiceLayer`,this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.fields=null,this.source=void 0,this._debouncedSaveOperations=s(async(e,t,n)=>{let{save:r,saveAs:i}=await import(`./save/imageryUtils.js`);switch(e){case 0:return r(this,t);case 1:return i(this,n,t)}})}normalizeCtorArgs(e,t){return typeof e==`string`?{url:e,...t}:e}load(e){let t=e==null?null:e.signal;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:[`Image Service`]},e).catch(ee).then(()=>this._openRaster(t))),Promise.resolve(this)}destroy(){super.destroy(),this._releaseWorkerHandle=a(this._releaseWorkerHandle)}set elevationInfo(e){e?.mode!==`relative-to-scene`&&this._set(`elevationInfo`,e),this._validateElevationInfo(e)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){let e=[N(`Pixel Value`),P(`Raw Pixel Value`)],t=this.raster?.rasterInfo??this.serviceRasterInfo,n=t?.attributeTable;if(n){let t=F(n);e.push(...t)}let r=t?.dataType,i=t?.multidimensionalInfo;if((r===`vector-magdir`||r===`vector-uv`)&&i!=null){let t=i.variables[0].unit?.trim(),n=I(t),r=L();e.push(n,r)}if(i){let t=R(i);e.push(...t)}return e}get renderer(){return super.renderer}set renderer(e){super.renderer=e}createPopupTemplate(e){let{rasterFields:t}=this,n=e?.visibleFieldNames??new Set(t.map(({name:e})=>e).filter(e=>e!==z.rawServicePixelValue)),r=J({fields:t,title:this.title},{...e,visibleFieldNames:n}),{rasterInfo:i}=this.raster;return r?.fieldInfos&&i&&B(r.fieldInfos,i),r}async generateRasterInfo(e,t){let n=d(V,e);if(await this.load(),!n||n.functionName?.toLowerCase()===`none`)return this.serviceRasterInfo;try{let{rasterInfo:e}=await this._openFunctionRaster(n,t);return e}catch(e){throw e instanceof r?e:new r(`imagery-tile-layer`,`the given raster function is not supported`)}}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}supportsExportMapTiles(){let e=this._primaryRasters[0]??this.raster,t=e?.datasetFormat===`RasterTileServer`,n=!!this.sourceJSON?.exportTilesAllowed,r=this.sourceJSON?.datasetFormat?.toLowerCase(),i=!/\/tiledimageservices[^.]*\.arcgis\.com/i.test(this.url)&&e?.tileType===`Raster`&&(r===`cache/jpegplus`||r===`cache/jpegpng`),a=e?.tileType===`Map`||i;return t&&n&&a}supportsWrite(){let e=this._primaryRasters[0]??this.raster;return!!(this.loaded?e.datasetFormat===`RasterTileServer`&&(e.tileType===`Raster`||e.tileType===`Map`):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))}write(e,t){return this.supportsWrite()?super.write(e,t):(X(t,this),null)}async hasDataChanged(){try{let e=this._primaryRasters[0]??this.raster,{dataChanged:t,updates:n}=await e.refresh();return t&&(this.serviceRasterInfo!==e.rasterInfo&&this._set(`serviceRasterInfo`,e.rasterInfo),e.sourceJSON&&this.sourceJSON!==e.sourceJSON&&(this.sourceJSON=e.sourceJSON),n&&this.read(n,{origin:`service`,url:this.parsedUrl,ignoreDefaults:!0})),t}catch{return!1}}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=w(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{let{url:t,rasterFunction:n,source:i}=this;if(!(t||i))throw new r(`imagery-tile-layer:open`,`missing url or source parameter`);i?await this._openFromSource(i,e):n?await this._openFromUrlWithRasterFunction(t,n,e):await this._openFromUrl(t,e)}let n=this.raster.rasterInfo;if(!n)throw new r(`imagery-tile-layer:load`,`cannot load resources on `+this.url);if(this._set(`serviceRasterInfo`,t?n:this._primaryRasters[0].rasterInfo),this._set(`spatialReference`,n.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,this.sourceJSON!=null){let e=this.raster.tileType===`Map`&&this.sourceJSON.minLOD!=null&&this.sourceJSON.maxLOD!=null?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:`service`})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:`service`});this.title||=this.raster.datasetName,this.raster.tileType===`Map`&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles(c(()=>this.customParameters,e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)}))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=T(e),this.url||=this._primaryRasters[0].url}async _openFromUrlWithRasterFunction(e,t,n){let i=[e];t&&O(t.toJSON(),i);let a;i.some(e=>$(e))&&(a=await H(),this._releaseWorkerHandle={remove:()=>U()});let o=await Promise.all(i.map(e=>D.open({url:e,rasterInfo:i.length===1?this.serviceRasterInfo:void 0,sourceJSON:i.length===1?this.sourceJSON:void 0,ioConfig:{sampling:`closest`,...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:a,signal:n}))),s=o.findIndex(e=>e==null);if(s>-1)throw new r(`imagery-tile-layer:open`,`cannot open raster: ${i[s]}`);return this._primaryRasters=o,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){let n;$(e)&&(n=await H(),this._releaseWorkerHandle={remove:()=>U()});let i=await D.open({url:e,rasterInfo:this.serviceRasterInfo,sourceJSON:this.sourceJSON,ioConfig:{sampling:`closest`,...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:n,signal:t});if(i==null)throw new r(`imagery-tile-layer:open`,`cannot open raster: ${e}`);this._primaryRasters=[i],this.raster=i}async _openFromSource(e,t){let n=`the tiled imagery data source is not supported`,i=e.type?.toLowerCase()===`coverage`?`CovJSON`:e.extent&&e.pixelBlock?`MEMORY`:null;if(!i)throw new r(`imagery-tile-layer:open`,n);i===`MEMORY`&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});let a=await D.open({url:``,source:e,datasetFormat:i,ioConfig:{sampling:`closest`,...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(a==null)throw new r(`imagery-tile-layer:open`,n);this._primaryRasters=[a],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=a}async _openFunctionRaster(e,t){let n={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(e=>n[e.url]=e);let r=k(e.functionDefinition?.toJSON()??e.toJSON(),n),i=new E({rasterFunction:r});return await i.open(t),i}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(e){e instanceof r&&i.getLogger(this).error(`imagery-tile-layer:open`,e.message),i.getLogger(this).warn(`imagery-tile-layer:open`,`the raster function cannot be applied and is removed`),this._set(`rasterFunction`,null),this.raster=this._primaryRasters[0]}}_validateElevationInfo(e){G(i.getLogger(this),K(`ImageryTile layers`,`relative-to-scene`,e)),G(i.getLogger(this),q(`ImageryTile layers`,e))}};e([l({clonable:!1})],Z.prototype,`_primaryRasters`,void 0),e([l({clonable:!1})],Z.prototype,`_releaseWorkerHandle`,void 0),e([l({json:{origins:{"web-scene":{write:!1}},write:!0}})],Z.prototype,`charts`,void 0),e([l({type:Y,value:null,json:{name:`layerDefinition.elevationInfo`,write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],Z.prototype,`elevationInfo`,null),e([l({type:W})],Z.prototype,`tileInfo`,void 0),e([l({readOnly:!0,clonable:!1})],Z.prototype,`graphicOrigin`,void 0),e([l(A)],Z.prototype,`legendEnabled`,void 0),e([l({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],Z.prototype,`isReference`,void 0),e([l({type:[`show`,`hide`]})],Z.prototype,`listMode`,void 0),e([l({json:{read:!0,write:!0}})],Z.prototype,`blendMode`,void 0),e([l({type:V,json:{name:`renderingRule`,write:!0}})],Z.prototype,`rasterFunction`,void 0),e([l()],Z.prototype,`sourceJSON`,void 0),e([l({readOnly:!0,json:{origins:{service:{read:{source:`currentVersion`}}}}})],Z.prototype,`version`,void 0),e([l({readOnly:!0,json:{read:!1}})],Z.prototype,`type`,void 0),e([l({type:[`ArcGISTiledImageServiceLayer`]})],Z.prototype,`operationalLayerType`,void 0),e([l({type:Boolean,value:!0,json:{read:{source:`disablePopup`,reader(e,t){return!t.disablePopup}},write:{target:`disablePopup`,overridePolicy(){return{enabled:!this.loaded||this.raster.tileType===`Raster`}},writer(e,t,n){t[n]=!e}}}})],Z.prototype,`popupEnabled`,void 0),e([l({type:t,json:{read:{source:`popupInfo`},write:{target:`popupInfo`,overridePolicy(){return{enabled:!this.loaded||this.raster.tileType===`Raster`}}}}})],Z.prototype,`popupTemplate`,void 0),e([l({readOnly:!0})],Z.prototype,`defaultPopupTemplate`,null),e([l(j)],Z.prototype,`screenSizePerspectiveEnabled`,void 0),e([l({readOnly:!0,type:[M]})],Z.prototype,`fields`,void 0),e([l({readOnly:!0,type:[M]})],Z.prototype,`rasterFields`,null),e([l({constructOnly:!0})],Z.prototype,`source`,void 0),Z=e([u(`esri.layers.ImageryTileLayer`)],Z);const Q=Z;function $(e){return/\.(png|gif|bmp)$/i.test(e)}export{Q as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import{ClonableMixin as n}from"../core/Clonable.js";import r from"../core/Error.js";import i from"../core/Logger.js";import{removeMaybe as a}from"../core/maybe.js";import{MultiOriginJSONSupportMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as s,throwIfAbortError as ee}from"../core/promiseUtils.js";import{watch as c}from"../core/reactiveUtils.js";import{property as l,subclass as u}from"../core/accessorSupport/decorators.js";import{ensureClass as d}from"../core/accessorSupport/ensureType.js";import f from"../graphic/ImageryTileGraphicOrigin.js";import p from"./Layer.js";import{ArcGISService as m}from"./mixins/ArcGISService.js";import{BlendLayer as h}from"./mixins/BlendLayer.js";import{CustomParametersMixin as te}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as g}from"./mixins/OperationalLayer.js";import{PortalLayer as _}from"./mixins/PortalLayer.js";import{RasterJobHandlerMixin as v}from"./mixins/RasterJobHandlerMixin.js";import{RasterPresetRendererMixin as y}from"./mixins/RasterPresetRendererMixin.js";import{RefreshableLayer as b}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as x}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as S}from"./mixins/TemporalLayer.js";import{TiledImagery as C}from"./mixins/TiledImagery.js";import{isFunctionRaster as w,getPrimaryRasters as T}from"./raster/datasets/datasetUtils.js";import E from"./raster/datasets/FunctionRaster.js";import D from"./raster/datasets/RasterFactory.js";import{getPrimaryRasterUrls as O,create as k}from"./raster/functions/rasterFunctionHelper.js";import{legendEnabled as A,screenSizePerspectiveEnabled as j}from"./support/commonProperties.js";import M from"./support/Field.js";import{getServicePixelValueField as N,getRawServicePixelValueField as P,getRasterAttributeTableFields as F,getMagnitudeField as I,getDirectionField as L,getMultidimensionalFields as R,commonRasterFieldNames as z,setDefaultRasterFieldFormats as B}from"./support/rasterFieldUtils.js";import V from"./support/RasterFunction.js";import{getRasterJobHandler as H,releaseRasterJobHandler as U}from"./support/rasterJobHelper.js";import W from"./support/TileInfo.js";import{logInvalidElevationInfoWarning as G,elevationModeUnsupportedMessage as K,featureExpressionUnsupportedMessage as q}from"../support/elevationInfoUtils.js";import{createPopupTemplate as J}from"../support/popupUtils.js";import Y from"../symbols/support/ElevationInfo.js";import{addLayerUnsupportedError as X}from"../webdoc/support/unsupportedErrors.js";let Z=class extends h(x(g(_(y(te(C(v(S(m(b(o(n(p))))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.charts=null,this.graphicOrigin=new f(this),this.legendEnabled=!0,this.isReference=null,this.listMode=`show`,this.sourceJSON=null,this.version=null,this.type=`imagery-tile`,this.operationalLayerType=`ArcGISTiledImageServiceLayer`,this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.fields=null,this.source=void 0,this._debouncedSaveOperations=s(async(e,t,n)=>{let{save:r,saveAs:i}=await import(`./save/imageryUtils.js`);switch(e){case 0:return r(this,t);case 1:return i(this,n,t)}})}normalizeCtorArgs(e,t){return typeof e==`string`?{url:e,...t}:e}load(e){let t=e==null?null:e.signal;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:[`Image Service`]},e).catch(ee).then(()=>this._openRaster(t))),Promise.resolve(this)}destroy(){super.destroy(),this._releaseWorkerHandle=a(this._releaseWorkerHandle)}set elevationInfo(e){e?.mode!==`relative-to-scene`&&this._set(`elevationInfo`,e),this._validateElevationInfo(e)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){let e=[N(`Pixel Value`),P(`Raw Pixel Value`)],t=this.raster?.rasterInfo??this.serviceRasterInfo,n=t?.attributeTable;if(n){let t=F(n);e.push(...t)}let r=t?.dataType,i=t?.multidimensionalInfo;if((r===`vector-magdir`||r===`vector-uv`)&&i!=null){let t=i.variables[0].unit?.trim(),n=I(t),r=L();e.push(n,r)}if(i){let t=R(i);e.push(...t)}return e}get renderer(){return super.renderer}set renderer(e){super.renderer=e}createPopupTemplate(e){let{rasterFields:t}=this,n=e?.visibleFieldNames??new Set(t.map(({name:e})=>e).filter(e=>e!==z.rawServicePixelValue)),r=J({fields:t,title:this.title},{...e,visibleFieldNames:n}),{rasterInfo:i}=this.raster;return r?.fieldInfos&&i&&B(r.fieldInfos,i),r}async generateRasterInfo(e,t){let n=d(V,e);if(await this.load(),!n||n.functionName?.toLowerCase()===`none`)return this.serviceRasterInfo;try{let{rasterInfo:e}=await this._openFunctionRaster(n,t);return e}catch(e){throw e instanceof r?e:new r(`imagery-tile-layer`,`the given raster function is not supported`)}}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}supportsExportMapTiles(){let e=this._primaryRasters[0]??this.raster,t=e?.datasetFormat===`RasterTileServer`,n=!!this.sourceJSON?.exportTilesAllowed,r=this.sourceJSON?.datasetFormat?.toLowerCase(),i=!/\/tiledimageservices[^.]*\.arcgis\.com/i.test(this.url)&&e?.tileType===`Raster`&&(r===`cache/jpegplus`||r===`cache/jpegpng`),a=e?.tileType===`Map`||i;return t&&n&&a}supportsWrite(){let e=this._primaryRasters[0]??this.raster;return!!(this.loaded?e.datasetFormat===`RasterTileServer`&&(e.tileType===`Raster`||e.tileType===`Map`):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))}write(e,t){return this.supportsWrite()?super.write(e,t):(X(t,this),null)}async hasDataChanged(){try{let e=this._primaryRasters[0]??this.raster,{dataChanged:t,updates:n}=await e.refresh();return t&&(this.serviceRasterInfo!==e.rasterInfo&&this._set(`serviceRasterInfo`,e.rasterInfo),e.sourceJSON&&this.sourceJSON!==e.sourceJSON&&(this.sourceJSON=e.sourceJSON),n&&this.read(n,{origin:`service`,url:this.parsedUrl,ignoreDefaults:!0})),t}catch{return!1}}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=w(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{let{url:t,rasterFunction:n,source:i}=this;if(!(t||i))throw new r(`imagery-tile-layer:open`,`missing url or source parameter`);i?await this._openFromSource(i,e):n?await this._openFromUrlWithRasterFunction(t,n,e):await this._openFromUrl(t,e)}let n=this.raster.rasterInfo;if(!n)throw new r(`imagery-tile-layer:load`,`cannot load resources on `+this.url);if(this._set(`serviceRasterInfo`,t?n:this._primaryRasters[0].rasterInfo),this._set(`spatialReference`,n.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,this.sourceJSON!=null){let e=this.raster.tileType===`Map`&&this.sourceJSON.minLOD!=null&&this.sourceJSON.maxLOD!=null?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:`service`})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:`service`});this.title||=this.raster.datasetName,this.raster.tileType===`Map`&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles(c(()=>this.customParameters,e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)}))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=T(e),this.url||=this._primaryRasters[0].url}async _openFromUrlWithRasterFunction(e,t,n){let i=[e];t&&O(t.toJSON(),i);let a;i.some(e=>$(e,this.ioConfig))&&(a=await H(),this._releaseWorkerHandle={remove:()=>U()});let o=await Promise.all(i.map(e=>D.open({url:e,rasterInfo:i.length===1?this.serviceRasterInfo:void 0,sourceJSON:i.length===1?this.sourceJSON:void 0,ioConfig:{sampling:`closest`,...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:a,signal:n}))),s=o.findIndex(e=>e==null);if(s>-1)throw new r(`imagery-tile-layer:open`,`cannot open raster: ${i[s]}`);return this._primaryRasters=o,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){let n;$(e,this.ioConfig)&&(n=await H(),this._releaseWorkerHandle={remove:()=>U()});let i=await D.open({url:e,rasterInfo:this.serviceRasterInfo,sourceJSON:this.sourceJSON,ioConfig:{sampling:`closest`,...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:n,signal:t});if(i==null)throw new r(`imagery-tile-layer:open`,`cannot open raster: ${e}`);this._primaryRasters=[i],this.raster=i}async _openFromSource(e,t){let n=`the tiled imagery data source is not supported`,i=e.type?.toLowerCase()===`coverage`?`CovJSON`:e.extent&&e.pixelBlock?`MEMORY`:null;if(!i)throw new r(`imagery-tile-layer:open`,n);i===`MEMORY`&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});let a=await D.open({url:``,source:e,datasetFormat:i,ioConfig:{sampling:`closest`,...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(a==null)throw new r(`imagery-tile-layer:open`,n);this._primaryRasters=[a],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=a}async _openFunctionRaster(e,t){let n={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(e=>n[e.url]=e);let r=k(e.functionDefinition?.toJSON()??e.toJSON(),n),i=new E({rasterFunction:r});return await i.open(t),i}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(e){e instanceof r&&i.getLogger(this).error(`imagery-tile-layer:open`,e.message),i.getLogger(this).warn(`imagery-tile-layer:open`,`the raster function cannot be applied and is removed`),this._set(`rasterFunction`,null),this.raster=this._primaryRasters[0]}}_validateElevationInfo(e){G(i.getLogger(this),K(`ImageryTile layers`,`relative-to-scene`,e)),G(i.getLogger(this),q(`ImageryTile layers`,e))}};e([l({clonable:!1})],Z.prototype,`_primaryRasters`,void 0),e([l({clonable:!1})],Z.prototype,`_releaseWorkerHandle`,void 0),e([l({json:{origins:{"web-scene":{write:!1}},write:!0}})],Z.prototype,`charts`,void 0),e([l({type:Y,value:null,json:{name:`layerDefinition.elevationInfo`,write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],Z.prototype,`elevationInfo`,null),e([l({type:W})],Z.prototype,`tileInfo`,void 0),e([l({readOnly:!0,clonable:!1})],Z.prototype,`graphicOrigin`,void 0),e([l(A)],Z.prototype,`legendEnabled`,void 0),e([l({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],Z.prototype,`isReference`,void 0),e([l({type:[`show`,`hide`]})],Z.prototype,`listMode`,void 0),e([l({json:{read:!0,write:!0}})],Z.prototype,`blendMode`,void 0),e([l({type:V,json:{name:`renderingRule`,write:!0}})],Z.prototype,`rasterFunction`,void 0),e([l()],Z.prototype,`sourceJSON`,void 0),e([l({readOnly:!0,json:{origins:{service:{read:{source:`currentVersion`}}}}})],Z.prototype,`version`,void 0),e([l({readOnly:!0,json:{read:!1}})],Z.prototype,`type`,void 0),e([l({type:[`ArcGISTiledImageServiceLayer`]})],Z.prototype,`operationalLayerType`,void 0),e([l({type:Boolean,value:!0,json:{read:{source:`disablePopup`,reader(e,t){return!t.disablePopup}},write:{target:`disablePopup`,overridePolicy(){return{enabled:!this.loaded||this.raster.tileType===`Raster`}},writer(e,t,n){t[n]=!e}}}})],Z.prototype,`popupEnabled`,void 0),e([l({type:t,json:{read:{source:`popupInfo`},write:{target:`popupInfo`,overridePolicy(){return{enabled:!this.loaded||this.raster.tileType===`Raster`}}}}})],Z.prototype,`popupTemplate`,void 0),e([l({readOnly:!0})],Z.prototype,`defaultPopupTemplate`,null),e([l(j)],Z.prototype,`screenSizePerspectiveEnabled`,void 0),e([l({readOnly:!0,type:[M]})],Z.prototype,`fields`,void 0),e([l({readOnly:!0,type:[M]})],Z.prototype,`rasterFields`,null),e([l({constructOnly:!0})],Z.prototype,`source`,void 0),Z=e([u(`esri.layers.ImageryTileLayer`)],Z);const Q=Z;function $(e,t){let{tileGeneration:n}=t??{};return n===`immediate`||/\.(png|gif|bmp)$/i.test(e)}export{Q as default};
|
|
@@ -101,16 +101,17 @@ export interface LineOfSightLayerProperties extends LayerProperties, Operational
|
|
|
101
101
|
* abortController.abort();
|
|
102
102
|
* ```
|
|
103
103
|
*
|
|
104
|
-
* If the [observer position](https://developers.arcgis.com/javascript/latest/references/core/analysis/LineOfSightAnalysisObserver/#position) or
|
|
105
|
-
* [target position](https://developers.arcgis.com/javascript/latest/references/core/analysis/LineOfSightAnalysisTarget/#position) have [z-values](https://developers.arcgis.com/javascript/latest/references/core/geometry/Point/#hasZ)
|
|
106
|
-
* then these will be treated as absolute values, otherwise the points will be aligned to the ground.
|
|
107
|
-
*
|
|
108
104
|
* > [!WARNING]
|
|
109
105
|
* >
|
|
110
|
-
* > **
|
|
111
|
-
* >
|
|
112
|
-
* >
|
|
113
|
-
* >
|
|
106
|
+
* > **Things to consider:**
|
|
107
|
+
* > * This layer is only supported in a 3D [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/).
|
|
108
|
+
* > * The results of the tool vary depending on the zoom level, as changes in zoom level affect the level of detail (LOD) of the scene geometry.
|
|
109
|
+
* > * Snapping, tooltips, display units, and input units used during interactive placement and editing are inherited from
|
|
110
|
+
* [ViewOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/).
|
|
111
|
+
* > * Snapping is enabled by default. This can be temporarily disabled by holding the `CTRL` key.
|
|
112
|
+
* > * Layer types currently supported for snapping are: [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/), [GraphicsLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GraphicsLayer/) (except Mesh geometries),
|
|
113
|
+
* > [GeoJSONLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/), [WFSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WFSLayer/), [CSVLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/CSVLayer/),
|
|
114
|
+
* > [3D Object SceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/), and [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/).
|
|
114
115
|
*
|
|
115
116
|
* @since 4.24
|
|
116
117
|
* @see [LineOfSightLayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/LineOfSightLayerView/)
|
|
@@ -118,6 +119,7 @@ export interface LineOfSightLayerProperties extends LayerProperties, Operational
|
|
|
118
119
|
* @see [LineOfSightAnalysisTarget](https://developers.arcgis.com/javascript/latest/references/core/analysis/LineOfSightAnalysisTarget/)
|
|
119
120
|
* @see [LineOfSightAnalysisObserver](https://developers.arcgis.com/javascript/latest/references/core/analysis/LineOfSightAnalysisObserver/)
|
|
120
121
|
* @see [LineOfSightAnalysisView3D](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/LineOfSightAnalysisView3D/)
|
|
122
|
+
* @see [ViewOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/)
|
|
121
123
|
* @see [Line Of Sight component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-line-of-sight/)
|
|
122
124
|
*/
|
|
123
125
|
export default class LineOfSightLayer extends LineOfSightLayerSuperclass {
|
|
@@ -64,7 +64,7 @@ export interface ViewshedLayerProperties extends LayerProperties, OperationalLay
|
|
|
64
64
|
* const layerView = await view.whenLayerView(viewshedLayer);
|
|
65
65
|
*
|
|
66
66
|
* // allow existing viewsheds in the layer to be selected and edited
|
|
67
|
-
* // select a viewshed by hovering and clicking on their
|
|
67
|
+
* // select a viewshed by hovering and clicking on their observer
|
|
68
68
|
* layerView.interactive = true;
|
|
69
69
|
*
|
|
70
70
|
* // start placing new viewsheds interactively
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{insertSortedStableTopN as e}from"../../../core/arrayUtils.js";import{importLazily as t}from"../../../core/importUtils.js";import{clone as n}from"../../../core/lang.js";import r from"../../../geometry/SpatialReference.js";import{polygonCentroid as i,extentCentroid as a}from"../../../geometry/support/centroid.js";import{getPolygonExtent as o,getGeometryExtent as s,expandExtent as c}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as l}from"../../../geometry/support/quantizationUtils.js";import{isValid as u,equals as d}from"../../../geometry/support/spatialReferenceUtils.js";import{closestPointOnCurve as f}from"../../../geometry/support/curves/closestPointOnCurve.js";import{getEndpoint as p,isCoordinate as m,cloneCurve as h}from"../../../geometry/support/curves/curveUtils.js";import g from"./AttributesBuilder.js";import{cleanFromGeometryEngine as _,getGeometry as v,transformCentroid as y}from"./geometryUtils.js";import{project as b}from"./projectionSupport.js";import{getDateInNumber as x}from"./queryUtils.js";import{SnappingCandidateEdge as S,SnappingCandidateVertex as C}from"./SnappingCandidate.js";import{isDateField as w,isDateOnlyField as T,isTimestampOffsetField as E,isStringField as D,isTimeOnlyField as O}from"../../support/fieldUtils.js";import k from"../../../rest/support/AutoIntervalBinParameters.js";import A from"../../../rest/support/DateBinParameters.js";import{unitsDict as j}from"../../../rest/support/DateBinUtils.js";import M from"../../../rest/support/FixedBoundariesBinParameters.js";import N from"../../../rest/support/FixedIntervalBinParameters.js";import{calculateStringStatistics as P,calculateStatistics as F,processSummaryStatisticsResult as I,calculateUniqueValuesCount as L,createUVResult as R,calculateClassBreaks as z,resolveCBResult as B,calculateHistogram as V,calculatePercentile as H,binIndex as U,getBinParams as W,isNullCountSupported as G,getAttributeComparator as K}from"../../../statistics/utils.js";import{utc as q}from"../../../time/constants.js";import{DateTime as J}from"luxon";const Y=t(()=>import(`../../../geometry/operators/json/convexHullOperator.js`));class X{constructor(e,t,n){this.items=e,this.query=t,this.geometryType=n.geometryType,this.hasZ=!!t.returnZ&&n.hasZ,this.hasM=!!t.returnM&&n.hasM,this.fieldsIndex=n.fieldsIndex,this.spatialReference=n.spatialReference,this.featureAdapter=n.featureAdapter,this.featureIdInfo=n.featureIdInfo}get size(){return this.items.length}createQueryResponseForCount(){let e=new g(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);let{groupByFieldsForStatistics:t,having:n,outStatistics:r}=this.query;if(!t?.length)return 1;let i=new Map,a=new Map,o=new Set;for(let s of r){let{statisticType:r}=s,c=r===`exceedslimit`?void 0:s.onStatisticField;if(!a.has(c)){let n=[];for(let r of t){let t=this._getAttributeValues(e,r,this.items,i);n.push(t)}a.set(c,this._calculateUniqueValues(n,this.items,e.returnDistinctValues))}let l=a.get(c);for(let t in l){let{data:r,items:i}=l[t],a=r.join(`,`);(!n||e.validateItems(i,n))&&o.add(a)}}return o.size}async createQueryResponse(){let e;if(e=this.query.outStatistics?this.query.outStatistics.some(e=>e.statisticType===`exceedslimit`)?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items):this._createFeatureQueryResponse(this.query),this.query.returnQueryGeometry){let t=this.query.geometry;u(this.query.outSR)&&!d(t.spatialReference,this.query.outSR)?e.queryGeometry=_({spatialReference:this.query.outSR,...b(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=_({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t,n){let r=this.featureAdapter,{point:i}=e,a=typeof e.distance==`number`?e.distance:e.distance.x,o=typeof e.distance==`number`?e.distance:e.distance.y;function s(e,t){let n=(e-i.x)/a,r=(t-i.y)/o;return n*n+r*r}let c={candidates:[]},l=this.geometryType===`esriGeometryPolygon`,u=this.geometryType===`esriGeometryPolyline`||this.geometryType===`esriGeometryPoint`,d=this._getPointCreator(t,this.spatialReference,n),g=new Q(null,0),_=new Q(null,0),v={x:0,y:0,z:0};for(let e of this.items){let t=r.getObjectId(e),n=r.getGeometryWithCurves?.(e);if(n!=null){b(n,t);continue}let i=r.getGeometry(e);if(i!=null){y(i,t);continue}}return c.candidates.sort((e,t)=>e.distance-t.distance),c;function y(t,n){let{coords:r,stride:a}=t,o=t.isPoint?te:t.lengths;if(g.coords=r,_.coords=r,e.returnEdge){let e=0;for(let t=0;t<o.length;t++){let r=o[t],u=e;for(let t=0;t<r;t++,e+=a){if(!l&&t===r-1||(g.coordsIndex=e,_.coordsIndex=t===r-1?u:e+a,!ee(v,i,g,_)))continue;let o=s(v.x,v.y);o<=1&&c.candidates.push(new S(n,d(v),Math.sqrt(o),d(g),d(_)))}}}if(e.vertexMode===`all`){let e=0;for(let t=0;t<o.length;t++){let r=o[t],i=e,u=_;u.coordsIndex=i;for(let t=0;t<r;t++,e+=a){if(g.coordsIndex=e,l&&t===r-1&&g.x===u.x&&g.y===u.y)continue;let i=s(g.x,g.y);i<=1&&c.candidates.push(new C(n,d(g),Math.sqrt(i)))}}}else if(u&&e.vertexMode===`ends`){let e=0,t=[];for(let n=0;n<o.length;n++){t.push(e);let r=o[n];e+=r*a,r>1&&t.push(e-a)}for(let e of t){g.coordsIndex=e;let t=s(g.x,g.y);t<=1&&c.candidates.push(new C(n,d(g),Math.sqrt(t)))}}}function b(t,n){let{candidates:r}=c,a={x:0,y:0,z:0};if(e.returnEdge){let e=[i.x,i.y],o=new Q(e,0),c=new Q(e,0);for(let{segments:i}of t.parts)for(let{start:t,curve:l}of i){let{curvePoint:i}=f(t,l,e),u=s(...i);if(u>1)continue;[a.x,a.y]=i,o.coords=t,c.coords=p(l);let g=m(l)?null:h(l);r.push(new S(n,d(a),Math.sqrt(u),d(o),d(c),!1,g))}}function o(e){a.x=t.vertexXY[e*2],a.y=t.vertexXY[e*2+1];let i=s(a.x,a.y);i>1||(a.z=t.vertexZ?.[e]??0,r.push(new C(n,d(a),Math.sqrt(i))))}if(e.vertexMode===`all`){let{vertexCount:e}=t;for(let t=0;t<e;++t)o(t);return}if(e.vertexMode===`ends`)switch(t.type){case`point`:o(0);break;case`polyline`:for(let e=0;e<t.partCount;++e){let n=t.partOffsets[e],r=t.partOffsets[e+1]-1;o(n),r!==n&&o(r)}}}}_getPointCreator(e,t,n){let r=n!=null&&!d(t,n)?e=>b(e,t,n):e=>e,{hasZ:i}=this;return i&&e?({x:e,y:t,z:n})=>r({x:e,y:t,z:n}):({x:e,y:t})=>r({x:e,y:t,z:0})}async createSummaryStatisticsResponse(e){let{field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,minValue:o,maxValue:s,scale:c,timeZone:l,outStatisticTypes:u}=e,d=this.fieldsIndex.get(t),f=w(d)||T(d)||E(d),p=await this._getDataValues({field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,scale:c,timeZone:l},this.items),m=G({normalizationType:i,normalizationField:r,minValue:o,maxValue:s}),h={value:.5,fieldType:d?.type},g=D(d)?P({values:p,supportsNullCount:m,percentileParams:h,outStatisticTypes:u}):F({values:p,minValue:o,maxValue:s,useSampleStdDev:!i,supportsNullCount:m,percentileParams:h,outStatisticTypes:u});return I(g,u,f)}async createUniqueValuesResponse(e){let{field:t,valueExpression:n,domains:r,returnAllCodedValues:i,scale:a,timeZone:o}=e,s=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:n,scale:a,timeZone:o},this.items,!1),c=L(s);return R(c,r,i,e.fieldDelimiter)}async createClassBreaksResponse(e){let{field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numClasses:u,scale:d,timeZone:f}=e,p=await this._getDataValues({field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,scale:d,timeZone:f},this.items),m=z(p,{field:t,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numClasses:u});return B(m,o)}async createHistogramResponse(e){let{field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numBins:u,scale:d,timeZone:f}=e,p=await this._getDataValues({field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,scale:d,timeZone:f},this.items);return V(p,{field:t,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numBins:u})}_sortFeatures(e,t,n){if(e.length>1&&t?.length)for(let r of t.slice().reverse()){let{compare:t,fieldOrExpression:i,fieldInfo:a}=$(r,this.fieldsIndex);e.sort((e,r)=>t(n(e,i,a),n(r,i,a)))}}_topNFeatures(t,n,r,i){if(t.length>1&&n?.length){let a=n.map(e=>{let{compare:t,fieldOrExpression:n,fieldInfo:r}=$(e,this.fieldsIndex);return(e,a)=>t(i(e,n,r),i(a,n,r))}).reduceRight((e,t)=>(n,r)=>{let i=t(n,r);return i!==0&&!Number.isNaN(i)?i:e(n,r)}),o=[];for(let n of t)e(o,n,r,a);return o}return t.slice(0,r)}_createFeatureQueryResponse(e){let{items:t,geometryType:n,hasM:r,hasZ:i,featureIdInfo:a,spatialReference:o}=this,{outFields:s,outSR:c,quantizationParameters:u,resultRecordCount:d,resultOffset:f,returnZ:p,returnM:m}=e,h=d!=null&&t.length>(f||0)+d,g=s&&(s.includes(`*`)?[...this.fieldsIndex.fields]:s.map(e=>this.fieldsIndex.get(e)));return{exceededTransferLimit:h,features:this._createFeatures(e,t),fields:g,geometryType:n,hasM:r&&m,hasZ:i&&p,objectIdFieldName:a.type===`object-id`?a.fieldName:null,spatialReference:_(c||o),transform:u&&l(u)||null}}_createFeatures(e,t){let n=new g(e,this.featureAdapter,this.fieldsIndex),{hasM:r,hasZ:i}=this,{orderByFields:a,quantizationParameters:o,returnGeometry:s,returnCentroid:c,maxAllowableOffset:u,resultOffset:d,resultRecordCount:f,returnZ:p=!1,returnM:m=!1}=e,h=i&&p,_=r&&m,b,x=d||0,S=f==null?null:x+f;S!=null&&S<=5e3&&S<t.length?b=this._topNFeatures(t,a,S,(e,t,r)=>n.getFieldValue(e,t,r)):(b=[...t],this._sortFeatures(b,a,(e,t,r)=>n.getFieldValue(e,t,r))),(x>0||S!=null)&&(b=b.slice(x,S??void 0));let C=[],w=0;if(!this.geometryType||!s&&!c)for(let e of b){let t=n.getAttributes(e);t&&(C[w++]=this._addFeatureJSONMetadata(e,{attributes:t}))}else{let e=l(o)??void 0,t=this.geometryType===`esriGeometryPolygon`||this.geometryType===`esriGeometryPolyline`;if(s&&!c)for(let r of b){let i=this.featureAdapter.getGeometry(r),a=this._addFeatureJSONMetadata(r,{attributes:n.getAttributes(r),geometry:v(this.geometryType,i,u,e,h,_)});t&&i&&!a.geometry&&(a.centroid=y(this,this.featureAdapter.getCentroid(r,this),e)),C[w++]=a}else if(!s&&c)for(let t of b)C[w++]=this._addFeatureJSONMetadata(t,{attributes:n.getAttributes(t),centroid:y(this,this.featureAdapter.getCentroid(t,this),e)});else for(let t of b)C[w++]=this._addFeatureJSONMetadata(t,{attributes:n.getAttributes(t),centroid:y(this,this.featureAdapter.getCentroid(t,this),e),geometry:v(this.geometryType,this.featureAdapter.getGeometry(t),u,e,h,_)})}return C}_addFeatureJSONMetadata(e,t){let n=this.featureAdapter.getMetadata?.(e);return n!==void 0&&(t.metadata=n),t}_createExceedsLimitQueryResponse(){let e=!1,t=1/0,n=1/0,r=1/0;for(let e of this.query.outStatistics??[])if(e.statisticType===`exceedslimit`){t=e.maxPointCount==null?1/0:e.maxPointCount,n=e.maxRecordCount==null?1/0:e.maxRecordCount,r=e.maxVertexCount==null?1/0:e.maxVertexCount;break}return e=this.geometryType===`esriGeometryPoint`?this.items.length>t:this.items.length>n||this.items.reduce((e,t)=>e+(this.featureAdapter.getGeometry(t)?.size??0),0)>r,{fields:[{name:`exceedslimit`,type:`esriFieldTypeInteger`,alias:`exceedslimit`,sqlType:`sqlTypeInteger`,domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,n={attributes:{}}){let r=[],i=new Map,a=new Map,o=new Map,s=new Map,c=new g(e,this.featureAdapter,this.fieldsIndex),l=e.outStatistics,{groupByFieldsForStatistics:u,having:d,orderByFields:f,resultRecordCount:p}=e,m=u?.length,h=!!m,_=h?u[0]:null,v=h&&!this.fieldsIndex.get(_);for(let f of l??[]){let{outStatisticFieldName:l,statisticType:p}=f,g=f,y=p===`exceedslimit`?void 0:f.onStatisticField,b=p===`percentile_disc`||p===`percentile_cont`,x=p===`EnvelopeAggregate`||p===`CentroidAggregate`||p===`ConvexHullAggregate`,S=h&&m===1&&(y===_||v)&&p===`count`;if(h){if(!o.has(y)){let e=[];for(let n of u){let r=this._getAttributeValues(c,n,t,i);e.push(r)}o.set(y,this._calculateUniqueValues(e,t,!x&&c.returnDistinctValues))}let n=o.get(y);if(!n)continue;let r=Object.keys(n);for(let a of r){let{count:r,data:o,items:f,itemPositions:p}=n[a],m=o.join(`,`);if(!d||c.validateItems(f,d)){let n=s.get(m)||{attributes:{}};if(e.returnAggIds&&(n.aggregateIds=f.map(e=>this.featureAdapter.getObjectId(e)).filter(e=>e!=null)),x){n.aggregateGeometries||={};let{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(g,f);n.aggregateGeometries[t]=e}else{let e=null;if(S)e=r;else{let n=this._getAttributeValues(c,y,t,i),r=p.map(e=>n[e]);e=b&&`statisticParameters`in g?this._getPercentileValue(g,r):this._getStatisticValue(g,r,null,c.returnDistinctValues)}n.attributes[l]=e}let a=0;u.forEach((e,t)=>n.attributes[this.fieldsIndex.get(e)?e:`EXPR_${++a}`]=o[t]),s.set(m,n)}}}else if(x){n.aggregateGeometries||={};let{aggregateGeometries:e,outStatisticFieldName:r}=await this._getAggregateGeometry(g,t);n.aggregateGeometries[r]=e}else{let e=this._getAttributeValues(c,y,t,i);n.attributes[l]=b&&`statisticParameters`in g?this._getPercentileValue(g,e):this._getStatisticValue(g,e,a,c.returnDistinctValues)}let C=(p===`min`||p===`max`)&&(D(this.fieldsIndex.get(y))||this._isAnyDateField(y))?this.fieldsIndex.get(y)?.type:null;r.push({name:l,alias:l,type:C||`esriFieldTypeDouble`})}let y=h?Array.from(s.values()):[n];return this._sortFeatures(y,f,(e,t)=>e.attributes[t]),p&&(y.length=Math.min(p,y.length)),{fields:r,features:y}}_isAnyDateField(e){let t=this.fieldsIndex.get(e);return w(t)||T(t)||E(t)||O(t)}async _getAggregateGeometry(e,t){let{statisticType:n,outStatisticFieldName:r}=e,{featureAdapter:s,spatialReference:c,geometryType:l}=this,u=t.map(e=>v(l,s.getGeometry(e))),d={aggregateGeometries:null,outStatisticFieldName:null},{convexHullExecuteMany:f}=await Y.getImportPromise(),[p]=f(u,{merge:!0});if(p&&p.rings[0].length<=3&&(p=null),n===`EnvelopeAggregate`)d.aggregateGeometries={...p?o(p):Z(u),spatialReference:c},d.outStatisticFieldName=r||`extent`;else if(n===`CentroidAggregate`){let[e,t]=p?i(p):a(Z(u));d.aggregateGeometries={x:e,y:t,spatialReference:c},d.outStatisticFieldName=r||`centroid`}else n===`ConvexHullAggregate`&&(d.aggregateGeometries=p&&{...p,spatialReference:c},d.outStatisticFieldName=r||`convexHull`);return d}_getStatisticValue(e,t,n,r){let{onStatisticField:i,statisticType:a}=e,o=null;return o=n?.has(i)?n.get(i):D(this.fieldsIndex.get(i))||this._isAnyDateField(i)?P({values:t,returnDistinct:r}):F({values:r?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),n&&n.set(i,o),o[a===`var`?`variance`:a]}_getPercentileValue(e,t){let{onStatisticField:n,statisticParameters:r,statisticType:i}=e,{value:a,orderBy:o}=r,s={value:a,orderBy:o,fieldType:this.fieldsIndex.get(n)?.type,isDiscrete:i===`percentile_disc`};return H(t,s)}_getAttributeValues(e,t,n,r){if(r.has(t))return r.get(t);let i=this.fieldsIndex.get(t),a=n.map(n=>e.getFieldValue(n,t,i));return r.set(t,a),a}_calculateUniqueValues(e,t,n){let r={},i=t.length;for(let a=0;a<i;a++){let i=t[a],o=[];for(let t of e)o.push(t[a]);let s=o.join(`,`);r[s]==null?r[s]={count:1,data:o,items:[i],itemPositions:[a]}:(n||r[s].count++,r[s].items.push(i),r[s].itemPositions.push(a))}return r}async _getDataValues(e,t,i=!0){let a=new g(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:o,scale:s,timeZone:c}=e,l=r.fromJSON(this.query.outSR||this.spatialReference);return o?a.getExpressionValues(t,o,{viewingMode:`map`,scale:s,spatialReference:l},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},c):a.getDataValues(t,n(e),i)}_calculateHistogramBins(e,t,n){if(t.min==null&&t.max==null)return[];let r=t.intervals,i=t.min??0,a=t.max??0,o=r.map(([e,t])=>({minValue:e,maxValue:t,count:0,items:[]}));for(let t=0;t<e.length;t++){let s=e[t],c=n[t];if(s!=null&&s>=i&&s<=a){let e=U(r,s);e>-1&&(o[e].count++,o[e].items.push(c))}}return o}async createQueryBinsResponse(e){let t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);let{value:n,outAlias:r,valueType:i}=t,a=[],o=[{name:r??n,alias:r??n,type:i??`esriFieldTypeString`},{name:`bin`,alias:`bin`,type:`esriFieldTypeInteger`}],s=new g(e,this.featureAdapter,this.fieldsIndex),c=new Map,l=[...this.items];this._sortFeatures(l,[n],(e,t,n)=>s.getFieldValue(e,t,n));let u=this._getAttributeValues(s,n,l,c),d=this._calculateUniqueValues([u],l,s.returnDistinctValues);for(let t in d){let{items:i}=d[t],s=await this._createBinsResponse(e,i);if(a.push(...s.features.map(e=>({...e,attributes:{...e.attributes,[r??n]:t}}))),s.fields)for(let e of s.fields)o.some(t=>t.name===e.name)||o.push(e)}return{fields:o,features:a}}async _createBinsResponse(e,t){let n=e.bin;switch(t??=this.items,n.type){case`autoIntervalBin`:return this._createAutoIntervalBinsResponse(k.fromJSON(n),e,t);case`dateBin`:return this._createDateBinsResponse(A.fromJSON(n),e,t);case`fixedBoundariesBin`:return this._createFixedBoundariesBinsResponse(M.fromJSON(n),e,t);case`fixedIntervalBin`:return this._createFixedIntervalBinsResponse(N.fromJSON(n),e,t)}}async _createAutoIntervalBinsResponse(e,t,n){let{field:r,normalizationField:i,numBins:a,normalizationType:o,normalizationTotal:s,start:c,end:l}=e,u=await this._getDataValues({field:e.field||e.expression,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},n),d=W(u,{field:r,normalizationField:i,normalizationType:o,normalizationTotal:s,numBins:a,minValue:x(o?e.normalizationMinValue:c,!1),maxValue:x(o?e.normalizationMaxValue:l,!1)}),f=this._calculateHistogramBins(u,d,n);return this._createFeaturesFromHistogramBins(f,t)}async _createDateBinsResponse(e,t,n){let{field:r,interval:i,start:a,end:o,snapToData:s,returnFullIntervalBin:c,offset:l,firstDayOfWeek:u}=e,d=i.unit,f=await this._getDataValues({field:r||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},n),p=O(this.fieldsIndex.get(r)),m=j.toJSON(d),h=f.filter(Boolean).sort((e,t)=>e-t),g=a==null?h[0]:x(a,p),_=o==null?h[h.length-1]:x(o,p),v=[];if(g!=null&&_!=null){let e={zone:t.outTimeReference?.ianaTimeZone??q},n={[l?.unit?j.toJSON(l.unit):`milliseconds`]:l?.value||0},r=J.fromMillis(g,e).minus(n),a=J.fromMillis(_,e).minus(n),o=typeof u==`number`&&u>=1&&u<=7?u:7,d=(e,t)=>{let n=(e.weekday-t+7)%7;return e.minus({days:n}).startOf(`day`)},f=(e,t)=>d(e,t).plus({days:7});if(s===`last`){let e=m===`week`?f(a,o):a;for(;e>r;){let t=e.minus({[m]:i.value});if(t<r){v.unshift([c?t.plus(n).toMillis():r.plus(n).toMillis(),e.plus(n).toMillis()]);break}v.unshift([t.plus(n).toMillis(),e.plus(n).toMillis()]),e=t}}else{let e=s===`first`?r:m===`week`?d(r,o):r.startOf(m);for(;e<=a;){let t=e.plus({[m]:i.value});if(t>a){v.push([e.plus(n).toMillis(),c?t.plus(n).toMillis():a.plus(n).toMillis()]);break}v.push([e.plus(n).toMillis(),t.plus(n).toMillis()]),e=t}}}let y=this._calculateHistogramBins(f,{intervals:v,min:g,max:_},n);return this._createFeaturesFromHistogramBins(y,t)}async _createFixedBoundariesBinsResponse(e,t,n){let{field:r}=e,i=await this._getDataValues({field:r||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},n),a=O(this.fieldsIndex.get(r)),o=e.boundaries.map(e=>x(e,a)).sort((e,t)=>e-t),s=[];for(let e=0;e<o.length-1;e++)s.push([o[e],o[e+1]]);let c={intervals:s,min:o.at(0),max:o.at(-1)},l=this._calculateHistogramBins(i,c,n);return this._createFeaturesFromHistogramBins(l,t)}async _createFixedIntervalBinsResponse(e,t,n){let{field:r,interval:i,normalizationType:a,start:o,end:s}=e,c=await this._getDataValues({field:r||e.expression,normalizationField:e.normalizationField,normalizationType:a,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},n),l=O(this.fieldsIndex.get(r)),u=W(c,{field:r,classificationMethod:`defined-interval`,definedInterval:i,minValue:x(a?e.normalizationMinValue:o,l),maxValue:x(a?e.normalizationMaxValue:s,l)},!0),d=this._calculateHistogramBins(c,u,n);return this._createFeaturesFromHistogramBins(d,t)}async _createFeaturesFromHistogramBins(e,t){let{upperBoundaryAlias:n,lowerBoundaryAlias:r}=t,i=r||`lowerBoundary`,a=n||`upperBoundary`,o=[],s=[{name:i,alias:i,type:`esriFieldTypeDouble`},{name:a,alias:a,type:`esriFieldTypeDouble`}],c=t.bin?.stackBy?.value,l=t.bin?.stackBy?.outAlias;c&&s.push({name:`bin`,alias:`bin`,type:`esriFieldTypeInteger`},{name:l??c,alias:l??c,type:`esriFieldTypeString`});let u=0,d=t.bin.type===`dateBin`,f=t.outTimeReference?.ianaTimeZone;for(let n of e){let{minValue:e,maxValue:r,items:p}=n,m={attributes:{}};m.attributes[i]=d&&f&&e!=null?J.fromMillis(e,{zone:f}).toISO():e,t.bin.hideUpperBound||(m.attributes[a]=d&&f&&r!=null?J.fromMillis(r,{zone:f}).toISO():r),t.returnAggIds&&(m.aggregateIds=p.map(e=>this.featureAdapter.getObjectId(e)).filter(e=>e!=null));let h;if(c?(h=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[c],orderByFields:[c]},p),m.attributes.bin=++u,t.bin.jsonStyle===`flat`?o.push(...h.features.map(({attributes:{EXPR_1:e,...t},...n})=>({...n,attributes:l??e?{...t,[l??e]:e,...m.attributes}:{...t,...m.attributes}}))):(m.stackedAttributes=h.features.map(({attributes:{EXPR_1:e,...t}})=>l??e?{...t,[l??e]:e}:t),o.push(m))):(t.bin?.splitBy&&(m.attributes.bin=++u),h=await this._createStatisticsQueryResponse(t,p,m),o.push(m)),h.fields)for(let e of h.fields)s.some(t=>t.name===e.name)||s.push(e)}return t.binOrder===`desc`&&o.reverse(),{fields:s,features:o}}}function Z(e){let t=s(e[0]);for(let n of e.slice(1))c(t,s(n));return t}function ee(e,t,n,r){let i=r.x-n.x,a=r.y-n.y,o=t.x-n.x,s=t.y-n.y,c=i*i+a*a;if(c===0)return!1;let l=o*i+s*a,u=Math.min(1,Math.max(0,l/c));return e.x=n.x+i*u,e.y=n.y+a*u,!0}class Q{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}const te=[1];function $(e,t){let n=e.split(` `),r=n[0],i=t.get(r),a=n[1]?n[1].toLowerCase()===`desc`:!1;return{compare:K(i?.type,a,`case-insensitive`),fieldOrExpression:r,fieldInfo:i}}export{X as QueryEngineResult};
|
|
2
|
+
import{insertSortedStableTopN as e}from"../../../core/arrayUtils.js";import{importLazily as t}from"../../../core/importUtils.js";import{clone as n}from"../../../core/lang.js";import r from"../../../geometry/SpatialReference.js";import{polygonCentroid as i,extentCentroid as a}from"../../../geometry/support/centroid.js";import{getPolygonExtent as o,getGeometryExtent as s,expandExtent as c}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as l}from"../../../geometry/support/quantizationUtils.js";import{isValid as u,equals as d}from"../../../geometry/support/spatialReferenceUtils.js";import{closestPointOnCurve as f}from"../../../geometry/support/curves/closestPointOnCurve.js";import{getEndpoint as p,isCoordinate as m,cloneCurve as h}from"../../../geometry/support/curves/curveUtils.js";import g from"./AttributesBuilder.js";import{cleanFromGeometryEngine as _,getGeometry as v,transformCentroid as y}from"./geometryUtils.js";import{project as b}from"./projectionSupport.js";import{getDateInNumber as x}from"./queryUtils.js";import{SnappingCandidateEdge as S,SnappingCandidateVertex as C}from"./SnappingCandidate.js";import{isDateField as w,isDateOnlyField as T,isTimestampOffsetField as E,isStringField as D,isTimeOnlyField as O}from"../../support/fieldUtils.js";import k from"../../../rest/support/AutoIntervalBinParameters.js";import A from"../../../rest/support/DateBinParameters.js";import{unitsDict as j}from"../../../rest/support/DateBinUtils.js";import M from"../../../rest/support/FixedBoundariesBinParameters.js";import N from"../../../rest/support/FixedIntervalBinParameters.js";import{isNullCountSupported as P,calculateStringStatistics as F,calculateStatistics as I,processSummaryStatisticsResult as L,calculateUniqueValuesCount as R,createUVResult as z,calculateClassBreaks as B,resolveCBResult as V,calculateHistogram as H,calculatePercentile as U,binIndex as W,getBinParams as G,getAttributeComparator as K}from"../../../statistics/utils.js";import{utc as q}from"../../../time/constants.js";import{DateTime as J}from"luxon";const Y=t(()=>import(`../../../geometry/operators/json/convexHullOperator.js`));class X{constructor(e,t,n){this.items=e,this.query=t,this.geometryType=n.geometryType,this.hasZ=!!t.returnZ&&n.hasZ,this.hasM=!!t.returnM&&n.hasM,this.fieldsIndex=n.fieldsIndex,this.spatialReference=n.spatialReference,this.featureAdapter=n.featureAdapter,this.featureIdInfo=n.featureIdInfo}get size(){return this.items.length}createQueryResponseForCount(){let e=new g(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);let{groupByFieldsForStatistics:t,having:n,outStatistics:r}=this.query;if(!t?.length)return 1;let i=new Map,a=new Map,o=new Set;for(let s of r){let{statisticType:r}=s,c=r===`exceedslimit`?void 0:s.onStatisticField;if(!a.has(c)){let n=[];for(let r of t){let t=this._getAttributeValues(e,r,this.items,i);n.push(t)}a.set(c,this._calculateUniqueValues(n,this.items,e.returnDistinctValues))}let l=a.get(c);for(let t in l){let{data:r,items:i}=l[t],a=r.join(`,`);(!n||e.validateItems(i,n))&&o.add(a)}}return o.size}async createQueryResponse(){let e;if(e=this.query.outStatistics?this.query.outStatistics.some(e=>e.statisticType===`exceedslimit`)?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items):this._createFeatureQueryResponse(this.query),this.query.returnQueryGeometry){let t=this.query.geometry;u(this.query.outSR)&&!d(t.spatialReference,this.query.outSR)?e.queryGeometry=_({spatialReference:this.query.outSR,...b(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=_({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t,n){let r=this.featureAdapter,{point:i}=e,a=typeof e.distance==`number`?e.distance:e.distance.x,o=typeof e.distance==`number`?e.distance:e.distance.y;function s(e,t){let n=(e-i.x)/a,r=(t-i.y)/o;return n*n+r*r}let c={candidates:[]},l=this.geometryType===`esriGeometryPolygon`,u=this.geometryType===`esriGeometryPolyline`||this.geometryType===`esriGeometryPoint`,d=this._getPointCreator(t,this.spatialReference,n),g=new Q(null,0),_=new Q(null,0),v={x:0,y:0,z:0};for(let e of this.items){let t=r.getObjectId(e),n=r.getGeometryWithCurves?.(e);if(n!=null){b(n,t);continue}let i=r.getGeometry(e);if(i!=null){y(i,t);continue}}return c.candidates.sort((e,t)=>e.distance-t.distance),c;function y(t,n){let{coords:r,stride:a}=t,o=t.isPoint?te:t.lengths;if(g.coords=r,_.coords=r,e.returnEdge){let e=0;for(let t=0;t<o.length;t++){let r=o[t],u=e;for(let t=0;t<r;t++,e+=a){if(!l&&t===r-1||(g.coordsIndex=e,_.coordsIndex=t===r-1?u:e+a,!ee(v,i,g,_)))continue;let o=s(v.x,v.y);o<=1&&c.candidates.push(new S(n,d(v),Math.sqrt(o),d(g),d(_)))}}}if(e.vertexMode===`all`){let e=0;for(let t=0;t<o.length;t++){let r=o[t],i=e,u=_;u.coordsIndex=i;for(let t=0;t<r;t++,e+=a){if(g.coordsIndex=e,l&&t===r-1&&g.x===u.x&&g.y===u.y)continue;let i=s(g.x,g.y);i<=1&&c.candidates.push(new C(n,d(g),Math.sqrt(i)))}}}else if(u&&e.vertexMode===`ends`){let e=0,t=[];for(let n=0;n<o.length;n++){t.push(e);let r=o[n];e+=r*a,r>1&&t.push(e-a)}for(let e of t){g.coordsIndex=e;let t=s(g.x,g.y);t<=1&&c.candidates.push(new C(n,d(g),Math.sqrt(t)))}}}function b(t,n){let{candidates:r}=c,a={x:0,y:0,z:0};if(e.returnEdge){let e=[i.x,i.y],o=new Q(e,0),c=new Q(e,0);for(let{segments:i}of t.parts)for(let{start:t,curve:l}of i){let{curvePoint:i}=f(t,l,e),u=s(...i);if(u>1)continue;[a.x,a.y]=i,o.coords=t,c.coords=p(l);let g=m(l)?null:h(l);r.push(new S(n,d(a),Math.sqrt(u),d(o),d(c),!1,g))}}function o(e){a.x=t.vertexXY[e*2],a.y=t.vertexXY[e*2+1];let i=s(a.x,a.y);i>1||(a.z=t.vertexZ?.[e]??0,r.push(new C(n,d(a),Math.sqrt(i))))}if(e.vertexMode===`all`){let{vertexCount:e}=t;for(let t=0;t<e;++t)o(t);return}if(e.vertexMode===`ends`)switch(t.type){case`point`:o(0);break;case`polyline`:for(let e=0;e<t.partCount;++e){let n=t.partOffsets[e],r=t.partOffsets[e+1]-1;o(n),r!==n&&o(r)}}}}_getPointCreator(e,t,n){let r=n!=null&&!d(t,n)?e=>b(e,t,n):e=>e,{hasZ:i}=this;return i&&e?({x:e,y:t,z:n})=>r({x:e,y:t,z:n}):({x:e,y:t})=>r({x:e,y:t,z:0})}async createSummaryStatisticsResponse(e){let{field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,minValue:o,maxValue:s,scale:c,timeZone:l,outStatisticTypes:u}=e,d=this.fieldsIndex.get(t),f=w(d)||T(d)||E(d),p=await this._getDataValues({field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,scale:c,timeZone:l},this.items),m=P({normalizationType:i,normalizationField:r,minValue:o,maxValue:s}),h={value:.5,fieldType:d?.type},g=D(d)?F({values:p,supportsNullCount:m,percentileParams:h,outStatisticTypes:u}):I({values:p,minValue:o,maxValue:s,useSampleStdDev:!i,supportsNullCount:m,percentileParams:h,outStatisticTypes:u});return L(g,u,f)}async createUniqueValuesResponse(e){let{field:t,valueExpression:n,domains:r,returnAllCodedValues:i,scale:a,timeZone:o}=e,s=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:n,scale:a,timeZone:o},this.items,!1),c=R(s);return z(c,r,i,e.fieldDelimiter)}async createClassBreaksResponse(e){let{field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numClasses:u,scale:d,timeZone:f}=e,p=await this._getDataValues({field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,scale:d,timeZone:f},this.items),m=B(p,{field:t,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numClasses:u});return V(m,o)}async createHistogramResponse(e){let{field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numBins:u,scale:d,timeZone:f}=e,p=await this._getDataValues({field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,scale:d,timeZone:f},this.items);return H(p,{field:t,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numBins:u})}_sortFeatures(e,t,n){if(e.length>1&&t?.length)for(let r of t.slice().reverse()){let{compare:t,fieldOrExpression:i,fieldInfo:a}=$(r,this.fieldsIndex);e.sort((e,r)=>t(n(e,i,a),n(r,i,a)))}}_topNFeatures(t,n,r,i){if(t.length>1&&n?.length){let a=n.map(e=>{let{compare:t,fieldOrExpression:n,fieldInfo:r}=$(e,this.fieldsIndex);return(e,a)=>t(i(e,n,r),i(a,n,r))}).reduceRight((e,t)=>(n,r)=>{let i=t(n,r);return i!==0&&!Number.isNaN(i)?i:e(n,r)}),o=[];for(let n of t)e(o,n,r,a);return o}return t.slice(0,r)}_createFeatureQueryResponse(e){let{items:t,geometryType:n,hasM:r,hasZ:i,featureIdInfo:a,spatialReference:o}=this,{outFields:s,outSR:c,quantizationParameters:u,resultRecordCount:d,resultOffset:f,returnZ:p,returnM:m}=e,h=d!=null&&t.length>(f||0)+d,g=s&&(s.includes(`*`)?[...this.fieldsIndex.fields]:s.map(e=>this.fieldsIndex.get(e)));return{exceededTransferLimit:h,features:this._createFeatures(e,t),fields:g,geometryType:n,hasM:r&&m,hasZ:i&&p,objectIdFieldName:a.type===`object-id`?a.fieldName:null,spatialReference:_(c||o),transform:u&&l(u)||null}}_createFeatures(e,t){let n=new g(e,this.featureAdapter,this.fieldsIndex),{hasM:r,hasZ:i}=this,{orderByFields:a,quantizationParameters:o,returnGeometry:s,returnCentroid:c,maxAllowableOffset:u,resultOffset:d,resultRecordCount:f,returnZ:p=!1,returnM:m=!1}=e,h=i&&p,_=r&&m,b,x=d||0,S=f==null?null:x+f;S!=null&&S<=5e3&&S<t.length?b=this._topNFeatures(t,a,S,(e,t,r)=>n.getFieldValue(e,t,r)):(b=[...t],this._sortFeatures(b,a,(e,t,r)=>n.getFieldValue(e,t,r))),(x>0||S!=null)&&(b=b.slice(x,S??void 0));let C=[],w=0;if(!this.geometryType||!s&&!c)for(let e of b){let t=n.getAttributes(e);t&&(C[w++]=this._addFeatureJSONMetadata(e,{attributes:t}))}else{let e=l(o)??void 0,t=this.geometryType===`esriGeometryPolygon`||this.geometryType===`esriGeometryPolyline`;if(s&&!c)for(let r of b){let i=this.featureAdapter.getGeometry(r),a=this._addFeatureJSONMetadata(r,{attributes:n.getAttributes(r),geometry:v(this.geometryType,i,u,e,h,_)});t&&i&&!a.geometry&&(a.centroid=y(this,this.featureAdapter.getCentroid(r,this),e)),C[w++]=a}else if(!s&&c)for(let t of b)C[w++]=this._addFeatureJSONMetadata(t,{attributes:n.getAttributes(t),centroid:y(this,this.featureAdapter.getCentroid(t,this),e)});else for(let t of b)C[w++]=this._addFeatureJSONMetadata(t,{attributes:n.getAttributes(t),centroid:y(this,this.featureAdapter.getCentroid(t,this),e),geometry:v(this.geometryType,this.featureAdapter.getGeometry(t),u,e,h,_)})}return C}_addFeatureJSONMetadata(e,t){let n=this.featureAdapter.getMetadata?.(e);return n!==void 0&&(t.metadata=n),t}_createExceedsLimitQueryResponse(){let e=!1,t=1/0,n=1/0,r=1/0;for(let e of this.query.outStatistics??[])if(e.statisticType===`exceedslimit`){t=e.maxPointCount==null?1/0:e.maxPointCount,n=e.maxRecordCount==null?1/0:e.maxRecordCount,r=e.maxVertexCount==null?1/0:e.maxVertexCount;break}return e=this.geometryType===`esriGeometryPoint`?this.items.length>t:this.items.length>n||this.items.reduce((e,t)=>e+(this.featureAdapter.getGeometry(t)?.size??0),0)>r,{fields:[{name:`exceedslimit`,type:`esriFieldTypeInteger`,alias:`exceedslimit`,sqlType:`sqlTypeInteger`,domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,n={attributes:{}}){let r=[],i=new Map,a=new Map,o=new Map,s=new Map,c=new g(e,this.featureAdapter,this.fieldsIndex),l=e.outStatistics,{groupByFieldsForStatistics:u,having:d,orderByFields:f,resultRecordCount:p}=e,m=u?.length,h=!!m,_=h?u[0]:null,v=h&&!this.fieldsIndex.get(_);for(let f of l??[]){let{outStatisticFieldName:l,statisticType:p}=f,g=f,y=p===`exceedslimit`?void 0:f.onStatisticField,b=p===`percentile_disc`||p===`percentile_cont`,x=p===`EnvelopeAggregate`||p===`CentroidAggregate`||p===`ConvexHullAggregate`,S=h&&m===1&&(y===_||v)&&p===`count`;if(h){if(!o.has(y)){let e=[];for(let n of u){let r=this._getAttributeValues(c,n,t,i);e.push(r)}o.set(y,this._calculateUniqueValues(e,t,!x&&c.returnDistinctValues))}let n=o.get(y);if(!n)continue;let r=Object.keys(n);for(let a of r){let{count:r,data:o,items:f,itemPositions:p}=n[a],m=o.join(`,`);if(!d||c.validateItems(f,d)){let n=s.get(m)||{attributes:{}};if(e.returnAggIds&&(n.aggregateIds=f.map(e=>this.featureAdapter.getObjectId(e)).filter(e=>e!=null)),x){n.aggregateGeometries||={};let{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(g,f);n.aggregateGeometries[t]=e}else{let e=null;if(S)e=r;else{let n=this._getAttributeValues(c,y,t,i),r=p.map(e=>n[e]);e=b&&`statisticParameters`in g?this._getPercentileValue(g,r):this._getStatisticValue(g,r,null,c.returnDistinctValues)}n.attributes[l]=e}let a=0;u.forEach((e,t)=>n.attributes[this.fieldsIndex.get(e)?e:`EXPR_${++a}`]=o[t]),s.set(m,n)}}}else if(x){n.aggregateGeometries||={};let{aggregateGeometries:e,outStatisticFieldName:r}=await this._getAggregateGeometry(g,t);n.aggregateGeometries[r]=e}else{let e=this._getAttributeValues(c,y,t,i);n.attributes[l]=b&&`statisticParameters`in g?this._getPercentileValue(g,e):this._getStatisticValue(g,e,a,c.returnDistinctValues)}let C=(p===`min`||p===`max`)&&(D(this.fieldsIndex.get(y))||this._isAnyDateField(y))?this.fieldsIndex.get(y)?.type:null;r.push({name:l,alias:l,type:C||`esriFieldTypeDouble`})}let y=h?Array.from(s.values()):[n];return this._sortFeatures(y,f,(e,t)=>e.attributes[t]),p&&(y.length=Math.min(p,y.length)),{fields:r,features:y}}_isAnyDateField(e){let t=this.fieldsIndex.get(e);return w(t)||T(t)||E(t)||O(t)}async _getAggregateGeometry(e,t){let{statisticType:n,outStatisticFieldName:r}=e,{featureAdapter:s,spatialReference:c,geometryType:l}=this,u=t.map(e=>v(l,s.getGeometry(e))),d={aggregateGeometries:null,outStatisticFieldName:null},{convexHullExecuteMany:f}=await Y.getImportPromise(),[p]=f(u,{merge:!0});if(p&&p.rings[0].length<=3&&(p=null),n===`EnvelopeAggregate`)d.aggregateGeometries={...p?o(p):Z(u),spatialReference:c},d.outStatisticFieldName=r||`extent`;else if(n===`CentroidAggregate`){let[e,t]=p?i(p):a(Z(u));d.aggregateGeometries={x:e,y:t,spatialReference:c},d.outStatisticFieldName=r||`centroid`}else n===`ConvexHullAggregate`&&(d.aggregateGeometries=p&&{...p,spatialReference:c},d.outStatisticFieldName=r||`convexHull`);return d}_getStatisticValue(e,t,n,r){let{onStatisticField:i,statisticType:a}=e,o=null;return o=n?.has(i)?n.get(i):D(this.fieldsIndex.get(i))||this._isAnyDateField(i)?F({values:t,returnDistinct:r}):I({values:r?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),n&&n.set(i,o),o[a===`var`?`variance`:a]}_getPercentileValue(e,t){let{onStatisticField:n,statisticParameters:r,statisticType:i}=e,{value:a,orderBy:o}=r,s={value:a,orderBy:o,fieldType:this.fieldsIndex.get(n)?.type,isDiscrete:i===`percentile_disc`};return U(t,s)}_getAttributeValues(e,t,n,r){if(r.has(t))return r.get(t);let i=this.fieldsIndex.get(t),a=n.map(n=>e.getFieldValue(n,t,i));return r.set(t,a),a}_calculateUniqueValues(e,t,n){let r={},i=t.length;for(let a=0;a<i;a++){let i=t[a],o=[];for(let t of e)o.push(t[a]);let s=o.join(`,`);r[s]==null?r[s]={count:1,data:o,items:[i],itemPositions:[a]}:(n||r[s].count++,r[s].items.push(i),r[s].itemPositions.push(a))}return r}async _getDataValues(e,t,i=!0){let a=new g(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:o,scale:s,timeZone:c}=e,l=r.fromJSON(this.query.outSR||this.spatialReference);return o?a.getExpressionValues(t,o,{viewingMode:`map`,scale:s,spatialReference:l},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},c):a.getDataValues(t,n(e),i)}_calculateHistogramBins(e,t,n){if(t.min==null&&t.max==null)return[];let r=t.intervals,i=t.min??0,a=t.max??0,o=r.map(([e,t])=>({minValue:e,maxValue:t,count:0,items:[]}));for(let t=0;t<e.length;t++){let s=e[t],c=n[t];if(s!=null&&s>=i&&s<=a){let e=W(r,s);e>-1&&(o[e].count++,o[e].items.push(c))}}return o}async createQueryBinsResponse(e){let t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);let{value:n,outAlias:r,valueType:i}=t,a=[],o=[{name:r??n,alias:r??n,type:i??`esriFieldTypeString`},{name:`bin`,alias:`bin`,type:`esriFieldTypeInteger`}],s=new g(e,this.featureAdapter,this.fieldsIndex),c=new Map,l=[...this.items];this._sortFeatures(l,[n],(e,t,n)=>s.getFieldValue(e,t,n));let u=this._getAttributeValues(s,n,l,c),d=this._calculateUniqueValues([u],l,s.returnDistinctValues);for(let t in d){let{items:i}=d[t],s=await this._createBinsResponse(e,i);if(a.push(...s.features.map(e=>({...e,attributes:{...e.attributes,[r??n]:t}}))),s.fields)for(let e of s.fields)o.some(t=>t.name===e.name)||o.push(e)}return{fields:o,features:a}}async _createBinsResponse(e,t){let n=e.bin;switch(t??=this.items,n.type){case`autoIntervalBin`:return this._createAutoIntervalBinsResponse(k.fromJSON(n),e,t);case`dateBin`:return this._createDateBinsResponse(A.fromJSON(n),e,t);case`fixedBoundariesBin`:return this._createFixedBoundariesBinsResponse(M.fromJSON(n),e,t);case`fixedIntervalBin`:return this._createFixedIntervalBinsResponse(N.fromJSON(n),e,t)}}async _createAutoIntervalBinsResponse(e,t,n){let{field:r,normalizationField:i,numBins:a,normalizationType:o,normalizationTotal:s,start:c,end:l}=e,u=await this._getDataValues({field:e.field||e.expression,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},n),d=G(u,{field:r,normalizationField:i,normalizationType:o,normalizationTotal:s,numBins:a,minValue:x(o?e.normalizationMinValue:c,!1),maxValue:x(o?e.normalizationMaxValue:l,!1)}),f=this._calculateHistogramBins(u,d,n);return this._createFeaturesFromHistogramBins(f,t)}async _createDateBinsResponse(e,t,n){let{field:r,interval:i,start:a,end:o,snapToData:s,returnFullIntervalBin:c,offset:l,firstDayOfWeek:u}=e,d=i.unit,f=await this._getDataValues({field:r||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},n),p=O(this.fieldsIndex.get(r)),m=j.toJSON(d),h=f.filter(Boolean).sort((e,t)=>e-t),g=a==null?h[0]:x(a,p),_=o==null?h[h.length-1]:x(o,p),v=[];if(g!=null&&_!=null){let e={zone:t.outTimeReference?.ianaTimeZone??q},n={[l?.unit?j.toJSON(l.unit):`milliseconds`]:l?.value||0},r=J.fromMillis(g,e).minus(n),a=J.fromMillis(_,e).minus(n),o=typeof u==`number`&&u>=1&&u<=7?u:7,d=(e,t)=>{let n=(e.weekday-t+7)%7;return e.minus({days:n}).startOf(`day`)},f=(e,t)=>d(e,t).plus({days:7});if(s===`last`){let e=m===`week`?f(a,o):a;for(;e>r;){let t=e.minus({[m]:i.value});if(t<r){v.unshift([c?t.plus(n).toMillis():r.plus(n).toMillis(),e.plus(n).toMillis()]);break}v.unshift([t.plus(n).toMillis(),e.plus(n).toMillis()]),e=t}}else{let e=s===`first`?r:m===`week`?d(r,o):r.startOf(m);for(;e<=a;){let t=e.plus({[m]:i.value});if(t>a){v.push([e.plus(n).toMillis(),c?t.plus(n).toMillis():a.plus(n).toMillis()]);break}v.push([e.plus(n).toMillis(),t.plus(n).toMillis()]),e=t}}}let y=this._calculateHistogramBins(f,{intervals:v,min:g,max:_},n);return this._createFeaturesFromHistogramBins(y,t)}async _createFixedBoundariesBinsResponse(e,t,n){let{field:r}=e,i=await this._getDataValues({field:r||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},n),a=O(this.fieldsIndex.get(r)),o=e.boundaries.map(e=>x(e,a)).sort((e,t)=>e-t),s=[];for(let e=0;e<o.length-1;e++)s.push([o[e],o[e+1]]);let c={intervals:s,min:o.at(0),max:o.at(-1)},l=this._calculateHistogramBins(i,c,n);return this._createFeaturesFromHistogramBins(l,t)}async _createFixedIntervalBinsResponse(e,t,n){let{field:r,interval:i,normalizationType:a,start:o,end:s}=e,c=await this._getDataValues({field:r||e.expression,normalizationField:e.normalizationField,normalizationType:a,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},n),l=O(this.fieldsIndex.get(r)),u=G(c,{field:r,classificationMethod:`defined-interval`,definedInterval:i,minValue:x(a?e.normalizationMinValue:o,l),maxValue:x(a?e.normalizationMaxValue:s,l)},!0),d=this._calculateHistogramBins(c,u,n);return this._createFeaturesFromHistogramBins(d,t)}async _createFeaturesFromHistogramBins(e,t){let{upperBoundaryAlias:n,lowerBoundaryAlias:r}=t,i=r||`lowerBoundary`,a=n||`upperBoundary`,o=[],s=[{name:i,alias:i,type:`esriFieldTypeDouble`},{name:a,alias:a,type:`esriFieldTypeDouble`}],c=t.bin?.stackBy?.value,l=t.bin?.stackBy?.outAlias;c&&s.push({name:`bin`,alias:`bin`,type:`esriFieldTypeInteger`},{name:l??c,alias:l??c,type:`esriFieldTypeString`});let u=0,d=t.bin.type===`dateBin`,f=t.outTimeReference?.ianaTimeZone;for(let n of e){let{minValue:e,maxValue:r,items:p}=n,m={attributes:{}};m.attributes[i]=d&&f&&e!=null?J.fromMillis(e,{zone:f}).toISO():e,t.bin.hideUpperBound||(m.attributes[a]=d&&f&&r!=null?J.fromMillis(r,{zone:f}).toISO():r),t.returnAggIds&&(m.aggregateIds=p.map(e=>this.featureAdapter.getObjectId(e)).filter(e=>e!=null));let h;if(c?(h=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[c],orderByFields:[c]},p),m.attributes.bin=++u,t.bin.jsonStyle===`flat`?o.push(...h.features.map(({attributes:{EXPR_1:e,...t},...n})=>({...n,attributes:l??e?{...t,[l??e]:e,...m.attributes}:{...t,...m.attributes}}))):(m.stackedAttributes=h.features.map(({attributes:{EXPR_1:e,...t}})=>l??e?{...t,[l??e]:e}:t),o.push(m))):(t.bin?.splitBy&&(m.attributes.bin=++u),h=await this._createStatisticsQueryResponse(t,p,m),o.push(m)),h.fields)for(let e of h.fields)s.some(t=>t.name===e.name)||s.push(e)}return t.binOrder===`desc`&&o.reverse(),{fields:s,features:o}}}function Z(e){let t=s(e[0]);for(let n of e.slice(1))c(t,s(n));return t}function ee(e,t,n,r){let i=r.x-n.x,a=r.y-n.y,o=t.x-n.x,s=t.y-n.y,c=i*i+a*a;if(c===0)return!1;let l=o*i+s*a,u=Math.min(1,Math.max(0,l/c));return e.x=n.x+i*u,e.y=n.y+a*u,!0}class Q{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}const te=[1];function $(e,t){let n=e.split(` `),r=n[0],i=t.get(r),a=n[1]?n[1].toLowerCase()===`desc`:!1;return{compare:K(i?.type,a,`case-insensitive`),fieldOrExpression:r,fieldInfo:i}}export{X as QueryEngineResult};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{toConst as n}from"../../../../core/compilerUtils.js";import r from"../../../../core/Error.js";import i from"../../../../core/Handles.js";import has from"../../../../core/has.js";import a from"../../../../core/Logger.js";import{onAbortOrThrow as o,throwIfAborted as s}from"../../../../core/promiseUtils.js";import{QueueProcessor as c}from"../../../../core/QueueProcessor.js";import{parseWhereClause as l}from"../../../../core/sql.js";import{getMetersPerUnitForSR as u}from"../../../../core/units.js";import d from"../../../../geometry/SpatialReference.js";import{set as f,create as p,expandWithAABB as m,expandWithRect as ee,negativeInfinity as h}from"../../../../geometry/support/aaBoundingBox.js";import{copy as te,negativeInfinity as g,create as ne,expandWithRect as re}from"../../../../geometry/support/aaBoundingRect.js";import{isWebMercator as _,isWGS84 as v}from"../../../../geometry/support/spatialReferenceUtils.js";import{normalizeColumnPath as y,readParquetFileAttribute as b}from"../../../parquet.js";import{convertToGeometry as x}from"../../featureConversionUtils.js";import{getFieldNamesFromStatistics as S}from"../../data/attributeSupport.js";import{getQueryResultExtent as C,getQueryBoundingRects as w,QueryEngine as T}from"../../data/QueryEngine.js";import{queryCapabilities as ie}from"../../data/QueryEngineCapabilities.js";import{QueryEngineResult as E}from"../../data/QueryEngineResult.js";import{normalizeQueryLike as D}from"../../data/queryUtils.js";import{createFileProvider as O}from"../parquet/createFileProvider.js";import{readFieldStatistic as k}from"../parquet/ParquetFileStatistics.js";import{createDrawingInfo as ae}from"./clientSideDefaults.js";import{getParquetFileId as oe,getParquetRowId as se,getParquetObjectId as ce}from"./parquetIdUtils.js";import A from"../../../support/Field.js";import j from"../../../support/FieldsIndex.js";import{isNumericField as M}from"../../../support/fieldUtils.js";import{fromParquetGeometryEncodingJSON as N}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as P,fromParquetJSONGeometryType as F,toParquetJSONGeometryType as I}from"../../../support/parquetUtils.js";import{loadParquetModule as L}from"../../../../libs/librust-parquet/loadParquetModule.js";import{utc as R}from"../../../../time/constants.js";import{FeatureStoreQueryAdapter as z}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as B}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as V}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as H}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as U}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const W=new z,G=`__OBJECTID`,K=8e3;class le{constructor(e,t){this._files=e,this._createFileStream=t,this._fileIndex=0,this._streamIndex=0,this._streams=[],this._pending=new Set,this._resolvedCount=0}async next(e){for(await this._fill(e);this._pending.size>0;){s(e),await this._fill(e);let t=await ue(this._pending);if(this._pending.delete(t.read),this._resolvedCount++,t.chunk!=null)return t.chunk}return null}async _fill(e){for(this._removeDone();this._pending.size<8;){let t=this._getOrCreateNextStream(e);if(t==null)return;this._pending.add(t.read(e))}}_getOrCreateNextStream(e){let t=this._resolvedCount>=8?8:2;if(this._fileIndex<this._files.length&&this._streams.length<t){let t=this._files[this._fileIndex++],n=new de(t.id,this._createFileStream(t,e));return this._streams.push(n),n}return this._getNextStream()}_getNextStream(){let e=this._streams.length;for(let t=0;t<e;t++){let n=(this._streamIndex+t)%e,r=this._streams[n];if(r.canRead)return this._streamIndex=(n+1)%e,r}return null}_removeDone(){let e=this._streamIndex;for(let t=this._streams.length-1;t>=0;t--)this._streams[t].done&&(this._streams.splice(t,1),t<e&&e--);this._streamIndex=this._streams.length>0?e%this._streams.length:0}}function ue(e){return Promise.race(Array.from(e,async e=>({read:e,chunk:await e})))}class de{constructor(e,t){this._fileId=e,this._stream=t,this._readCount=0,this._reachedEnd=!1}get canRead(){return!this._reachedEnd}get done(){return this._reachedEnd&&this._readCount===0}async read(e){this._readCount++;try{let t=await(await this._stream).next(e);return t==null?(this._reachedEnd=!0,null):{fileId:this._fileId,chunk:t}}finally{this._readCount--}}}class fe{constructor(){this._hasZ=!1,this._hasM=!1,this._queue=new c({concurrency:4,process:(e,t)=>this._executeQuery(e,t)}),this._streams=new Map,this._streamIdCounter=0,this._indexMap={},this._handles=new i}async load(e){let t=e.spatialReference?d.fromJSON(e.spatialReference):void 0;if(t&&!t.isWGS84&&!t.isWebMercator)throw new r(`parquet:unsupported-projection`,`Only WGS84 and Web Mercator are supported`);this._customParameters=e.customParameters,this._loadParameters=e,await this._updateProvider(O(e.provider,null,()=>this._customParameters));let n=await this._provider.getMetadata(),i=await P(n,{fields:e.fields?.map(e=>A.fromJSON(e)),geometryEncoding:e.geometryEncoding?N(e.geometryEncoding):null,geometryType:e.geometryType?F(e.geometryType):null,displayOptimization:e.displayOptimization,spatialReference:t});if(this._hasZ=!!n?.hasZ,this._hasM=!!n?.hasM,!i.fields)throw new r(`parquet:unsupported`,`Fields must be defined`);let o;if(i.spatialReference&&i.geometryType){if(!i.spatialReference)throw new r(`parquet:unsupported`,`SpatialReference must be defined`);if(!i.spatialReference.isGeographic&&!i.spatialReference.isWebMercator)throw new r(`parquet:unsupported-projection`,`Only WGS84 and Web Mercator are supported`);i.spatialReference.isGeographic&&!i.spatialReference.isWGS84&&(a.getLogger(`parquet:unsupported-projection`).warn(`Found a geographic projection that is not WGS84. Handling as WGS84.`,{spatialReference:i.spatialReference}),i.spatialReference=d.WGS84),o={geometry:i.geometryEncoding?{geometryType:I(i.geometryType),spatialReference:i.spatialReference.toJSON(),encoding:i.geometryEncoding.toJSON()}:null,displayOptimization:i.displayOptimization}}this.setCustomParameters(e.customParameters),this._displayOptimization=i.displayOptimization,await this._provider.updateGeometryInfo(o),this._capabilities=$(await this._getFileStatistics(),this._hasZ,this._hasM);let s=await this._provider.getFiles();if(!s.length)return{layerDefinition:{},capabilities:$(null,this._hasZ,this._hasM)};let c=await s[0].file;i.file=c;let{fields:l}=i;if(l==null)throw new r(`parquet-layer:missing-metadata`,`Unable to create parquet source: cannot infer fields`,l);l.push(new A({name:G,type:`oid`,alias:G}));for(let e of l){let t=c.getColumnId(e.name);t!=null&&(this._indexMap[e.name]=t)}let u=j.fromLayerJSON({fields:l.map(e=>e.toJSON()),dateFieldsTimeReference:{timeZoneIANA:`UTC`}});this._fieldsIndex=u;let f=I(i.geometryType??`point`);return this._metadata=H.createFeature({fieldsIndex:u.toJSON(),geometryType:f,hasZ:this._hasZ,hasM:this._hasM,featureIdInfo:{type:`object-id`,fieldName:G},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:i.spatialReference,outSpatialReference:null,attributeSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:R}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:f,featureIdInfo:{type:`object-id`,fieldName:G},hasM:this._hasM,hasZ:this._hasZ,spatialReference:i.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},this._fullExtent=n?.extent?n.extent:await this._tryDeriveParquetFullExtent(i),{capabilities:this._capabilities,layerDefinition:{fields:i.fields?.map(e=>e.toJSON()),drawingInfo:ae(f),extent:this._fullExtent??void 0,geometryType:f,hasZ:this._hasZ,hasM:this._hasM,geometryEncoding:i.geometryEncoding?.toJSON(),displayOptimization:i.displayOptimization}}}destroy(){this._provider.destroy(),this._queue.destroy();for(let{handle:e}of this._streams.values())e.remove();this._streams.clear(),this._indexMap={},this._handles.removeAll()}async reload(e){this.destroy(),await this.load(e)}set remoteClient(e){this._source=e.createInvokeProxy(``)}setCustomParameters(e){this._customParameters=e}getIndexMap(){return this._indexMap}async updateFileProvider(e){this._loadParameters={...this._loadParameters,provider:e};let t=O(e,this._provider.getGeometryInfo(),()=>this._customParameters);await this._updateProvider(t)}async getDiagnosticsSnapshot(){let e=await this._provider.getFiles();return{files:await Promise.all(e.map(e=>e.getDiagnosticsSnapshot()))}}async getColumnIndex(e){return(await this._getFileInfoById(e.fileId)).getColumnIndex(e.rowGroupIndex,e.columnIndex)}async getOffsetIndex(e){return(await this._getFileInfoById(e.fileId)).getOffsetIndex(e.rowGroupIndex,e.columnIndex)}async queryFeatures(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),we(n)||(n.resultRecordCount=n.resultRecordCount?Math.min(n.resultRecordCount,K):K,n.resultOffset=n.resultOffset??0),n.outStatistics?this._queryStatistics(n,t):(n.returnDistinctValues&&(n.returnGeometry=void 0),(await this._enqueueQuery(n,t)).createQueryResponse())}async queryFeatureCount(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),!q(n)&&!n.returnDistinctValues&&!n.groupByFieldsForStatistics?.length&&!n.outStatistics?.length?this._getFeatureCount():(n.returnDistinctValues||(n.outFields=void 0),n.returnGeometry=void 0,(await this._enqueueQuery(n,t)).createQueryResponseForCount())}async queryObjectIds(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),q(n)?(n.resultRecordCount=n.resultRecordCount?Math.min(n.resultRecordCount,8e3):8e3,n.resultOffset=n.resultOffset??0,n.returnGeometry=void 0,n.outFields=void 0,n.returnDistinctValues=void 0,(await this._enqueueQuery(n,t)).items.map(e=>e.getObjectId())):Array.from({length:await this._getFeatureCount()},(e,t)=>t)}async queryAttributeBins(e,t={}){throw new r(`parquet:unsupported`,`queryAttributeBins not supported.`)}async queryExtent(e,t){let r=await D(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),this._fullExtent&&!q(r))return{count:await this._getFeatureCount(),extent:this._fullExtent};let i=n(this._metadata.spatialReference);r.returnGeometry=!0,r.outFields=void 0;let a=f(p(),h),o=p(),s=await this._enqueueQuery(r,t),c=0;for(let e of s.items)e.getBounds(o)&&(m(a,o),c+=1);let l=C(a,i,r.outSR?n(r.outSR):i.toJSON(),i,!1);return{count:c,extent:l}}async queryStream(e,t){if(!t.signal)throw Error(`InternalError: AbortSignal must be passed`);let n=await this._getCandidateFiles(e),r=new le(n,async(t,n)=>{let r=await t.file,i=await this._createParquetDisplayQuery(r,t.id,e);return r.executeQuery(i,K,n)}),i=this._streamIdCounter++,a=o(t.signal,e=>{let t=this._streams.get(i);t!=null&&(t.handle.remove(),this._streams.delete(i))});return this._streams.set(i,{stream:r,handle:a}),i}async getStreamNext(e,t){if(!t.signal)throw Error(`InternalError: AbortSignal must be passed`);let n=this._streams.get(e);if(!n)return{result:null};let r=await n.stream.next(t.signal);if(r==null)return n.handle.remove(),this._streams.delete(e),{result:null};let i=r.chunk.serialize().buffer,a={fileId:r.fileId,buffer:i};return i instanceof ArrayBuffer?{result:a,transferList:[i]}:{result:a}}async getStreamNextFeatures(e,t){let{result:n}=await this.getStreamNext(e,t);if(n==null)return null;let r=(await L()).ParquetChunk.deserialize(new Uint8Array(n.buffer)),i=new U(this._metadata,this._indexMap,r,n.fileId),a=[];for(;i.next();){let e=x(i.readGeometryWorldSpace(),i.geometryType,i.hasZ,i.hasM),t=i.readAttributes();a.push({attributes:t,geometry:e})}return{features:a}}async createPatch(e,t,n,r,i){if(!i.signal)throw Error(`InternalError: AbortSignal must be passed`);return(await(await(await this._getFileInfoById(e)).file).createChunkPatch(t,n,r,i.signal)).serialize().buffer}async _updateProvider(e){let t=this._provider;this._handles.removeAll(),this._provider=e,this._handles.add([e.events.on(`rangeRead`,e=>{this._source.onRangeRead(e)}),e.events.on(`sourceChanged`,async()=>{await this.reload(this._loadParameters),await this._source.onSourceChange()})]),await t?.destroy()}async _getCandidateFiles(e){let t=await this._provider.getFiles(),n=await this._getSpatialFilePruning(e);if(n==null)return t;let r=t.filter(e=>this._mayIncludeFileForSpatialPruning(e,n));return n.type===`xz`?Ce(r,n):r}async _queryStatistics(e,t){let n=await D({...e},null,this._queryEngineParams.spatialReference);if(n.returnGeometry=void 0,ve(n,this._fieldsIndex)){let e=await this._getStatisticsFromFiles(n);if(e)return e}return(await this._enqueueQuery(n,t)).createQueryResponse()}async _getStatisticsFromFiles(e){let t=await this._provider.getFiles(),n={},r=[];for(let i of e.outStatistics??[]){let e=xe(i,t);if(!e.available)return null;n[i.outStatisticFieldName]=e.value,r.push(be(i,this._fieldsIndex))}return{fields:r,features:[{attributes:n}]}}async _getSpatialFilePruning(e){if(e.type!==`tile`&&(e.type!==`arcade`||e.extent==null))return null;let t=this._displayOptimization?.index;if(t==null)return null;let n=e.outSpatialReference.wkid;if(t.wkid==null||n==null)return null;let r=t.wkid,i=await L();switch(t.type){case`xz`:return{type:`xz`,fieldName:y(t.code),intersects:(a,o)=>i.queryIntersectsXZStatistics(t.fullExtent,e.extent,n,r,t.maxLevel,a,o)};case`z`:return{type:`xy`,xFieldName:y(t.xColumn),yFieldName:y(t.yColumn),intersects:(t,a,o,s)=>i.queryIntersectsXYStatistics(e.extent,n,r,t,a,o,s)}}}_mayIncludeFileForSpatialPruning(e,t){switch(t.type){case`xz`:{let n=Z(e,t);return n?.type===`null-only`?!1:n?.type!==`bounds`||t.intersects(n.minValue,n.maxValue)}case`xy`:{let n=e.statistics.statistics.get(t.xFieldName),r=e.statistics.statistics.get(t.yFieldName);return n?.type===`null-only`||r?.type===`null-only`?!1:n?.type!==`bounds`||r?.type!==`bounds`||t.intersects(n.minValue,n.maxValue,r.minValue,r.maxValue)}}}async _tryDeriveParquetFullExtent(n){if(!n.spatialReference)return null;if(this._fullExtent==null&&n.geometryEncoding?.type===`location`){let r=await this._provider.getFiles(),{xField:i,yField:a}=n.geometryEncoding,o=f(p(),h),s=!1;for(let n of r){let r=await n.file;for(let n of r.rowGroups()){let r={stack:[],error:void 0,hasError:!1};try{let t=e(r,n.columnDescriptorForAttribute(i),!1),c=e(r,n.columnDescriptorForAttribute(a),!1),l=k(t),u=k(c);if(l?.type===`bounds`&&u?.type===`bounds`){let e=[l.minValue,u.minValue,l.maxValue,u.maxValue];ee(o,e),s=!0}n.free()}catch(e){r.error=e,r.hasError=!0}finally{t(r)}}}return s?{xmin:o[0],ymin:o[1],xmax:o[3],ymax:o[4],spatialReference:n.spatialReference?.toJSON()}:null}return null}async _getFileInfoById(e){let t=await this._provider.getFiles();for(let n of t)if(n.id===e)return n;throw Error(`InternalError: File ${e} does not exist`)}async _getFileStatistics(){return{featureCount:await this._getFeatureCount(),byteLength:await this._getByteLength()}}async _getFile(e){return(await this._getFileInfoById(e)).file}async _createParquetQuery(e,t,n,r,i){let a=(await L()).Query.new();n!=null&&a.setPreFilterStart(n),r!=null&&a.setPreFilterCount(r),i!=null&&a.setPostFilterCount(i);let o=await this._getRequiredFields(e);a.setOutFields(o),(e.geometry||e.returnGeometry)&&a.setReturnGeometry(!0),a.setReturnZ(!!e.returnZ),a.setReturnM(!!e.returnM);let s=this._tryGetGeneralizedGeometryResolution(e);s!=null&&a.setSourceResolution(s);let c=e.geometry?.spatialReference??this._queryEngineParams.spatialReference,l=c.wkid;if(e.geometry&&(_(c)||v(c))){let t=te(ne(),g);for(let n of w(e.geometry))re(t,n);a.setOutSpatialReference(l),a.setExtent({xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3]})}if(e.where){let{id:n,file:r}=t;await this._setWhereClause(a,await r,n,e.where)}return a}async _createParquetDisplayQuery(e,t,n){let r=(await L()).Query.new();if(n.type===`tile`){r.setExtent(n.extent),r.setQuantizationTransform(n.transform);let e=this._sourceResolution(n.resolution,n.outSpatialReference);e!=null&&r.setSourceResolution(e)}else n.type===`arcade`&&n.extent!=null&&r.setExtent(n.extent);return r.setOutFields(n.outFields.filter(e=>this._indexMap[e]!=null)),r.setOutSpatialReference(n.outSpatialReference.wkid),r.setReturnGeometry(n.returnGeometry),r.setReturnZ(n.returnZ),r.setReturnM(n.returnM),n.where&&await this._setWhereClause(r,e,t,n.where),r}async _getFeatureCount(){return(await this._provider.getFiles()).map(e=>e.statistics.rowCount).reduce((e,t)=>e+t,0)}async _getByteLength(){return(await this._provider.getFiles()).map(e=>e.statistics.byteSize).reduce((e,t)=>e+t,0)}_validateQuery(e){if(!this._capabilities.query.supportsStatistics&&e.outStatistics)throw new r(`parquet:unsupported`,`Statistics queries are not supported`,{query:e});if(!this._capabilities.query.supportsOrderBy&&e.orderByFields?.length)throw new r(`parquet:unsupported`,`Queries using orderBy are not supported`,{query:e});if(!this._capabilities.query.supportsDistinct&&e.returnDistinctValues)throw new r(`parquet:unsupported`,`Queries using returnDistinctValues are not supported`,{query:e})}async _setWhereClause(e,t,n,i){let a=this._indexMap,o=this._fieldsIndex,s={getAttribute(e,r){let i=a[r];if(i==null){if(o.get(r)?.name===`__OBJECTID`){let t=e.row+e.rowGroupStart;return ce(n,t)}return null}let s=o.get(r);return b(t,e.rowGroup,e.row,i,s.type)}},c=await l(i,this._fieldsIndex);if(!c.isStandardized)throw new r(`sql-parse-error`,`expression is not standardized`);let u=(e,t,n)=>c.testFeatureCompiled({rowGroup:e,row:t,rowGroupStart:n},s,null),d=c.fieldNames.map(e=>o.get(e)).filter(e=>e&&this._indexMap[e?.name]!=null);e.setWhere(i),e.setWhereEvaluator(u),e.setWhereFields(d.map(e=>e.name))}async*_streamFeatures(e,t,n,r,i){let a=await this._provider.getFiles(),o=0;for(let s of a){let a=o,c=o+s.statistics.rowCount;if(o+=s.statistics.rowCount,t!=null&&t>=c)continue;let l=t==null?null:Math.max(t-a,0),u=n;if(n!=null){let e=t??0,r=e+n;u=Math.max(Math.min(r,c)-Math.max(e,a),0)}if(u===0)continue;let d=await this._createParquetQuery(e,s,l,u,r),f=await(await s.file).executeQuery(d,K),p=async()=>{let e=await f.next(i);if(!e)return null;let t=new U(this._metadata,this._indexMap,e,s.id);return X([new B(t,null,0,!1)],this._queryEngineParams)},m=await p();for(;m!=null;)yield m,m=await p()}}async _queryFeaturesWithQueryEnginePagination(e,t){let n=[],r=this._streamFeatures(e,null,null,null,t),i=await r.next();for(;!i.done;){let a=await i.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(let e of a)n.push(e);i=await r.next()}return n}async _queryFeaturesWithUpfrontPagination(e,t){let n=e.resultOffset??0,r=e.resultRecordCount??K,i,a,o;ge(e)?_e(e)||(o=n+r):(n&&=(i=n,0),a=e.resultRecordCount);let s=[],c=this._streamFeatures(e,i,a,o,t),l=await c.next();for(;!l.done&&r>0;){let i=await l.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(let e of i){if(n>0){n--;continue}if(s.push(e),--r<=0)return s}l=await c.next()}return s}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){if(e.objectIds?.length){let n=new Map;for(let t of e.objectIds){let e=oe(t),r=se(t),i=n.get(e);i||(i=[],n.set(e,i)),i.push(r)}let r=[];for(let[i,a]of n.entries()){let n=await this._executeFileIdQuery(e,i,a,t);for(let e of n)r.push(e)}return new E(r,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:W,featureIdInfo:this._queryEngineParams.featureIdInfo})}if(e.where===`1=1`&&(e.where=null),e.resultOffset??=0,e.resultRecordCount??=await this._getFeatureCount(),e.resultRecordCount>2e7&&!(this._displayOptimization&&e.geometry))throw new r(`parquet:cannot-execute-query`,`Unable to execute query, dataset is too large.`);let n=!!e.orderByFields?.length||!!e.outStatistics?.length||!!e.returnDistinctValues,i=n?await this._queryFeaturesWithQueryEnginePagination(e,t):await this._queryFeaturesWithUpfrontPagination(e,t);return n||(e.resultOffset=0),new E(i,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:W,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(e,t,n,r){let i=await this._getRequiredFields(e),a=(await L()).Query.new();a.setOutFields(i),a.setReturnGeometry(!!e.returnGeometry),a.setReturnZ(!!e.returnZ),a.setReturnM(!!e.returnM),a.setIds(new Uint32Array(n));let o=await(await this._getFile(t)).executeQuery(a,K,r),s=await o.next(r),c=0,l=[];for(;s!=null;){let e=new U(this._metadata,this._indexMap,s,t),n=new B(e,null,c++,!1);l.push(n),s=await o.next(r)}return X(l,this._queryEngineParams).executeQueryForOpaqueFeatures(e,r)}async _getRequiredFields(e){let t=new Set;if(e.outStatistics)for(let n of S(this._fieldsIndex,e.outStatistics,e.groupByFieldsForStatistics))t.add(n);else if(e.outFields)for(let n of e.outFields)t.add(n);return(t.has(`*`)?this._fieldsIndex.fields.map(e=>e.name):Array.from(t)).filter(e=>this._indexMap[e]!=null)}_tryGetGeneralizedGeometryResolution(e){if(!this._displayOptimization)return null;let t=e.outSR??this._queryEngineParams.spatialReference;if(!_(t)&&!v(t))return null;let n=e.quantizationParameters?.tolerance??e.maxAllowableOffset;return n?this._sourceResolution(n,t):null}_sourceResolution(e,t){let n=this._queryEngineParams.spatialReference,r=u(t)/u(n)*e;return!Number.isFinite(r)||r<=0?null:r}}function pe(e){switch(e){case`fullText`:case`having`:case`timeExtent`:case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:case`objectIds`:case`where`:case`geometry`:case`resultOffset`:case`resultRecordCount`:return!0;default:return!1}}function me(e){switch(e){case`fullText`:case`having`:case`timeExtent`:case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:case`objectIds`:case`where`:case`geometry`:return!0;default:return!1}}function he(e){switch(e){case`fullText`:case`having`:case`timeExtent`:return!0;case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:return!1;case`objectIds`:case`where`:case`resultOffset`:case`geometry`:case`resultRecordCount`:return!1}return!1}function q(e){for(let t in e){let n=t;if(pe(n)&&e[n]!==null)return!0}return!1}function ge(e){for(let t in e){let n=t;if(me(n)&&e[n]!==null)return!0}return!1}function _e(e){for(let t in e){let n=t;if(he(n)&&e[n]!==null)return!0}return!1}function ve(e,t){return!!e.outStatistics?.length&&!q(e)&&!e.groupByFieldsForStatistics?.length&&!e.orderByFields?.length&&!e.returnDistinctValues&&!e.returnAggIds&&e.outStatistics.every(e=>ye(e,t))}function ye(e,t){switch(e.statisticType){case`count`:return e.onStatisticField===`1`||t.get(e.onStatisticField)!=null;case`min`:case`max`:{let n=t.get(e.onStatisticField);return n!=null&&M(n)}default:return!1}}function be(e,t){let n=e.statisticType===`exceedslimit`?null:t.get(e.onStatisticField),r=(e.statisticType===`min`||e.statisticType===`max`)&&n?.type===`esriFieldTypeDate`?n.type:`esriFieldTypeDouble`;return{name:e.outStatisticFieldName,alias:e.outStatisticFieldName,type:r}}function xe(e,t){switch(e.statisticType){case`count`:return J(e,t);case`min`:return Y(e,t,Math.min);case`max`:return Y(e,t,Math.max);default:return{available:!1,value:null}}}function J(e,t){if(e.statisticType!==`count`)return{available:!1,value:null};if(e.onStatisticField===`1`)return{available:!0,value:t.reduce((e,t)=>e+t.statistics.rowCount,0)};let n=0;for(let r of t){let t=r.statistics.statistics.get(e.onStatisticField);if(t==null||t.nullCount==null)return{available:!1,value:null};n+=r.statistics.rowCount-t.nullCount}return{available:!0,value:n}}function Y(e,t,n){if(e.statisticType!==`min`&&e.statisticType!==`max`)return{available:!1,value:null};let r=null,i=e.statisticType===`min`?`minValue`:`maxValue`;for(let a of t){let t=a.statistics.statistics.get(e.onStatisticField);if(t==null)return{available:!1,value:null};switch(t.type){case`null-only`:continue;case`unknown`:return{available:!1,value:null};case`bounds`:{let e=Se(t[i]);if(e==null)return{available:!1,value:null};r=r==null?e:n(r,e);break}}}return{available:!0,value:r}}function Se(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function X(e,t){let n=new V;for(let t of e)n.insert(t);return new T({...t,featureStore:n})}function Z(e,t){return e.statistics.statistics.get(t.fieldName)??null}function Ce(e,t){return e.slice().sort((e,n)=>{let r=Q(e,t),i=Q(n,t);return r===i?0:r<i?-1:1})}function Q(e,t){let n=Z(e,t);return n?.type===`bounds`?n.maxValue-n.minValue:1/0}function $(e,t,n){let r=e?.featureCount,i=!1;return r!=null&&r<has(`parquetlayer-full-query-feature-count`)&&(i=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:n,supportsTrueCurve:!1,supportsZ:t},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{...ie,maxRecordCount:K,supportsOrderBy:i,supportsDistinct:!0,supportsStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1}},queryAttributeBins:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}function we(e){return!!e.objectIds?.length||!!e.outStatistics||!!e.orderByFields?.length||!!e.returnDistinctValues}export{fe as default};
|
|
2
|
+
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{toConst as n}from"../../../../core/compilerUtils.js";import r from"../../../../core/Error.js";import i from"../../../../core/Handles.js";import has from"../../../../core/has.js";import a from"../../../../core/Logger.js";import{onAbortOrThrow as o,throwIfAborted as s}from"../../../../core/promiseUtils.js";import{QueueProcessor as c}from"../../../../core/QueueProcessor.js";import{parseWhereClause as l}from"../../../../core/sql.js";import{getMetersPerUnitForSR as u}from"../../../../core/units.js";import d from"../../../../geometry/SpatialReference.js";import{set as f,create as p,expandWithAABB as m,expandWithRect as ee,negativeInfinity as h}from"../../../../geometry/support/aaBoundingBox.js";import{copy as te,create as g,expandWithRect as ne,negativeInfinity as re}from"../../../../geometry/support/aaBoundingRect.js";import{isWebMercator as _,isWGS84 as v}from"../../../../geometry/support/spatialReferenceUtils.js";import{normalizeColumnPath as y,readParquetFileAttribute as b}from"../../../parquet.js";import{convertToGeometry as x}from"../../featureConversionUtils.js";import{getFieldNamesFromStatistics as S}from"../../data/attributeSupport.js";import{getQueryResultExtent as C,getQueryBoundingRects as w,QueryEngine as T}from"../../data/QueryEngine.js";import{queryCapabilities as ie}from"../../data/QueryEngineCapabilities.js";import{QueryEngineResult as E}from"../../data/QueryEngineResult.js";import{normalizeQueryLike as D}from"../../data/queryUtils.js";import{createFileProvider as O}from"../parquet/createFileProvider.js";import{readFieldStatistic as k}from"../parquet/ParquetFileStatistics.js";import{createDrawingInfo as ae}from"./clientSideDefaults.js";import{getParquetFileId as oe,getParquetRowId as se,getParquetObjectId as ce}from"./parquetIdUtils.js";import A from"../../../support/Field.js";import j from"../../../support/FieldsIndex.js";import{isNumericField as M}from"../../../support/fieldUtils.js";import{fromParquetGeometryEncodingJSON as N}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as P,fromParquetJSONGeometryType as F,toParquetJSONGeometryType as I}from"../../../support/parquetUtils.js";import{loadParquetModule as L}from"../../../../libs/librust-parquet/loadParquetModule.js";import{utc as R}from"../../../../time/constants.js";import{FeatureStoreQueryAdapter as z}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as B}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as V}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as H}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as U}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const W=new z,G=`__OBJECTID`,K=8e3;class le{constructor(e,t){this._files=e,this._createFileStream=t,this._fileIndex=0,this._streamIndex=0,this._streams=[],this._pending=new Set,this._resolvedCount=0}async next(e){for(await this._fill(e);this._pending.size>0;){s(e),await this._fill(e);let t=await ue(this._pending);if(this._pending.delete(t.read),this._resolvedCount++,t.chunk!=null)return t.chunk}return null}async _fill(e){for(this._removeDone();this._pending.size<8;){let t=this._getOrCreateNextStream(e);if(t==null)return;this._pending.add(t.read(e))}}_getOrCreateNextStream(e){let t=this._resolvedCount>=8?8:2;if(this._fileIndex<this._files.length&&this._streams.length<t){let t=this._files[this._fileIndex++],n=new de(t.id,this._createFileStream(t,e));return this._streams.push(n),n}return this._getNextStream()}_getNextStream(){let e=this._streams.length;for(let t=0;t<e;t++){let n=(this._streamIndex+t)%e,r=this._streams[n];if(r.canRead)return this._streamIndex=(n+1)%e,r}return null}_removeDone(){let e=this._streamIndex;for(let t=this._streams.length-1;t>=0;t--)this._streams[t].done&&(this._streams.splice(t,1),t<e&&e--);this._streamIndex=this._streams.length>0?e%this._streams.length:0}}function ue(e){return Promise.race(Array.from(e,async e=>({read:e,chunk:await e})))}class de{constructor(e,t){this._fileId=e,this._stream=t,this._readCount=0,this._reachedEnd=!1}get canRead(){return!this._reachedEnd}get done(){return this._reachedEnd&&this._readCount===0}async read(e){this._readCount++;try{let t=await(await this._stream).next(e);return t==null?(this._reachedEnd=!0,null):{fileId:this._fileId,chunk:t}}finally{this._readCount--}}}class fe{constructor(){this._hasZ=!1,this._hasM=!1,this._queue=new c({concurrency:4,process:(e,t)=>this._executeQuery(e,t)}),this._streams=new Map,this._streamIdCounter=0,this._indexMap={},this._handles=new i}async load(e){let t=e.spatialReference?d.fromJSON(e.spatialReference):void 0;if(t&&!t.isWGS84&&!t.isWebMercator)throw new r(`parquet:unsupported-projection`,`Only WGS84 and Web Mercator are supported`);this._customParameters=e.customParameters,this._loadParameters=e,await this._updateProvider(O(e.provider,null,()=>this._customParameters));let n=await this._provider.getMetadata(),i=await P(n,{fields:e.fields?.map(e=>A.fromJSON(e)),geometryEncoding:e.geometryEncoding?N(e.geometryEncoding):null,geometryType:e.geometryType?F(e.geometryType):null,displayOptimization:e.displayOptimization,spatialReference:t});if(this._hasZ=!!n?.hasZ,this._hasM=!!n?.hasM,!i.fields)throw new r(`parquet:unsupported`,`Fields must be defined`);let o;if(i.spatialReference&&i.geometryType){if(!i.spatialReference)throw new r(`parquet:unsupported`,`SpatialReference must be defined`);if(!i.spatialReference.isGeographic&&!i.spatialReference.isWebMercator)throw new r(`parquet:unsupported-projection`,`Only WGS84 and Web Mercator are supported`);i.spatialReference.isGeographic&&!i.spatialReference.isWGS84&&(a.getLogger(`parquet:unsupported-projection`).warn(`Found a geographic projection that is not WGS84. Handling as WGS84.`,{spatialReference:i.spatialReference}),i.spatialReference=d.WGS84),o={geometry:i.geometryEncoding?{geometryType:I(i.geometryType),spatialReference:i.spatialReference.toJSON(),encoding:i.geometryEncoding.toJSON()}:null,displayOptimization:i.displayOptimization}}this.setCustomParameters(e.customParameters),this._displayOptimization=i.displayOptimization,await this._provider.updateGeometryInfo(o),this._capabilities=$(await this._getFileStatistics(),this._hasZ,this._hasM);let s=await this._provider.getFiles();if(!s.length)return{layerDefinition:{},capabilities:$(null,this._hasZ,this._hasM)};let c=await s[0].file;i.file=c;let{fields:l}=i;if(l==null)throw new r(`parquet-layer:missing-metadata`,`Unable to create parquet source: cannot infer fields`,l);l.push(new A({name:G,type:`oid`,alias:G}));for(let e of l){let t=c.getColumnId(e.name);t!=null&&(this._indexMap[e.name]=t)}let u=j.fromLayerJSON({fields:l.map(e=>e.toJSON()),dateFieldsTimeReference:{timeZoneIANA:`UTC`}});this._fieldsIndex=u;let f=I(i.geometryType??`point`);return this._metadata=H.createFeature({fieldsIndex:u.toJSON(),geometryType:f,hasZ:this._hasZ,hasM:this._hasM,featureIdInfo:{type:`object-id`,fieldName:G},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:i.spatialReference,outSpatialReference:null,attributeSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:R}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:f,featureIdInfo:{type:`object-id`,fieldName:G},hasM:this._hasM,hasZ:this._hasZ,spatialReference:i.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},this._fullExtent=n?.extent?n.extent:await this._tryDeriveParquetFullExtent(i),{capabilities:this._capabilities,layerDefinition:{fields:i.fields?.map(e=>e.toJSON()),drawingInfo:ae(f),extent:this._fullExtent??void 0,geometryType:f,hasZ:this._hasZ,hasM:this._hasM,geometryEncoding:i.geometryEncoding?.toJSON(),displayOptimization:i.displayOptimization}}}destroy(){this._provider.destroy(),this._queue.destroy();for(let{handle:e}of this._streams.values())e.remove();this._streams.clear(),this._indexMap={},this._handles.removeAll()}async reload(e){this.destroy(),await this.load(e)}set remoteClient(e){this._source=e.createInvokeProxy(``)}setCustomParameters(e){this._customParameters=e}getIndexMap(){return this._indexMap}async updateFileProvider(e){this._loadParameters={...this._loadParameters,provider:e};let t=O(e,this._provider.getGeometryInfo(),()=>this._customParameters);await this._updateProvider(t)}async getDiagnosticsSnapshot(){let e=await this._provider.getFiles();return{files:await Promise.all(e.map(e=>e.getDiagnosticsSnapshot()))}}async getColumnIndex(e){return(await this._getFileInfoById(e.fileId)).getColumnIndex(e.rowGroupIndex,e.columnIndex)}async getOffsetIndex(e){return(await this._getFileInfoById(e.fileId)).getOffsetIndex(e.rowGroupIndex,e.columnIndex)}async queryFeatures(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),we(n)||(n.resultRecordCount=n.resultRecordCount?Math.min(n.resultRecordCount,K):K,n.resultOffset=n.resultOffset??0),n.outStatistics?this._queryStatistics(n,t):(n.returnDistinctValues&&(n.returnGeometry=void 0),(await this._enqueueQuery(n,t)).createQueryResponse())}async queryFeatureCount(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),!q(n)&&!n.returnDistinctValues&&!n.groupByFieldsForStatistics?.length&&!n.outStatistics?.length?this._getFeatureCount():(n.returnDistinctValues||(n.outFields=void 0),n.returnGeometry=void 0,(await this._enqueueQuery(n,t)).createQueryResponseForCount())}async queryObjectIds(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),q(n)?(n.resultRecordCount=n.resultRecordCount?Math.min(n.resultRecordCount,8e3):8e3,n.resultOffset=n.resultOffset??0,n.returnGeometry=void 0,n.outFields=void 0,n.returnDistinctValues=void 0,(await this._enqueueQuery(n,t)).items.map(e=>e.getObjectId())):Array.from({length:await this._getFeatureCount()},(e,t)=>t)}async queryAttributeBins(e,t={}){throw new r(`parquet:unsupported`,`queryAttributeBins not supported.`)}async queryExtent(e,t){let r=await D(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),this._fullExtent&&!q(r))return{count:await this._getFeatureCount(),extent:this._fullExtent};let i=n(this._metadata.spatialReference);r.returnGeometry=!0,r.outFields=void 0;let a=f(p(),h),o=p(),s=await this._enqueueQuery(r,t),c=0;for(let e of s.items)e.getBounds(o)&&(m(a,o),c+=1);let l=C(a,i,r.outSR?n(r.outSR):i.toJSON(),i,!1);return{count:c,extent:l}}async queryStream(e,t){if(!t.signal)throw Error(`InternalError: AbortSignal must be passed`);let n=await this._getCandidateFiles(e),r=new le(n,async(t,n)=>{let r=await t.file,i=await this._createParquetDisplayQuery(r,t.id,e);return r.executeQuery(i,K,n)}),i=this._streamIdCounter++,a=o(t.signal,e=>{let t=this._streams.get(i);t!=null&&(t.handle.remove(),this._streams.delete(i))});return this._streams.set(i,{stream:r,handle:a}),i}async getStreamNext(e,t){if(!t.signal)throw Error(`InternalError: AbortSignal must be passed`);let n=this._streams.get(e);if(!n)return{result:null};let r=await n.stream.next(t.signal);if(r==null)return n.handle.remove(),this._streams.delete(e),{result:null};let i=r.chunk.serialize().buffer,a={fileId:r.fileId,buffer:i};return i instanceof ArrayBuffer?{result:a,transferList:[i]}:{result:a}}async getStreamNextFeatures(e,t){let{result:n}=await this.getStreamNext(e,t);if(n==null)return null;let r=(await L()).ParquetChunk.deserialize(new Uint8Array(n.buffer)),i=new U(this._metadata,this._indexMap,r,n.fileId),a=[];for(;i.next();){let e=x(i.readGeometryWorldSpace(),i.geometryType,i.hasZ,i.hasM),t=i.readAttributes();a.push({attributes:t,geometry:e})}return{features:a}}async createPatch(e,t,n,r,i){if(!i.signal)throw Error(`InternalError: AbortSignal must be passed`);return(await(await(await this._getFileInfoById(e)).file).createChunkPatch(t,n,r,i.signal)).serialize().buffer}async _updateProvider(e){let t=this._provider;this._handles.removeAll(),this._provider=e,this._handles.add([e.events.on(`rangeRead`,e=>{this._source.onRangeRead(e)}),e.events.on(`sourceChanged`,async()=>{await this.reload(this._loadParameters),await this._source.onSourceChange()})]),await t?.destroy()}async _getCandidateFiles(e){let t=await this._provider.getFiles(),n=await this._getSpatialFilePruning(e);if(n==null)return t;let r=t.filter(e=>this._mayIncludeFileForSpatialPruning(e,n));return n.type===`xz`?Ce(r,n):r}async _queryStatistics(e,t){let n=await D({...e},null,this._queryEngineParams.spatialReference);if(n.returnGeometry=void 0,ve(n,this._fieldsIndex)){let e=await this._getStatisticsFromFiles(n);if(e)return e}return(await this._enqueueQuery(n,t)).createQueryResponse()}async _getStatisticsFromFiles(e){let t=await this._provider.getFiles(),n={},r=[];for(let i of e.outStatistics??[]){let e=xe(i,t);if(!e.available)return null;n[i.outStatisticFieldName]=e.value,r.push(be(i,this._fieldsIndex))}return{fields:r,features:[{attributes:n}]}}async _getSpatialFilePruning(e){if(e.type!==`tile`&&(e.type!==`arcade`||e.extent==null))return null;let t=this._displayOptimization?.index;if(t==null)return null;let n=e.outSpatialReference.wkid;if(t.wkid==null||n==null)return null;let r=t.wkid,i=await L();switch(t.type){case`xz`:return{type:`xz`,fieldName:y(t.code),intersects:(a,o)=>i.queryIntersectsXZStatistics(t.fullExtent,e.extent,n,r,t.maxLevel,a,o)};case`z`:return{type:`xy`,xFieldName:y(t.xColumn),yFieldName:y(t.yColumn),intersects:(t,a,o,s)=>i.queryIntersectsXYStatistics(e.extent,n,r,t,a,o,s)}}}_mayIncludeFileForSpatialPruning(e,t){switch(t.type){case`xz`:{let n=Z(e,t);return n?.type===`null-only`?!1:n?.type!==`bounds`||t.intersects(n.minValue,n.maxValue)}case`xy`:{let n=e.statistics.statistics.get(t.xFieldName),r=e.statistics.statistics.get(t.yFieldName);return n?.type===`null-only`||r?.type===`null-only`?!1:n?.type!==`bounds`||r?.type!==`bounds`||t.intersects(n.minValue,n.maxValue,r.minValue,r.maxValue)}}}async _tryDeriveParquetFullExtent(n){if(!n.spatialReference)return null;if(this._fullExtent==null&&n.geometryEncoding?.type===`location`){let r=await this._provider.getFiles(),{xField:i,yField:a}=n.geometryEncoding,o=f(p(),h),s=!1;for(let n of r){let r=await n.file;for(let n of r.rowGroups()){let r={stack:[],error:void 0,hasError:!1};try{let t=e(r,n.columnDescriptorForAttribute(i),!1),c=e(r,n.columnDescriptorForAttribute(a),!1),l=k(t),u=k(c);if(l?.type===`bounds`&&u?.type===`bounds`){let e=[l.minValue,u.minValue,l.maxValue,u.maxValue];ee(o,e),s=!0}n.free()}catch(e){r.error=e,r.hasError=!0}finally{t(r)}}}return s?{xmin:o[0],ymin:o[1],xmax:o[3],ymax:o[4],spatialReference:n.spatialReference?.toJSON()}:null}return null}async _getFileInfoById(e){let t=await this._provider.getFiles();for(let n of t)if(n.id===e)return n;throw Error(`InternalError: File ${e} does not exist`)}async _getFileStatistics(){return{featureCount:await this._getFeatureCount(),byteLength:await this._getByteLength()}}async _getFile(e){return(await this._getFileInfoById(e)).file}async _createParquetQuery(e,t,n,r,i){let a=(await L()).Query.new();n!=null&&a.setPreFilterStart(n),r!=null&&a.setPreFilterCount(r),i!=null&&a.setPostFilterCount(i);let o=await this._getRequiredFields(e);a.setOutFields(o),(e.geometry||e.returnGeometry)&&a.setReturnGeometry(!0),a.setReturnZ(!!e.returnZ),a.setReturnM(!!e.returnM);let s=this._tryGetGeneralizedGeometryResolution(e);s!=null&&a.setSourceResolution(s);let c=e.geometry?.spatialReference??this._queryEngineParams.spatialReference,l=c.wkid;if(e.geometry&&(_(c)||v(c))){let t=te(g(),re);for(let n of w(e.geometry))ne(t,n);a.setOutSpatialReference(l),a.setExtent({xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3]})}if(e.where){let{id:n,file:r}=t;await this._setWhereClause(a,await r,n,e.where)}return a}async _createParquetDisplayQuery(e,t,n){let r=(await L()).Query.new();if(n.type===`tile`){r.setExtent(n.extent),r.setQuantizationTransform(n.transform);let e=this._sourceResolution(n.resolution,n.outSpatialReference);e!=null&&r.setSourceResolution(e)}else n.type===`arcade`&&n.extent!=null&&r.setExtent(n.extent);return r.setOutFields(n.outFields.filter(e=>this._indexMap[e]!=null)),r.setOutSpatialReference(n.outSpatialReference.wkid),r.setReturnGeometry(n.returnGeometry),r.setReturnZ(n.returnZ),r.setReturnM(n.returnM),n.where&&await this._setWhereClause(r,e,t,n.where),r}async _getFeatureCount(){return(await this._provider.getFiles()).map(e=>e.statistics.rowCount).reduce((e,t)=>e+t,0)}async _getByteLength(){return(await this._provider.getFiles()).map(e=>e.statistics.byteSize).reduce((e,t)=>e+t,0)}_validateQuery(e){if(!this._capabilities.query.supportsStatistics&&e.outStatistics)throw new r(`parquet:unsupported`,`Statistics queries are not supported`,{query:e});if(!this._capabilities.query.supportsOrderBy&&e.orderByFields?.length)throw new r(`parquet:unsupported`,`Queries using orderBy are not supported`,{query:e});if(!this._capabilities.query.supportsDistinct&&e.returnDistinctValues)throw new r(`parquet:unsupported`,`Queries using returnDistinctValues are not supported`,{query:e})}async _setWhereClause(e,t,n,i){let a=this._indexMap,o=this._fieldsIndex,s={getAttribute(e,r){let i=a[r];if(i==null){if(o.get(r)?.name===`__OBJECTID`){let t=e.row+e.rowGroupStart;return ce(n,t)}return null}let s=o.get(r);return b(t,e.rowGroup,e.row,i,s.type)}},c=await l(i,this._fieldsIndex);if(!c.isStandardized)throw new r(`sql-parse-error`,`expression is not standardized`);let u=(e,t,n)=>c.testFeatureCompiled({rowGroup:e,row:t,rowGroupStart:n},s,null),d=c.fieldNames.map(e=>o.get(e)).filter(e=>e&&this._indexMap[e?.name]!=null);e.setWhere(i),e.setWhereEvaluator(u),e.setWhereFields(d.map(e=>e.name))}async*_streamFeatures(e,t,n,r,i){let a=await this._provider.getFiles(),o=0;for(let s of a){let a=o,c=o+s.statistics.rowCount;if(o+=s.statistics.rowCount,t!=null&&t>=c)continue;let l=t==null?null:Math.max(t-a,0),u=n;if(n!=null){let e=t??0,r=e+n;u=Math.max(Math.min(r,c)-Math.max(e,a),0)}if(u===0)continue;let d=await this._createParquetQuery(e,s,l,u,r),f=await(await s.file).executeQuery(d,K),p=async()=>{let e=await f.next(i);if(!e)return null;let t=new U(this._metadata,this._indexMap,e,s.id);return X([new B(t,null,0,!1)],this._queryEngineParams)},m=await p();for(;m!=null;)yield m,m=await p()}}async _queryFeaturesWithQueryEnginePagination(e,t){let n=[],r=this._streamFeatures(e,null,null,null,t),i=await r.next();for(;!i.done;){let a=await i.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(let e of a)n.push(e);i=await r.next()}return n}async _queryFeaturesWithUpfrontPagination(e,t){let n=e.resultOffset??0,r=e.resultRecordCount??K,i,a,o;ge(e)?_e(e)||(o=n+r):(n&&=(i=n,0),a=e.resultRecordCount);let s=[],c=this._streamFeatures(e,i,a,o,t),l=await c.next();for(;!l.done&&r>0;){let i=await l.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(let e of i){if(n>0){n--;continue}if(s.push(e),--r<=0)return s}l=await c.next()}return s}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){if(e.objectIds?.length){let n=new Map;for(let t of e.objectIds){let e=oe(t),r=se(t),i=n.get(e);i||(i=[],n.set(e,i)),i.push(r)}let r=[];for(let[i,a]of n.entries()){let n=await this._executeFileIdQuery(e,i,a,t);for(let e of n)r.push(e)}return new E(r,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:W,featureIdInfo:this._queryEngineParams.featureIdInfo})}if(e.where===`1=1`&&(e.where=null),e.resultOffset??=0,e.resultRecordCount??=await this._getFeatureCount(),e.resultRecordCount>2e7&&!(this._displayOptimization&&e.geometry))throw new r(`parquet:cannot-execute-query`,`Unable to execute query, dataset is too large.`);let n=!!e.orderByFields?.length||!!e.outStatistics?.length||!!e.returnDistinctValues,i=n?await this._queryFeaturesWithQueryEnginePagination(e,t):await this._queryFeaturesWithUpfrontPagination(e,t);return n||(e.resultOffset=0),new E(i,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:W,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(e,t,n,r){let i=await this._getRequiredFields(e),a=(await L()).Query.new();a.setOutFields(i),a.setReturnGeometry(!!e.returnGeometry),a.setReturnZ(!!e.returnZ),a.setReturnM(!!e.returnM),a.setIds(new Uint32Array(n));let o=await(await this._getFile(t)).executeQuery(a,K,r),s=await o.next(r),c=0,l=[];for(;s!=null;){let e=new U(this._metadata,this._indexMap,s,t),n=new B(e,null,c++,!1);l.push(n),s=await o.next(r)}return X(l,this._queryEngineParams).executeQueryForOpaqueFeatures(e,r)}async _getRequiredFields(e){let t=new Set;if(e.outStatistics)for(let n of S(this._fieldsIndex,e.outStatistics,e.groupByFieldsForStatistics))t.add(n);else if(e.outFields)for(let n of e.outFields)t.add(n);return(t.has(`*`)?this._fieldsIndex.fields.map(e=>e.name):Array.from(t)).filter(e=>this._indexMap[e]!=null)}_tryGetGeneralizedGeometryResolution(e){if(!this._displayOptimization)return null;let t=e.outSR??this._queryEngineParams.spatialReference;if(!_(t)&&!v(t))return null;let n=e.quantizationParameters?.tolerance??e.maxAllowableOffset;return n?this._sourceResolution(n,t):null}_sourceResolution(e,t){let n=this._queryEngineParams.spatialReference,r=u(t)/u(n)*e;return!Number.isFinite(r)||r<=0?null:r}}function pe(e){switch(e){case`fullText`:case`having`:case`timeExtent`:case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:case`objectIds`:case`where`:case`geometry`:case`resultOffset`:case`resultRecordCount`:return!0;default:return!1}}function me(e){switch(e){case`fullText`:case`having`:case`timeExtent`:case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:case`objectIds`:case`where`:case`geometry`:return!0;default:return!1}}function he(e){switch(e){case`fullText`:case`having`:case`timeExtent`:return!0;case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:return!1;case`objectIds`:case`where`:case`resultOffset`:case`geometry`:case`resultRecordCount`:return!1}return!1}function q(e){for(let t in e){let n=t;if(pe(n)&&e[n]!==null)return!0}return!1}function ge(e){for(let t in e){let n=t;if(me(n)&&e[n]!==null)return!0}return!1}function _e(e){for(let t in e){let n=t;if(he(n)&&e[n]!==null)return!0}return!1}function ve(e,t){return!!e.outStatistics?.length&&!q(e)&&!e.groupByFieldsForStatistics?.length&&!e.orderByFields?.length&&!e.returnDistinctValues&&!e.returnAggIds&&e.outStatistics.every(e=>ye(e,t))}function ye(e,t){switch(e.statisticType){case`count`:return e.onStatisticField===`1`||t.get(e.onStatisticField)!=null;case`min`:case`max`:{let n=t.get(e.onStatisticField);return n!=null&&M(n)}default:return!1}}function be(e,t){let n=e.statisticType===`exceedslimit`?null:t.get(e.onStatisticField),r=(e.statisticType===`min`||e.statisticType===`max`)&&n?.type===`esriFieldTypeDate`?n.type:`esriFieldTypeDouble`;return{name:e.outStatisticFieldName,alias:e.outStatisticFieldName,type:r}}function xe(e,t){switch(e.statisticType){case`count`:return J(e,t);case`min`:return Y(e,t,Math.min);case`max`:return Y(e,t,Math.max);default:return{available:!1,value:null}}}function J(e,t){if(e.statisticType!==`count`)return{available:!1,value:null};if(e.onStatisticField===`1`)return{available:!0,value:t.reduce((e,t)=>e+t.statistics.rowCount,0)};let n=0;for(let r of t){let t=r.statistics.statistics.get(e.onStatisticField);if(t==null||t.nullCount==null)return{available:!1,value:null};n+=r.statistics.rowCount-t.nullCount}return{available:!0,value:n}}function Y(e,t,n){if(e.statisticType!==`min`&&e.statisticType!==`max`)return{available:!1,value:null};let r=null,i=e.statisticType===`min`?`minValue`:`maxValue`;for(let a of t){let t=a.statistics.statistics.get(e.onStatisticField);if(t==null)return{available:!1,value:null};switch(t.type){case`null-only`:continue;case`unknown`:return{available:!1,value:null};case`bounds`:{let e=Se(t[i]);if(e==null)return{available:!1,value:null};r=r==null?e:n(r,e);break}}}return{available:!0,value:r}}function Se(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function X(e,t){let n=new V;for(let t of e)n.insert(t);return new T({...t,featureStore:n})}function Z(e,t){return e.statistics.statistics.get(t.fieldName)??null}function Ce(e,t){return e.slice().sort((e,n)=>{let r=Q(e,t),i=Q(n,t);return r===i?0:r<i?-1:1})}function Q(e,t){let n=Z(e,t);return n?.type===`bounds`?n.maxValue-n.minValue:1/0}function $(e,t,n){let r=e?.featureCount,i=!1;return r!=null&&r<has(`parquetlayer-full-query-feature-count`)&&(i=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:n,supportsTrueCurve:!1,supportsZ:t},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{...ie,maxRecordCount:K,supportsOrderBy:i,supportsDistinct:!0,supportsStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1}},queryAttributeBins:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}function we(e){return!!e.objectIds?.length||!!e.outStatistics||!!e.orderByFields?.length||!!e.returnDistinctValues}export{fe as default};
|