@arcgis/core 5.1.0-next.105 → 5.1.0-next.107
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/AreaMeasurementAnalysis.d.ts +5 -5
- package/analysis/DimensionAnalysis.d.ts +3 -3
- package/analysis/DimensionSimpleStyle.d.ts +2 -2
- package/analysis/DirectLineMeasurementAnalysis.d.ts +4 -4
- package/analysis/DistanceMeasurementAnalysis.d.ts +4 -4
- package/analysis/ElevationProfileAnalysis.d.ts +3 -3
- package/analysis/LengthDimension.d.ts +2 -2
- package/analysis/LineOfSightAnalysis.d.ts +4 -4
- package/analysis/ShadowCast/DiscreteOptions.d.ts +7 -3
- package/analysis/ShadowCast/MinDurationOptions.d.ts +5 -1
- package/analysis/ShadowCast/TotalDurationOptions.d.ts +7 -3
- package/analysis/ShadowCast/types.d.ts +1 -1
- package/analysis/ShadowCastAnalysis.d.ts +11 -6
- package/analysis/SliceAnalysis.d.ts +4 -4
- package/analysis/SlicePlane.d.ts +3 -3
- package/analysis/Viewshed.d.ts +2 -2
- package/analysis/ViewshedAnalysis.d.ts +3 -3
- package/analysis/VolumeMeasurement/VolumeMeasurementCutFillOptions.d.ts +1 -1
- package/analysis/VolumeMeasurementAnalysis.d.ts +3 -3
- package/applications/Components/imageryUtils.d.ts +24 -0
- package/applications/Components/layerUtils.d.ts +21 -0
- package/applications/Components/layerUtils.js +2 -0
- package/applications/Components/templateUtils.d.ts +11 -1
- package/applications/Components/templateUtils.js +1 -1
- package/arcgisGlobal.d.ts +6 -0
- package/assets/components/assets/icon/buttons16.json +1 -0
- package/assets/components/assets/icon/buttons24.json +1 -0
- package/assets/components/assets/icon/buttons32.json +1 -0
- package/assets/components/assets/icon/entityTypes16.json +1 -0
- package/assets/components/assets/icon/entityTypes24.json +1 -0
- package/assets/components/assets/icon/entityTypes32.json +1 -0
- package/assets/esri/core/t9n/Units_ar.json +1 -1
- package/assets/esri/core/t9n/Units_bg.json +1 -1
- package/assets/esri/core/t9n/Units_bs.json +1 -1
- package/assets/esri/core/t9n/Units_ca.json +1 -1
- package/assets/esri/core/t9n/Units_cs.json +1 -1
- package/assets/esri/core/t9n/Units_da.json +1 -1
- package/assets/esri/core/t9n/Units_de.json +1 -1
- package/assets/esri/core/t9n/Units_el.json +1 -1
- package/assets/esri/core/t9n/Units_es.json +1 -1
- package/assets/esri/core/t9n/Units_et.json +1 -1
- package/assets/esri/core/t9n/Units_fi.json +1 -1
- package/assets/esri/core/t9n/Units_fr.json +1 -1
- package/assets/esri/core/t9n/Units_he.json +1 -1
- package/assets/esri/core/t9n/Units_hr.json +1 -1
- package/assets/esri/core/t9n/Units_hu.json +1 -1
- package/assets/esri/core/t9n/Units_id.json +1 -1
- package/assets/esri/core/t9n/Units_it.json +1 -1
- package/assets/esri/core/t9n/Units_ja.json +1 -1
- package/assets/esri/core/t9n/Units_ko.json +1 -1
- package/assets/esri/core/t9n/Units_lt.json +1 -1
- package/assets/esri/core/t9n/Units_lv.json +1 -1
- package/assets/esri/core/t9n/Units_nl.json +1 -1
- package/assets/esri/core/t9n/Units_no.json +1 -1
- package/assets/esri/core/t9n/Units_pl.json +1 -1
- package/assets/esri/core/t9n/Units_pt-BR.json +1 -1
- package/assets/esri/core/t9n/Units_pt-PT.json +1 -1
- package/assets/esri/core/t9n/Units_ro.json +1 -1
- package/assets/esri/core/t9n/Units_ru.json +1 -1
- package/assets/esri/core/t9n/Units_sk.json +1 -1
- package/assets/esri/core/t9n/Units_sl.json +1 -1
- package/assets/esri/core/t9n/Units_sr.json +1 -1
- package/assets/esri/core/t9n/Units_sv.json +1 -1
- package/assets/esri/core/t9n/Units_th.json +1 -1
- package/assets/esri/core/t9n/Units_tr.json +1 -1
- package/assets/esri/core/t9n/Units_uk.json +1 -1
- package/assets/esri/core/t9n/Units_vi.json +1 -1
- package/assets/esri/core/t9n/Units_zh-CN.json +1 -1
- package/assets/esri/core/t9n/Units_zh-HK.json +1 -1
- package/assets/esri/core/t9n/Units_zh-TW.json +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{6854b28853f5dd195110.js → 01c70c27aa3a955e2928.js} +1 -1
- package/assets/esri/core/workers/chunks/{b7a81fd4994eabba1869.js → 0c8e6ccb5a8174718d62.js} +1 -1
- package/assets/esri/core/workers/chunks/{a943bd2e6fb7443c2b66.js → 17604cbd4d24158e2c16.js} +1 -1
- package/assets/esri/core/workers/chunks/179c9fe4ac83b42e5976.js +1 -0
- package/assets/esri/core/workers/chunks/1d1929f98d941179be29.js +2 -0
- package/assets/esri/core/workers/chunks/{24247ee93f43fff5e596.js.LICENSE.txt → 1d1929f98d941179be29.js.LICENSE.txt} +1 -3
- package/assets/esri/core/workers/chunks/1ebb613bbe09fcf274d8.js +1 -0
- package/assets/esri/core/workers/chunks/24b43fb12fc3009fdc30.js +1 -0
- package/assets/esri/core/workers/chunks/2b9661700743d1f9717e.js +1 -0
- package/assets/esri/core/workers/chunks/2f0a3b22fc46d832e240.js +1 -0
- package/assets/esri/core/workers/chunks/{2dced41ff2aa1bd86665.js → 33ec193e6d7a0cb9d8dd.js} +1 -1
- package/assets/esri/core/workers/chunks/340f2c996f62f7f5ceae.js +1 -0
- package/assets/esri/core/workers/chunks/37c63570c0b4981cd519.js +1 -0
- package/assets/esri/core/workers/chunks/{a0e72b107991ba38a9f0.js → 502c3da8c49bf885f51d.js} +1 -1
- package/assets/esri/core/workers/chunks/518046d2b95a7590a092.js +1 -0
- package/assets/esri/core/workers/chunks/547dc6ccb989bd962661.js +1 -0
- package/assets/esri/core/workers/chunks/549d348ca181d06aefb7.js +2 -0
- package/assets/esri/core/workers/chunks/{9b89cc85c1b5d561df7c.js → 55334ad3618899cdbf78.js} +2 -2
- package/assets/esri/core/workers/chunks/{7485d59d60d61737d662.js → 55b765c72d13b3b911f9.js} +1 -1
- package/assets/esri/core/workers/chunks/{1e8d5bfc5f8c2664190c.js → 56d9d3f108ff6e719dd4.js} +1 -1
- package/assets/esri/core/workers/chunks/5cdf87e7a59ace38df87.js +1 -0
- package/assets/esri/core/workers/chunks/622bdd1b9d5d292ec12b.js +1 -0
- package/assets/esri/core/workers/chunks/69c9eb93553b006b640d.js +2 -0
- package/assets/esri/core/workers/chunks/6d20d741b8ae1a45b422.js +1 -0
- package/assets/esri/core/workers/chunks/702a3ef9e1b3442cbee7.js +1 -0
- package/assets/esri/core/workers/chunks/75a7de23c05435ec7649.js +1 -0
- package/assets/esri/core/workers/chunks/762e23466308f22d7076.js +1 -0
- package/assets/esri/core/workers/chunks/{52219561c144e5cb4442.js → 770611659b38066a6228.js} +1 -1
- package/assets/esri/core/workers/chunks/{e90afd914f2ccd4f5374.js → 7ce60331f94ee0a5d674.js} +6 -6
- package/assets/esri/core/workers/chunks/825db2ea15308ee6e5dc.js +1 -0
- package/assets/esri/core/workers/chunks/8330302096d4312a4393.js +1 -0
- package/assets/esri/core/workers/chunks/{7617bd0f3a70dfe61637.js → 8557dd9ef336b23f768f.js} +1 -1
- package/assets/esri/core/workers/chunks/885eac78a76184efa1e5.js +1 -0
- package/assets/esri/core/workers/chunks/{79dc7045d9a2d43ba8df.js → 890b7a1153b7f65eba9a.js} +1 -1
- package/assets/esri/core/workers/chunks/9234a293d61e134f121f.js +1 -0
- package/assets/esri/core/workers/chunks/{44636ef119c6a576470b.js → 94eab215bab3e4e0e5b5.js} +1 -1
- package/assets/esri/core/workers/chunks/95dee5853c6e89f15ea9.js +1 -0
- package/assets/esri/core/workers/chunks/a5b9ae4c93f9af7589f2.js +1 -0
- package/assets/esri/core/workers/chunks/{fb415b01f0f1d644832d.js → ac408c62565e2c8b5975.js} +1 -1
- package/assets/esri/core/workers/chunks/b3e8ab68fc38306f13c6.js +1 -0
- package/assets/esri/core/workers/chunks/b69d1d528e271568cbd8.js +2 -0
- package/assets/esri/core/workers/chunks/{0cc74bc3772be51cabc1.js → bbaf8baa3ca6195467e4.js} +1 -1
- package/assets/esri/core/workers/chunks/{f7e386ece75afb6e4be5.js → bc249bb667f0564ad093.js} +1 -1
- package/assets/esri/core/workers/chunks/c4872cf3b71d00f450e1.js +1 -0
- package/assets/esri/core/workers/chunks/c5ab346a226df1894302.js +1 -0
- package/assets/esri/core/workers/chunks/{39a8e6c9d710d3faea3c.js → cdb48d198145493f76f3.js} +1 -1
- package/assets/esri/core/workers/chunks/{359dbfbfb9acfb18bc6e.js → d4014213c476bf8099af.js} +1 -1
- package/assets/esri/core/workers/chunks/da29cf0e64065631a470.js +1 -0
- package/assets/esri/core/workers/chunks/ddebc1dc10a2d207389f.js +1 -0
- package/assets/esri/core/workers/chunks/e393fd61deb2e7f22ee6.js +1 -0
- package/assets/esri/core/workers/chunks/ea2bf7c543cc536400b7.js +30 -0
- package/assets/esri/core/workers/chunks/ece30bfd5c49b8d99752.js +1 -0
- package/assets/esri/core/workers/chunks/ecf4d07917efc97eb991.js +1 -0
- package/assets/esri/core/workers/chunks/ee56290e600cbeb25a00.js +1 -0
- package/assets/esri/core/workers/chunks/f52c6efc5a2abf5ac845.js +1 -0
- package/assets/esri/core/workers/chunks/fc1fe1f58a65a1694c09.js +1 -0
- package/assets/esri/geometry/support/pe-wasm.wasm +0 -0
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
- package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +84 -1
- package/assets/esri/themes/base/widgets/_Sketch.scss +1 -24
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ar.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bg.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ca.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_cs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_da.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_de.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_el.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_en.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_es.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_et.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_he.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hu.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_id.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_it.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ja.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ko.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lt.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_nl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_no.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-BR.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-PT.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ro.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ru.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_th.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_tr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_uk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_vi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-CN.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-HK.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-TW.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_en.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_no.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_en.json +1 -1
- package/chunks/ComponentShader.glsl.js +11 -15
- package/chunks/Fog.glsl.js +3 -3
- package/chunks/GlowComposition.glsl.js +38 -56
- package/chunks/OITDimOpaque.glsl.js +8 -3
- package/chunks/SimpleAtmosphere.glsl.js +3 -3
- package/chunks/lyr3DWorker.js +1 -1
- package/chunks/pe-wasm.js +1 -1
- package/config.js +1 -1
- package/core/generatorUtils.js +2 -0
- package/core/libs/gl-matrix-2/factories/vec2f64.js +1 -1
- package/core/libs/gl-matrix-2/math/vec2.js +1 -1
- package/core/mathUtils.js +1 -1
- package/core/typedArrayUtil.js +1 -1
- package/geometry/HeightModelInfo.js +1 -1
- package/geometry/geometryEngine.d.ts +2 -2
- package/geometry/support/WKIDUnitConversion.js +1 -1
- package/geometry/support/buffer/BufferView.js +1 -1
- package/geometry/support/vcsData.js +1 -1
- package/geometry/support/vcsLookup.js +1 -1
- package/identity/IdentityManagerBase.js +1 -1
- package/kernel.js +1 -1
- package/layers/DimensionLayer.d.ts +5 -5
- package/layers/FeatureLayer.d.ts +2 -2
- package/layers/GaussianSplatLayer.d.ts +3 -3
- package/layers/LineOfSightLayer.d.ts +5 -5
- package/layers/ParquetLayer.d.ts +6 -4
- package/layers/SubtypeGroupLayer.d.ts +2 -2
- package/layers/ViewshedLayer.d.ts +3 -3
- package/layers/graphics/sources/ParquetSource.js +1 -1
- package/layers/graphics/sources/parquet/FileProvider.js +2 -0
- package/layers/graphics/sources/parquet/PortalParquetFileProvider.js +2 -0
- package/layers/graphics/sources/parquet/PortalParquetLayerFileProvider.js +2 -0
- package/layers/graphics/sources/parquet/UrlsFileProvider.js +2 -0
- package/layers/graphics/sources/parquet/createFileProvider.js +2 -0
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.d.ts +1 -1
- package/layers/raster/datasets/ImageAuxRaster.js +1 -1
- package/layers/raster/datasets/MRFRaster.js +1 -1
- package/layers/raster/datasets/pixelReader.js +1 -1
- package/layers/raster/formats/JpgPlus.js +1 -1
- package/layers/raster/formats/RasterCodec.js +1 -1
- package/layers/raster/functions/clipUtils.js +1 -1
- package/layers/support/AggregateField.d.ts +2 -1
- package/layers/support/LayerContingentValuesCache.js +1 -1
- package/layers/support/SubtypeSublayer.d.ts +4 -4
- package/layers/support/parquetUtils.d.ts +18 -7
- package/layers/support/parquetUtils.js +1 -1
- package/layers/support/rasterFunctionUtils.d.ts +2 -2
- package/libs/parquet/parquet.js +1 -1
- package/linkChart/ChronologicalLayoutSettings.d.ts +1 -1
- package/networks/CircuitManager.d.ts +3 -3
- package/networks/UnitIdentifierManager.d.ts +1 -1
- package/networks/UnitIdentifierManager.js +1 -1
- package/networks/UtilityNetwork.d.ts +2 -2
- package/networks/UtilityNetwork.js +1 -1
- package/networks/support/Circuit.d.ts +1 -1
- package/networks/support/CircuitLocation.d.ts +1 -1
- package/networks/support/CircuitSection.d.ts +1 -1
- package/networks/support/Subcircuit.d.ts +1 -1
- package/networks/support/TraceJobInfo.js +1 -1
- package/networks/support/jsonTypes.d.ts +10 -3
- package/package.json +4 -4
- package/popup/FieldInfo.d.ts +4 -2
- package/popup/support/FieldInfoFormat.d.ts +3 -2
- package/rest/featureService/FeatureService.d.ts +1 -1
- package/rest/knowledgeGraph/FieldIndex.d.ts +1 -1
- package/rest/knowledgeGraph/GraphObjectType.d.ts +2 -2
- package/rest/knowledgeGraph/GraphSearch.d.ts +1 -1
- package/rest/knowledgeGraph/GraphSearchStreaming.d.ts +1 -1
- package/rest/networks/circuits/support/CircuitVerifyResult.js +1 -1
- package/rest/networks/circuits/support/ExportCircuitsParameters.d.ts +19 -1
- package/rest/networks/circuits/support/ExportCircuitsResult.js +1 -1
- package/rest/networks/circuits/support/VerifyCircuitsParameters.d.ts +18 -10
- package/rest/networks/circuits/support/VerifyCircuitsParameters.js +1 -1
- package/rest/networks/circuits/support/VerifyCircuitsResult.js +1 -1
- package/rest/networks/support/TraceParameters.js +1 -1
- package/rest/networks/support/TraceResult.js +1 -1
- package/rest/networks/trace.js +1 -1
- package/rest/networks/unitIdentifiers/support/QueryUnitIdentifiersParameters.js +1 -1
- package/rest/support/AreasAndLengthsParameters.d.ts +1 -1
- package/rest/support/GeneralizeParameters.d.ts +1 -1
- package/rest/support/Query.d.ts +1 -1
- package/rest/support/RelationParameters.d.ts +1 -1
- package/rest/support/types.d.ts +1 -1
- package/support/revision.js +1 -1
- package/symbols/CIMSymbol.d.ts +1 -1
- package/views/2d/analysis/AreaMeasurementAnalysisView2D.d.ts +1 -0
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
- package/views/2d/layers/features/sources/strategies/ParquetSnapshotLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/ParquetSnapshotSourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/ParquetSourceChunk.js +1 -1
- package/views/3d/analysis/AreaMeasurementAnalysisView3D.d.ts +1 -0
- package/views/3d/analysis/DimensionAnalysisView3D.d.ts +7 -6
- package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.d.ts +2 -0
- package/views/3d/analysis/LineOfSight/LineOfSightAuthoringUtils.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +2 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.d.ts +5 -1
- package/views/3d/analysis/SliceAnalysisView3D.d.ts +4 -3
- package/views/3d/analysis/Viewshed/ViewshedConfiguration.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedDrawToolRenderer.js +2 -0
- package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedInteractionVisuals.js +2 -0
- package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +2 -0
- package/views/3d/analysis/Viewshed/ViewshedPlacementOperation.js +2 -0
- package/views/3d/analysis/Viewshed/ViewshedPlacementPointPlugin.js +2 -0
- package/views/3d/analysis/Viewshed/ViewshedPlacementRootPlugin.js +2 -0
- package/views/3d/analysis/Viewshed/ViewshedSnappingController.js +2 -0
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool2.js +1 -1
- package/views/3d/analysis/Viewshed/analysisViewRegister.js +1 -1
- package/views/3d/analysis/Viewshed/placementUtils.js +2 -0
- package/views/3d/analysis/Viewshed/toolLifecycleUtils.js +2 -0
- package/views/3d/analysis/Viewshed/viewshedSubToolUtils.js +1 -1
- package/views/3d/analysis/Viewshed/viewshedToolUtils.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +4 -3
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
- package/views/3d/environment/FoggyWeather.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/polygonUtils.js +1 -1
- package/views/3d/layers/i3s/Intersector.js +1 -1
- package/views/3d/layers/support/UVWorkspace.js +2 -0
- package/views/3d/layers/support/patternUtils.js +1 -1
- package/views/3d/layers/support/uvUtils.js +1 -1
- package/views/3d/support/ResourceController.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
- package/views/3d/support/meshProcessing.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +8 -8
- package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +13 -9
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +63 -49
- package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
- package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
- package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowCompositionTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/lib/AttributeArray.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/Geometry.js +1 -1
- package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/PathCapBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/PathExtruder.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFieldCreation.js +1 -1
- package/views/3d/webgl-engine/materials/PathLayouts.js +2 -0
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/shaders/SphereDepthInterpolate.glsl.js +2 -3
- package/views/PopupView.d.ts +77 -1
- package/views/PopupView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/draw/DrawTool.d.ts +77 -0
- package/views/draw/support/editingSessionUtils.js +1 -1
- package/views/draw/support/managers/PluginLifecycleManager.d.ts +10 -0
- package/views/interactive/InteractiveToolBase.d.ts +11 -0
- package/views/interactive/editGeometry/interfaces.d.ts +8 -0
- package/views/interactive/interfaces.d.ts +20 -0
- package/views/layers/DimensionLayerView.d.ts +2 -1
- package/views/layers/LineOfSightLayerView.d.ts +2 -1
- package/views/layers/ViewshedLayerView.d.ts +2 -1
- package/views/webgl/capabilities/load.js +1 -1
- package/webscene/Slide.js +1 -1
- package/widgets/Attachments/types.d.ts +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.d.ts +38 -5
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/ReactiveContingentValuesManager.js +2 -0
- package/widgets/BatchAttributeForm/ReactiveGraphic.js +1 -1
- package/widgets/BatchAttributeForm/attachmentUtils.js +1 -1
- package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
- package/widgets/BatchAttributeForm/css.js +1 -1
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.d.ts +11 -0
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +77 -0
- package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
- package/widgets/BatchAttributeForm/interfaceUtils.js +2 -0
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
- package/widgets/BatchAttributeForm/types.d.ts +30 -2
- package/widgets/BatchAttributeForm.d.ts +52 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.d.ts +9 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
- package/widgets/Editor.d.ts +1 -1
- package/widgets/FeatureTable/FieldColumn.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/LayerList/LayerListItem.js +1 -1
- package/widgets/Sketch/SketchViewModel.d.ts +67 -2
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch/VisibleElements.d.ts +19 -1
- package/widgets/Sketch/VisibleElements.js +1 -1
- package/widgets/Sketch/support/OperationHandle.js +1 -1
- package/widgets/Sketch/support/PluginManager.d.ts +12 -0
- package/widgets/Sketch/support/PluginManager.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/TimeSlider.d.ts +3 -3
- package/widgets/VideoPlayer/VideoPlayerViewModel.d.ts +10 -0
- package/widgets/VideoPlayer/VideoPlayerViewModel.js +1 -1
- package/widgets/support/ContingentValuesManager.js +1 -1
- package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.d.ts +81 -0
- package/widgets/support/SelectionToolbar/types.d.ts +4 -0
- package/widgets/support/forms/formUtils.js +1 -1
- package/assets/esri/core/workers/chunks/11b0d3a825fe50dd1e84.js +0 -1
- package/assets/esri/core/workers/chunks/130851b81f04e6a008cd.js +0 -1
- package/assets/esri/core/workers/chunks/1a3426276dc82a8a80f2.js +0 -1
- package/assets/esri/core/workers/chunks/1c8a21b7b60c0709e6b2.js +0 -1
- package/assets/esri/core/workers/chunks/24247ee93f43fff5e596.js +0 -2
- package/assets/esri/core/workers/chunks/276cb6a1cdd26d0e1444.js +0 -1
- package/assets/esri/core/workers/chunks/2b3a8a53cd68f666676b.js +0 -1
- package/assets/esri/core/workers/chunks/2ecb21c402cdd8c82533.js +0 -1
- package/assets/esri/core/workers/chunks/2f903bd3a2611e7f0946.js +0 -30
- package/assets/esri/core/workers/chunks/2fda38219d778f0447b5.js +0 -1
- package/assets/esri/core/workers/chunks/38d7430d2370b69334d7.js +0 -1
- package/assets/esri/core/workers/chunks/39d6032d79720935910d.js +0 -1
- package/assets/esri/core/workers/chunks/5dafd35801dca4229aed.js +0 -1
- package/assets/esri/core/workers/chunks/642be1619c0e76355cb6.js +0 -1
- package/assets/esri/core/workers/chunks/6d66dc77af8d112c33c6.js +0 -1
- package/assets/esri/core/workers/chunks/7b3642195d6d3ea9b830.js +0 -1
- package/assets/esri/core/workers/chunks/7e57029ec958f6423d5d.js +0 -2
- package/assets/esri/core/workers/chunks/8042e001545e2782499c.js +0 -1
- package/assets/esri/core/workers/chunks/855bf811cd79b97c169a.js +0 -1
- package/assets/esri/core/workers/chunks/881234f25c7814de8753.js +0 -1
- package/assets/esri/core/workers/chunks/8a7682071941c35f05c1.js +0 -1
- package/assets/esri/core/workers/chunks/8fdd57e2a0af647f1e3e.js +0 -1
- package/assets/esri/core/workers/chunks/90ea570f6b6ce8ca693b.js +0 -1
- package/assets/esri/core/workers/chunks/9373daa677dc767d7cf0.js +0 -1
- package/assets/esri/core/workers/chunks/95df6d2ebacc43ac5fa3.js +0 -1
- package/assets/esri/core/workers/chunks/a02ebdcb802d128c8eee.js +0 -1
- package/assets/esri/core/workers/chunks/adf72d87f0114aeade0e.js +0 -1
- package/assets/esri/core/workers/chunks/aec4a4cd7044fdbbbe34.js +0 -1
- package/assets/esri/core/workers/chunks/b1a21a4d7d73ad7d0e47.js +0 -1
- package/assets/esri/core/workers/chunks/b262478da29470abb72b.js +0 -2
- package/assets/esri/core/workers/chunks/b75e090a7e935ff870a3.js +0 -1
- package/assets/esri/core/workers/chunks/bacf0c9d5d3e084dea61.js +0 -1
- package/assets/esri/core/workers/chunks/c0e4fd6fa1d765275248.js +0 -2
- package/assets/esri/core/workers/chunks/cfaa6e205bfc0c94a1b1.js +0 -1
- package/assets/esri/core/workers/chunks/d3f08f1a9a250cd8a2c8.js +0 -1
- package/assets/esri/core/workers/chunks/dcb7a3ff59677b1cf0f1.js +0 -1
- /package/assets/esri/core/workers/chunks/{7e57029ec958f6423d5d.js.LICENSE.txt → 549d348ca181d06aefb7.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{9b89cc85c1b5d561df7c.js.LICENSE.txt → 55334ad3618899cdbf78.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{b262478da29470abb72b.js.LICENSE.txt → 69c9eb93553b006b640d.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{c0e4fd6fa1d765275248.js.LICENSE.txt → b69d1d528e271568cbd8.js.LICENSE.txt} +0 -0
package/layers/ParquetLayer.d.ts
CHANGED
|
@@ -251,13 +251,15 @@ export interface ParquetLayerProperties extends LayerProperties, CustomParameter
|
|
|
251
251
|
* ###### Using the [getParquetLayerInfo()](https://developers.arcgis.com/javascript/latest/references/core/layers/support/parquetUtils/#getParquetLayerInfo)
|
|
252
252
|
*
|
|
253
253
|
* Use the [getParquetLayerInfo()](https://developers.arcgis.com/javascript/latest/references/core/layers/support/parquetUtils/#getParquetLayerInfo) method to
|
|
254
|
-
* retrieve information needed to create a parquet layer from the first Parquet file in the specified
|
|
254
|
+
* retrieve information needed to create a parquet layer from the first Parquet file in the specified data source.
|
|
255
255
|
* The following snippet shows how to create a new ParquetLayer using the retrieved information returned from the `getParquetLayerInfo()`.
|
|
256
256
|
*
|
|
257
257
|
* ```js
|
|
258
|
-
* // get parquet layer info from the first Parquet file in the
|
|
259
|
-
* const
|
|
260
|
-
*
|
|
258
|
+
* // get parquet layer info from the first Parquet file in the data source
|
|
259
|
+
* const data = new ParquetFilesData({
|
|
260
|
+
* urls: ["url-to-your-parquet-file.parquet", "url-to-your-parquet-file2.parquet"]
|
|
261
|
+
* });
|
|
262
|
+
* const info = await parquetUtils.getParquetLayerInfo(data);
|
|
261
263
|
* const layer = new ParquetLayer(info);
|
|
262
264
|
*
|
|
263
265
|
* // create a renderer based on the geometry type
|
|
@@ -348,7 +348,7 @@ export default class SubtypeGroupLayer extends SubtypeGroupLayerSuperclass {
|
|
|
348
348
|
* > FeatureLayers are not optimized for high-frequency, dynamic data, or real-time streaming use cases. As a result, they may not perform efficiently with rapidly updating data streams.
|
|
349
349
|
* > For real-time or dynamic data updates, use [StreamLayers](https://developers.arcgis.com/javascript/latest/references/core/layers/StreamLayer/), which are designed for efficient handling of high-frequency streaming data and dynamic features.
|
|
350
350
|
* >
|
|
351
|
-
* > When calling the applyEdits method on a service that does not have [vertical coordinate system](https://
|
|
351
|
+
* > When calling the applyEdits method on a service that does not have [vertical coordinate system](https://doc.esri.com/en/arcgis-pro/latest/help/mapping/properties/vertical-coordinate-systems.html) information,
|
|
352
352
|
* > the z-values of the geometries in the `edits` object will automatically be converted to match the spatial reference of the layer.
|
|
353
353
|
* > Example: The service has a horizontal spatial reference with `feet` units, and `applyEdits()` is called with z-values based on `meter` units,
|
|
354
354
|
* > then the method will automatically convert the z values from `meter` to `feet` units.
|
|
@@ -669,7 +669,7 @@ export default class SubtypeGroupLayer extends SubtypeGroupLayerSuperclass {
|
|
|
669
669
|
* > [SubtypeGroupLayerView#queryFeatures](https://developers.arcgis.com/javascript/latest/references/core/views/layers/FeatureLikeLayerView/#queryFeatures)
|
|
670
670
|
* > method.
|
|
671
671
|
* >
|
|
672
|
-
* > When querying a service with z-values and no [vertical coordinate system](https://
|
|
672
|
+
* > When querying a service with z-values and no [vertical coordinate system](https://doc.esri.com/en/arcgis-pro/latest/help/mapping/properties/vertical-coordinate-systems.html) information,
|
|
673
673
|
* > the z-values will automatically be converted to match the [Query.outSpatialReference](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#outSpatialReference) units.
|
|
674
674
|
* > Example: The service has a horizontal spatial reference using `feet` units and the query is made with `outSpatialReference`
|
|
675
675
|
* > based on `meter` units, then [queryFeatures()](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#queryFeatures) automatically converts the values from `feet` to `meter` units.
|
|
@@ -61,17 +61,17 @@ export interface ViewshedLayerProperties extends LayerProperties, OperationalLay
|
|
|
61
61
|
*
|
|
62
62
|
* ```js
|
|
63
63
|
* // retrieve layer view for the layer
|
|
64
|
-
* const
|
|
64
|
+
* const layerView = await view.whenLayerView(viewshedLayer);
|
|
65
65
|
*
|
|
66
66
|
* // allow existing viewsheds in the layer to be selected and edited
|
|
67
67
|
* // select a viewshed by hovering and clicking on their field-of-view manipulators
|
|
68
|
-
*
|
|
68
|
+
* layerView.interactive = true;
|
|
69
69
|
*
|
|
70
70
|
* // start placing new viewsheds interactively
|
|
71
71
|
* const abortController = new AbortController();
|
|
72
72
|
*
|
|
73
73
|
* try {
|
|
74
|
-
* await
|
|
74
|
+
* await layerView.place({ signal: abortController.signal });
|
|
75
75
|
* } catch (error) {
|
|
76
76
|
* if (error.name === "AbortError") {
|
|
77
77
|
* console.log("Placement operation was cancelled.");
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{Loadable as
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../core/Error.js";import{Loadable as r}from"../../../core/Loadable.js";import s from"../../../core/Logger.js";import{throwIfAborted as o}from"../../../core/promiseUtils.js";import{watch as i}from"../../../core/reactiveUtils.js";import{open as a}from"../../../core/workers.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import l from"../../../geometry/Extent.js";import{createFileProviderSchema as u,toParquetJSONGeometryType as y}from"../../support/parquetUtils.js";import p from"../../../rest/support/FeatureSet.js";let m=class extends r{constructor(t){super(t),this.type="parquet"}load(t){const e=null!=t?t.signal:null;return this.addResolvingPromise(this._initialize(e)),this.addHandles([i(()=>this.layer.data,async t=>{t&&await this._proxy.updateFileProvider(await u(t))}),i(()=>this.layer.customParameters,t=>this._setCustomParameters(t))]),Promise.resolve(this)}destroy(){this._connection?.destroy()}async openPorts(){return await this.load(),this._connection.openPorts()}async queryFeaturesJSON(t,e={}){return await this.load(e),this._proxy.queryFeatures(t.toJSON(),{signal:e?.signal})}async queryFeatures(t,e={}){const r=await this.queryFeaturesJSON(t,{signal:e?.signal});return p.fromJSON(r)}async queryObjectIds(t,e){return await this._proxy.queryObjectIds(t.toJSON(),{signal:e?.signal})}async queryFeatureCount(t,e){return this._proxy.queryFeatureCount(t.toJSON(),{signal:e?.signal})}async queryExtent(t,e){if(null==this.layer.geometryEncoding)return s.getLogger(this).warn("Tried to queryExtent, but source does not have a geometry. Returning null extent."),{count:0,extent:null};const r=await this._proxy.queryExtent(t.toJSON(),{signal:e?.signal});return{count:r.count,extent:l.fromJSON(r.extent)}}async _initialize(t){if(!this.layer.data)throw new e("parquet:missing-data","A data source must be specified",this.layer);const r=await u(this.layer.data,{signal:t});o(t),this._connection=await a("ParquetSourceWorker",{strategy:"dedicated",signal:t,registryTarget:this}),o(t),this._proxy=this._connection.createInvokeProxy();const{layerDefinition:s,capabilities:i}=await this._proxy.load({provider:r,fields:this.layer.fields?.map(t=>t.toJSON()),geometryType:this.layer.geometryType?y(this.layer.geometryType):null,spatialReference:this.layer.spatialReference?.toJSON(),geometryEncoding:this.layer.geometryEncoding?.toJSON(),displayOptimization:this.layer.displayOptimization,customParameters:this.layer.customParameters});o(t),this.sourceJSON=s,this.capabilities=i}_setCustomParameters(t){this._proxy.setCustomParameters(t).catch(()=>{s.getLogger(this).warn("Failed to update customParameters")})}};t([n()],m.prototype,"type",void 0),t([n({constructOnly:!0})],m.prototype,"layer",void 0),t([n()],m.prototype,"sourceJSON",void 0),t([n()],m.prototype,"capabilities",void 0),m=t([c("esri.layers.graphics.sources.ParquetSource")],m);export{m as ParquetSource};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import e from"../../../../request.js";import has from"../../../../core/has.js";import{QueueProcessor as t}from"../../../../core/QueueProcessor.js";import{isBlobProtocol as a}from"../../../../core/urlUtils.js";const r="parquet.v1",s=new t({concurrency:12,process:async t=>{const{data:a}=await e(t.url,t.options);return a}});class n{constructor(e=()=>{}){this._getCustomParameters=e}async fetchRange(e,t,a,n){const o=await this._resolveFileUrl(e),c={url:o,options:{responseType:"array-buffer",query:this._getCustomParameters()??{},cacheMode:"no-store",useQueue:!0,headers:{range:`bytes=${t}-${a}`}}};if(!has("parquetlayer-cache-enabled"))return s.push(c);const i=new URL(o);i.searchParams.append("range",`${t}-${a}`);try{const e=await caches.open(`${r}:${o}`),t=await e.match(i);if(t)return await t.arrayBuffer();const a=await s.push(c);return await e.put(i,new Response(a,{headers:{"Content-Type":"application/octet-stream","Content-Length":a.byteLength.toString()}})),a}catch(h){return s.push(c)}}async fetchLength(t){const s=await this._resolveFileUrl(t);if(a(s)){const{data:t}=await e(s,{responseType:"blob"});return t.size}const{data:n}=await e(s,{responseType:"native",method:"head",query:this._getCustomParameters()}),o=n.headers.get("Content-Length");if(null==o)throw new Error("Unable to parse content length");const c=parseInt(o,10);if(!has("parquetlayer-cache-enabled"))return c;try{const e=`${r}:${s}`,t=new URL(s);t.searchParams.append("metadata","true");let a=await caches.open(e);const o=n.headers.get("etag")??n.headers.get("Last-Modified");if(null==o)return await caches.delete(e),c;const i=await a.match(t),h=await(i?.json());h?.tag!==o&&(await caches.delete(e),a=await caches.open(e));const p=JSON.stringify({tag:o});await a.put(t,new Response(p,{headers:{"Content-Type":"application/json","Content-Length":p.length.toString()}}))}catch(i){}return c}}export{n as FileProvider};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import e from"../../../../request.js";import{FileProvider as r}from"./FileProvider.js";import{parseKnownArcGISOnlineDomain as s}from"../../../../portal/support/urlUtils.js";class t extends r{constructor(e,r){super(r),this._schema=e,this._isAgol=!!s(this._schema.itemUrl)}async getFileList(){return[`${this._baseUrl}/data`]}async fetchLength(e){return this._schema.size}async fetchRange(e,r,s,t){try{return await super.fetchRange(e,r,s,t)}catch{this._resolvedUrl=null}return super.fetchRange(e,r,s,t)}async _resolveFileUrl(e){return this._resolvedUrl||(this._resolvedUrl=this._fetchResolvedUrl()),this._resolvedUrl}get _baseUrl(){return this._schema.itemCdnUrl??this._schema.itemUrl}async _fetchResolvedUrl(){if(!this._isAgol)return`${this._baseUrl}/data`;return(await e(`${this._baseUrl}/data`,{query:{signedurl:!0,expiration:9,f:"json"}})).data.signedUrl}}export{t as PortalParquetFileProvider};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import t from"../../../../request.js";import{FileProvider as e}from"./FileProvider.js";const s=100;class r extends e{constructor(t,e){super(e),this._schema=t}get _baseUrl(){return this._schema.itemCdnUrl??this._schema.itemUrl}async getFileList(){const t=await this._getResources();return Array.from(t.keys())}async getResource(t){const e=(await this._getResources()).get(t);if(!e)throw new Error(`Resource ${t} not found.`);return e}async fetchLength(t){return(await this.getResource(t)).size}async fetchRange(t,e,s,r){try{return await super.fetchRange(t,e,s,r)}catch{this._invalidate()}return super.fetchRange(t,e,s,r)}async _resolveFileUrl(t){return(await this.getResource(t)).signedUrl}_invalidate(){this._resources=null,this._itemData=null}async _getResources(){return this._resources||(this._resources=this._fetchResources()),await this._resources}async _getItemData(){return this._itemData||(this._itemData=this._fetchItemData()),await this._itemData}async _fetchItemData(){const{data:e}=await t(`${this._baseUrl}/data`);return e}async _fetchResources(){const e=this._getItemData(),r=new Map;let a=1;for(;-1!==a;){const i=await t(`${this._baseUrl}/resources`,{query:{f:"json",start:a,num:s}}),c=`${(await e).directory}/`;for(const t of i.data.resources)t.resource.startsWith(c)&&r.set(t.resource,t);a=i.data.nextStart}return r}}export{r as PortalParquetResourcesFileProvider};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{FileProvider as e}from"./FileProvider.js";class r extends e{constructor(e,r=()=>{}){super(r),this._schema=e}async getFileList(){return this._schema.urls}async _resolveFileUrl(e){return e}}export{r as UrlsFileProvider};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{PortalParquetFileProvider as r}from"./PortalParquetFileProvider.js";import{PortalParquetResourcesFileProvider as e}from"./PortalParquetLayerFileProvider.js";import{UrlsFileProvider as t}from"./UrlsFileProvider.js";function o(o,a){switch(o.type){case"urls":return new t(o,a);case"portal-parquet-file":return new r(o,a);case"portal-parquet-layer":return new e(o,a)}}export{o as createFileProvider};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import r from"../../../../core/Collection.js";import{toConst as s}from"../../../../core/compilerUtils.js";import i from"../../../../core/Error.js";import has from"../../../../core/has.js";import o from"../../../../core/Logger.js";import{onAbortOrThrow as a,throwIfAborted as n}from"../../../../core/promiseUtils.js";import{QueueProcessor as u}from"../../../../core/QueueProcessor.js";import{parseWhereClause as p}from"../../../../core/sql.js";import l from"../../../../geometry/SpatialReference.js";import{set as c,create as d,expandWithRect as f,expandWithAABB as m,negativeInfinity as y,fromRect as h}from"../../../../geometry/support/aaBoundingBox.js";import{getQueryResultExtent as g,QueryEngine as w}from"../../data/QueryEngine.js";import{QueryEngineResult as _}from"../../data/QueryEngineResult.js";import{normalizeQueryLike as I}from"../../data/queryUtils.js";import{createDrawingInfo as F}from"./clientSideDefaults.js";import{getParquetFileId as x,getParquetRowId as R}from"./parquetIdUtils.js";import S from"../../../support/Field.js";import q from"../../../support/FieldsIndex.js";import{fromParquetGeometryEncodingJSON as C}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as E,fromParquetJSONGeometryType as v,toParquetJSONGeometryType as b}from"../../../support/parquetUtils.js";import{loadParquetModule as O}from"../../../../libs/parquet/loadParquetModule.js";import{createParquetFile as Q,readGeoMetadata as T}from"../../../../libs/parquet/parquet.js";import{FeatureStoreQueryAdapter as j}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as P}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as M}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as A}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as G}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const B=new j,D=4,z="__OBJECTID",W=new TextDecoder;class U{constructor(){this._fileInfos=new Map,this._queue=new u({concurrency:D,process:(e,t)=>this._executeQuery(e,t)}),this._indexMap={}}async load(s){const{urls:a}=s,n=s.spatialReference?l.fromJSON(s.spatialReference):void 0;if(n&&!n.isWGS84&&!n.isWebMercator)throw new i("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");const u=await E({urls:new r(a),fields:s.fields?.map(e=>S.fromJSON(e)),geometryEncoding:s.geometryEncoding?C(s.geometryEncoding):null,geometryType:s.geometryType?v(s.geometryType):null,displayOptimization:s.displayOptimization,spatialReference:n},{customParameters:s.customParameters});if(!u.fields)throw new i("parquet:unsupported","Fields must be defined");let p;if(u.spatialReference&&u.geometryType){if(!u.spatialReference)throw new i("parquet:unsupported","SpatialReference must be defined");if(!u.spatialReference.isGeographic&&!u.spatialReference.isWebMercator)throw new i("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");u.spatialReference.isGeographic&&!u.spatialReference.isWGS84&&(o.getLogger("parquet:unsupported-projection").warn("Found a geographic projection that is not WGS84. Handling as WGS84.",{spatialReference:u.spatialReference}),u.spatialReference=l.WGS84),p={geometry:u.geometryEncoding?{geometryType:b(u.geometryType),spatialReference:u.spatialReference.toJSON(),encoding:u.geometryEncoding.toJSON()}:null,displayOptimization:u.displayOptimization}}this.setCustomParameters(s.customParameters),this._geometryInfo=p;for(const e of a)this._addFile(e);this._capabilities=H(await this.getFileStatistics());const m=this._fileInfos.values().next().value;if(!m)return{layerDefinition:{},capabilities:H(null)};const h=await m,{fields:g}=u;if(null==g)throw new i("parquet-layer:missing-metadata","Unable to create parquet source: cannot infer fields",g);g.push(new S({name:z,type:"oid",alias:z}));for(const e of g){const t=h.file.columnForFieldName(e.name);null!=t&&(this._indexMap[e.name]=t)}const w=new q(g.map(e=>e.toJSON()));this._fieldsIndex=w;const _=b(u.geometryType??"point");if(this._metadata=A.createFeature({fieldsIndex:w.toJSON(),geometryType:_,hasZ:!1,hasM:!1,featureIdInfo:{type:"object-id",fieldName:"rowId"},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:u.spatialReference,outSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:_,featureIdInfo:{type:"object-id",fieldName:"rowId"},hasM:!1,hasZ:!1,spatialReference:u.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},u.spatialReference){const e=await this.getFileInfos();this._fullExtent=V(e,u.spatialReference.toJSON())}if(null==this._fullExtent&&"location"===u.geometryEncoding?.type){const{xField:r,yField:s}=u.geometryEncoding,i=c(d(),y);for(const o of await this.getFileInfos())for(const a of o.file.rowGroups()){const o={stack:[],error:void 0,hasError:!1};try{const t=e(o,a.columnDescriptorForAttribute(r),!1),n=e(o,a.columnDescriptorForAttribute(s),!1),u=[t.minValue(),n.minValue(),t.maxValue(),n.maxValue()];f(i,u),a.free()}catch(I){o.error=I,o.hasError=!0}finally{t(o)}}this._fullExtent={xmin:i[0],ymin:i[1],xmax:i[3],ymax:i[4],spatialReference:u.spatialReference?.toJSON()}}return{capabilities:this._capabilities,layerDefinition:{fields:u.fields?.map(e=>e.toJSON()),drawingInfo:F(_),extent:this._fullExtent??void 0,geometryType:_,geometryEncoding:u.geometryEncoding?.toJSON(),displayOptimization:u.displayOptimization}}}destroy(){for(const e of this._fileInfos.values())e.then(e=>e.file.free);this._fileInfos.clear(),this._queue.destroy()}setCustomParameters(e){this._customParameters=e}getIndexMap(){return this._indexMap}async getFileId(e){const t=this._fileInfos.get(e);if(!t)throw new Error(`InternalError: File ${e} does not exist`);return(await t).id}async getFileInfo(e){const t=this._fileInfos.get(e);if(!t)throw new Error(`InternalError: File ${e} does not exist`);return t}async getFileInfos(){return Promise.all(Array.from(this._fileInfos.values()))}async getFileStatistics(){if(!this._fileInfos.size)return null;const e=(await this.getFileInfos()).reduce((e,t)=>e+t.file.byteLength(),0);return{featureCount:await this._getFeatureCount(),byteLength:e}}async updateFiles(e){const t=new Set(e);for(const[r,s]of this._fileInfos.entries())t.has(r)?t.delete(r):(s.then(e=>e.file.free()),this._fileInfos.delete(r));await Promise.all(Array.from(t.values()).map(e=>this._addFile(e)))}async queryFeatures(e,t){this._validateQuery(e),Z(e)||(e.resultRecordCount=e.resultRecordCount?Math.min(e.resultRecordCount,8e3):8e3,e.resultOffset=e.resultOffset??0),(e.outStatistics||e.returnDistinctValues)&&(e.returnGeometry=void 0);return(await this._enqueueQuery(e,t)).createQueryResponse()}async queryFeatureCount(e,t){const r=await I(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),!N(r))return this._getFeatureCount();r.outFields=void 0,r.returnGeometry=void 0;return(await this._enqueueQuery(r,t)).createQueryResponseForCount()}async queryObjectIds(e,t){const r=await I(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),!N(r))return Array.from({length:await this._getFeatureCount()},(e,t)=>t);r.resultRecordCount=r.resultRecordCount?Math.min(r.resultRecordCount,8e3):8e3,r.resultOffset=r.resultOffset??0,r.returnGeometry=void 0,r.outFields=void 0;return(await this._enqueueQuery(r,t)).items.map(e=>e.getObjectId())}async queryExtent(e,t){const r=await I(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),this._fullExtent&&!N(r))return{count:await this._getFeatureCount(),extent:this._fullExtent};const i=s(this._metadata.spatialReference);r.returnGeometry=!0,r.outFields=void 0;const o=c(d(),y),a=d(),n=await this._enqueueQuery(r,t);let u=0;for(const s of n.items)s.getBounds(a)&&(m(o,a),u+=1);return{count:u,extent:g(o,i,r.outSR?s(r.outSR):i,i,!1)}}async queryStream(e,t,r){if(!r.signal)throw new Error("InternalError: AbortSignal must be passed");const s=await this.getFileInfo(e),i=(await O()).Query.new();"tile"===t.type&&(i.setExtent(t.extent),i.setQuantizationTransform(t.transform),i.setScale(t.scale)),i.setOutFields(t.outFields.filter(e=>null!=this._indexMap[e])),i.setOutSpatialReference(t.outSpatialReference.wkid),i.setReturnGeometry(!0),t.where&&await this._setWhereClause(i,s.file,t.where);const o=await s.file.executeQuery(i,r.signal),n=s.streamIdCounter++,u=a(r.signal,e=>{const t=s.streams.get(n);null!=t&&(t.handle.remove(),s.streams.delete(n))});return s.streams.set(n,{stream:o,handle:u}),n}async getStreamNext(e,t,r){if(!r.signal)throw new Error("InternalError: AbortSignal must be passed");const s=await this.getFileInfo(e),i=s.streams.get(t);if(!i)return null;const o=await i.stream.next(r.signal);return null==o&&(i.handle.remove(),s.streams.delete(t)),o?.serialize().buffer}async createPatch(e,t,r,s,i){if(!i.signal)throw new Error("InternalError: AbortSignal must be passed");const o=await this.getFileInfo(e);return(await o.file.createChunkPatch(t,r,s,i.signal)).serialize().buffer}async _getFile(e){for(const t of await this.getFileInfos())if(t.id===e)return t.file;throw new Error(`InternalError: File ${e} does not exist`)}_addFile(e){const t=this._fileInfos.size;this._fileInfos.set(e,this._createFileInfo(e,t))}async _createFileInfo(e,t){return{id:t,file:await Q(e,{geometryInfo:this._geometryInfo,getCustomParameters:()=>this._customParameters}),streamIdCounter:0,streams:new Map}}async _getFeatureCount(){return(await this.getFileInfos()).reduce((e,t)=>e+t.file.numRows(),0)}_validateQuery(e){if(!this._capabilities.query.supportsStatistics&&e.outStatistics)throw new i("parquet:unsupported","Statistics queries are not supported",{query:e});if(!this._capabilities.query.supportsOrderBy&&e.orderByFields?.length)throw new i("parquet:unsupported","Queries using orderBy are not supported",{query:e});if(!this._capabilities.query.supportsDistinct&&e.returnDistinctValues)throw new i("parquet:unsupported","Queries using returnDistinctValues are not supported",{query:e})}async _setWhereClause(e,t,r){const s=this._indexMap,o=this._fieldsIndex,a={getAttribute(e,r){const i=t.readAttribute(e.rowGroup,e.row,s[r]);if(null==i)return null;const a=o.get(r);return"esriFieldTypeString"===a.type||"esriFieldTypeDateOnly"===a.type||"esriFieldTypeTimeOnly"===a.type||"esriFieldTypeTimestampOffset"===a.type?W.decode(i):i}},n=await p(r,this._fieldsIndex);if(!n.isStandardized)throw new i("sql-parse-error","expression is not standardized");const u=(e,t)=>n.testFeatureCompiled({rowGroup:e,row:t},a,null);e.setWhere(r),e.setWhereEvaluator(u),e.setWhereFields(n.fieldNames)}async*_fetchChunks(e,t){const r=await O();for(const s of await this.getFileInfos()){const i=r.Query.new();i.setOutFields(e.fields),i.setReturnGeometry(e.returnGeometry),e.where&&await this._setWhereClause(i,s.file,e.where);const o=await s.file.executeQuery(i),a=[],u=o.next(t);for(let e=0;e<D;e++)a.push(o.next(t));let p=await u;for(;null!=p;){n(t);const e=new G(this._metadata,this._indexMap,p,s.id),r=k([new P(e,null,0,!1)],this._queryEngineParams),i=a.shift();a.push(o.next(t)),yield r,p=await i}}}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){const r=await this._getReadParams(e);if(e.where=void 0,e.objectIds?.length){const r=new Map;for(const t of e.objectIds){const e=x(t),s=R(t);let i=r.get(e);i||(i=[],r.set(e,i)),i.push(s)}const s=[];for(const[i,o]of r.entries()){const r=await this._executeFileIdQuery(e,i,o,t);for(const e of r)s.push(e)}return new _(s,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:B,featureIdInfo:this._queryEngineParams.featureIdInfo})}let s=e.resultRecordCount??await this._getFeatureCount(),i=e.resultOffset??0;e.resultRecordCount=void 0,e.resultOffset=void 0;const o=[];for await(const a of this._fetchChunks(r,t)){const r=await a.executeQueryForOpaqueFeatures(e,t);if(r.length>i){const t=r.slice(i,Math.min(i+s,r.length));for(const e of t)o.push(e);if(i=0,s-=t.length,0===s)return new _(o,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:B,featureIdInfo:this._queryEngineParams.featureIdInfo})}else i-=r.length}return new _(o,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:B,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(e,t,r,s){const i=await this._getReadParams(e),o=(await O()).Query.new();o.setOutFields(i.fields),o.setReturnGeometry(i.returnGeometry),o.setIds(new Uint32Array(r));const a=await this._getFile(t),n=await a.executeQuery(o,s);let u=await n.next(s),p=0;const l=[];for(;null!=u;){const e=new G(this._metadata,this._indexMap,u,t),r=new P(e,null,p++,!1);l.push(r),u=await n.next(s)}return k(l,this._queryEngineParams).executeQueryForOpaqueFeatures(e,s)}async _getReadParams(e){const t=new Set;if(e.outStatistics)for(const r of e.outStatistics)null!=r.onStatisticField&&t.add(r.onStatisticField);if(e.outFields)for(const r of e.outFields)t.add(r);return{fields:(t.has("*")?this._fieldsIndex.fields.map(e=>e.name):Array.from(t)).filter(e=>null!=this._indexMap[e]),returnGeometry:!!e.returnGeometry||!!e.geometry,where:e.where}}}function N(e){for(const t in e){const r=t;switch(r){case"resultOffset":case"resultRecordCount":case"aggregateIds":case"distance":case"gdbVersion":case"geometry":case"having":case"timeExtent":case"objectIds":case"historicMoment":case"where":return null!=e[r]}}return!1}function k(e,t){const r=new M;for(const s of e)r.insert(s);return new w({...t,featureStore:r})}function J(e){switch(e.length){case 4:return h(d(),e);case 6:return e;default:throw new i("parquet:protocol-violation","Invalid Geoparquet file. BoundingBox size must be 4 or 6.",{bbox:e})}}function V(e,t){const r=c(d(),y);for(const s of e){const e=T(s.file);if(!e)return null;const t=e.columns[e.primary_column];if(!t.bbox)return null;const i=J(t.bbox);m(r,i)}return{xmin:r[0],ymin:r[1],xmax:r[3],ymax:r[4],spatialReference:t}}function H(e){const t=e?.featureCount;let r=!1;return null!=t&&t<has("parquetlayer-full-query-feature-count")&&(r=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:!1,supportsTrueCurve:!1,supportsZ:!1},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:{maxRecordCount:8e3,maxRecordCountFactor:void 0,maxUniqueIDCount:void 0,relativeTimeBinWindow:void 0,standardMaxRecordCount:void 0,standardMaxRecordCountNoGeometry:void 0,supportsStatisticsAggregatedIds:!1,supportsCacheHint:!1,supportsCentroid:!0,supportsCentroidOnDegeneratedQuantizedGeometry:!1,supportsCurrentUser:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDisjointSpatialRelationship:!1,supportsDistance:!1,supportsOutDistance:!1,supportsDistinct:r,supportsExtent:!1,supportsFormatPBF:!1,supportsFormatPBFWithCurves:!1,supportsGeometryProperties:!1,supportsHavingClause:!1,supportsHistoricMoment:!1,supportsMaxRecordCountFactor:!1,supportsOrderBy:r,supportsPagination:!0,supportsPaginationOnAggregatedQueries:!1,supportsPercentileStatistics:!1,supportsQuantization:!0,supportsQuantizationEditMode:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsReturnExceededLimitGeometries:!1,supportsStandardizedQueriesOnly:!1,supportsTopFeaturesQuery:!1,supportsStatistics:r,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsCompactGeometry:!1,supportsSqlExpression:!1,supportsTrueCurve:!1,tileMaxRecordCount:void 0},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 Z(e){return!!(e.objectIds?.length||e.outStatistics||e.orderByFields?.length||e.returnDistinctValues)}export{U as default};
|
|
2
|
+
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{toConst as r}from"../../../../core/compilerUtils.js";import s from"../../../../core/Error.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{onAbortOrThrow as o,throwIfAborted as a}from"../../../../core/promiseUtils.js";import{QueueProcessor as n}from"../../../../core/QueueProcessor.js";import{parseWhereClause as u}from"../../../../core/sql.js";import p from"../../../../geometry/SpatialReference.js";import{set as l,create as c,expandWithRect as d,expandWithAABB as f,negativeInfinity as m,fromRect as y}from"../../../../geometry/support/aaBoundingBox.js";import{getQueryResultExtent as h,QueryEngine as g}from"../../data/QueryEngine.js";import{QueryEngineResult as w}from"../../data/QueryEngineResult.js";import{normalizeQueryLike as _}from"../../data/queryUtils.js";import{createFileProvider as I}from"../parquet/createFileProvider.js";import{createDrawingInfo as F}from"./clientSideDefaults.js";import{getParquetFileId as x,getParquetRowId as R}from"./parquetIdUtils.js";import S from"../../../support/Field.js";import v from"../../../support/FieldsIndex.js";import{fromParquetGeometryEncodingJSON as q}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as C,fromParquetJSONGeometryType as E,toParquetJSONGeometryType as b}from"../../../support/parquetUtils.js";import{loadParquetModule as O}from"../../../../libs/parquet/loadParquetModule.js";import{createParquetFile as Q,readGeoMetadata as P}from"../../../../libs/parquet/parquet.js";import{FeatureStoreQueryAdapter as T}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as j}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as M}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as A}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as B}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const G=new T,D=4,z="__OBJECTID",W=new TextDecoder;class U{constructor(){this._fileInfos=new Map,this._queue=new n({concurrency:D,process:(e,t)=>this._executeQuery(e,t)}),this._indexMap={}}async load(r){const o=r.spatialReference?p.fromJSON(r.spatialReference):void 0;if(o&&!o.isWGS84&&!o.isWebMercator)throw new s("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");this._customParameters=r.customParameters,this._provider=I(r.provider,()=>this._customParameters);const a=await C(this._provider,{fields:r.fields?.map(e=>S.fromJSON(e)),geometryEncoding:r.geometryEncoding?q(r.geometryEncoding):null,geometryType:r.geometryType?E(r.geometryType):null,displayOptimization:r.displayOptimization,spatialReference:o});if(!a.fields)throw new s("parquet:unsupported","Fields must be defined");let n;if(a.spatialReference&&a.geometryType){if(!a.spatialReference)throw new s("parquet:unsupported","SpatialReference must be defined");if(!a.spatialReference.isGeographic&&!a.spatialReference.isWebMercator)throw new s("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");a.spatialReference.isGeographic&&!a.spatialReference.isWGS84&&(i.getLogger("parquet:unsupported-projection").warn("Found a geographic projection that is not WGS84. Handling as WGS84.",{spatialReference:a.spatialReference}),a.spatialReference=p.WGS84),n={geometry:a.geometryEncoding?{geometryType:b(a.geometryType),spatialReference:a.spatialReference.toJSON(),encoding:a.geometryEncoding.toJSON()}:null,displayOptimization:a.displayOptimization}}this.setCustomParameters(r.customParameters),this._geometryInfo=n;const u=await this._provider.getFileList();for(const e of u)this._addFile(e);this._capabilities=H(await this._getFileStatistics());const f=this._fileInfos.values().next().value;if(!f)return{layerDefinition:{},capabilities:H(null)};const y=await f,{fields:h}=a;if(null==h)throw new s("parquet-layer:missing-metadata","Unable to create parquet source: cannot infer fields",h);h.push(new S({name:z,type:"oid",alias:z}));for(const e of h){const t=y.file.columnForFieldName(e.name);null!=t&&(this._indexMap[e.name]=t)}const g=new v(h.map(e=>e.toJSON()));this._fieldsIndex=g;const w=b(a.geometryType??"point");if(this._metadata=A.createFeature({fieldsIndex:g.toJSON(),geometryType:w,hasZ:!1,hasM:!1,featureIdInfo:{type:"object-id",fieldName:"rowId"},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:a.spatialReference,outSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:w,featureIdInfo:{type:"object-id",fieldName:"rowId"},hasM:!1,hasZ:!1,spatialReference:a.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},a.spatialReference){const e=await this._getFileInfos();this._fullExtent=V(e,a.spatialReference.toJSON())}if(null==this._fullExtent&&"location"===a.geometryEncoding?.type){const{xField:r,yField:s}=a.geometryEncoding,i=l(c(),m);for(const o of await this._getFileInfos())for(const a of o.file.rowGroups()){const o={stack:[],error:void 0,hasError:!1};try{const t=e(o,a.columnDescriptorForAttribute(r),!1),n=e(o,a.columnDescriptorForAttribute(s),!1),u=[t.minValue(),n.minValue(),t.maxValue(),n.maxValue()];d(i,u),a.free()}catch(_){o.error=_,o.hasError=!0}finally{t(o)}}this._fullExtent={xmin:i[0],ymin:i[1],xmax:i[3],ymax:i[4],spatialReference:a.spatialReference?.toJSON()}}return{capabilities:this._capabilities,layerDefinition:{fields:a.fields?.map(e=>e.toJSON()),drawingInfo:F(w),extent:this._fullExtent??void 0,geometryType:w,geometryEncoding:a.geometryEncoding?.toJSON(),displayOptimization:a.displayOptimization}}}destroy(){for(const e of this._fileInfos.values())e.then(e=>e.file.free);this._fileInfos.clear(),this._queue.destroy()}setCustomParameters(e){this._customParameters=e}getIndexMap(){return this._indexMap}async getFilesIds(){const e=[];for await(const t of this._fileInfos.values())e.push(t.id);return e}async getFileId(e){const t=this._fileInfos.get(e);if(!t)throw new Error(`InternalError: File ${e} does not exist`);return(await t).id}async updateFileProvider(e){const t=I(e,()=>this._customParameters),r=await t.getFileList();this._provider=t,await this._updateFiles(new Set(r))}async queryFeatures(e,t){this._validateQuery(e),L(e)||(e.resultRecordCount=e.resultRecordCount?Math.min(e.resultRecordCount,8e3):8e3,e.resultOffset=e.resultOffset??0),(e.outStatistics||e.returnDistinctValues)&&(e.returnGeometry=void 0);return(await this._enqueueQuery(e,t)).createQueryResponse()}async queryFeatureCount(e,t){const r=await _(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),!N(r))return this._getFeatureCount();r.outFields=void 0,r.returnGeometry=void 0;return(await this._enqueueQuery(r,t)).createQueryResponseForCount()}async queryObjectIds(e,t){const r=await _(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),!N(r))return Array.from({length:await this._getFeatureCount()},(e,t)=>t);r.resultRecordCount=r.resultRecordCount?Math.min(r.resultRecordCount,8e3):8e3,r.resultOffset=r.resultOffset??0,r.returnGeometry=void 0,r.outFields=void 0;return(await this._enqueueQuery(r,t)).items.map(e=>e.getObjectId())}async queryExtent(e,t){const s=await _(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(s),this._fullExtent&&!N(s))return{count:await this._getFeatureCount(),extent:this._fullExtent};const i=r(this._metadata.spatialReference);s.returnGeometry=!0,s.outFields=void 0;const o=l(c(),m),a=c(),n=await this._enqueueQuery(s,t);let u=0;for(const r of n.items)r.getBounds(a)&&(f(o,a),u+=1);return{count:u,extent:h(o,i,s.outSR?r(s.outSR):i,i,!1)}}async queryStream(e,t,r){if(!r.signal)throw new Error("InternalError: AbortSignal must be passed");const s=await this._getFileInfoById(e),i=(await O()).Query.new();"tile"===t.type&&(i.setExtent(t.extent),i.setQuantizationTransform(t.transform),i.setScale(t.scale)),i.setOutFields(t.outFields.filter(e=>null!=this._indexMap[e])),i.setOutSpatialReference(t.outSpatialReference.wkid),i.setReturnGeometry(!0),t.where&&await this._setWhereClause(i,s.file,t.where);const a=await s.file.executeQuery(i,r.signal),n=s.streamIdCounter++,u=o(r.signal,e=>{const t=s.streams.get(n);null!=t&&(t.handle.remove(),s.streams.delete(n))});return s.streams.set(n,{stream:a,handle:u}),n}async getStreamNext(e,t,r){if(!r.signal)throw new Error("InternalError: AbortSignal must be passed");const s=await this._getFileInfoById(e),i=s.streams.get(t);if(!i)return null;const o=await i.stream.next(r.signal);return null==o&&(i.handle.remove(),s.streams.delete(t)),o?.serialize().buffer}async createPatch(e,t,r,s,i){if(!i.signal)throw new Error("InternalError: AbortSignal must be passed");const o=await this._getFileInfoById(e);return(await o.file.createChunkPatch(t,r,s,i.signal)).serialize().buffer}async _updateFiles(e){for(const[t,r]of this._fileInfos.entries())e.has(t)?e.delete(t):(r.then(e=>e.file.free()),this._fileInfos.delete(t));await Promise.all(Array.from(e.values(),e=>this._addFile(e)))}async _getFileInfos(){return Promise.all(Array.from(this._fileInfos.values()))}async _getFileInfoById(e){for await(const t of this._fileInfos.values())if(t.id===e)return t;throw new Error(`InternalError: File ${e} does not exist`)}async _getFileStatistics(){if(!this._fileInfos.size)return null;const e=(await this._getFileInfos()).reduce((e,t)=>e+t.file.byteLength(),0);return{featureCount:await this._getFeatureCount(),byteLength:e}}async _getFile(e){for(const t of await this._getFileInfos())if(t.id===e)return t.file;throw new Error(`InternalError: File ${e} does not exist`)}_addFile(e){const t=this._fileInfos.size;this._fileInfos.set(e,this._createFileInfo(e,t))}async _createFileInfo(e,t){return{id:t,file:await Q(e,{geometryInfo:this._geometryInfo,provider:this._provider}),streamIdCounter:0,streams:new Map}}async _getFeatureCount(){return(await this._getFileInfos()).reduce((e,t)=>e+t.file.numRows(),0)}_validateQuery(e){if(!this._capabilities.query.supportsStatistics&&e.outStatistics)throw new s("parquet:unsupported","Statistics queries are not supported",{query:e});if(!this._capabilities.query.supportsOrderBy&&e.orderByFields?.length)throw new s("parquet:unsupported","Queries using orderBy are not supported",{query:e});if(!this._capabilities.query.supportsDistinct&&e.returnDistinctValues)throw new s("parquet:unsupported","Queries using returnDistinctValues are not supported",{query:e})}async _setWhereClause(e,t,r){const i=this._indexMap,o=this._fieldsIndex,a={getAttribute(e,r){const s=t.readAttribute(e.rowGroup,e.row,i[r]);if(null==s)return null;const a=o.get(r);return"esriFieldTypeString"===a.type||"esriFieldTypeDateOnly"===a.type||"esriFieldTypeTimeOnly"===a.type||"esriFieldTypeTimestampOffset"===a.type?W.decode(s):s}},n=await u(r,this._fieldsIndex);if(!n.isStandardized)throw new s("sql-parse-error","expression is not standardized");const p=(e,t)=>n.testFeatureCompiled({rowGroup:e,row:t},a,null);e.setWhere(r),e.setWhereEvaluator(p),e.setWhereFields(n.fieldNames)}async*_fetchChunks(e,t){const r=await O();for(const s of await this._getFileInfos()){const i=r.Query.new();i.setOutFields(e.fields),i.setReturnGeometry(e.returnGeometry),e.where&&await this._setWhereClause(i,s.file,e.where);const o=await s.file.executeQuery(i),n=[],u=o.next(t);for(let e=0;e<D;e++)n.push(o.next(t));let p=await u;for(;null!=p;){a(t);const e=new B(this._metadata,this._indexMap,p,s.id),r=k([new j(e,null,0,!1)],this._queryEngineParams),i=n.shift();n.push(o.next(t)),yield r,p=await i}}}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){const r=await this._getReadParams(e);if(e.where=void 0,e.objectIds?.length){const r=new Map;for(const t of e.objectIds){const e=x(t),s=R(t);let i=r.get(e);i||(i=[],r.set(e,i)),i.push(s)}const s=[];for(const[i,o]of r.entries()){const r=await this._executeFileIdQuery(e,i,o,t);for(const e of r)s.push(e)}return new w(s,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:G,featureIdInfo:this._queryEngineParams.featureIdInfo})}let s=e.resultRecordCount??await this._getFeatureCount(),i=e.resultOffset??0;e.resultRecordCount=void 0,e.resultOffset=void 0;const o=[];for await(const a of this._fetchChunks(r,t)){const r=await a.executeQueryForOpaqueFeatures(e,t);if(r.length>i){const t=r.slice(i,Math.min(i+s,r.length));for(const e of t)o.push(e);if(i=0,s-=t.length,0===s)return new w(o,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:G,featureIdInfo:this._queryEngineParams.featureIdInfo})}else i-=r.length}return new w(o,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:G,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(e,t,r,s){const i=await this._getReadParams(e),o=(await O()).Query.new();o.setOutFields(i.fields),o.setReturnGeometry(i.returnGeometry),o.setIds(new Uint32Array(r));const a=await this._getFile(t),n=await a.executeQuery(o,s);let u=await n.next(s),p=0;const l=[];for(;null!=u;){const e=new B(this._metadata,this._indexMap,u,t),r=new j(e,null,p++,!1);l.push(r),u=await n.next(s)}return k(l,this._queryEngineParams).executeQueryForOpaqueFeatures(e,s)}async _getReadParams(e){const t=new Set;if(e.outStatistics)for(const r of e.outStatistics)null!=r.onStatisticField&&t.add(r.onStatisticField);if(e.outFields)for(const r of e.outFields)t.add(r);return{fields:(t.has("*")?this._fieldsIndex.fields.map(e=>e.name):Array.from(t)).filter(e=>null!=this._indexMap[e]),returnGeometry:!!e.returnGeometry||!!e.geometry,where:e.where}}}function N(e){for(const t in e){const r=t;switch(r){case"resultOffset":case"resultRecordCount":case"aggregateIds":case"distance":case"gdbVersion":case"geometry":case"having":case"timeExtent":case"objectIds":case"historicMoment":case"where":return null!=e[r]}}return!1}function k(e,t){const r=new M;for(const s of e)r.insert(s);return new g({...t,featureStore:r})}function J(e){switch(e.length){case 4:return y(c(),e);case 6:return e;default:throw new s("parquet:protocol-violation","Invalid Geoparquet file. BoundingBox size must be 4 or 6.",{bbox:e})}}function V(e,t){const r=l(c(),m);for(const s of e){const e=P(s.file);if(!e)return null;const t=e.columns[e.primary_column];if(!t.bbox)return null;const i=J(t.bbox);f(r,i)}return{xmin:r[0],ymin:r[1],xmax:r[3],ymax:r[4],spatialReference:t}}function H(e){const t=e?.featureCount;let r=!1;return null!=t&&t<has("parquetlayer-full-query-feature-count")&&(r=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:!1,supportsTrueCurve:!1,supportsZ:!1},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:{maxRecordCount:8e3,maxRecordCountFactor:void 0,maxUniqueIDCount:void 0,relativeTimeBinWindow:void 0,standardMaxRecordCount:void 0,standardMaxRecordCountNoGeometry:void 0,supportsStatisticsAggregatedIds:!1,supportsCacheHint:!1,supportsCentroid:!0,supportsCentroidOnDegeneratedQuantizedGeometry:!1,supportsCurrentUser:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDisjointSpatialRelationship:!1,supportsDistance:!1,supportsOutDistance:!1,supportsDistinct:r,supportsExtent:!1,supportsFormatPBF:!1,supportsFormatPBFWithCurves:!1,supportsGeometryProperties:!1,supportsHavingClause:!1,supportsHistoricMoment:!1,supportsMaxRecordCountFactor:!1,supportsOrderBy:r,supportsPagination:!0,supportsPaginationOnAggregatedQueries:!1,supportsPercentileStatistics:!1,supportsQuantization:!0,supportsQuantizationEditMode:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsReturnExceededLimitGeometries:!1,supportsStandardizedQueriesOnly:!1,supportsTopFeaturesQuery:!1,supportsStatistics:r,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsCompactGeometry:!1,supportsSqlExpression:!1,supportsTrueCurve:!1,tileMaxRecordCount:void 0},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 L(e){return!!(e.objectIds?.length||e.outStatistics||e.orderByFields?.length||e.returnDistinctValues)}export{U as default};
|
|
@@ -715,7 +715,7 @@ export default class KnowledgeGraphSublayer extends KnowledgeGraphSublayerSuperc
|
|
|
715
715
|
* > [FeatureLayerView.queryFeatures()](https://developers.arcgis.com/javascript/latest/references/core/views/layers/FeatureLayerView/#queryFeatures)
|
|
716
716
|
* > method.
|
|
717
717
|
* >
|
|
718
|
-
* > When querying a service with z-values and no [vertical coordinate system](https://
|
|
718
|
+
* > When querying a service with z-values and no [vertical coordinate system](https://doc.esri.com/en/arcgis-pro/latest/help/mapping/properties/vertical-coordinate-systems.html) information,
|
|
719
719
|
* > the z-values will automatically be converted to match the [Query.outSpatialReference](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#outSpatialReference) units.
|
|
720
720
|
* > Example: The service has a horizontal spatial reference using `feet` units and the query is made with `outSpatialReference`
|
|
721
721
|
* > based on `meter` units, then [queryFeatures()](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#queryFeatures) automatically converts the values from `feet` to `meter` units.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import e from"../../../core/Error.js";import{eachAlways as s,createAbortError as a}from"../../../core/promiseUtils.js";import{property as r,subclass as o}from"../../../core/accessorSupport/decorators.js";import i from"../../../geometry/Extent.js";import n from"../../../geometry/SpatialReference.js";import l from"./BaseRaster.js";import c from"./InMemoryRaster.js";import{parsePAMInfo as m}from"./pamParser.js";import{getFormat as f}from"../formats/RasterCodec.js";import{estimateStatisticsFromHistograms as p}from"../functions/stretchUtils.js";import h from"../transforms/PolynomialTransform.js";let u=class extends l{fetchRawTile(t,e,s,a={}){if(this._imageBlob){const{blockWidth:a,blockHeight:r}=this.rasterInfo.storageInfo;return this.decodePixelBlock(this._imageBlob,{tileSize:[a,r],tileIndex:[t,e,s],canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0})}return this._inMemoryRaster.fetchRawTile(t,e,s,a)}async _open(t){const s=await this._fetchData(t);if(null==s)throw new e("image-aux-raster:open","the data cannot be decoded");let{spatialReference:a,statistics:r,histograms:o,transform:l}=await this._fetchAuxiliaryData(t);const m=!a;m&&(a=new n({wkid:3857})),o?.length&&null==r&&(r=p(o));const{width:f,height:h}=s;let u=new i({xmin:-.5,ymin:.5-h,xmax:f-.5,ymax:.5,spatialReference:a});const d=l?l.forwardTransform(u):u;let g=!0;if(l){const t=l.forwardCoefficients;g=t&&0===t[1]&&0===t[2],g&&(l=null,u=d)}const w=new c({preGenerateTiles:!1,source:{extent:d,nativeExtent:u,transform:l,pixelBlocks:[s],statistics:r,histograms:o,keyProperties:{DateType:"Processed"},isPseudoSpatialReference:m},ioConfig:{sampling:"closest",skipStatistics:!0}});this.ioConfig.skipMapInfo&&(w.ioConfig.skipMapInfo=!0),await w.open(),w.source=null,this._set("rasterInfo",w.rasterInfo),this._inMemoryRaster=w}async _fetchData(t){const{data:s}=await this.request(this.url,{responseType:"array-buffer",signal:t?.signal}),a=f(s)
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../core/Error.js";import{eachAlways as s,createAbortError as a}from"../../../core/promiseUtils.js";import{property as r,subclass as o}from"../../../core/accessorSupport/decorators.js";import i from"../../../geometry/Extent.js";import n from"../../../geometry/SpatialReference.js";import l from"./BaseRaster.js";import c from"./InMemoryRaster.js";import{parsePAMInfo as m}from"./pamParser.js";import{getFormat as f}from"../formats/RasterCodec.js";import{estimateStatisticsFromHistograms as p}from"../functions/stretchUtils.js";import h from"../transforms/PolynomialTransform.js";let u=class extends l{fetchRawTile(t,e,s,a={}){if(this._imageBlob){const{blockWidth:a,blockHeight:r}=this.rasterInfo.storageInfo;return this.decodePixelBlock(this._imageBlob,{tileSize:[a,r],tileIndex:[t,e,s],canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0})}return this._inMemoryRaster.fetchRawTile(t,e,s,a)}async _open(t){const s=await this._fetchData(t);if(null==s)throw new e("image-aux-raster:open","the data cannot be decoded");let{spatialReference:a,statistics:r,histograms:o,transform:l}=await this._fetchAuxiliaryData(t);const m=!a;m&&(a=new n({wkid:3857})),o?.length&&null==r&&(r=p(o));const{width:f,height:h}=s;let u=new i({xmin:-.5,ymin:.5-h,xmax:f-.5,ymax:.5,spatialReference:a});const d=l?l.forwardTransform(u):u;let g=!0;if(l){const t=l.forwardCoefficients;g=t&&0===t[1]&&0===t[2],g&&(l=null,u=d)}const w=new c({preGenerateTiles:!1,source:{extent:d,nativeExtent:u,transform:l,pixelBlocks:[s],statistics:r,histograms:o,keyProperties:{DateType:"Processed"},isPseudoSpatialReference:m},ioConfig:{sampling:"closest",skipStatistics:!0}});this.ioConfig.skipMapInfo&&(w.ioConfig.skipMapInfo=!0),await w.open(),w.source=null,this._set("rasterInfo",w.rasterInfo),this._inMemoryRaster=w}async _fetchData(t){const{data:s}=await this.request(this.url,{responseType:"array-buffer",signal:t?.signal}),a=f(s);if("jpg"!==a&&"png"!==a&&"gif"!==a&&"bmp"!==a)throw new e("image-aux-raster:open","the data is not a supported format");this._set("datasetFormat",a.toUpperCase());const r=a.toLowerCase();try{const t=await this.decodePixelBlock(s,{format:r,canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0});return this._imageBlob=s,t}catch{return this.decodePixelBlock(s,{format:r,canvasUsage:"no-canvas",skipStatistics:!0})}}async _fetchAuxiliaryData(t){const e=t?.signal,{skipExtensions:r=[],skipMapInfo:o}=this.ioConfig,i=o||r.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:e}),n=this.datasetFormat,l="JPG"===n?"jgw":"PNG"===n?"pgw":"BMP"===n?"bpw":null,c=l&&r.includes(l)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+l,{responseType:"text",signal:e}),f=await s([i,c]);if(e?.aborted)throw a();const p=m(f[0].value?.data);if(!p.transform){const t=f[1].value?f[1].value.data.split("\n").slice(0,6).map(t=>Number(t)):null;p.transform=6===t?.length?new h({forwardCoefficients:[t[4],t[5],t[0],-t[1],t[2],-t[3]]}):null}return p}};t([r({type:String,json:{write:!0}})],u.prototype,"datasetFormat",void 0),u=t([o("esri.layers.raster.datasets.ImageAuxRaster")],u);const d=u;export{d as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import e from"../../../core/Error.js";import{property as
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../core/Error.js";import{property as s,subclass as r}from"../../../core/accessorSupport/decorators.js";import i from"../../../geometry/Extent.js";import o from"../../../geometry/Point.js";import n from"../../../geometry/SpatialReference.js";import a from"./BaseRaster.js";import{parseSpatialReference as l,parsePAMInfo as f}from"./pamParser.js";import{getElement as u,getElementValue as h}from"./xmlUtilities.js";import{isPlatformLittleEndian as c}from"../formats/utils.js";import{estimateStatisticsFromHistograms as p}from"../functions/stretchUtils.js";import m from"../../support/PixelBlock.js";import g from"../../support/RasterInfo.js";import d from"../../support/RasterStorageInfo.js";const y=new Map([["byte","u8"],["signedbyte","s8"],["int8","s8"],["uint8","u8"],["int16","s16"],["uint16","u16"],["int32","s32"],["uint32","u32"],["float32","f32"],["float64","f64"],["double64","f64"]]),x=new Map;x.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),x.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),x.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),x.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"}),x.set("qb3",{blobExtension:".pq3",isOneSegment:!0,decoderFormat:"qb3"});let b=class extends a{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this._isBsq=!1,this.datasetFormat="MRF"}async fetchRawTile(t,e,s,r={}){const{blockWidth:i,blockHeight:o,blockBoundary:n}=this.rasterInfo.storageInfo,a=n[t];if(!a||a.maxRow<e||a.maxCol<s||a.minRow>e||a.minCol>s)return null;const{bandCount:l,pixelType:f}=this.rasterInfo,{ranges:u,actualTileWidth:h,actualTileHeight:c}=this._getTileLocation(t,e,s);if(!u||0===u.length)return null;if(u.some(t=>t.from>t.to)){const t=new Uint8Array(i*o);return new m({width:i,height:o,pixels:void 0,mask:t,validPixelCount:0})}const{bandIds:p}=this.ioConfig,g=this._getBandSegmentCount(),d=[];let y=0;for(y=0;y<g;y++)p&&!p.includes(y)||d.push(this.request(this._files.data,{range:{from:u[y].from,to:u[y].to},responseType:"array-buffer",signal:r.signal}));const b=await Promise.all(d),w=b.map(t=>t.data.byteLength).reduce((t,e)=>t+e),I=new Uint8Array(w),_=[];let A=0;for(y=0;y<g;y++)_.push(A),I.set(new Uint8Array(b[y].data),A),A+=b[y].data.byteLength;const F=x.get(this.rasterInfo.storageInfo.compression).decoderFormat,R=await this.decodePixelBlock(I.buffer,{width:i,height:o,format:F,planes:p?.length||l,offsets:_,pixelType:f}).catch(()=>null);if(null==R)return null;let{noDataValue:S}=this.rasterInfo;if(null!=S&&"lerc"!==F&&!R.mask&&(S=S[0],null!=S)){const t=R.width*R.height,e=new Uint8Array(t);if(Math.abs(S)>1e24)for(y=0;y<t;y++)Math.abs((R.pixels[0][y]-S)/S)>1e-6&&(e[y]=1);else for(y=0;y<t;y++)R.pixels[0][y]!==S&&(e[y]=1);R.mask=e}let M=0,k=0;if(h!==i||c!==o){let t=R.mask;if(t)for(y=0;y<o;y++)if(k=y*i,y<c)for(M=h;M<i;M++)t[k+M]=0;else for(M=0;M<i;M++)t[k+M]=0;else for(t=new Uint8Array(i*o),R.mask=t,y=0;y<c;y++)for(k=y*i,M=0;M<h;M++)t[k+M]=1}return R}async _open(t){this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const e=t?t.signal:null,s=await this.request(this.url,{responseType:"xml",signal:e}),{rasterInfo:r,files:i}=this._parseHeader(s.data),{skipMapInfo:o,skipExtensions:n=[]}=this.ioConfig;if(!n.includes("aux.xml")&&!o){const e=await this._fetchAuxiliaryData(t);null!=e&&(r.statistics=e.statistics??r.statistics,r.histograms=e.histograms,e.histograms&&null==r.statistics&&(r.statistics=p(e.histograms)))}o&&this.updateImageSpaceRasterInfo(r),this._set("rasterInfo",r),this._files=i;const a=await this.request(i.index,{responseType:"array-buffer",signal:e});this._storageIndex=w(a.data);const{blockWidth:l,blockHeight:f}=this.rasterInfo.storageInfo,u=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:h,height:c}=this.rasterInfo,m=[],g=this._getBandSegmentCount();let d=0,y=-1;for(;d<this._storageIndex.length;){y++;const t=Math.ceil(h/l/u**y)-1,e=Math.ceil(c/f/u**y)-1;d+=(t+1)*(e+1)*g*4,m.push({maxRow:e,maxCol:t,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=m,y>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=y),this.updateTileInfo()}_getBandSegmentCount(){return this._isBsq?this.rasterInfo.bandCount:1}_getTileLocation(t,e,s){const{blockWidth:r,blockHeight:i,pyramidScalingFactor:o}=this.rasterInfo.storageInfo,{width:n,height:a}=this.rasterInfo,l=this._getBandSegmentCount();let f,u,h,c=0,p=0;for(h=0;h<t;h++)p=o**h,f=Math.ceil(n/r/p),u=Math.ceil(a/i/p),c+=f*u;p=o**t,f=Math.ceil(n/r/p),u=Math.ceil(a/i/p),c+=e*f+s,c*=4*l;const m=this._storageIndex.subarray(c,c+4*l);let g=0,d=0;const y=[];for(let x=0;x<l;x++)g=m[4*x]*2**32+m[4*x+1],d=g+m[4*x+2]*2**32+m[4*x+3]-1,y.push({from:g,to:d});return{ranges:y,actualTileWidth:s<f-1?r:Math.ceil(n/p)-r*(f-1),actualTileHeight:e<u-1?i:Math.ceil(a/p)-i*(u-1)}}_parseHeader(t){const s=u(t,"MRF_META/Raster");if(!s)throw new e("mrf:open","not a valid MRF format");const r=u(s,"Size"),a=parseInt(r.getAttribute("x"),10),f=parseInt(r.getAttribute("y"),10),c=parseInt(r.getAttribute("c"),10),p=(h(s,"Compression")||"none").toLowerCase();if(!x.has(p))throw new e("mrf:open","currently does not support compression "+p);const m=h(s,"DataType")||"UInt8",b=y.get(m.toLowerCase());if(null==b)throw new e("mrf:open","currently does not support pixel type "+m);const w=u(s,"PageSize"),I=parseInt(w.getAttribute("x"),10),_=parseInt(w.getAttribute("y"),10),A=w.getAttribute("c"),F=A?A===String(c):x.get(p).isOneSegment;this._isBsq=!F;const R=u(s,"DataValues");let S;if(R){const t=R.getAttribute("NoData");null!=t&&(S=t.trim().split(" ").map(t=>parseFloat(t)))}if(u(t,"MRF_META/CachedSource"))throw new e("mrf:open","currently does not support MRF referencing other data files");const M=u(t,"MRF_META/GeoTags"),k=u(M,"BoundingBox");let C,T=!1;if(null!=k){const t=parseFloat(k.getAttribute("minx")),e=parseFloat(k.getAttribute("miny")),s=parseFloat(k.getAttribute("maxx")),r=parseFloat(k.getAttribute("maxy")),o=h(M,"Projection")||"";let a=n.WGS84;if("LOCAL_CS[]"!==o)if(o.toLowerCase().startsWith("epsg:")){const t=Number(o.slice(5));isNaN(t)||0===t||(a=new n({wkid:t}))}else a=l(o)??n.WGS84;else T=!0,a=new n({wkid:3857});C=new i(t,e,s,r),C.spatialReference=a}else T=!0,C=new i({xmin:-.5,ymin:.5-f,xmax:a-.5,ymax:.5,spatialReference:new n({wkid:3857})});const j=u(t,"MRF_META/Rsets"),B=parseInt(j?.getAttribute("scale")||"2",10),L=C.spatialReference,E=new d({origin:new o({x:C.xmin,y:C.ymax,spatialReference:L}),blockWidth:I,blockHeight:_,pyramidBlockWidth:I,pyramidBlockHeight:_,compression:p,pyramidScalingFactor:B}),P=new o({x:C.width/a,y:C.height/f,spatialReference:L}),U=new g({width:a,height:f,extent:C,isPseudoSpatialReference:T,spatialReference:L,bandCount:c,pixelType:b,pixelSize:P,noDataValue:S,storageInfo:E}),q=this._getAuxFullPath(h(s,"DataFile")),W=this._getAuxFullPath(h(s,"IndexFile"));return{rasterInfo:U,files:{mrf:this.url,index:W||this.url.replace(".mrf",".idx"),data:q||this.url.replace(".mrf",x.get(p).blobExtension)}}}_getAuxFullPath(t){if(!t)return null;if(t.includes("\\"))return null;if(t.includes("/"))return t.startsWith(new URL(this.url).origin)?t:null;return`${this.url.slice(0,this.url.lastIndexOf("/"))}/${t}`}async _fetchAuxiliaryData(t){try{const{data:e}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:t?.signal});return f(e)}catch{return null}}};function w(t){if(t.byteLength%16>0)throw new Error("invalid array buffer must be multiples of 16");let e;if(c){const s=new Uint8Array(t),r=new ArrayBuffer(t.byteLength),i=new Uint8Array(r);for(let e=0;e<t.byteLength/4;e++)for(let t=0;t<4;t++)i[4*e+t]=s[4*e+3-t];e=new Uint32Array(r)}else e=new Uint32Array(t);return e}t([s()],b.prototype,"_files",void 0),t([s()],b.prototype,"_storageIndex",void 0),t([s()],b.prototype,"_isBsq",void 0),t([s({type:String,json:{write:!0}})],b.prototype,"datasetFormat",void 0),b=t([r("esri.layers.raster.datasets.MRFRaster")],b);const I=b;export{I as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../../../core/Error.js";import{throwIfAborted as t}from"../../../core/promiseUtils.js";import i from"../../../geometry/Extent.js";import n from"../../../geometry/Point.js";import{getByteCount as o}from"../formats/pixelRangeUtils.js";import{clip as a,snapToRaster as r}from"../functions/clipUtils.js";import{transformPixels as s}from"../functions/pixelTransformUtils.js";import{mapPixelValueToAttribute as l,mosaic as c,pixelIdFieldName as p,convertPixelBlockToFeatures as f,getValidPixels as u,countCategoricalPixels as m}from"../functions/pixelUtils.js";import{load as x,projectPolygon as h}from"../functions/rasterProjectionHelper.js";import{computeBoxStatistics as d,computeStatisticsHistograms as y}from"../functions/stretchUtils.js";import w from"../../support/Field.js";import g from"../../support/PixelBlock.js";import{getBandNames as k}from"../../../renderers/support/rasterRendererHelper.js";import b from"../../../rest/support/ImageIdentifyParameters.js";const S=2**30,B=2048,P=2**20,j=20,I=100;async function z(e,t){return"imagery"===e.type?await e.generateRasterInfo(e.rasterFunction,t):e.raster.rasterInfo}function R(e){const t=[new w({name:p,alias:"Pixel ID",type:"oid"})],{pixelType:i}=e,n="f32"===i?"single":"f64"===i?"double":"integer";return k(e).forEach(e=>{t.push(new w({name:e,alias:e,type:n}))}),t.map(e=>e.toJSON())}async function T(t,i){if(t.spatialReference.equals(i))return t;if("polyline"===t.type){const n=(await import("../../../geometry/operators/projectOperator.js")).execute(t,i);if(null==n)throw new e("read-pixels","failed to project the geometry into the layer's spatial reference");return n}if("extent"===t.type||t.rings[0].length<j){const e=(await import("../../../geometry/operators/lengthOperator.js")).execute(t,{unit:"meters"})/I;t=(await import("../../../geometry/operators/densifyOperator.js")).execute(t,e,{unit:"meters"}),await x(),t=h(t,i)}return t}async function v(e,t,i=!1){const{spatialReference:o}=e,a=t?.geometry,s=await T(a??e.extent,o),l="extent"===s.type?s:s.extent,c=null==a||"extent"===a.type&&a.spatialReference.equals(o)?void 0:s,p=new n({x:e.pixelSize.x,y:e.pixelSize.y,spatialReference:o}),f=!!t?.autoResample,u=f?p:t?.pixelSize??p;let{extent:m,width:x,height:h}=r(e,l,u);if(!f)return{extent:m,clipGeometry:c,width:x,height:h,pixelSize:u};const d=e.storageInfo?.pyramidScalingFactor??2;let{x:y,y:w}=u;const g=t?.maxPixelCount??P;for(;x*h>g&&(!i||Math.max(x,h)>1024);)y*=d,w*=d,x/=d,h/=d;return x=Math.round(x),h=Math.round(h),{extent:m,clipGeometry:c,width:x,height:h,pixelSize:new n({x:y,y:w,spatialReference:o})}}async function*M(e,n,o=!1,r){const{extent:s,clipGeometry:l,width:c,height:p}=n,f=s.width/c,u=s.height/p,m=Math.ceil(c/B),x=Math.ceil(p/B),h=f*B,d=u*B,{xmin:y,xmax:w,ymin:g,ymax:k}=s,b=x*m,S={bandIds:n.bandIds?.length?n.bandIds:void 0,interpolation:"nearest",...r};for(let P=0;P<x;P++)for(let n=0;n<m;n++){t(S);const r=new i({xmin:y+n*h,xmax:o?Math.min(w,y+(n+1)*h):y+(n+1)*h,ymax:k-P*d,ymin:o?Math.max(g,k-(P+1)*d):k-(P+1)*d,spatialReference:s.spatialReference}),c={row:P,col:n},p=P*m+n+1;if(l&&!r.intersects(l)){yield{extent:r,pixelBlock:null,id:c,total:b,current:p};continue}const x=o?Math.round(r.width/f):B,j=o?Math.round(r.height/u):B;let{pixelBlock:I}=await e.fetchPixels(r,x,j,S).catch(()=>({pixelBlock:void 0}));I&&l&&(I=await a(I,r,l)),yield{extent:r,pixelBlock:I,id:c,total:b,current:p}}}async function*F(e,i,n){const o=await z(e,n),a=R(o),r={...i,geometry:i?.geometry??o.extent},s=M(e,await v(o,r),!0,n),l=o.width;for await(const c of s){if(!c.pixelBlock){yield{...c};continue}const r=V(e),{pixelBlock:s}=c,{statistics:p,histograms:f}=await K({pixelBlock:s,rasterJobHandler:r},n),u=c;u.statistics=p,u.histograms=f;const m=c.id.row*o.width*B+c.id.col*B;t(n),u.featureSet=await _({pixelBlock:s,extent:c.extent,fields:a,skipFactor:i?.skipFactor??1,rasterJobHandler:r,pixelIdOffset:m,imageRowSize:l},n),t(n),yield u}}function H(t,i,n){const a=o(i),{width:r,height:s}=t;if(r*s*a>S)throw new e("fetch-pixels","failed to fetch pixels as pixel byte count exceeds the 1GB limit");if(n&&r*s>n)throw new e("fetch-pixels",`failed to fetch pixels as pixel count exceeds the ${n} limit`)}async function C(t,i,n){if(!i.geometry)throw new e("fetch-pixels","geometry is required to fetch pixel feature set");const o=await z(t),a=await v(o,i,!0);H(a,o.pixelType);const{extent:r,pixelSize:s}=a,l=Math.round(o.extent.width/s.x),c=R(o),p={fields:c,features:[]},f=p.features,{maxPixelCount:u}=i,m=!!i.autoResample&&null!=u&&a.width*a.height>u,x=m?1:i.skipFactor??1,h=a.width<=B||a.height<=B,d=M(t,a,1===x||h,n);for await(const e of d){if(!e.pixelBlock)continue;const i=V(t),a=Math.floor((o.extent.ymax-e.extent.ymax)/s.y)*l+Math.floor((e.extent.xmin-o.extent.xmin)/s.x),r=await _({pixelBlock:e.pixelBlock,extent:e.extent,fields:c,skipFactor:x,rasterJobHandler:i,pixelIdOffset:a,imageRowSize:l},n);if(r?.features?.length){const{features:e}=r,t=e.length;for(let i=0;i<t;i++){const t=e.pop();f.push(t)}}}if(m&&u){const e=u/(i.skipFactor??1)**2;if(f.length>e){const t=f.length/e,i=[...f],n=f.length-1;f.length=0;for(let o=0,a=0;o<e-1;o++){a+=t;const e=Math.round(a);e<n&&f.push(i[e])}}}return{extent:r,featureSet:p,pixelSize:s}}async function O(e,t,i){const{geometry:n}=t;if("multipoint"===n.type)return J(e,n,i);if("polyline"===n.type)return U(e,n,i);const o=await $(e,{geometry:n},i);if(!o)return null;return d(o)}async function J(e,t,i){const n=await z(e,i),o=t.points.map((e,i)=>t.getPoint(i)).map(t=>q(e,t,i)),a=(await Promise.all(o)).filter(e=>null!=e);if(a.length<=1)return N(a[0]);const r=a[0].map((e,t)=>a.map(e=>e[t]));return d(new g({pixels:r,pixelType:n.pixelType}))}async function q(e,t,i){if("imagery"===e.type){const n=await e.identify(new b({geometry:t,returnCatalogItems:!1}),i).catch(()=>null);return null==n?.value||n.value.includes("NoData")?null:n.value.replaceAll(", "," ").split(" ").map(e=>Number(e))}const n=await e.identify(t,i).catch(()=>null);return n?.value}function N(e){return e?.map(e=>({min:e,max:e,avg:e,median:e,quartile1:e,quartile3:e}))}async function U(e,t,i){const n=await D(e,{geometry:t},i),o=await z(e,i),{bandCount:a,pixelType:r}=o,s=new Array(a).fill(0).map(()=>g.createEmptyBand(r,n.length));let l=0;for(let c=0;c<n.length;c++){const e=n[c];if(null!=e.value){l++;for(let t=0;t<a;t++)s[t][c]=e.value[t]}}l!==n.length&&s.forEach((e,t)=>{s[t]=e.subarray(0,l)});return d(new g({pixels:s,pixelType:r}))}async function A(t,i,n){const o=await z(t,n);if(!o.attributeTable||!o.pixelType.startsWith("u"))return null;const a=o.attributeTable.clone(),r=a.fields.find(e=>"value"===e.name.toLowerCase()),s=a.fields.find(e=>"count"===e.name.toLowerCase());if(!r||!s)throw new e("compute-attribute-table","Value or count field not found in attribute table");const l=2**Number(o.pixelType.slice(1)),c=new Uint32Array(l),{geometry:p,pixelSize:f}=i;return await L(t,{geometry:p,pixelSize:f},(e,t)=>m(e,c),n),a.features.forEach(e=>{const t=e.attributes[r.name];e.attributes[s.name]=c[t]}),a}async function E(e,t,i){const{geometry:n}=t;if("point"===n.type)return q(e,n,i);if("multipoint"===n.type){const t=n.points.map((e,t)=>n.getPoint(t)).map(t=>q(e,t,i)),o=(await Promise.all(t)).filter(e=>null!=e);if(0===o.length)return null;return G(o).map(e=>e/o.length)}const o=await L(e,{geometry:n},(e,t)=>W(e),i),a=o?.filter(e=>e.count>0);if(!a?.length)return null;const r=G(a.map(e=>e.bandSum)),s=a.map(e=>e.count).reduce((e,t)=>e+t);return r.map(e=>e/s)}function G(e){return e.reduce((e,t)=>e.map((e,i)=>e+t[i]))}function W(e){const{width:t,height:i,pixels:n,mask:o}=e,a=new Array(n.length).fill(0);let r=0;for(let s=0;s<i;s++)for(let e=0;e<t;e++){const i=s*t+e;if(!o||o[i]){for(let e=0;e<n.length;e++)a[e]+=n[e][i];r++}}return{bandSum:a,count:r}}async function D(e,t,i){const n=await L(e,{geometry:t.geometry},u,i);return n?.flat()??[]}async function L(i,n,o,r){const s=i.spatialReference;let{geometry:l}=n;if("polyline"===l.type&&!l.spatialReference.equals(s)){const t=(await import("../../../geometry/operators/projectOperator.js")).execute(l,s);if(null==t)throw new e("read-pixels","failed to fetch pixels");l=t}const c="polyline"===l.type?l.extent:l,p=await T(c,s),f="polyline"===l.type?l:p,u=await z(i,r),m={geometry:p,autoResample:!1,pixelSize:n?.pixelSize},x=[],h=M(i,await v(u,m),!0,r);for await(const e of h){if(!e.pixelBlock)continue;const{extent:i}=e,n=o(await a(e.pixelBlock,i,f),i);x.push(n),t(r)}return x}async function K(e,t){const{rasterJobHandler:i}=e,{pixelBlock:n}=e,{statistics:o,histograms:a}=i?await i.computeStatisticsHistograms({pixelBlock:n},t):y(n);return{statistics:o,histograms:a}}async function _(e,t){const{extent:i,fields:n,skipFactor:o,rasterJobHandler:a,pixelIdOffset:r,imageRowSize:s}=e,{pixelBlock:l}=e,c=n.map(({name:e})=>e),p=a?await a.convertPixelBlockToFeatures({pixelBlock:l,extent:i,fieldNames:c,skipFactor:o,pixelIdOffset:r,imageRowSize:s},t):f({pixelBlock:l,extent:i,fieldNames:c,skipFactor:o,pixelIdOffset:r,imageRowSize:s});return p?{fields:n,features:p}:void 0}function V(e){return"_rasterJobHandler"in e?e._rasterJobHandler:null}async function $(e,t,i){const n=await z(e);t={...t,maxPixelCount:t.maxPixelCount??2**28};const o=await v(n,t);o.bandIds=t.bandIds?.length?t.bandIds:void 0,H(o,n.pixelType,t.maxPixelCount);const{width:a,height:r}=o;if(a<=B&&r<=B){const t=o.bandIds?.length?o.bandIds:void 0,{pixelBlock:n}=await e.fetchPixels(o.extent,a,r,{bandIds:t,interpolation:"nearest",...i});return n}const s=[],l=M(e,o,!1,i);for await(const c of l)s.push(c.pixelBlock);if(!s.some(e=>null!=e))return null;const p=Math.ceil(a/B),f=Math.ceil(r/B),u={width:p*B,height:f*B};let m;const x=V(e);if(x){const e=await x.mosaicAndTransform({srcPixelBlocks:s,srcMosaicSize:u,destDimension:u},{...i,transferPixelsToWorker:!0});m=e?.pixelBlock}else m=c(s,u);return m}async function Q(t,i,n){if(!i.geometry)throw new e("compute-statistics-histograms","geometry is required to fetch pixel feature set");let o=await $(t,i,n);if(!o)throw new e("compute-statistics-histograms","failed to get intersecting pixels");const{valueAttributeFieldName:a}=i;if(a&&"value"!==a.toLowerCase()){const e=await z(t,n);o=l(o,e,a)}const r=V(t),{transformType:c}=i;if(c){const e={lambda:i.lambda,shift:i.shift};o=r?await r.transformPixels({pixelBlock:o,transformType:c,transformParameters:e},{...n,transferPixelsToWorker:!0}):s(o,c,e)}const p=i.histogramSize??void 0;return r?await r.computeStatisticsHistograms({pixelBlock:o,histogramSize:p,includeSkewnessKurtosis:!0},{...n,transferPixelsToWorker:!0}):y(o,{histogramSize:p,includeSkewnessKurtosis:!0})}export{O as computeBoxStatistics,A as computeRasterAttributeTable,Q as computeStatisticsHistograms,F as createPixelFeatureSetCursor,C as fetchPixelFeatureSet,E as identifyAveragePixelValue,D as readIntersectingPixels};
|
|
2
|
+
import e from"../../../core/Error.js";import{throwIfAborted as t}from"../../../core/promiseUtils.js";import i from"../../../geometry/Extent.js";import n from"../../../geometry/Point.js";import{getByteCount as o}from"../formats/pixelRangeUtils.js";import{convertPixelSize as r,snapToRaster as a,clip as s}from"../functions/clipUtils.js";import{transformPixels as l}from"../functions/pixelTransformUtils.js";import{mapPixelValueToAttribute as c,mosaic as p,pixelIdFieldName as u,convertPixelBlockToFeatures as f,getValidPixels as m,countCategoricalPixels as x}from"../functions/pixelUtils.js";import{load as d,projectPolygon as h}from"../functions/rasterProjectionHelper.js";import{computeBoxStatistics as y,computeStatisticsHistograms as w}from"../functions/stretchUtils.js";import g from"../../support/Field.js";import S from"../../support/PixelBlock.js";import{getBandNames as k}from"../../../renderers/support/rasterRendererHelper.js";import b from"../../../rest/support/ImageIdentifyParameters.js";const z=2**30,B=2048,P=2**20,I=20,R=100;async function j(e,t){return"imagery"===e.type?await e.generateRasterInfo(e.rasterFunction,t):e.raster.rasterInfo}function v(e){const{rasterInfo:t,geometry:i,pixelSize:o,downsampleOnly:s=!1,maxPixelCountForDownsample:l}=e;if(!o)return!0;if(!s)return!1;const c=r(o,t.spatialReference);if(c.x+c.y<=t.pixelSize.x+t.pixelSize.y)return!0;if(null==l)return!1;const p="polyline"===i?.type?i.extent:i??t.extent,u=new n({x:t.pixelSize.x,y:t.pixelSize.y,spatialReference:t.spatialReference}),f=a(t,p,u);return f.width*f.height<=l}function T(e){const t=[new g({name:u,alias:"Pixel ID",type:"oid"})],{pixelType:i}=e,n="f32"===i?"single":"f64"===i?"double":"integer";return k(e).forEach(e=>{t.push(new g({name:e,alias:e,type:n}))}),t.map(e=>e.toJSON())}async function F(t,i){if(t.spatialReference.equals(i))return t;if("polyline"===t.type){const n=(await import("../../../geometry/operators/projectOperator.js")).execute(t,i);if(null==n)throw new e("read-pixels","failed to project the geometry into the layer's spatial reference");return n}if("extent"===t.type||t.rings[0].length<I){const e=(await import("../../../geometry/operators/lengthOperator.js")).execute(t,{unit:"meters"})/R;t=(await import("../../../geometry/operators/densifyOperator.js")).execute(t,e,{unit:"meters"}),await d(),t=h(t,i)}return t}async function M(e,t,i=!1){const{spatialReference:o}=e,r=t?.geometry,s=await F(r??e.extent,o),l="extent"===s.type?s:s.extent,c=null==r||"extent"===r.type&&r.spatialReference.equals(o)?void 0:s,p=new n({x:e.pixelSize.x,y:e.pixelSize.y,spatialReference:o}),u=!!t?.autoResample,f=u?p:t?.pixelSize??p;let{extent:m,width:x,height:d}=a(e,l,f);if(!u)return{extent:m,clipGeometry:c,width:x,height:d,pixelSize:f};const h=e.storageInfo?.pyramidScalingFactor??2;let{x:y,y:w}=f;const g=t?.maxPixelCount??P;for(;x*d>g&&(!i||Math.max(x,d)>1024);)y*=h,w*=h,x/=h,d/=h;return x=Math.round(x),d=Math.round(d),{extent:m,clipGeometry:c,width:x,height:d,pixelSize:new n({x:y,y:w,spatialReference:o})}}async function*C(e,n,o=!1,r){const{extent:a,clipGeometry:l,width:c,height:p}=n,u=a.width/c,f=a.height/p,m=Math.ceil(c/B),x=Math.ceil(p/B),d=u*B,h=f*B,{xmin:y,xmax:w,ymin:g,ymax:S}=a,k=x*m,b={bandIds:n.bandIds?.length?n.bandIds:void 0,interpolation:"nearest",...r};for(let z=0;z<x;z++)for(let n=0;n<m;n++){t(b);const r=new i({xmin:y+n*d,xmax:o?Math.min(w,y+(n+1)*d):y+(n+1)*d,ymax:S-z*h,ymin:o?Math.max(g,S-(z+1)*h):S-(z+1)*h,spatialReference:a.spatialReference}),c={row:z,col:n},p=z*m+n+1;if(l&&!r.intersects(l)){yield{extent:r,pixelBlock:null,id:c,total:k,current:p};continue}const x=o?Math.round(r.width/u):B,P=o?Math.round(r.height/f):B;let{pixelBlock:I}=await e.fetchPixels(r,x,P,b).catch(()=>({pixelBlock:void 0}));I&&l&&(I=await s(I,r,l)),yield{extent:r,pixelBlock:I,id:c,total:k,current:p}}}async function*O(e,i,n){const o=await j(e,n),r=T(o),a={...i,geometry:i?.geometry??o.extent},s=C(e,await M(o,a),!0,n),l=o.width;for await(const c of s){if(!c.pixelBlock){yield{...c};continue}const a=Q(e),{pixelBlock:s}=c,{statistics:p,histograms:u}=await V({pixelBlock:s,rasterJobHandler:a},n),f=c;f.statistics=p,f.histograms=u;const m=c.id.row*o.width*B+c.id.col*B;t(n),f.featureSet=await $({pixelBlock:s,extent:c.extent,fields:r,skipFactor:i?.skipFactor??1,rasterJobHandler:a,pixelIdOffset:m,imageRowSize:l},n),t(n),yield f}}function H(t,i,n){const r=o(i),{width:a,height:s}=t;if(a*s*r>z)throw new e("fetch-pixels","failed to fetch pixels as pixel byte count exceeds the 1GB limit");if(n&&a*s>n)throw new e("fetch-pixels",`failed to fetch pixels as pixel count exceeds the ${n} limit`)}async function D(t,i,n){if(!i.geometry)throw new e("fetch-pixels","geometry is required to fetch pixel feature set");const o=await j(t),r=await M(o,i,!0);H(r,o.pixelType);const{extent:a,pixelSize:s}=r,l=Math.round(o.extent.width/s.x),c=T(o),p={fields:c,features:[]},u=p.features,{maxPixelCount:f}=i,m=!!i.autoResample&&null!=f&&r.width*r.height>f,x=m?1:i.skipFactor??1,d=r.width<=B||r.height<=B,h=C(t,r,1===x||d,n);for await(const e of h){if(!e.pixelBlock)continue;const i=Q(t),r=Math.floor((o.extent.ymax-e.extent.ymax)/s.y)*l+Math.floor((e.extent.xmin-o.extent.xmin)/s.x),a=await $({pixelBlock:e.pixelBlock,extent:e.extent,fields:c,skipFactor:x,rasterJobHandler:i,pixelIdOffset:r,imageRowSize:l},n);if(a?.features?.length){const{features:e}=a,t=e.length;for(let i=0;i<t;i++){const t=e.pop();u.push(t)}}}if(m&&f){const e=f/(i.skipFactor??1)**2;if(u.length>e){const t=u.length/e,i=[...u],n=u.length-1;u.length=0;for(let o=0,r=0;o<e-1;o++){r+=t;const e=Math.round(r);e<n&&u.push(i[e])}}}return{extent:a,featureSet:p,pixelSize:s}}async function J(e,t,i){const{geometry:n}=t;if("multipoint"===n.type)return q(e,n,i);if("polyline"===n.type)return A(e,n,i);const o=await X(e,{geometry:n},i);if(!o)return null;return y(o)}async function q(e,t,i){const n=await j(e,i),o=t.points.map((e,i)=>t.getPoint(i)).map(t=>N(e,t,i)),r=(await Promise.all(o)).filter(e=>null!=e);if(r.length<=1)return U(r[0]);const a=r[0].map((e,t)=>r.map(e=>e[t]));return y(new S({pixels:a,pixelType:n.pixelType}))}async function N(e,t,i){if("imagery"===e.type){const n=await e.identify(new b({geometry:t,returnCatalogItems:!1}),i).catch(()=>null);return null==n?.value||n.value.includes("NoData")?null:n.value.replaceAll(", "," ").split(" ").map(e=>Number(e))}const n=await e.identify(t,i).catch(()=>null);return n?.value}function U(e){return e?.map(e=>({min:e,max:e,avg:e,median:e,quartile1:e,quartile3:e}))}async function A(e,t,i){const n=await K(e,{geometry:t},i),o=await j(e,i),{bandCount:r,pixelType:a}=o,s=new Array(r).fill(0).map(()=>S.createEmptyBand(a,n.length));let l=0;for(let c=0;c<n.length;c++){const e=n[c];if(null!=e.value){l++;for(let t=0;t<r;t++)s[t][c]=e.value[t]}}l!==n.length&&s.forEach((e,t)=>{s[t]=e.subarray(0,l)});return y(new S({pixels:s,pixelType:a}))}async function E(t,i,n){const o=await j(t,n);if(!o.attributeTable||!o.pixelType.startsWith("u"))return null;const r=o.attributeTable.clone(),a=r.fields.find(e=>"value"===e.name.toLowerCase()),s=r.fields.find(e=>"count"===e.name.toLowerCase());if(!a||!s)throw new e("compute-attribute-table","Value or count field not found in attribute table");const l=2**Number(o.pixelType.slice(1)),c=new Uint32Array(l),{geometry:p,pixelSize:u,downsampleOnly:f,maxPixelCountForDownsample:m}=i,d=v({rasterInfo:o,geometry:p,pixelSize:u,downsampleOnly:f,maxPixelCountForDownsample:m})?void 0:u;return await _(t,{geometry:p,pixelSize:d},(e,t)=>x(e,c),n),r.features.forEach(e=>{const t=e.attributes[a.name];e.attributes[s.name]=c[t]}),r}async function G(e,t,i){const{geometry:n}=t;if("point"===n.type)return N(e,n,i);if("multipoint"===n.type){const t=n.points.map((e,t)=>n.getPoint(t)).map(t=>N(e,t,i)),o=(await Promise.all(t)).filter(e=>null!=e);if(0===o.length)return null;return W(o).map(e=>e/o.length)}const o=await _(e,{geometry:n},(e,t)=>L(e),i),r=o?.filter(e=>e.count>0);if(!r?.length)return null;const a=W(r.map(e=>e.bandSum)),s=r.map(e=>e.count).reduce((e,t)=>e+t);return a.map(e=>e/s)}function W(e){return e.reduce((e,t)=>e.map((e,i)=>e+t[i]))}function L(e){const{width:t,height:i,pixels:n,mask:o}=e,r=new Array(n.length).fill(0);let a=0;for(let s=0;s<i;s++)for(let e=0;e<t;e++){const i=s*t+e;if(!o||o[i]){for(let e=0;e<n.length;e++)r[e]+=n[e][i];a++}}return{bandSum:r,count:a}}async function K(e,t,i){const n=await _(e,{geometry:t.geometry},m,i);return n?.flat()??[]}async function _(i,n,o,r){const a=i.spatialReference;let{geometry:l}=n;if("polyline"===l.type&&!l.spatialReference.equals(a)){const t=(await import("../../../geometry/operators/projectOperator.js")).execute(l,a);if(null==t)throw new e("read-pixels","failed to fetch pixels");l=t}const c="polyline"===l.type?l.extent:l,p=await F(c,a),u="polyline"===l.type?l:p,f=await j(i,r),m={geometry:p,autoResample:!1,pixelSize:n?.pixelSize},x=[],d=C(i,await M(f,m),!0,r);for await(const e of d){if(!e.pixelBlock)continue;const{extent:i}=e,n=o(await s(e.pixelBlock,i,u),i);x.push(n),t(r)}return x}async function V(e,t){const{rasterJobHandler:i}=e,{pixelBlock:n}=e,{statistics:o,histograms:r}=i?await i.computeStatisticsHistograms({pixelBlock:n},t):w(n);return{statistics:o,histograms:r}}async function $(e,t){const{extent:i,fields:n,skipFactor:o,rasterJobHandler:r,pixelIdOffset:a,imageRowSize:s}=e,{pixelBlock:l}=e,c=n.map(({name:e})=>e),p=r?await r.convertPixelBlockToFeatures({pixelBlock:l,extent:i,fieldNames:c,skipFactor:o,pixelIdOffset:a,imageRowSize:s},t):f({pixelBlock:l,extent:i,fieldNames:c,skipFactor:o,pixelIdOffset:a,imageRowSize:s});return p?{fields:n,features:p}:void 0}function Q(e){return"_rasterJobHandler"in e?e._rasterJobHandler:null}async function X(e,t,i){const n=await j(e);t={...t,maxPixelCount:t.maxPixelCount??2**28};const o=await M(n,t);o.bandIds=t.bandIds?.length?t.bandIds:void 0,H(o,n.pixelType,t.maxPixelCount);const{width:r,height:a}=o;if(r<=B&&a<=B){const t=o.bandIds?.length?o.bandIds:void 0,{pixelBlock:n}=await e.fetchPixels(o.extent,r,a,{bandIds:t,interpolation:"nearest",...i});return n}const s=[],l=C(e,o,!1,i);for await(const p of l)s.push(p.pixelBlock);if(!s.some(e=>null!=e))return null;const c=Math.ceil(r/B),u=Math.ceil(a/B),f={width:c*B,height:u*B};let m;const x=Q(e);if(x){const e=await x.mosaicAndTransform({srcPixelBlocks:s,srcMosaicSize:f,destDimension:f},{...i,transferPixelsToWorker:!0});m=e?.pixelBlock}else m=p(s,f);return m}async function Y(t,i,n){if(!i.geometry)throw new e("compute-statistics-histograms","geometry is required to fetch pixel feature set");const{pixelSize:o,downsampleOnly:r,maxPixelCountForDownsample:a}=i,s=await j(t,n),p=v({rasterInfo:s,geometry:i.geometry,pixelSize:o,downsampleOnly:r,maxPixelCountForDownsample:a})?void 0:o;let u=await X(t,{...i,pixelSize:p},n);if(!u)throw new e("compute-statistics-histograms","failed to get intersecting pixels");const{valueAttributeFieldName:f}=i;f&&"value"!==f.toLowerCase()&&(u=c(u,s,f));const m=Q(t),{transformType:x}=i;if(x){const e={lambda:i.lambda,shift:i.shift};u=m?await m.transformPixels({pixelBlock:u,transformType:x,transformParameters:e},{...n,transferPixelsToWorker:!0}):l(u,x,e)}const d=i.histogramSize??void 0;return m?await m.computeStatisticsHistograms({pixelBlock:u,histogramSize:d,includeSkewnessKurtosis:!0},{...n,transferPixelsToWorker:!0}):w(u,{histogramSize:d,includeSkewnessKurtosis:!0})}export{J as computeBoxStatistics,E as computeRasterAttributeTable,Y as computeStatisticsHistograms,O as createPixelFeatureSetCursor,D as fetchPixelFeatureSet,G as identifyAveragePixelValue,K as readIntersectingPixels};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{J as t}from"../../../chunks/Jpg.js";import{F as e}from"../../../chunks/Zlib.js";class r{static decode(r,n=!1){const s=new Uint8Array(r),
|
|
2
|
+
import{J as t}from"../../../chunks/Jpg.js";import{F as e}from"../../../chunks/Zlib.js";class r{static decode(r,n=!1){const s=new Uint8Array(r),o=new t;o.parse(s);const{width:a,height:l,numComponents:i,eof:f}=o,h=o.getData(a,l,1!==i),c=a*l;let u,g=null;if(n&&f<s.length-1)try{const t=new e(s.subarray(f)).getBytes();g=new Uint8Array(c);for(let e=0,r=0;e<t.length;e++)for(let n=7;n>=0;n--)g[r++]=t[e]>>n&1}catch{}if(1===i&&h.length===a*l){const t=new Uint8Array(h.buffer);u=[t,t,t]}else{u=[];for(let t=0;t<3;t++)u.push(new Uint8Array(c));for(let t=0,e=0;t<c;t++)for(let r=0;r<3;r++)u[r][t]=h[e++]}return{width:a,height:l,pixels:u,mask:g}}}export{r as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import t from"../../../core/Error.js";import{assertIsSome as e}from"../../../core/maybe.js";import{isAbortError as a}from"../../../core/promiseUtils.js";import{decode as i}from"./ImageCanvasDecoder.js";import s from"./JpgPlus.js";import{load as r,decode as n}from"./Lerc.js";import{decode as o}from"./Lzw.js";import{convertNoDataToMask as h}from"./pixelRangeUtils.js";import{F as c}from"../../../chunks/Zlib.js";import{load as l,decode as p}from"./Qb3.js";import d from"./Raw.js";import{decodeTileOrStrip as u,decode as f}from"./TiffDecoder.js";import{isPlatformLittleEndian as m}from"./utils.js";import w from"../../support/PixelBlock.js";import g from"../../support/SimpleBandStatistics.js";var y=function(t){var e,a,i,s,r,n;function o(t){var e,a,i,s,r,n,o,h,c,l,p,d,u;for(this.data=t,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.animation=null,this.text={},r=null;;){switch(e=this.readUInt32(),h=function(){var t,e;for(e=[],t=0;t<4;++t)e.push(String.fromCharCode(this.data[this.pos++]));return e}.call(this).join(""),h){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(e);break;case"fcTL":r&&this.animation.frames.push(r),this.pos+=4,r={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()},s=this.readUInt16(),i=this.readUInt16()||100,r.delay=1e3*s/i,r.disposeOp=this.data[this.pos++],r.blendOp=this.data[this.pos++],r.data=[];break;case"IDAT":case"fdAT":for("fdAT"===h&&(this.pos+=4,e-=4),t=(null!=r?r.data:void 0)||this.imgData,p=0;0<=e?p<e:p>e;0<=e?++p:--p)t.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(this.transparency.indexed=this.read(e),(c=255-this.transparency.indexed.length)>0)for(d=0;0<=c?d<c:d>c;0<=c?++d:--d)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(e)[0];break;case 2:this.transparency.rgb=this.read(e)}break;case"tEXt":n=(l=this.read(e)).indexOf(0),o=String.fromCharCode.apply(String,l.slice(0,n)),this.text[o]=String.fromCharCode.apply(String,l.slice(n+1));break;case"IEND":return r&&this.animation.frames.push(r),this.colors=function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}.call(this),this.hasAlphaChannel=4===(u=this.colorType)||6===u,a=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*a,this.colorSpace=function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}.call(this),void(this.imgData=new Uint8Array(this.imgData));default:this.pos+=e}if(this.pos+=4,this.pos>this.data.length)throw new Error("Incomplete or corrupt PNG file")}}return o.load=function(t,e,a){var i;return"function"==typeof e&&(a=e),(i=new XMLHttpRequest).open("GET",t,!0),i.responseType="arraybuffer",i.onload=function(){var t;return t=new o(new Uint8Array(i.response||i.mozResponseArrayBuffer)),"function"==typeof(null!=e?e.getContext:void 0)&&t.render(e),"function"==typeof a?a(t):void 0},i.send(null)},a=1,i=2,e=0,o.prototype.read=function(t){var e,a;for(a=[],e=0;0<=t?e<t:e>t;0<=t?++e:--e)a.push(this.data[this.pos++]);return a},o.prototype.readUInt32=function(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]},o.prototype.readUInt16=function(){return this.data[this.pos++]<<8|this.data[this.pos++]},o.prototype.decodePixels=function(t){var e,a,i,s,r,n,o,h,l,p,d,u,f,m,w,g,y,x,b,k,v,T,C;if(null==t&&(t=this.imgData),0===t.length)return new Uint8Array(0);for(t=(t=new c(t)).getBytes(),g=(u=this.pixelBitlength/8)*this.width,f=new Uint8Array(g*this.height),n=t.length,w=0,m=0,a=0;m<n;){switch(t[m++]){case 0:for(s=b=0;b<g;s=b+=1)f[a++]=t[m++];break;case 1:for(s=k=0;k<g;s=k+=1)e=t[m++],r=s<u?0:f[a-u],f[a++]=(e+r)%256;break;case 2:for(s=v=0;v<g;s=v+=1)e=t[m++],i=(s-s%u)/u,y=w&&f[(w-1)*g+i*u+s%u],f[a++]=(y+e)%256;break;case 3:for(s=T=0;T<g;s=T+=1)e=t[m++],i=(s-s%u)/u,r=s<u?0:f[a-u],y=w&&f[(w-1)*g+i*u+s%u],f[a++]=(e+Math.floor((r+y)/2))%256;break;case 4:for(s=C=0;C<g;s=C+=1)e=t[m++],i=(s-s%u)/u,r=s<u?0:f[a-u],0===w?y=x=0:(y=f[(w-1)*g+i*u+s%u],x=i&&f[(w-1)*g+(i-1)*u+s%u]),o=r+y-x,h=Math.abs(o-r),p=Math.abs(o-y),d=Math.abs(o-x),l=h<=p&&h<=d?r:p<=d?y:x,f[a++]=(e+l)%256;break;default:throw new Error("Invalid filter algorithm: "+t[m-1])}w++}return f},o.prototype.decodePalette=function(){var t,e,a,i,s,r,n,o,h;for(a=this.palette,r=this.transparency.indexed||[],s=new Uint8Array((r.length||0)+a.length),i=0,a.length,t=0,e=n=0,o=a.length;n<o;e=n+=3)s[i++]=a[e],s[i++]=a[e+1],s[i++]=a[e+2],s[i++]=null!=(h=r[t++])?h:255;return s},o.prototype.copyToImageData=function(t,e){var a,i,s,r,n,o,h,c,l,p,d;if(i=this.colors,l=null,a=this.hasAlphaChannel,this.palette.length&&(l=null!=(d=this._decodedPalette)?d:this._decodedPalette=this.decodePalette(),i=4,a=!0),c=(s=t.data||t).length,n=l||e,r=o=0,1===i)for(;r<c;)h=l?4*e[r/4]:o,p=n[h++],s[r++]=p,s[r++]=p,s[r++]=p,s[r++]=a?n[h++]:this.transparency.grayscale&&this.transparency.grayscale===p?0:255,o=h;else for(;r<c;)h=l?4*e[r/4]:o,s[r++]=n[h++],s[r++]=n[h++],s[r++]=n[h++],s[r++]=a?n[h++]:this.transparency.rgb&&this.transparency.rgb[1]===n[h-3]&&this.transparency.rgb[3]===n[h-2]&&this.transparency.rgb[5]===n[h-1]?0:255,o=h},o.prototype.decode=function(){var t;return t=new Uint8Array(this.width*this.height*4),this.copyToImageData(t,this.decodePixels()),t},r=t.document&&t.document.createElement("canvas"),n=r&&r.getContext("2d"),s=function(t){var e;return n.width=t.width,n.height=t.height,n.clearRect(0,0,t.width,t.height),n.putImageData(t,0,0),(e=new Image).src=r.toDataURL(),e},o.prototype.decodeFrames=function(t){var e,a,i,r,n,o,h,c;if(this.animation){for(c=[],a=n=0,o=(h=this.animation.frames).length;n<o;a=++n)e=h[a],i=t.createImageData(e.width,e.height),r=this.decodePixels(new Uint8Array(e.data)),this.copyToImageData(i,r),e.imageData=i,c.push(e.image=s(i));return c}},o.prototype.renderFrame=function(t,s){var r,n,o;return r=(n=this.animation.frames)[s],o=n[s-1],0===s&&t.clearRect(0,0,this.width,this.height),(null!=o?o.disposeOp:void 0)===a?t.clearRect(o.xOffset,o.yOffset,o.width,o.height):(null!=o?o.disposeOp:void 0)===i&&t.putImageData(o.imageData,o.xOffset,o.yOffset),r.blendOp===e&&t.clearRect(r.xOffset,r.yOffset,r.width,r.height),t.drawImage(r.image,r.xOffset,r.yOffset)},o.prototype.animate=function(t){var e,a,i,s,r,n,o=this;return a=0,n=this.animation,s=n.numFrames,i=n.frames,r=n.numPlays,(e=function(){var n,h;if(n=a++%s,h=i[n],o.renderFrame(t,n),s>1&&a/s<r)return o.animation._timeout=setTimeout(e,h.delay)})()},o.prototype.stopAnimation=function(){var t;return clearTimeout(null!=(t=this.animation)?t._timeout:void 0)},o.prototype.render=function(t){var e,a;return t._png&&t._png.stopAnimation(),t._png=this,t.width=this.width,t.height=this.height,e=t.getContext("2d"),this.animation?(this.decodeFrames(e),this.animate(e)):(a=e.createImageData(this.width,this.height),this.copyToImageData(a,this.decodePixels()),e.putImageData(a,0,0))},o}(self);const x=new Set(["jpg","png","bmp","gif"]);async function b(e,a){if(!m)throw new t("rasterCoded:decode","lerc decoder is not supported on big endian platform");await r();const{offset:i}=a,{width:s,height:o,pixelType:h,statistics:c,depthCount:l,noDataValues:p,bandMasks:d,pixels:u,mask:f,validPixelCount:y}=n(e,{inputOffset:i,returnInterleaved:a.returnInterleaved}),x=new w({width:s,height:o,pixelType:h.toLowerCase(),pixels:u,mask:f,validPixelCount:y,statistics:c.map(({minValue:t,maxValue:e})=>new g(t,e)),bandMasks:d,depthCount:l,noDataValues:p});return c?.length||a.skipStatistics||x.updateStatistics(),x}async function k(e,a){await l();const i=p(e);if(!i)throw new t("rasterCodec:decode","failed to decode the input data.");const{width:s,height:r,pixels:n,pixelType:o}=i,h=new w({width:s,height:r,pixelType:o,pixels:n});return a.skipStatistics||h.updateStatistics(),h}async function v(t,a){const i=await f(t,{...a,noDataValue:a.tiffNoDataValue,matchAllNoData:a.matchAllNoData});e(i);const s=new w({width:i.width,height:i.height,pixels:i.pixels,pixelType:i.pixelType.toLowerCase(),mask:i.mask,bandMasks:i.bandMasks,statistics:null});return a.skipStatistics||s.updateStatistics(),s}async function T(t,e){const a=await u(t,e.customOptions),i=new w({width:a.width,height:a.height,pixels:a.pixels,pixelType:a.pixelType.toLowerCase(),mask:a.mask,statistics:null});return e.skipStatistics||i.updateStatistics(),i}function C(t,e){const a=e.pixelType||"u8",i=w.getPixelArrayConstructor(a),s="u8"===a?t:new i(t.buffer),r=[],n=e.planes||1;if(1===n)r.push(s);else for(let h=0;h<n;h++){const a=(e.width||1)*(e.height||t.length),o=new i(a);for(let t=0;t<a;t++)o[t]=s[t*n+h];r.push(o)}const o=new w({width:e.width||1,height:e.height||t.length,pixels:r,pixelType:a,statistics:null});return e.skipStatistics||o.updateStatistics(),o}function I(t,e){return C(new c(new Uint8Array(t)).getBytes(),e)}function U(t,e){return C(o(t,e.offset,e.eof,!e.isInputBigEndian),e)}function A(t,e,a){const{pixelTypeCtor:i}=M(e.pixelType),s=(0,d.decode)(t,{width:e.width,height:e.height,pixelType:i,format:a}),r=new w({width:e.width,height:e.height,pixels:s.pixels,pixelType:e.pixelType,mask:s.mask,statistics:null});return e.skipStatistics||r.updateStatistics(),r}function D(t,e){const a=s.decode(t,e.applyJpegMask),i=new w({width:a.width,height:a.height,pixels:a.pixels,pixelType:"u8",mask:a.mask,statistics:null});return e.skipStatistics||i.updateStatistics(),i}function S(t,e){const a=new Uint8Array(t),i=new y(a),{width:s,height:r}=e,n=s*r,o=i.decode(),h=new Uint8Array(n);for(let l=0;l<n;l++)h[l]=o[4*l+3];const c=new w({width:s,height:r,pixels:[],pixelType:"u8",mask:h,statistics:[]});for(let l=0;l<3;l++){const t=new Uint8Array(n);for(let e=0;e<n;e++)t[e]=o[4*e+l];c.addData({pixels:t})}return e.skipStatistics||c.updateStatistics(),c}async function P(t,e,a,s){const r={...a,format:e},n=await i(t,r,s),o=new w(n);return a.skipStatistics||o.updateStatistics(),o}function j(e){if(null==e)throw new t("rasterCodec:decode","parameter encodeddata is required.");const a=new Uint8Array(e,0,10);let i="";return 255===a[0]&&216===a[1]?i="jpg":137===a[0]&&80===a[1]&&78===a[2]&&71===a[3]?i="png":67===a[0]&&110===a[1]&&116===a[2]&&90===a[3]&&73===a[4]&&109===a[5]&&97===a[6]&&103===a[7]&&101===a[8]&&32===a[9]?i="lerc":76===a[0]&&101===a[1]&&114===a[2]&&99===a[3]&&50===a[4]&&32===a[5]?i="lerc2":73===a[0]&&73===a[1]&&42===a[2]&&0===a[3]||77===a[0]&&77===a[1]&&0===a[2]&&42===a[3]||73===a[0]&&73===a[1]&&43===a[2]&&0===a[3]||77===a[0]&&77===a[1]&&0===a[2]&&43===a[3]?i="tiff":71===a[0]&&73===a[1]&&70===a[2]?i="gif":66===a[0]&&77===a[1]?i="bmp":81===a[0]&&66===a[1]&&51===a[2]?i="qb3":String.fromCharCode.apply(null,a).toLowerCase().includes("error")&&(i="error"),i}function O(e){let a=null;switch(e){case"lerc":case"lerc2":a=b;break;case"jpg":a=D;break;case"png":a=S;break;case"bsq":case"bip":a=(t,a)=>A(t,a,e);break;case"tiff":a=v;break;case"deflate":a=I;break;case"lzw":a=U;break;case"qb3":a=k;break;case"error":a=()=>{throw new t("rasterCodec:decode","input data contains error")};break;default:a=()=>{throw new t("rasterCodec:decode","unsupported raster format")}}return a}function M(t){let e=null,a=null;switch(t?t.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":a=255,e=Uint8Array;break;case"u16":a=a||65535,e=Uint16Array;break;case"u32":a=a||2**32-1,e=Uint32Array;break;case"s8":a=a||-128,e=Int8Array;break;case"s16":a=a||-32768,e=Int16Array;break;case"s32":a=a||0-2**31,e=Int32Array;break;default:e=Float32Array}return{pixelTypeCtor:e,noDataValue:a}}function L(t,e=1){if(!t)return;const{pixels:a,width:i,height:s,mask:r}=t;if(!a||0===a.length)return;const n=i-1,o=s-1,h=[];let c=null;const l=w.getPixelArrayConstructor(t.pixelType);if(0===e){for(const t of a){const e=new l(n*o);for(let a=0;a<o;a++){const s=a*i;for(let i=0;i<n;i++)e[a*n+i]=t[s+i]}h.push(e)}if(null!=r){c=new Uint8Array(n*o);for(let t=0;t<o;t++){const e=t*i;for(let a=0;a<n;a++)c[t*n+a]=r[e+a]}}}else{for(const t of a){const e=new l(n*o);for(let a=0;a<o;a++){const s=a*i;for(let r=0;r<n;r++)e[a*n+r]=(t[s+r]+t[s+r+1]+t[s+i+r]+t[s+i+r+1])/4}h.push(e)}if(r){c=new Uint8Array(n*o);for(let t=0;t<o;t++){const e=t*i;for(let a=0;a<n;a++)c[t*n+a]=Math.min.apply(null,[r[e+a],r[e+a+1],r[e+i+a],r[e+i+a+1]])}}}t.width=n,t.height=o,t.mask=c,t.pixels=h}function R(t){let e=j(t);return"lerc2"===e?e="lerc":"error"===e&&(e=""),e}async function B(e,i={},s){if(null==e)throw new t("rasterCodec:decode","missing encodeddata parameter.");let r=i.format?.toLowerCase();if(!("bsq"!==r&&"bip"!==r||null!=i.width&&null!=i.height))throw new t("rasterCodec:decode","requires width and height in options parameter.");if("tiff"===r&&i.customOptions)return T(e,i);if((!r||"bsq"!==r&&"bip"!==r&&"deflate"!==r&&"lzw"!==r)&&(r=j(e)),"no-canvas"!==i.canvasUsage&&x.has(r))try{return await P(e,r,i,s)}catch(l){if(a(l))throw l;if("canvas-only"===i.canvasUsage)throw new t("rasterCodec:decode",`failed to decode the input data with canvas for format ${r}`)}const n=O(r);let o;i.isPoint&&(null!=(i={...i}).width&&i.width++,null!=i.height&&i.height++);const{offsets:c}=i;if(c&&c.length>1){const t=c.map((t,a)=>n(e.slice(t,c[a+1]),i)),a=await Promise.all(t);o=a[0],o.pixels=a.map(t=>t.pixels[0]);const s=a.map(t=>t.mask);a.some(t=>null!=t)&&(s.forEach((t,e)=>{null==t&&(s[e]=new Uint8Array(o.width*o.height).fill(255))}),o.bandMasks=s,o.mask=w.combineBandMasks(s)),o.updateStatistics()}else o=await n(e,{...i,offset:c?.[0]??i.offset});return"jpg"!==r&&null!=i.noDataValue&&1===o.depthCount&&h(o,i.noDataValue,{customFloatTolerance:i.tolerance}),i.isPoint&&L(o),o}export{B as decode,R as getFormat};
|
|
2
|
+
import t from"../../../core/Error.js";import{assertIsSome as e}from"../../../core/maybe.js";import{isAbortError as a}from"../../../core/promiseUtils.js";import{decode as i}from"./ImageCanvasDecoder.js";import s from"./JpgPlus.js";import{load as r,decode as n}from"./Lerc.js";import{decode as o}from"./Lzw.js";import{convertNoDataToMask as h}from"./pixelRangeUtils.js";import{F as c}from"../../../chunks/Zlib.js";import{load as l,decode as p}from"./Qb3.js";import d from"./Raw.js";import{decodeTileOrStrip as f,decode as u}from"./TiffDecoder.js";import{isPlatformLittleEndian as m}from"./utils.js";import w from"../../support/PixelBlock.js";import g from"../../support/SimpleBandStatistics.js";var y=function(t){var e,a,i,s,r,n;function o(t){var e,a,i,s,r,n,o,h,c,l,p,d,f;for(this.data=t,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.animation=null,this.text={},r=null;;){switch(e=this.readUInt32(),h=function(){var t,e;for(e=[],t=0;t<4;++t)e.push(String.fromCharCode(this.data[this.pos++]));return e}.call(this).join(""),h){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(e);break;case"fcTL":r&&this.animation.frames.push(r),this.pos+=4,r={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()},s=this.readUInt16(),i=this.readUInt16()||100,r.delay=1e3*s/i,r.disposeOp=this.data[this.pos++],r.blendOp=this.data[this.pos++],r.data=[];break;case"IDAT":case"fdAT":for("fdAT"===h&&(this.pos+=4,e-=4),t=(null!=r?r.data:void 0)||this.imgData,p=0;0<=e?p<e:p>e;0<=e?++p:--p)t.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(this.transparency.indexed=this.read(e),(c=255-this.transparency.indexed.length)>0)for(d=0;0<=c?d<c:d>c;0<=c?++d:--d)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(e)[0];break;case 2:this.transparency.rgb=this.read(e)}break;case"tEXt":n=(l=this.read(e)).indexOf(0),o=String.fromCharCode.apply(String,l.slice(0,n)),this.text[o]=String.fromCharCode.apply(String,l.slice(n+1));break;case"IEND":return r&&this.animation.frames.push(r),this.colors=function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}.call(this),this.hasAlphaChannel=4===(f=this.colorType)||6===f,a=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*a,this.colorSpace=function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}.call(this),void(this.imgData=new Uint8Array(this.imgData));default:this.pos+=e}if(this.pos+=4,this.pos>this.data.length)throw new Error("Incomplete or corrupt PNG file")}}return o.load=function(t,e,a){var i;return"function"==typeof e&&(a=e),(i=new XMLHttpRequest).open("GET",t,!0),i.responseType="arraybuffer",i.onload=function(){var t;return t=new o(new Uint8Array(i.response||i.mozResponseArrayBuffer)),"function"==typeof(null!=e?e.getContext:void 0)&&t.render(e),"function"==typeof a?a(t):void 0},i.send(null)},a=1,i=2,e=0,o.prototype.read=function(t){var e,a;for(a=[],e=0;0<=t?e<t:e>t;0<=t?++e:--e)a.push(this.data[this.pos++]);return a},o.prototype.readUInt32=function(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]},o.prototype.readUInt16=function(){return this.data[this.pos++]<<8|this.data[this.pos++]},o.prototype.decodePixels=function(t){var e,a,i,s,r,n,o,h,l,p,d,f,u,m,w,g,y,x,b,k,T,v,C;if(null==t&&(t=this.imgData),0===t.length)return new Uint8Array(0);for(t=(t=new c(t)).getBytes(),g=(f=this.pixelBitlength/8)*this.width,u=new Uint8Array(g*this.height),n=t.length,w=0,m=0,a=0;m<n;){switch(t[m++]){case 0:for(s=b=0;b<g;s=b+=1)u[a++]=t[m++];break;case 1:for(s=k=0;k<g;s=k+=1)e=t[m++],r=s<f?0:u[a-f],u[a++]=(e+r)%256;break;case 2:for(s=T=0;T<g;s=T+=1)e=t[m++],i=(s-s%f)/f,y=w&&u[(w-1)*g+i*f+s%f],u[a++]=(y+e)%256;break;case 3:for(s=v=0;v<g;s=v+=1)e=t[m++],i=(s-s%f)/f,r=s<f?0:u[a-f],y=w&&u[(w-1)*g+i*f+s%f],u[a++]=(e+Math.floor((r+y)/2))%256;break;case 4:for(s=C=0;C<g;s=C+=1)e=t[m++],i=(s-s%f)/f,r=s<f?0:u[a-f],0===w?y=x=0:(y=u[(w-1)*g+i*f+s%f],x=i&&u[(w-1)*g+(i-1)*f+s%f]),o=r+y-x,h=Math.abs(o-r),p=Math.abs(o-y),d=Math.abs(o-x),l=h<=p&&h<=d?r:p<=d?y:x,u[a++]=(e+l)%256;break;default:throw new Error("Invalid filter algorithm: "+t[m-1])}w++}return u},o.prototype.decodePalette=function(){var t,e,a,i,s,r,n,o,h;for(a=this.palette,r=this.transparency.indexed||[],s=new Uint8Array((r.length||0)+a.length),i=0,a.length,t=0,e=n=0,o=a.length;n<o;e=n+=3)s[i++]=a[e],s[i++]=a[e+1],s[i++]=a[e+2],s[i++]=null!=(h=r[t++])?h:255;return s},o.prototype.copyToImageData=function(t,e){var a,i,s,r,n,o,h,c,l,p,d;if(i=this.colors,l=null,a=this.hasAlphaChannel,this.palette.length&&(l=null!=(d=this._decodedPalette)?d:this._decodedPalette=this.decodePalette(),i=4,a=!0),c=(s=t.data||t).length,n=l||e,r=o=0,1===i)for(;r<c;)h=l?4*e[r/4]:o,p=n[h++],s[r++]=p,s[r++]=p,s[r++]=p,s[r++]=a?n[h++]:this.transparency.grayscale&&this.transparency.grayscale===p?0:255,o=h;else for(;r<c;)h=l?4*e[r/4]:o,s[r++]=n[h++],s[r++]=n[h++],s[r++]=n[h++],s[r++]=a?n[h++]:this.transparency.rgb&&this.transparency.rgb[1]===n[h-3]&&this.transparency.rgb[3]===n[h-2]&&this.transparency.rgb[5]===n[h-1]?0:255,o=h},o.prototype.decode=function(){var t;return t=new Uint8Array(this.width*this.height*4),this.copyToImageData(t,this.decodePixels()),t},r=t.document&&t.document.createElement("canvas"),n=r&&r.getContext("2d"),s=function(t){var e;return n.width=t.width,n.height=t.height,n.clearRect(0,0,t.width,t.height),n.putImageData(t,0,0),(e=new Image).src=r.toDataURL(),e},o.prototype.decodeFrames=function(t){var e,a,i,r,n,o,h,c;if(this.animation){for(c=[],a=n=0,o=(h=this.animation.frames).length;n<o;a=++n)e=h[a],i=t.createImageData(e.width,e.height),r=this.decodePixels(new Uint8Array(e.data)),this.copyToImageData(i,r),e.imageData=i,c.push(e.image=s(i));return c}},o.prototype.renderFrame=function(t,s){var r,n,o;return r=(n=this.animation.frames)[s],o=n[s-1],0===s&&t.clearRect(0,0,this.width,this.height),(null!=o?o.disposeOp:void 0)===a?t.clearRect(o.xOffset,o.yOffset,o.width,o.height):(null!=o?o.disposeOp:void 0)===i&&t.putImageData(o.imageData,o.xOffset,o.yOffset),r.blendOp===e&&t.clearRect(r.xOffset,r.yOffset,r.width,r.height),t.drawImage(r.image,r.xOffset,r.yOffset)},o.prototype.animate=function(t){var e,a,i,s,r,n,o=this;return a=0,n=this.animation,s=n.numFrames,i=n.frames,r=n.numPlays,(e=function(){var n,h;if(n=a++%s,h=i[n],o.renderFrame(t,n),s>1&&a/s<r)return o.animation._timeout=setTimeout(e,h.delay)})()},o.prototype.stopAnimation=function(){var t;return clearTimeout(null!=(t=this.animation)?t._timeout:void 0)},o.prototype.render=function(t){var e,a;return t._png&&t._png.stopAnimation(),t._png=this,t.width=this.width,t.height=this.height,e=t.getContext("2d"),this.animation?(this.decodeFrames(e),this.animate(e)):(a=e.createImageData(this.width,this.height),this.copyToImageData(a,this.decodePixels()),e.putImageData(a,0,0))},o}(self);async function x(e,a){if(!m)throw new t("rasterCoded:decode","lerc decoder is not supported on big endian platform");await r();const{width:i,height:s,pixelType:o,statistics:h,depthCount:c,noDataValues:l,bandMasks:p,pixels:d,mask:f,validPixelCount:u}=n(e,{inputOffset:a.offset,returnInterleaved:a.returnInterleaved});return new w({width:i,height:s,pixelType:o.toLowerCase(),pixels:d,mask:f,validPixelCount:u,statistics:h.map(({minValue:t,maxValue:e})=>new g(t,e)),bandMasks:p,depthCount:c,noDataValues:l})}async function b(e,a){await l();const i=p(e);if(!i)throw new t("rasterCodec:decode","failed to decode the input data.");const{width:s,height:r,pixels:n,pixelType:o}=i;return new w({width:s,height:r,pixelType:o,pixels:n})}async function k(t,a){const i=await u(t,{...a,noDataValue:a.tiffNoDataValue,matchAllNoData:a.matchAllNoData});e(i);return new w({width:i.width,height:i.height,pixels:i.pixels,pixelType:i.pixelType.toLowerCase(),mask:i.mask,bandMasks:i.bandMasks})}async function T(t,e){const a=await f(t,e.customOptions),i=new w({width:a.width,height:a.height,pixels:a.pixels,pixelType:a.pixelType.toLowerCase(),mask:a.mask});return e.skipStatistics||i.updateStatistics(),i}function v(t,e){const a=e.pixelType||"u8",i=w.getPixelArrayConstructor(a),s="u8"===a?t:new i(t.buffer),r=[],n=e.planes||1;if(1===n)r.push(s);else for(let o=0;o<n;o++){const a=(e.width||1)*(e.height||t.length),h=new i(a);for(let t=0;t<a;t++)h[t]=s[t*n+o];r.push(h)}return new w({width:e.width||1,height:e.height||t.length,pixels:r,pixelType:a})}function C(t,e){return v(new c(new Uint8Array(t)).getBytes(),e)}function A(t,e){return v(o(t,e.offset,e.eof,!e.isInputBigEndian),e)}function I(t,e){const a=e.format,{pixelTypeCtor:i}=M(e.pixelType),s=(0,d.decode)(t,{width:e.width,height:e.height,pixelType:i,format:a});return new w({width:e.width,height:e.height,pixels:s.pixels,pixelType:e.pixelType,mask:s.mask})}function U(t,e){const a=s.decode(t,e.applyJpegMask);return new w({width:a.width,height:a.height,pixels:a.pixels,pixelType:"u8",mask:a.mask})}function D(t,e){const a=new Uint8Array(t),i=new y(a),{width:s,height:r}=e,n=s*r,o=i.decode(),h=new Uint8Array(n);for(let l=0;l<n;l++)h[l]=o[4*l+3];const c=new w({width:s,height:r,pixels:[],pixelType:"u8",mask:h});for(let l=0;l<3;l++){const t=new Uint8Array(n);for(let e=0;e<n;e++)t[e]=o[4*e+l];c.pixels.push(t)}return c}async function P(t,e,a){const s=await i(t,e,a);return new w(s)}async function j(e,i,s){const r=i.format||L(e),n={...i,format:r},{canvasUsage:o}=i;if("no-canvas"!==o)try{return await P(e,n,s)}catch(h){if(a(h))throw h;if("canvas-only"===o)throw new t("rasterCodec:decode",`failed to decode the input data with canvas for format ${r}`)}return"jpg"===r?U(e,n):D(e,n)}function O(e){let a=null;switch(e){case"lerc":a=x;break;case"jpg":case"png":a=j;break;case"bmp":case"gif":a=P;break;case"bsq":case"bip":a=I;break;case"tiff":a=k;break;case"deflate":a=C;break;case"lzw":a=A;break;case"qb3":a=b;break;default:a=()=>{throw new t("rasterCodec:decode",`unsupported raster format ${e}`)}}return a}function M(t){let e=null,a=null;switch(t?t.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":a=255,e=Uint8Array;break;case"u16":a=a||65535,e=Uint16Array;break;case"u32":a=a||2**32-1,e=Uint32Array;break;case"s8":a=a||-128,e=Int8Array;break;case"s16":a=a||-32768,e=Int16Array;break;case"s32":a=a||0-2**31,e=Int32Array;break;default:e=Float32Array}return{pixelTypeCtor:e,noDataValue:a}}function S(t,e="bilinear"){if(!t)return;const{pixels:a,width:i,height:s,mask:r}=t;if(!a||0===a.length)return;const n=i-1,o=s-1,h=[];let c=null;const l=w.getPixelArrayConstructor(t.pixelType);if("nearest"===e){for(const t of a){const e=new l(n*o);for(let a=0;a<o;a++){const s=a*i;for(let i=0;i<n;i++)e[a*n+i]=t[s+i]}h.push(e)}if(null!=r){c=new Uint8Array(n*o);for(let t=0;t<o;t++){const e=t*i;for(let a=0;a<n;a++)c[t*n+a]=r[e+a]}}}else{for(const t of a){const e=new l(n*o);for(let a=0;a<o;a++){const s=a*i;for(let r=0;r<n;r++)e[a*n+r]=(t[s+r]+t[s+r+1]+t[s+i+r]+t[s+i+r+1])/4}h.push(e)}if(r){c=new Uint8Array(n*o);for(let t=0;t<o;t++){const e=t*i;for(let a=0;a<n;a++)c[t*n+a]=Math.min.apply(null,[r[e+a],r[e+a+1],r[e+i+a],r[e+i+a+1]])}}}t.width=n,t.height=o,t.mask=c,t.pixels=h}function L(t){if(!t)return;const e=new Uint8Array(t,0,10);let a;return 255===e[0]&&216===e[1]?a="jpg":137===e[0]&&80===e[1]&&78===e[2]&&71===e[3]?a="png":67===e[0]&&110===e[1]&&116===e[2]&&90===e[3]&&73===e[4]&&109===e[5]&&97===e[6]&&103===e[7]&&101===e[8]&&32===e[9]||76===e[0]&&101===e[1]&&114===e[2]&&99===e[3]&&50===e[4]&&32===e[5]?a="lerc":73===e[0]&&73===e[1]&&42===e[2]&&0===e[3]||77===e[0]&&77===e[1]&&0===e[2]&&42===e[3]||73===e[0]&&73===e[1]&&43===e[2]&&0===e[3]||77===e[0]&&77===e[1]&&0===e[2]&&43===e[3]?a="tiff":71===e[0]&&73===e[1]&&70===e[2]?a="gif":66===e[0]&&77===e[1]?a="bmp":81===e[0]&&66===e[1]&&51===e[2]&&(a="qb3"),a}async function R(e,a={},i){if(null==e)throw new t("rasterCodec:decode","missing encodeddata parameter.");let s=a.format?.toLowerCase();if(!("bsq"!==s&&"bip"!==s||null!=a.width&&null!=a.height))throw new t("rasterCodec:decode","requires width and height in options parameter.");if("tiff"===s&&a.customOptions)return T(e,a);if(!s||"bsq"!==s&&"bip"!==s&&"deflate"!==s&&"lzw"!==s){if(s=L(e),!s){throw String.fromCharCode.apply(null,[...new Uint8Array(e,0,10)]).toLowerCase().includes("error")?new t("rasterCodec:decode","input data contains error"):new t("rasterCodec:decode","unsupported raster format")}a={...a,format:s}}const r=O(s);let n;a.isPoint&&(null!=(a={...a}).width&&a.width++,null!=a.height&&a.height++);const{offsets:o}=a;if(o&&o.length>1){const t=o.map((t,s)=>r(e.slice(t,o[s+1]),a,i)),s=await Promise.all(t);n=s[0],n.pixels=s.map(t=>t.pixels[0]);const h=s.map(t=>t.mask);h.some(t=>null!=t)&&(h.forEach((t,e)=>{h[e]??=new Uint8Array(n.width*n.height).fill(255)}),n.bandMasks=h,n.mask=w.combineBandMasks(h))}else n=await r(e,{...a,offset:o?.[0]??a.offset},i);return"jpg"!==s&&null!=a.noDataValue&&1===n.depthCount&&h(n,a.noDataValue,{customFloatTolerance:a.tolerance}),a.isPoint&&S(n),n.statistics?.length||a.skipStatistics||n.updateStatistics(),n}export{R as decode,L as getFormat};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{getMetersPerUnitForSR as t}from"../../../core/units.js";import e from"../../../geometry/Extent.js";import n from"../../../geometry/Point.js";import i from"../../support/PixelBlock.js";function a(e,n){if(e.spatialReference.equals(n))return e;const i=t(e.spatialReference),a=t(n);if(i===a)return e;const r=i/a;return{x:e.x*r,y:e.y*r}}async function r(t,e,n){if("extent"===n.type)return m(t,e,n);const{width:a,height:r}=t,h=new Uint8Array(a*r);if(!(await import("../../../geometry/operators/intersectsOperator.js")).execute(e,n))return new i({pixelType:t.pixelType,width:a,height:r,mask:h,maskIsAlpha:!1,pixels:[...t.pixels]});if("polyline"===n.type)return s(t,e,n);return(await import("../../../geometry/operators/containsOperator.js")).execute(n,e)?t:o(t,e,n)}function o(t,e,n){if(!t)return t;const{width:a,height:r}=t,o=h({geometry:n,size:[a,r],srcExtent:e,srcMask:t.mask});return new i({pixelType:t.pixelType,width:a,height:r,mask:o,maskIsAlpha:!1,pixels:[...t.pixels]})}function h(t){const{geometry:e,size:n,srcExtent:i,srcMask:a}=t,[r,o]=n;let h;const m=i.width/r,s=i.height/o,{xmin:l,ymax:p}=i;if("extent"===e.type){const t=(e.xmin-l)/m,n=(e.xmax-l)/m,i=(p-e.ymax)/s,a=(p-e.ymin)/s;h=[[[t,i],[t,a],[n,a],[n,i],[t,i]]]}else h=e.rings.map(t=>t.map(([t,e])=>[(t-l)/m,(p-e)/s]));return x(h,n,a)}function x(t,e,n){const[i,a]=e,r=new OffscreenCanvas(i,a).getContext("2d");r.fillStyle="#f00",r.beginPath(),t.forEach(t=>{r.moveTo(t[0][0],t[0][1]);for(let e=0;e<t.length;e++)r.lineTo(t[e][0],t[e][1]);r.closePath()}),r.fill();const o=r.getImageData(0,0,i,a).data,h=i*a,x=new Uint8Array(h);let m=!1;for(let s=0;s<h;s++)n&&!n[s]||(o[4*s+3]>127?x[s]=255:m=!0);return m||n?x:void 0}function m(t,e,n){const{width:a,height:r}=t,o=new Uint8Array(a*r),h=e.width/a,x=e.height/r;if(n.width/h<.5||n.height/x<.5)return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]});const{xmin:m,xmax:s,ymin:l,ymax:p}=e,{xmin:f,xmax:c,ymin:y,ymax:u}=n,M=Math.max(m,f),w=Math.min(s,c),d=Math.max(l,y),g=Math.min(p,u),T=.5*h,k=.5*x;if(w-M<T||g-d<k||w<m+T||M>s-T||d>p-k||g<l+k)return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]});const R=Math.max(0,(M-m)/h),j=Math.min(a,Math.max(0,(w-m)/h)),A=Math.max(0,(p-g)/x),z=Math.min(r,Math.max(0,(p-d)/x)),E=Math.round(R),P=Math.round(j)-1,S=Math.round(A),U=Math.round(z)-1;if(E===P&&R%1>.5&&j%1<.5||S===U&&A%1>.5&&z%1<.5)return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]});if(0===E&&0===S&&P===a&&U===r)return t;const v=t.mask;for(let i=S;i<=U;i++)for(let t=E;t<=P;t++){const e=i*a+t;o[e]=v?v[e]:255}return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]})}function s(t,e,n){const{width:a,height:r}=t,o=new Uint8Array(a*r),h=e.width/a,x=e.height/r,{xmin:m,ymax:s}=e,{paths:l}=n,p=t.mask;for(let i=0;i<l.length;i++){const t=l[i];for(let e=0;e<t.length-1;e++){const[n,i]=t[e],[l,f]=t[e+1],c=Math.min(i,f),y=Math.max(i,f),u=Math.max(0,Math.floor((s-y)/x)),M=Math.min(r-1,Math.floor((s-c)/x));if(!(M<u))if(u===M){const t=Math.min(n,l),e=Math.max(n,l),i=Math.max(0,Math.floor((t-m)/h)),r=Math.min(a-1,Math.floor((e-m)/h));if(r<i)continue;const x=u*a;for(let n=x+i;n<=x+r;n++)o[n]=p?p[n]:255}else{const t=(n-m)/h,e=(l-n)/(f-i)/h,r=x*e;for(let n=u;n<=M;n++){const h=e*(s-n*x-i)+t,m=Math.max(0,Math.floor(r>0?h-r:h)),l=Math.min(a-1,Math.floor(r>0?h:h-r));if(l<m)continue;const f=n*a;for(let t=f+m;t<=f+l;t++)o[t]=p?p[t]:255}}}}return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]})}function l(t,e){const{extent:i}=p(t,e,new n({x:t.pixelSize.x,y:t.pixelSize.y,spatialReference:t.spatialReference})),{extent:a}=t.extent;if(i.xmax=Math.min(i.xmax,a.xmax),i.ymax=Math.min(i.ymax,a.ymax),i.xmin<i.xmax&&i.ymin<i.ymax){const{x:e,y:n}=t.pixelSize,a=Math.round(i.width/e),r=Math.round(i.height/n);t.extent=i,t.width=a,t.height=r}}function p(t,n,i,r=!0){const{spatialReference:o}=t,{x:h,y:x}=a(i,o);let m,s,l;const p="extent"===n.type?n:n.extent;let{xmin:f,xmax:c,ymax:y,ymin:u}=p;const{xmin:M,ymax:w}=t.extent;return r?(f=M+(f>M?h*Math.round((f-M)/h):0),y=w-(y<w?x*Math.round((w-y)/x):0),c=M+(c>M?h*Math.round((c-M)/h):0),u=w-(u<w?x*Math.round((w-u)/x):0),m=new e({xmin:f,ymax:y,xmax:c,ymin:u,spatialReference:o}),s=Math.round(m.width/h),l=Math.round(m.height/x)):(s=Math.floor((c-f)/h+.8),l=Math.floor((y-u)/x+.8),f=M+(f>M?h*Math.floor((f-M)/h+.1):0),y=w-(y<w?x*Math.floor((w-y)/x+.1):0),c=f+s*h,u=y-l*x,m=new e({xmin:f,ymax:y,xmax:c,ymin:u,spatialReference:o})),{extent:m,width:s,height:l}}export{r as clip,l as clipRasterInfo,h as convertGeometryToMask,p as snapToRaster};
|
|
2
|
+
import{getMetersPerUnitForSR as t}from"../../../core/units.js";import e from"../../../geometry/Extent.js";import n from"../../../geometry/Point.js";import i from"../../support/PixelBlock.js";function a(e,n){if(e.spatialReference.equals(n))return e;const i=t(e.spatialReference),a=t(n);if(i===a)return e;const r=i/a;return{x:e.x*r,y:e.y*r}}async function r(t,e,n){if("extent"===n.type)return m(t,e,n);const{width:a,height:r}=t,h=new Uint8Array(a*r);if(!(await import("../../../geometry/operators/intersectsOperator.js")).execute(e,n))return new i({pixelType:t.pixelType,width:a,height:r,mask:h,maskIsAlpha:!1,pixels:[...t.pixels]});if("polyline"===n.type)return s(t,e,n);return(await import("../../../geometry/operators/containsOperator.js")).execute(n,e)?t:o(t,e,n)}function o(t,e,n){if(!t)return t;const{width:a,height:r}=t,o=h({geometry:n,size:[a,r],srcExtent:e,srcMask:t.mask});return new i({pixelType:t.pixelType,width:a,height:r,mask:o,maskIsAlpha:!1,pixels:[...t.pixels]})}function h(t){const{geometry:e,size:n,srcExtent:i,srcMask:a}=t,[r,o]=n;let h;const m=i.width/r,s=i.height/o,{xmin:l,ymax:p}=i;if("extent"===e.type){const t=(e.xmin-l)/m,n=(e.xmax-l)/m,i=(p-e.ymax)/s,a=(p-e.ymin)/s;h=[[[t,i],[t,a],[n,a],[n,i],[t,i]]]}else h=e.rings.map(t=>t.map(([t,e])=>[(t-l)/m,(p-e)/s]));return x(h,n,a)}function x(t,e,n){const[i,a]=e,r=new OffscreenCanvas(i,a).getContext("2d");r.fillStyle="#f00",r.beginPath(),t.forEach(t=>{r.moveTo(t[0][0],t[0][1]);for(let e=0;e<t.length;e++)r.lineTo(t[e][0],t[e][1]);r.closePath()}),r.fill();const o=r.getImageData(0,0,i,a).data,h=i*a,x=new Uint8Array(h);let m=!1;for(let s=0;s<h;s++)n&&!n[s]||(o[4*s+3]>127?x[s]=255:m=!0);return m||n?x:void 0}function m(t,e,n){const{width:a,height:r}=t,o=new Uint8Array(a*r),h=e.width/a,x=e.height/r;if(n.width/h<.5||n.height/x<.5)return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]});const{xmin:m,xmax:s,ymin:l,ymax:p}=e,{xmin:f,xmax:c,ymin:y,ymax:u}=n,M=Math.max(m,f),w=Math.min(s,c),d=Math.max(l,y),g=Math.min(p,u),T=.5*h,k=.5*x;if(w-M<T||g-d<k||w<m+T||M>s-T||d>p-k||g<l+k)return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]});const R=Math.max(0,(M-m)/h),j=Math.min(a,Math.max(0,(w-m)/h)),A=Math.max(0,(p-g)/x),z=Math.min(r,Math.max(0,(p-d)/x)),E=Math.round(R),P=Math.round(j)-1,S=Math.round(A),U=Math.round(z)-1;if(E===P&&R%1>.5&&j%1<.5||S===U&&A%1>.5&&z%1<.5)return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]});if(0===E&&0===S&&P===a&&U===r)return t;const v=t.mask;for(let i=S;i<=U;i++)for(let t=E;t<=P;t++){const e=i*a+t;o[e]=v?v[e]:255}return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]})}function s(t,e,n){const{width:a,height:r}=t,o=new Uint8Array(a*r),h=e.width/a,x=e.height/r,{xmin:m,ymax:s}=e,{paths:l}=n,p=t.mask;for(let i=0;i<l.length;i++){const t=l[i];for(let e=0;e<t.length-1;e++){const[n,i]=t[e],[l,f]=t[e+1],c=Math.min(i,f),y=Math.max(i,f),u=Math.max(0,Math.floor((s-y)/x)),M=Math.min(r-1,Math.floor((s-c)/x));if(!(M<u))if(u===M){const t=Math.min(n,l),e=Math.max(n,l),i=Math.max(0,Math.floor((t-m)/h)),r=Math.min(a-1,Math.floor((e-m)/h));if(r<i)continue;const x=u*a;for(let n=x+i;n<=x+r;n++)o[n]=p?p[n]:255}else{const t=(n-m)/h,e=(l-n)/(f-i)/h,r=x*e;for(let n=u;n<=M;n++){const h=e*(s-n*x-i)+t,m=Math.max(0,Math.floor(r>0?h-r:h)),l=Math.min(a-1,Math.floor(r>0?h:h-r));if(l<m)continue;const f=n*a;for(let t=f+m;t<=f+l;t++)o[t]=p?p[t]:255}}}}return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]})}function l(t,e){const{extent:i}=p(t,e,new n({x:t.pixelSize.x,y:t.pixelSize.y,spatialReference:t.spatialReference})),{extent:a}=t.extent;if(i.xmax=Math.min(i.xmax,a.xmax),i.ymax=Math.min(i.ymax,a.ymax),i.xmin<i.xmax&&i.ymin<i.ymax){const{x:e,y:n}=t.pixelSize,a=Math.round(i.width/e),r=Math.round(i.height/n);t.extent=i,t.width=a,t.height=r}}function p(t,n,i,r=!0){const{spatialReference:o}=t,{x:h,y:x}=a(i,o);let m,s,l;const p="extent"===n.type?n:n.extent;let{xmin:f,xmax:c,ymax:y,ymin:u}=p;const{xmin:M,ymax:w}=t.extent;return r?(f=M+(f>M?h*Math.round((f-M)/h):0),y=w-(y<w?x*Math.round((w-y)/x):0),c=M+(c>M?h*Math.round((c-M)/h):0),u=w-(u<w?x*Math.round((w-u)/x):0),m=new e({xmin:f,ymax:y,xmax:c,ymin:u,spatialReference:o}),s=Math.round(m.width/h),l=Math.round(m.height/x)):(s=Math.floor((c-f)/h+.8),l=Math.floor((y-u)/x+.8),f=M+(f>M?h*Math.floor((f-M)/h+.1):0),y=w-(y<w?x*Math.floor((w-y)/x+.1):0),c=f+s*h,u=y-l*x,m=new e({xmin:f,ymax:y,xmax:c,ymin:u,spatialReference:o})),{extent:m,width:s,height:l}}export{r as clip,l as clipRasterInfo,h as convertGeometryToMask,a as convertPixelSize,p as snapToRaster};
|
|
@@ -52,7 +52,8 @@ export default class AggregateField extends JSONSupport {
|
|
|
52
52
|
constructor(properties?: AggregateFieldProperties);
|
|
53
53
|
/**
|
|
54
54
|
* The display name that describes the aggregate field in the [Legend](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-legend/),
|
|
55
|
-
* [Popup](https://developers.arcgis.com/javascript/latest/map-components/arcgis-popup/), and
|
|
55
|
+
* [Popup](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-popup/), and
|
|
56
|
+
* other UI elements.
|
|
56
57
|
*
|
|
57
58
|
* @example aggregateField.alias = "Total population";
|
|
58
59
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../request.js";import{isSome as n}from"../../core/arrayUtils.js";import{JSONSupportMixin as i}from"../../core/JSONSupport.js";import{Loadable as s}from"../../core/Loadable.js";import{property as o,subclass as r}from"../../core/accessorSupport/decorators.js";import{parse as a}from"./arcgisLayerUrl.js";import l from"./Contingency.js";import u from"./ContingencyConstraintViolation.js";import c from"./ContingentValue.js";import p from"./ContingentValuesResult.js";import d from"./FieldGroup.js";import{isStringField as f,isDateField as y}from"./fieldUtils.js";import m from"./Subtype.js";import{getNormalizedFeatureTypeInfo as g}from"../../widgets/FeatureForm/featureFormUtils.js";var h;let V=h=class extends(i(s)){constructor(e){super(e),this.request=t,this.fieldGroups=null,this.fieldGroupDefinitions=null}initialize(){}get loaded(){return super.loaded}get subtypeFieldName(){return g(this.layer).typeFieldName}static async createLoadedLayerContingentValuesCache(e,t){await e.load();const n=e.sourceJSON;if(void 0===e.layerId)return null;const i=n?.hasContingentValuesDefinition;if(i)return new h({layer:e}).load(t);if(void 0===i){const n=a(e.url);if(null==n)return null;const i=n.url.path;if((await C(i,t)).supportsQueryDataElements){const n=e.layerId.toString(),s=await x(i,n,t);if(s){const n=s.map(t=>({name:t.name,isEditingRestrictive:t.isEditingRestrictive,fields:t.fieldNames.names.map(t=>e.fieldsIndex.normalizeFieldName(t))}));return new h({layer:e,fieldGroupDefinitions:n}).load(t)}}}return null}async load(e){const t=this.layer.load(e).then(()=>this._initializeContingentValues(this.fieldGroupDefinitions,e));return this.addResolvingPromise(t),this}validateContingencyConstraints(e,t){const n=Object.keys(e),i=[],s=[];for(const o of this.fieldGroups){const r=o.isEditingRestrictive?"error":"warning";if(t&&!o.fields.some(e=>t.includes(e)))continue;if(!o.fields.every(e=>n.includes(e))){s.push(new u({fieldGroup:o,type:r}));continue}let a=!1;const l=e[this.subtypeFieldName],c=o.contingencies.filter(e=>!(!e.isRetired&&e.subtype)||e.subtype.code===l);if(0!==c.length){for(const t of c){let n=!0;for(const i in t.values){const s=t.values[i];if("any"!==s.objectType)if("null"===s.objectType){if(null!=e[i]){n=!1;break}}else if("code"===s.objectType){if(e[i]!==s.codedValue.code){n=!1;break}}else if("range"===s.objectType){const t=e[i];if(t<s.minValue||t>s.maxValue){n=!1;break}}}if(n){a=!0;break}}a||i.push(new u({fieldGroup:o,type:r}))}}return{invalid:i,incomplete:s}}getContingentValues(e,t,n=!1){const i=e[this.subtypeFieldName],s=null!=i,o={};let r=[];const a=this.fieldGroups.filter(e=>e.fields.includes(t));r.push(new c({objectType:"any"}));for(const l of a){let a=[];const u=l.contingencies.filter(e=>!(e.isRetired||e.subtype&&s&&e.subtype.code!==i));let c=!1;const p={};for(const n of u){let i,s=!0;for(const o in n.values){const r=n.values[o];if(t!==o){if(void 0!==e[o]&&"any"!==r.objectType)if("null"===r.objectType)null!==e[o]&&(s=!1);else if("code"===r.objectType)e[o]!==r.codedValue.code&&(s=!1);else if("range"===r.objectType){const t=e[o];(t<r.minValue||t>r.maxValue)&&(s=!1)}}else i=r,c=c||"range"===r.objectType}if(i&&s){if("any"===i.objectType){a.length=0,a.push(i);break}const e=b(i);p[e]||a.push(i),p[e]=!0}}c&&(a=j(a)),o[l.name]=a,r=n?G(r,a):[]}return 1===a.length&&n&&(r=[]),new p({contingentValuesAllGroups:r,contingentValuesByFieldGroup:o})}async _initializeContingentValues(e,t){const n=e??await this._fetchFieldGroupDefs(t);if(0===n.length)return void(this.fieldGroups=[]);const i=await this._fetchContingentValues(n,t);this.fieldGroups=i}async _fetchFieldGroupDefs(e){if(void 0===this.layer.layerId)return[];const t=this.layer.sourceJSON,n=this.layer.layerId.toString(),i=a(this.layer.url).url.path;if(t?.hasContingentValuesDefinition){return(await v(i,n,e)).map(e=>({name:e.name,isEditingRestrictive:e.restrictive,fields:e.fields.map(e=>this.layer.fieldsIndex.normalizeFieldName(e))}))}return void 0!==t?.hasContingentValuesDefinition?[]:C(i,e).then(async t=>{if(t.supportsQueryDataElements){return(await x(i,n,e)).map(e=>({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fieldNames.names.map(e=>this.layer.fieldsIndex.normalizeFieldName(e))}))}return[]})}async _fetchContingentValues(e,t){if(void 0===this.layer.layerId)return[];const n=this.layer.sourceJSON,i=this.layer.layerId.toString(),s=a(this.layer.url).url.path;if(n?.hasContingentValuesDefinition){const n=await S(s,i,t);return this._constructFieldGroupsAGOL(e,n)}const o=await F(s,i,t);return this._constructFieldGroupsEnterprise(e,o)}_constructFieldGroupsAGOL(e,t){return e.map(e=>{const n=t.contingentValuesDefinition.fieldGroups.find(t=>t.name===e.name);if(n){let i=[];return i=t.contingentValuesDefinition.hasSubType?this._parseAGOLFieldGroupSubtype(e,t,n.subTypes):this._parseAGOLFieldGroup(e,t,n.contingentValues),new d({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null}).filter(n)}_parseAGOLFieldGroupSubtype(e,t,n){let i=[];return n?.forEach(n=>{const s=this._getSubtypeAGOL(n.name);i=i.concat(this._parseAGOLFieldGroup(e,t,n.contingentValues,s))}),i}_parseAGOLFieldGroup(e,t,n,i=null){const s=[];for(const o of n??[]){const n=this._parseAGOLContingency(o,e,t,i);s.push(n)}return s}_parseAGOLContingency(e,t,n,i){const s=e.id,o=!!e.retired&&1===e.retired,r={};for(let a=0,l=0;a<t.fields.length;a++){const s=t.fields[a],o=n.typeCodes[e.types[a]];if("Code"===o){let t=e.values[l];l++;const o=this._getDomain(i,s),a=this.layer.getField(s);if("string"===a?.type){const e=n.stringDicts.find(e=>e.domain===o?.name);e&&(t=e.entries[t])}const u=o?.codedValues.find(e=>e.code===t),p=new c({codedValue:u,objectType:"code"});r[s]=p}else if("Range"===o){const t=e.values[l];l++;const n=t.range[0],i=t.range[1],o=new c({minValue:n,maxValue:i,objectType:"range"});r[s]=o}else if("Any"===o){const e=new c({objectType:"any"});r[s]=e}else{const e=new c({objectType:"null"});r[s]=e}}return new l({id:s,isRetired:o,subtype:i,values:r})}_constructFieldGroupsEnterprise(e,t){const i=t.fieldGroups;return e.map(e=>{const n=i.find(t=>t.name===e.name);if(n){const i=n.contingencies.map(n=>{const i=n.id,s=n.isRetired||!1,o=this._getSubtypeEnterprise(n.subtypeCode),r={};for(let a=0;a<e.fields.length;a++){const i=e.fields[a];let s=n.values[a];if("number"==typeof s||"string"==typeof s){const e=this._getDomain(o,i),n=this.layer.getField(i);if(f(n))s=t.stringDictionary[s];else if(y(n)){const e=new Date(`${s}+00:00`);s=e.getTime()}const a=e?.codedValues.find(e=>e.code===s),l=new c({codedValue:a,objectType:"code"});r[i]=l}else if("object"==typeof s){const e=s.minValue,t=s.maxValue,n=new c({minValue:e,maxValue:t,objectType:"range"});r[i]=n}else if(s){const e=new c({objectType:"any"});r[i]=e}else{const e=new c({objectType:"null"});r[i]=e}}return new l({id:i,isRetired:s,subtype:o,values:r})});return new d({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null}).filter(n)}_getSubtypeEnterprise(e){const t=this.layer.sourceJSON;let n;if(t?.subtypes){const i=t.subtypes.find(t=>t.code===e);n=m.fromJSON(i)}return n||null}_getSubtypeAGOL(e){const t=this.layer.sourceJSON;let n;if(t?.subtypes){const i=t.subtypes.find(t=>t.name===e);n=m.fromJSON(i)}return n||null}_getDomain(e,t){const n=e?O(e,t):this.layer.getFieldDomain(t);return"inherited"===n?.type?this.layer.getFieldDomain(t):n}};function b(e){switch(e.objectType){case"any":return"@any@";case"null":return"@null@";case"code":return e.codedValue.name+e.codedValue.code.toString();case"range":return e.minValue.toString()+"-"+e.maxValue.toString()}}function j(e){let t,n;e.sort((e,t)=>"null"===e.objectType?-1:"null"===t.objectType?1:e.minValue-t.minValue);const i=[];for(const s of e)"null"!==s.objectType?null!=t&&null!=n?n<s.minValue?(i.push(new c({objectType:"range",minValue:t,maxValue:n})),t=s.minValue,n=s.maxValue):n<s.maxValue&&(n=s.maxValue):(t=s.minValue,n=s.maxValue):i.push(s);return i.push(new c({objectType:"range",minValue:t,maxValue:n})),i}function T(e,t){const n=[];let i,s=0;for(const o of e)for(;s<t.length;s++){const e=t[s];if("null"===o.objectType&&"null"===e.objectType)n.push(new c({objectType:"null"}));else{if("null"===o.objectType)break;if("null"===e.objectType)continue}if(o.maxValue<e.minValue)break;if(o.maxValue===e.minValue){n.push(new c({objectType:"range",minValue:o.maxValue,maxValue:e.minValue}));break}if(!(o.minValue>e.maxValue))if(o.minValue!==e.maxValue){if(i=o.minValue>e.minValue?o.minValue:e.minValue,o.maxValue<e.maxValue){n.push(new c({objectType:"range",minValue:i,maxValue:o.maxValue}));break}n.push(new c({objectType:"range",minValue:i,maxValue:e.maxValue}))}else n.push(new c({objectType:"range",minValue:o.minValue,maxValue:e.maxValue}))}return n}function w(e,t){const n=[];for(const i of e)t.some(e=>{if(i.objectType===e.objectType)switch(i.objectType){case"any":case"null":return!0;case"code":return i.codedValue.code===e.codedValue.code&&i.codedValue.name===e.codedValue.name}return!1})&&n.push(i);return n}function G(e,t){if(0===e.length||0===t.length)return[];if("any"===e[0].objectType)return t;if("any"===t[0].objectType)return e;const n="range"===e[0].objectType||"range"===e[1]?.objectType,i="range"===t[0].objectType||"range"===t[1]?.objectType;return n||i?T(e,t):w(e,t)}async function v(e,n,i){return t(`${e}/${n}/fieldgroups`,{responseType:"json",query:{f:"json"},...i}).then(e=>e.data.fieldGroups??[])}async function x(e,n,i){return t(`${e}/queryDataElements`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then(e=>e.data.layerDataElements?.[0].dataElement.fieldGroups??[])}async function C(e,n){return t(e,{responseType:"json",query:{f:"json"},...n}).then(e=>e.data)}async function F(e,n,i){return t(`${e}/queryContingentValues`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then(e=>e.data.contingentValueSets?.[0])}async function S(e,n,i){return t(`${e}/${n}/contingentValues`,{responseType:"json",query:{f:"json"},...i}).then(e=>e.data)}function O(e,t){const n=e.domains;if(n){const[e,i]=Object.entries(n).find(([e])=>e.trim().toLowerCase()===t.trim().toLowerCase())||[];return i||null}return null}e([o({constructOnly:!0})],V.prototype,"layer",void 0),e([o({constructOnly:!0})],V.prototype,"request",void 0),e([o({type:[d]})],V.prototype,"fieldGroups",void 0),e([o({constructOnly:!0})],V.prototype,"fieldGroupDefinitions",void 0),e([o()],V.prototype,"subtypeFieldName",null),V=h=e([r("esri.layers.support.LayerContingentValuesCache")],V);const D=V;export{D as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../request.js";import{isSome as n}from"../../core/arrayUtils.js";import{JSONSupportMixin as i}from"../../core/JSONSupport.js";import{Loadable as s}from"../../core/Loadable.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{throwIfAborted as r,isAborted as a,createAbortError as l}from"../../core/promiseUtils.js";import{addMany as u}from"../../core/SetUtils.js";import{property as c,subclass as p}from"../../core/accessorSupport/decorators.js";import{parse as d}from"./arcgisLayerUrl.js";import f from"./Contingency.js";import y from"./ContingencyConstraintViolation.js";import m from"./ContingentValue.js";import g from"./ContingentValuesResult.js";import h from"./FieldGroup.js";import{isStringField as V,isDateField as b}from"./fieldUtils.js";import j from"./Subtype.js";import{getNormalizedFeatureTypeInfo as T}from"../../widgets/FeatureForm/featureFormUtils.js";var w;let G=w=class extends(i(s)){constructor(e){super(e),this.request=t,this.fieldGroups=null,this._relatedFieldsLookup=new Map,this.fieldGroupDefinitions=null}initialize(){}get loaded(){return super.loaded}get subtypeFieldName(){return T(this.layer).typeFieldName}static async createLoadedLayerContingentValuesCache(e,t){await e.load();const n=e.sourceJSON;if(r(t),void 0===e.layerId)return null;const i=n?.hasContingentValuesDefinition;if(i){const n=new w({layer:e});if(a(t))throw n.destroy(),l();return n.load(t)}if(void 0===i){const n=d(e.url);if(null==n)return null;const i=n.url.path,s=await D(i,t);if(r(t),s.supportsQueryDataElements){const n=e.layerId.toString(),s=await O(i,n,t);if(r(t),s){const n=s.map(t=>({name:t.name,isEditingRestrictive:t.isEditingRestrictive,fields:t.fieldNames.names.map(t=>e.fieldsIndex.normalizeFieldName(t))})),i=new w({layer:e,fieldGroupDefinitions:n});return r(t),i.load(t)}}}return null}async load(e){const t=this.layer.load(e).then(()=>this._initializeContingentValues(this.fieldGroupDefinitions,e));return this.addResolvingPromise(t),this}validateContingencyConstraints(e,t){const n=Object.keys(e),i=[],s=[];for(const o of this.fieldGroups){const r=o.isEditingRestrictive?"error":"warning";if(t&&!o.fields.some(e=>t.includes(e)))continue;if(!o.fields.every(e=>n.includes(e))){s.push(new y({fieldGroup:o,type:r}));continue}let a=!1;const l=e[this.subtypeFieldName],u=o.contingencies.filter(e=>!(!e.isRetired&&e.subtype)||e.subtype.code===l);if(0!==u.length){for(const t of u){let n=!0;for(const i in t.values){const s=t.values[i];if("any"!==s.objectType)if("null"===s.objectType){if(null!=e[i]){n=!1;break}}else if("code"===s.objectType){if(e[i]!==s.codedValue.code){n=!1;break}}else if("range"===s.objectType){const t=e[i];if(t<s.minValue||t>s.maxValue){n=!1;break}}}if(n){a=!0;break}}a||i.push(new y({fieldGroup:o,type:r}))}}return{invalid:i,incomplete:s}}getRelatedFields(e){return o(this._relatedFieldsLookup,e,()=>R(this.fieldGroups,e))}getContingentValues(e,t,n=!1){const i=e[this.subtypeFieldName],s=null!=i,o={};let r=[];const a=this.fieldGroups.filter(e=>e.fields.includes(t));r.push(new m({objectType:"any"}));for(const l of a){let a=[];const u=l.contingencies.filter(e=>!(e.isRetired||e.subtype&&s&&e.subtype.code!==i));let c=!1;const p={};for(const n of u){let i,s=!0;for(const o in n.values){const r=n.values[o];if(t!==o){if(void 0!==e[o]&&"any"!==r.objectType)if("null"===r.objectType)null!==e[o]&&(s=!1);else if("code"===r.objectType)e[o]!==r.codedValue.code&&(s=!1);else if("range"===r.objectType){const t=e[o];(t<r.minValue||t>r.maxValue)&&(s=!1)}}else i=r,c=c||"range"===r.objectType}if(i&&s){if("any"===i.objectType){a.length=0,a.push(i);break}const e=v(i);p[e]||a.push(i),p[e]=!0}}c&&(a=F(a)),o[l.name]=a,r=n?C(r,a):[]}return 1===a.length&&n&&(r=[]),new g({contingentValuesAllGroups:r,contingentValuesByFieldGroup:o})}async _initializeContingentValues(e,t){const n=e??await this._fetchFieldGroupDefs(t);if(0===n.length)return this.fieldGroups=[],void this._relatedFieldsLookup.clear();const i=await this._fetchContingentValues(n,t);this.fieldGroups=i}async _fetchFieldGroupDefs(e){if(void 0===this.layer.layerId)return[];const t=this.layer.sourceJSON,n=this.layer.layerId.toString(),i=d(this.layer.url).url.path;if(t?.hasContingentValuesDefinition){return(await _(i,n,e)).map(e=>({name:e.name,isEditingRestrictive:e.restrictive,fields:e.fields.map(e=>this.layer.fieldsIndex.normalizeFieldName(e))}))}return void 0!==t?.hasContingentValuesDefinition?[]:D(i,e).then(async t=>{if(t.supportsQueryDataElements){return(await O(i,n,e)).map(e=>({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fieldNames.names.map(e=>this.layer.fieldsIndex.normalizeFieldName(e))}))}return[]})}async _fetchContingentValues(e,t){if(void 0===this.layer.layerId)return[];const n=this.layer.sourceJSON,i=this.layer.layerId.toString(),s=d(this.layer.url).url.path;if(n?.hasContingentValuesDefinition){const n=await E(s,i,t);return this._constructFieldGroupsAGOL(e,n)}const o=await L(s,i,t);return this._constructFieldGroupsEnterprise(e,o)}_constructFieldGroupsAGOL(e,t){return e.map(e=>{const n=t.contingentValuesDefinition.fieldGroups.find(t=>t.name===e.name);if(n){let i=[];return i=t.contingentValuesDefinition.hasSubType?this._parseAGOLFieldGroupSubtype(e,t,n.subTypes):this._parseAGOLFieldGroup(e,t,n.contingentValues),new h({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null}).filter(n)}_parseAGOLFieldGroupSubtype(e,t,n){let i=[];return n?.forEach(n=>{const s=this._getSubtypeAGOL(n.name);i=i.concat(this._parseAGOLFieldGroup(e,t,n.contingentValues,s))}),i}_parseAGOLFieldGroup(e,t,n,i=null){const s=[];for(const o of n??[]){const n=this._parseAGOLContingency(o,e,t,i);s.push(n)}return s}_parseAGOLContingency(e,t,n,i){const s=e.id,o=!!e.retired&&1===e.retired,r={};for(let a=0,l=0;a<t.fields.length;a++){const s=t.fields[a],o=n.typeCodes[e.types[a]];if("Code"===o){let t=e.values[l];l++;const o=this._getDomain(i,s),a=this.layer.getField(s);if("string"===a?.type){const e=n.stringDicts.find(e=>e.domain===o?.name);e&&(t=e.entries[t])}const u=o?.codedValues.find(e=>e.code===t),c=new m({codedValue:u,objectType:"code"});r[s]=c}else if("Range"===o){const t=e.values[l];l++;const n=t.range[0],i=t.range[1],o=new m({minValue:n,maxValue:i,objectType:"range"});r[s]=o}else if("Any"===o){const e=new m({objectType:"any"});r[s]=e}else{const e=new m({objectType:"null"});r[s]=e}}return new f({id:s,isRetired:o,subtype:i,values:r})}_constructFieldGroupsEnterprise(e,t){const i=t.fieldGroups;return e.map(e=>{const n=i.find(t=>t.name===e.name);if(n){const i=n.contingencies.map(n=>{const i=n.id,s=n.isRetired||!1,o=this._getSubtypeEnterprise(n.subtypeCode),r={};for(let a=0;a<e.fields.length;a++){const i=e.fields[a];let s=n.values[a];if("number"==typeof s||"string"==typeof s){const e=this._getDomain(o,i),n=this.layer.getField(i);if(V(n))s=t.stringDictionary[s];else if(b(n)){const e=new Date(`${s}+00:00`);s=e.getTime()}const a=e?.codedValues.find(e=>e.code===s),l=new m({codedValue:a,objectType:"code"});r[i]=l}else if("object"==typeof s){const e=s.minValue,t=s.maxValue,n=new m({minValue:e,maxValue:t,objectType:"range"});r[i]=n}else if(s){const e=new m({objectType:"any"});r[i]=e}else{const e=new m({objectType:"null"});r[i]=e}}return new f({id:i,isRetired:s,subtype:o,values:r})});return new h({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null}).filter(n)}_getSubtypeEnterprise(e){const t=this.layer.sourceJSON;let n;if(t?.subtypes){const i=t.subtypes.find(t=>t.code===e);n=j.fromJSON(i)}return n||null}_getSubtypeAGOL(e){const t=this.layer.sourceJSON;let n;if(t?.subtypes){const i=t.subtypes.find(t=>t.name===e);n=j.fromJSON(i)}return n||null}_getDomain(e,t){const n=e?N(e,t):this.layer.getFieldDomain(t);return"inherited"===n?.type?this.layer.getFieldDomain(t):n}};function v(e){switch(e.objectType){case"any":return"@any@";case"null":return"@null@";case"code":return e.codedValue.name+e.codedValue.code.toString();case"range":return e.minValue.toString()+"-"+e.maxValue.toString()}}function F(e){let t,n;e.sort((e,t)=>"null"===e.objectType?-1:"null"===t.objectType?1:e.minValue-t.minValue);const i=[];for(const s of e)"null"!==s.objectType?null!=t&&null!=n?n<s.minValue?(i.push(new m({objectType:"range",minValue:t,maxValue:n})),t=s.minValue,n=s.maxValue):n<s.maxValue&&(n=s.maxValue):(t=s.minValue,n=s.maxValue):i.push(s);return i.push(new m({objectType:"range",minValue:t,maxValue:n})),i}function x(e,t){const n=[];let i,s=0;for(const o of e)for(;s<t.length;s++){const e=t[s];if("null"===o.objectType&&"null"===e.objectType)n.push(new m({objectType:"null"}));else{if("null"===o.objectType)break;if("null"===e.objectType)continue}if(o.maxValue<e.minValue)break;if(o.maxValue===e.minValue){n.push(new m({objectType:"range",minValue:o.maxValue,maxValue:e.minValue}));break}if(!(o.minValue>e.maxValue))if(o.minValue!==e.maxValue){if(i=o.minValue>e.minValue?o.minValue:e.minValue,o.maxValue<e.maxValue){n.push(new m({objectType:"range",minValue:i,maxValue:o.maxValue}));break}n.push(new m({objectType:"range",minValue:i,maxValue:e.maxValue}))}else n.push(new m({objectType:"range",minValue:o.minValue,maxValue:e.maxValue}))}return n}function S(e,t){const n=[];for(const i of e)t.some(e=>{if(i.objectType===e.objectType)switch(i.objectType){case"any":case"null":return!0;case"code":return i.codedValue.code===e.codedValue.code&&i.codedValue.name===e.codedValue.name}return!1})&&n.push(i);return n}function C(e,t){if(0===e.length||0===t.length)return[];if("any"===e[0].objectType)return t;if("any"===t[0].objectType)return e;const n="range"===e[0].objectType||"range"===e[1]?.objectType,i="range"===t[0].objectType||"range"===t[1]?.objectType;return n||i?x(e,t):S(e,t)}async function _(e,n,i){return t(`${e}/${n}/fieldgroups`,{responseType:"json",query:{f:"json"},...i}).then(e=>e.data.fieldGroups??[])}async function O(e,n,i){return t(`${e}/queryDataElements`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then(e=>e.data.layerDataElements?.[0].dataElement.fieldGroups??[])}async function D(e,n){return t(e,{responseType:"json",query:{f:"json"},...n}).then(e=>e.data)}async function L(e,n,i){return t(`${e}/queryContingentValues`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then(e=>e.data.contingentValueSets?.[0])}async function E(e,n,i){return t(`${e}/${n}/contingentValues`,{responseType:"json",query:{f:"json"},...i}).then(e=>e.data)}function N(e,t){const n=e.domains;if(n){const[e,i]=Object.entries(n).find(([e])=>e.trim().toLowerCase()===t.trim().toLowerCase())||[];return i||null}return null}function R(e,t){const n=new Set;for(const i of e)i.fields.includes(t)&&u(n,i.fields);return n.delete(t),n}e([c({constructOnly:!0})],G.prototype,"layer",void 0),e([c({constructOnly:!0})],G.prototype,"request",void 0),e([c({type:[h]})],G.prototype,"fieldGroups",void 0),e([c({constructOnly:!0})],G.prototype,"fieldGroupDefinitions",void 0),e([c()],G.prototype,"subtypeFieldName",null),G=w=e([p("esri.layers.support.LayerContingentValuesCache")],G);const k=G;export{k as default};
|