@arcgis/core 5.0.0-next.4 → 5.0.0-next.5
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/Map.js +1 -1
- package/analysis/ElevationProfileAnalysis.js +1 -1
- package/analysis/VolumeMeasurement/volumeMeasurementConfiguration.js +1 -1
- package/applications/KnowledgeStudio/generalSdkInternalAccess.d.ts +4 -0
- package/applications/KnowledgeStudio/generalSdkInternalAccess.js +5 -0
- package/applications/KnowledgeStudio/generalSharedKgUtils.d.ts +1 -0
- package/applications/KnowledgeStudio/generalSharedKgUtils.js +1 -1
- package/applications/KnowledgeStudio/layerInternalAccessUtils.d.ts +2 -0
- package/applications/KnowledgeStudio/layerInternalAccessUtils.js +1 -1
- package/applications/KnowledgeStudio/resourceSerializationUtils.js +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.uk.json +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0366b78b0ccf4ed5f6ac.js +1 -0
- package/assets/esri/core/workers/chunks/037b2548bf85e2d7c6ac.js +1 -0
- package/assets/esri/core/workers/chunks/{c0feec6e2f0e45900ae0.js → 0686243904381ef863dc.js} +1 -1
- package/assets/esri/core/workers/chunks/06ba43843e9c4988049b.js +1 -0
- package/assets/esri/core/workers/chunks/0f100e163e1847e04155.js +1 -0
- package/assets/esri/core/workers/chunks/{388482cea4b9fdeaf06e.js → 0f30a9514571c7be9978.js} +1 -1
- package/assets/esri/core/workers/chunks/0f8847f9ae3068833fa4.js +1 -0
- package/assets/esri/core/workers/chunks/{14ace5dc4b8984212a57.js → 17d5f8dba6ebb1184506.js} +1 -1
- package/assets/esri/core/workers/chunks/{b2add7338258ca7c24dd.js → 1da74aa308ded5748ef5.js} +1 -1
- package/assets/esri/core/workers/chunks/{651b9144abb1895cc510.js → 1e848d9da1c61a27cf18.js} +1 -1
- package/assets/esri/core/workers/chunks/1eedac33c9fcd7681427.js +1 -0
- package/assets/esri/core/workers/chunks/239377336a2009caea01.js +1 -0
- package/assets/esri/core/workers/chunks/285762ff92d5388b6024.js +1 -0
- package/assets/esri/core/workers/chunks/{40b81d1c2d53cf598b8e.js → 2f03d33f4ca8a48461fc.js} +1 -1
- package/assets/esri/core/workers/chunks/{4f01be74dd26e639330f.js → 2f24017e72d41c259faa.js} +1 -1
- package/assets/esri/core/workers/chunks/3271614322ba4b44fb5a.js +1 -0
- package/assets/esri/core/workers/chunks/36b1f47d70b57d79df7b.js +1 -0
- package/assets/esri/core/workers/chunks/{3d65b8a2fbe1df050a25.js → 377a66034e7c1bad5599.js} +1 -1
- package/assets/esri/core/workers/chunks/37f2ef14399546e697e6.js +1 -0
- package/assets/esri/core/workers/chunks/{0f9bb3187306f89e3d63.js → 398f356b11fd33bd3831.js} +1 -1
- package/assets/esri/core/workers/chunks/3a457e718a901a45902e.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/4442817beb7a76c95770.js +1 -0
- package/assets/esri/core/workers/chunks/4c5a7249a311070d8f43.js +1 -0
- package/assets/esri/core/workers/chunks/551c6c89b51b99f4864b.js +1 -0
- package/assets/esri/core/workers/chunks/{9a723d739ac44b45432c.js → 557960763695abee4a83.js} +1 -1
- package/assets/esri/core/workers/chunks/655360995c1cbc78a5a3.js +1 -0
- package/assets/esri/core/workers/chunks/67d9cfe02613cb73ee37.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/6a69dafeb7c9ca8a3d84.js +1 -0
- package/assets/esri/core/workers/chunks/6c3b99209d542efa64d4.js +1 -0
- package/assets/esri/core/workers/chunks/{8215015f11221a354273.js → 6d049182bec34a22abcd.js} +1 -1
- package/assets/esri/core/workers/chunks/71762199aef5d3107da2.js +1 -0
- package/assets/esri/core/workers/chunks/72c851c400752094b162.js +1 -0
- package/assets/esri/core/workers/chunks/7558919912f7fdc4837b.js +1 -0
- package/assets/esri/core/workers/chunks/7596d005a4dc3964b140.js +1 -0
- package/assets/esri/core/workers/chunks/762fe93015b705546188.js +1 -0
- package/assets/esri/core/workers/chunks/79dbfa2b9b332ca0002f.js +1 -0
- package/assets/esri/core/workers/chunks/7a23ab84e1144f081c92.js +1 -0
- package/assets/esri/core/workers/chunks/{2a5f331c0f18d8574b4e.js → 811d4c46c75cf6a63e78.js} +1 -1
- package/assets/esri/core/workers/chunks/829bc5dbda2f51561446.js +1 -0
- package/assets/esri/core/workers/chunks/8372f142c4d7a65c7954.js +1 -0
- package/assets/esri/core/workers/chunks/8605ec4678eb4511c715.js +1 -0
- package/assets/esri/core/workers/chunks/883ffaa69b3e6eb158bf.js +1 -0
- package/assets/esri/core/workers/chunks/{3d22fe2f2c40abbc246e.js → 88d942cd25bef74fd50a.js} +1 -1
- package/assets/esri/core/workers/chunks/{0086a09441627842d34a.js → 8f3503b2fb6cd38757b9.js} +1 -1
- package/assets/esri/core/workers/chunks/9786f91455350eaae493.js +1 -0
- package/assets/esri/core/workers/chunks/98311fec6c16a1b23586.js +1 -0
- package/assets/esri/core/workers/chunks/9c5cbf8810f37b1a4718.js +1 -0
- package/assets/esri/core/workers/chunks/a091623bbfb3d771c8d8.js +1 -0
- package/assets/esri/core/workers/chunks/a137c27ce078bea44f89.js +1 -0
- package/assets/esri/core/workers/chunks/a29d7205394cb8b2a847.js +1 -0
- package/assets/esri/core/workers/chunks/a2a284d4dd5caaecbc2e.js +1 -0
- package/assets/esri/core/workers/chunks/{135e270b4f03c4270870.js → a4db5c9a90107e097df8.js} +1 -1
- package/assets/esri/core/workers/chunks/a61cb4f1ca282bf8b75d.js +1 -0
- package/assets/esri/core/workers/chunks/a6ac1ff89c40f3a4797a.js +1 -0
- package/assets/esri/core/workers/chunks/{dc31865edea480f0ebba.js → a8c4fd779e454e4075c4.js} +1 -1
- package/assets/esri/core/workers/chunks/a8f998b8ec8c56150479.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/aa6eb55e4fb57c4e8eeb.js +1 -0
- package/assets/esri/core/workers/chunks/aa78b69219d9a0ef1c54.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/af3fc2562bb6d217adf6.js +1 -0
- package/assets/esri/core/workers/chunks/{46ef545d2b3b3f4e6d32.js → b017bac40dc8328013e3.js} +2 -2
- package/assets/esri/core/workers/chunks/{46ef545d2b3b3f4e6d32.js.LICENSE.txt → b017bac40dc8328013e3.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/b59f9c3f7a149214256f.js +1 -0
- package/assets/esri/core/workers/chunks/b96eb0ea506379182d62.js +2 -0
- package/assets/esri/core/workers/chunks/{24921d31efa8d222ad2d.js.LICENSE.txt → b96eb0ea506379182d62.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{b5863afafd3a7d2d5c05.js → bb5484b5eeacc9ad2ceb.js} +3 -3
- package/assets/esri/core/workers/chunks/bb56717c4e36f28d4c08.js +1 -0
- package/assets/esri/core/workers/chunks/bb7976e2f883b544add6.js +1 -0
- package/assets/esri/core/workers/chunks/c0b7e86860838638537f.js +1 -0
- package/assets/esri/core/workers/chunks/c134ebbaeac514cbd657.js +1 -0
- package/assets/esri/core/workers/chunks/c2b47a7dc961863d283f.js +1 -0
- package/assets/esri/core/workers/chunks/{0eaa4dccba0d844b9da3.js → c3ddcf9148dd2640c402.js} +1 -1
- package/assets/esri/core/workers/chunks/c476643002387f60ea42.js +1 -0
- package/assets/esri/core/workers/chunks/ce16489cf7eb0d78c741.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/d048e4926e78458afa3e.js +1 -0
- package/assets/esri/core/workers/chunks/d39a10155317e6f7a21c.js +1 -0
- package/assets/esri/core/workers/chunks/d6e0528eacee7ea4c1ce.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/d886fb97bdb348a16f25.js +1 -0
- package/assets/esri/core/workers/chunks/{00aa85ae6419aad183ea.js → dc4982b0ac007bd70213.js} +1 -1
- package/assets/esri/core/workers/chunks/e1258b6a404e58878c7a.js +1 -0
- package/assets/esri/core/workers/chunks/e31192ae920e3e19b6aa.js +1 -0
- package/assets/esri/core/workers/chunks/e6a86cad44056735ed26.js +1 -0
- package/assets/esri/core/workers/chunks/e82f5437bd66779c6740.js +1 -0
- package/assets/esri/core/workers/chunks/{039ec0fbe3b4b398b8c6.js → f26dc1d83beed63b6045.js} +1 -1
- package/assets/esri/core/workers/chunks/{fa5c87889c2f0bef896b.js → f35aaa04cca676c2d3f8.js} +1 -1
- package/assets/esri/core/workers/chunks/f5b7e7f2860a825ed373.js +1 -0
- package/assets/esri/core/workers/chunks/f651c05604eab83aef5f.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{18da83afbc324fef9fd8.js → f779034623980bf9a37c.js} +2 -2
- package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
- package/assets/esri/themes/base/widgets/_Directions.scss +17 -18
- 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/chunks/ComponentShader.glsl.js +72 -39
- package/chunks/OITBlend.glsl.js +3 -3
- package/chunks/bundle.js +1 -1
- package/config.js +1 -1
- package/core/QueueProcessor.js +1 -1
- package/core/has.js +1 -1
- package/core/sanitizerUtils.js +1 -1
- package/core/workers/Connection.js +1 -1
- package/core/workers/WorkerHandle.js +1 -1
- package/core/workers/utils.js +1 -1
- package/geohash/GeohashCell.js +1 -1
- package/geohash/geohashUtils.js +1 -1
- package/geometry/GeometryCursor.js +1 -1
- package/geometry/geometryCursorCollectUtils.js +1 -1
- package/geometry/libtess.js +1 -1
- package/geometry/support/jsonUtils.js +1 -1
- package/geometry/support/normalizeUtilsSync.js +1 -1
- package/geometry/support/triangulationUtils.js +1 -1
- package/interfaces.d.ts +426 -347
- package/intl/date.js +1 -1
- package/intl.d.ts +2 -0
- package/intl.js +1 -1
- package/kernel.js +1 -1
- package/layers/FeatureLayer.js +1 -1
- package/layers/graphics/OptimizedFeature.js +1 -1
- package/layers/graphics/OptimizedGeometry.js +1 -1
- package/layers/graphics/centroid.js +1 -1
- package/layers/graphics/contains.js +1 -1
- package/layers/graphics/data/AttributesBuilder.js +1 -1
- package/layers/graphics/data/FeatureStore.js +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/data/geometryUtils.js +1 -1
- package/layers/graphics/data/spatialQuerySupport.js +1 -1
- package/layers/graphics/featureConversionUtils.js +1 -1
- package/layers/graphics/sources/OGCFeatureSource.js +1 -1
- package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
- package/layers/graphics/sources/geojson/geojson.js +1 -1
- package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/graphics/sources/support/clientSideDefaults.js +1 -1
- package/layers/knowledgeGraph/layerUtils.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/support/PixelBlock.js +1 -1
- package/layers/support/RasterInfo.js +1 -1
- package/layers/support/RasterJobHandler.js +1 -1
- package/layers/support/RasterSensorInfo.js +1 -1
- package/layers/support/RasterStorageInfo.js +1 -1
- package/layers/support/RasterWorker.js +1 -1
- package/layers/support/TitleCreator.js +1 -1
- package/layers/support/arcgisLayerUrl.js +1 -1
- package/layers/support/capabilities.js +1 -1
- package/layers/support/rasterDatasets/BaseRaster.js +1 -1
- package/layers/support/rasterDatasets/pixelReader.js +1 -1
- package/layers/support/rasterFieldUtils.js +1 -1
- package/layers/support/rasterFunctions/pixelUtils.js +1 -1
- package/layers/support/serviceCapabilitiesUtils.js +1 -1
- package/package.json +5 -5
- package/request.js +1 -1
- package/rest/print.js +1 -1
- package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
- package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
- package/rest/query/operations/query.js +1 -1
- package/rest/query/operations/queryZScale.js +1 -1
- package/rest/versionManagement/getVersionInfos.js +1 -1
- package/smartMapping/statistics/histogram.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
- package/smartMapping/support/utils.js +1 -1
- package/support/elevationInfoUtils.js +1 -1
- package/support/requestImageUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/GoToManager.js +1 -1
- package/views/2d/analysis/ElevationProfile/ElevationProfileLineVisualization2D.js +1 -1
- package/views/2d/engine/vectorTiles/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/engine/webgl/Mesh2D.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushVTLSymbol.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/templateUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/AFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/layers/features/aggregation/GridCell.js +1 -1
- package/views/2d/layers/features/processor/AAggregateStrategy.js +1 -1
- package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
- package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
- package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
- package/views/2d/layers/features/schema/SourceSchema.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/FeatureFilterEvaluator.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
- package/views/2d/layers/features/support/GraphicsReader.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/3d/FocusAreasView.js +1 -1
- package/views/3d/GroundView3D.js +1 -1
- package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
- package/views/3d/glTF/DefaultLoadingContext.js +1 -1
- package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureStore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/pipeline/featureSet/PBFPointFeatureSetView.js +1 -1
- package/views/3d/layers/graphics/pipeline/featureSet/TiledFeatureStore.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SQueryFeatureAdapter.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3DContext.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/layers/support/featureTileQuery3D.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
- package/views/3d/state/controllers/RotateController.js +1 -1
- package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
- package/views/3d/state/controllers/ZoomControllerLocal.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/DisplayQualityProfile.js +1 -1
- package/views/3d/support/QualitySettings.js +1 -1
- package/views/3d/support/StreamDataLoader.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
- package/views/3d/support/flow/FlowWorker.js +1 -1
- package/views/3d/support/flow/StreamlineResources3D.js +1 -1
- package/views/3d/support/flow/constants.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/support/renderInfoUtils/polygon.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/terrain/TileOverlayData.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +7 -7
- package/views/3d/webgl-engine/core/shaderModules/BooleanDrawUniform.js +5 -0
- package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueConstructionContext.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillDepth.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +4 -4
- package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileLineInputComputation.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileResult.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
- package/views/analysis/ElevationProfile/elevationProfileGenerationUtils.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/reshapeUtils.js +1 -1
- package/views/interactive/dragEventPipeline.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js +1 -1
- package/views/webgl/ShaderBuilder.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Directions/css.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/Editor/AddAssociationWorkflow.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/Edits.js +1 -1
- package/widgets/Editor/MergeFeaturesWorkflow.d.ts +4 -0
- package/widgets/Editor/MergeFeaturesWorkflow.js +5 -0
- package/widgets/Editor/MergeFeaturesWorkflowData.d.ts +4 -0
- package/widgets/Editor/MergeFeaturesWorkflowData.js +5 -0
- package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
- package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/UpdateFeaturesWorkflowData.js +1 -1
- package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
- package/widgets/Editor/components/UploadDetails.js +1 -1
- package/widgets/Editor/support/EditorItem.js +1 -1
- package/widgets/Editor/support/mergeFeaturesUtils.js +5 -0
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/Feature/FeatureExpression.js +1 -1
- package/widgets/Feature/FeatureFields/FeatureFieldsViewModel.js +1 -1
- package/widgets/Feature/FeatureFields.js +1 -1
- package/widgets/Feature/FeatureMedia/FeatureMediaViewModel.js +1 -1
- package/widgets/Feature/FeatureMedia.js +1 -1
- package/widgets/Feature/FeatureViewModel.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/Feature.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/SequentialNavigationUI.js +1 -1
- package/widgets/OrientedImageryViewer/components/SketchTools.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/support/ColorPicker.js +1 -1
- package/widgets/support/SelectionList/LayerItem.js +1 -1
- package/widgets/support/jsxWidgetSupport.js +1 -1
- package/assets/esri/core/workers/chunks/065f2bbcaeef1f13fd48.js +0 -1
- package/assets/esri/core/workers/chunks/0731e588afd1f561ec3b.js +0 -1
- package/assets/esri/core/workers/chunks/188272af9a6470ccfe31.js +0 -1
- package/assets/esri/core/workers/chunks/1a9f544f20f643161a36.js +0 -1
- package/assets/esri/core/workers/chunks/1cfcadaa98ac528fea37.js +0 -1
- package/assets/esri/core/workers/chunks/1db0bf570a04687b3130.js +0 -1
- package/assets/esri/core/workers/chunks/24921d31efa8d222ad2d.js +0 -2
- package/assets/esri/core/workers/chunks/2a900a632a1231deb713.js +0 -1
- package/assets/esri/core/workers/chunks/31c6e951b99315e8e68a.js +0 -1
- package/assets/esri/core/workers/chunks/35491fbdd287470d40a4.js +0 -1
- package/assets/esri/core/workers/chunks/36247c6f6fc2891df2cf.js +0 -1
- package/assets/esri/core/workers/chunks/3d53307efbc3f07d7bf2.js +0 -1
- package/assets/esri/core/workers/chunks/42a72e1d963e4636323b.js +0 -1
- package/assets/esri/core/workers/chunks/456161a323be7d640c61.js +0 -1
- package/assets/esri/core/workers/chunks/500d09d2191127371081.js +0 -1
- package/assets/esri/core/workers/chunks/5707713c2f27588b9194.js +0 -1
- package/assets/esri/core/workers/chunks/5713f96bade5ebb54c81.js +0 -1
- package/assets/esri/core/workers/chunks/5718cf135e105e1e026b.js +0 -1
- package/assets/esri/core/workers/chunks/5c585b338a9e9aa0e205.js +0 -1
- package/assets/esri/core/workers/chunks/5d1d909354c90cb8eb60.js +0 -1
- package/assets/esri/core/workers/chunks/5ea03f53d4d64d9e7cae.js +0 -1
- package/assets/esri/core/workers/chunks/63019a7eb5222dc5e420.js +0 -1
- package/assets/esri/core/workers/chunks/64629ddcf008349eaf41.js +0 -1
- package/assets/esri/core/workers/chunks/64ee8d2acae2d6fce608.js +0 -1
- package/assets/esri/core/workers/chunks/6fcacfcb3d83515c37c9.js +0 -1
- package/assets/esri/core/workers/chunks/72ecf49d03bb24bf0998.js +0 -1
- package/assets/esri/core/workers/chunks/7421f9575487cdc9e28e.js +0 -1
- package/assets/esri/core/workers/chunks/77a11d7d53325d108ed8.js +0 -1
- package/assets/esri/core/workers/chunks/7a05b1f6163112bc9db2.js +0 -1
- package/assets/esri/core/workers/chunks/7d9882ddfa6495f72baa.js +0 -1
- package/assets/esri/core/workers/chunks/7fffad8ff6878fa1fd56.js +0 -1
- package/assets/esri/core/workers/chunks/81bbe5251ed13c0d91cc.js +0 -1
- package/assets/esri/core/workers/chunks/8b16aa50d879b92a5375.js +0 -1
- package/assets/esri/core/workers/chunks/8bc64fc7c4b9eb8fca4d.js +0 -1
- package/assets/esri/core/workers/chunks/8bfa19c24be0e3f3fd74.js +0 -1
- package/assets/esri/core/workers/chunks/8eefa133c36a004c054c.js +0 -1
- package/assets/esri/core/workers/chunks/9834bc11586a2d8d6f35.js +0 -1
- package/assets/esri/core/workers/chunks/9c6fc4fe2c46f40d63d9.js +0 -1
- package/assets/esri/core/workers/chunks/a5f25104938ab33e7a85.js +0 -1
- package/assets/esri/core/workers/chunks/a7bd294996e6c8b8354a.js +0 -1
- package/assets/esri/core/workers/chunks/abf4f018c692c18c3320.js +0 -1
- package/assets/esri/core/workers/chunks/b1f667006cba60ef4aa7.js +0 -1
- package/assets/esri/core/workers/chunks/b2d9f4e057af26a538fb.js +0 -1
- package/assets/esri/core/workers/chunks/b62807c6fcfb70a87cd4.js +0 -1
- package/assets/esri/core/workers/chunks/b8339c1d60847a9eed3e.js +0 -1
- package/assets/esri/core/workers/chunks/c362fbbafec91c44eeb2.js +0 -1
- package/assets/esri/core/workers/chunks/c941d15190fc08523d0d.js +0 -1
- package/assets/esri/core/workers/chunks/cc70a4a915b0b2ccb2a0.js +0 -1
- package/assets/esri/core/workers/chunks/d121045cddbe55c2ecb2.js +0 -1
- package/assets/esri/core/workers/chunks/d2120a623b1bd91b9ed9.js +0 -1
- package/assets/esri/core/workers/chunks/d78c2833cdc4730a88a3.js +0 -1
- package/assets/esri/core/workers/chunks/df438b62702007267798.js +0 -1
- package/assets/esri/core/workers/chunks/f4eb090bcc3eca64306a.js +0 -1
- package/assets/esri/core/workers/chunks/f7846523adacbfe5047e.js +0 -1
- package/assets/esri/core/workers/chunks/f839b86bee15deaf84e4.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{isSome as s}from"../../core/arrayUtils.js";import{createTask as i}from"../../core/asyncUtils.js";import r from"../../core/Collection.js";import{
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{isSome as s}from"../../core/arrayUtils.js";import{createTask as i}from"../../core/asyncUtils.js";import r from"../../core/Collection.js";import{stripHTMLSanitizer as a}from"../../core/sanitizerUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import{featureHasFields as n,extractSubstitutionTemplatesFromString as c}from"./fieldUtils.js";import{loadArcade as d}from"../../support/loadArcade.js";const p="relationships/",u="expression/",f=/<br\s*\/*>/gi;let h=class extends t{constructor(e){super(e),this._featureUtils=null,this.effectivePopupTemplate=null}get _arcadeTask(){if(this.expressionsUsedInTitle.length>0){return this._get("_arcadeTask")||i(()=>d())}return null}get featureUtilsPromise(){return this._get("featureUtilsPromise")??import("../../widgets/Feature/support/featureUtils.js").then(e=>this._featureUtils=e)}get calculatedExpressions(){const e=new r;if(!this.expressionsUsedInTitle.length)return e;if(!this._arcadeTask?.value){for(const t of this.expressionsUsedInTitle??[])e.push({name:t.name,invalid:!0});return e}for(const t of this.expressionsUsedInTitle)try{const s=this._arcadeTask.value.arcade.parseScript(t.expression,["$layer","$map","$datastore"]);if(s.isAsync){e.push({name:t.name,invalid:!0});break}e.push({name:t.name,syntax:s,invalid:!1,func:this._arcadeTask.value.arcade.compileScript(s,{vars:{$feature:"any"}})})}catch{e.push({name:t.name,invalid:!0});break}return e}get expressionsUsedInTitle(){let e=this.effectivePopupTemplate?.title??"";return"string"!=typeof e?[]:(e=e.toLowerCase(),this.effectivePopupTemplate?.expressionInfos?.filter(t=>e.includes(`{expression/${t.name.toLowerCase()}}`))??[])}get fieldInfoMap(){return this._featureUtils?this._createFieldInfoMap(this._featureUtils.getAllFieldInfos(this.effectivePopupTemplate)):null}get hasBadExpressions(){return this.calculatedExpressions.some(e=>!0===e.invalid)}get requiredFields(){const e=new Set;if(this._arcadeTask?.value&&!this.hasBadExpressions)for(const s of this.calculatedExpressions?.toArray()??[])try{const t=this._arcadeTask.value.arcade.extractFieldLiterals(s.syntax);for(const s of t){const t=s.split("."),i=this.fieldsIndex.get(t.at(-1)??"");i&&e.add(i.name)}}catch{}const t=this._extractFieldNames(this.workingTitle);for(const s of t){const t=this.fieldsIndex.get(s);t&&e.add(t.name)}return null!=this.objectIdField&&e.add(this.objectIdField),e}get titleFromDisplayField(){let e="";return this.displayField&&(e=this.fieldsIndex.get(this.displayField)?.name??""),e||(e=this.fieldsIndex.get(this.objectIdField)?.name??""),e?`{${e}}`:""}get workingTitle(){const e=this.effectivePopupTemplate?this.effectivePopupTemplate.title:"";return""===e||null==e||this.hasBadExpressions||"string"!=typeof e?this.titleFromDisplayField:e}async getTitle(e,t,s){const i=t.getObjectId()??t.attributes[e.objectIdField];return(await this.getTitles(e,[t],s)).get(i)??""}async getTitles(e,t,s){const i=new Map,r=s?.timeZone??"system";try{const[{substituteFieldsInLinksAndAttributes:o}]=await Promise.all([this.featureUtilsPromise,this._arcadeTask?.promise]);s?.fetchMissingFields&&(t=await this._checkAndReQueryGraphics(e,t));const{fieldInfoMap:l,workingTitle:n}=this,c=n&&l;t.forEach(t=>{const d=t.getObjectId()??t.attributes[e.objectIdField];let p=c?o({attributes:t.attributes,expressionAttributes:null,fieldInfoMap:l,globalAttributes:this._createFormattedAttributes(e,t,r).global,layer:e,text:n}):"";s?.removeHTML&&(p=a.sanitize(p).replaceAll(f," ")),i.set(d,p)})}catch{}return i}async _checkAndReQueryGraphics(e,t){const i=t.map(t=>t.getObjectId()??t.attributes[e.objectIdField]).filter(s);if(i.length!==t.length)return t;if(t.some(e=>!n(e,this.requiredFields))){const s=e.createQuery();s.where="1=1",s.outFields=[...this.requiredFields],s.objectIds=i;const r=await e.queryFeatures(s);if(r?.features.length===t.length)return r.features}return t}_createFieldInfoMap(e){const t=new Map;if(!e)return t;for(const s of e){if(!s.fieldName)continue;const e=this.fieldsIndex.get(s.fieldName),i=e?.name??s.fieldName;s.fieldName=i,t.set(i.toLowerCase(),s)}return t}_createFormattedAttributes(e,t,s="system"){const i=this.effectivePopupTemplate?.fieldInfos??[],r={};if(!this._featureUtils)return{};if(!this.hasBadExpressions&&this.calculatedExpressions.length>0&&this._arcadeTask?.value){const s=this._arcadeTask.value.Feature.createFromGraphicLikeObject(t.geometry,t.attributes,e,null);for(const e of this.calculatedExpressions)try{r[`expression/${e.name}`]=e.func({vars:{$feature:s}})}catch{}}const a={...t.attributes,...r};return{global:this._featureUtils.formatAttributes({fieldInfos:i,attributes:a,graphic:t,timeZone:s,layer:e,fieldInfoMap:this.fieldInfoMap}),content:[]}}_extractFieldNames(e){return c(e).filter(e=>!(e.startsWith(p)||e.startsWith(u)))}};e([o({readOnly:!0})],h.prototype,"_arcadeTask",null),e([o()],h.prototype,"_featureUtils",void 0),e([o({readOnly:!0})],h.prototype,"featureUtilsPromise",null),e([o({readOnly:!0})],h.prototype,"calculatedExpressions",null),e([o()],h.prototype,"displayField",void 0),e([o()],h.prototype,"effectivePopupTemplate",void 0),e([o()],h.prototype,"expressionsUsedInTitle",null),e([o()],h.prototype,"fieldsIndex",void 0),e([o()],h.prototype,"fieldInfoMap",null),e([o()],h.prototype,"fields",void 0),e([o()],h.prototype,"objectIdField",void 0),e([o()],h.prototype,"requiredFields",null),h=e([l("esri.layers.support.TitleCreator")],h);export{h as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{urlToObject as e,getOrigin as r,join as t,removeQueryParameters as s,removeTrailingSlash as n,Url as l,makeAbsolute as i}from"../../core/urlUtils.js";import{w as u}from"../../chunks/persistableUrlUtils.js";const o={mapserver:"MapServer",imageserver:"ImageServer",featureserver:"FeatureServer",knowledgegraphserver:"KnowledgeGraphServer",sceneserver:"SceneServer",streamserver:"StreamServer",vectortileserver:"VectorTileServer","3dtilesserver":"3DTilesServer",videoserver:"VideoServer"},a=Object.values(o),c=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/rest\\/services\\/(.+?)\\/(${a.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),v=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/([^/\\n]+)\\/(${a.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),
|
|
5
|
+
import{urlToObject as e,getOrigin as r,join as t,removeQueryParameters as s,removeTrailingSlash as n,Url as l,makeAbsolute as i}from"../../core/urlUtils.js";import{w as u}from"../../chunks/persistableUrlUtils.js";const o={mapserver:"MapServer",imageserver:"ImageServer",featureserver:"FeatureServer",knowledgegraphserver:"KnowledgeGraphServer",sceneserver:"SceneServer",streamserver:"StreamServer",vectortileserver:"VectorTileServer","3dtilesserver":"3DTilesServer",videoserver:"VideoServer"},a=Object.values(o),c=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/rest\\/services\\/(.+?)\\/(${a.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),v=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/([^/\\n]+)\\/(${a.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),d=/(.*?)\/(?:layers\/)?(\d+)\/?$/i;function f(e){return c.test(e)}function p(r){if(null==r)return null;const t=e(r),s=t?.path.match(c)||t?.path.match(v);if(!s)return null;const[,n,l,i,u]=s,a=l.indexOf("/");return{title:h(-1!==a?l.slice(a+1):l),serverType:o[i.toLowerCase()],sublayer:null!=u&&""!==u?parseInt(u,10):null,url:{path:n}}}function m(r){const t=e(r).path.match(d);return t?{serviceUrl:t[1],sublayerId:Number(t[2])}:null}function h(e){return(e=e.replaceAll(/\s*[/_]+\s*/g," "))[0].toUpperCase()+e.slice(1)}function w(e,r){const t=[];if(e){const r=p(e);null!=r&&r.title&&t.push(r.title)}if(r){const e=h(r);t.push(e)}if(2===t.length){if(t[0].toLowerCase().includes(t[1].toLowerCase()))return t[0];if(t[1].toLowerCase().includes(t[0].toLowerCase()))return t[1]}return t.join(" - ")}const g=["services","features","tiles","elevation3d"];function y(e){let t=r(e,!0);return!!t&&(t=t.toLowerCase(),!!t.endsWith(".arcgis.com")&&(!!g.some(e=>t.startsWith(e))||/^[a-z\d-]+\.svcs[a-z\d-]*\./.test(t)))}function S(e,r){return e?n(s(e,r)):e}function C(r){let{url:t}=r;if(!t)return{url:t};t=s(t,r.logger);const l=e(t),i=p(l.path);let u;if(null!=i)null!=i.sublayer&&null==r.layer.layerId&&(u=i.sublayer),t=i.url.path;else if(r.nonStandardUrlAllowed){const e=m(l.path);null!=e&&(t=e.serviceUrl,u=e.sublayerId)}return{url:n(t),layerId:u}}function b(e,r,s,n,l){u(r,n,"url",l),n.url&&null!=e.layerId&&(n.url=t(n.url,s,e.layerId.toString()))}function I(e){if(!e)return!1;const r=e.toLowerCase(),t=r.includes("/services/"),s=r.includes("/mapserver/wmsserver"),n=r.includes("/imageserver/wmsserver"),l=r.includes("/wmsserver");return t&&(s||n||l)}function L(e){if(!e)return!1;const r=new l(i(e)),t=r.authority?.toLowerCase();return"server.arcgisonline.com"===t||"services.arcgisonline.com"===t}export{h as cleanTitle,f as isArcGISUrl,y as isHostedAgolService,L as isServerOrServicesAGOLUrl,I as isWmsServer,p as parse,m as parseNonStandardSublayerUrl,S as sanitizeUrl,C as sanitizeUrlWithLayerId,a as serverTypes,w as titleFromUrlAndName,b as writeUrlWithLayerId};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const s={supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1,supportedStatistics:void 0,supportedNormalizationTypes:void 0},t={analytics:{supportsCacheHint:!1},attachment:{supportsContentType:!1,supportsExifInfo:!1,supportsKeywords:!1,supportsName:!1,supportsSize:!1,supportsCacheHint:!1,supportsOrderByFields:!1,supportsResize:!1,supportsTypeWildcard:!1},data:{isVersioned:!1,isBranchVersioned:!1,supportsAttachment:!1,supportsM:!1,supportsZ:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsAsyncApplyEdits:!1,zDefault:void 0},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryBins:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},queryAttributeBins:s,query:{maxRecordCount:0,maxRecordCountFactor:0,maxUniqueIDCount:0,standardMaxRecordCount:0,supportsCacheHint:!1,supportsCentroid:!1,supportsCentroidOnDegeneratedQuantizedGeometry:!1,supportsCompactGeometry:!1,supportsCurrentUser:!1,supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDisjointSpatialRelationship:!1,supportsDistance:!1,supportsDistinct:!1,supportsExtent:!1,supportsFormatPBF:!1,supportsGeometryProperties:!1,supportsHavingClause:!1,supportsHistoricMoment:!1,supportsMaxRecordCountFactor:!1,supportsOrderBy:!1,supportsPagination:!1,supportsPaginationOnAggregatedQueries:!1,supportsPercentileStatistics:!1,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsSqlExpression:!1,supportsStandardizedQueriesOnly:!1,supportsTopFeaturesQuery:!1,supportsTrueCurve:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsStatistics:!1,tileMaxRecordCount:0}};export{t as zeroCapabilities,s as zeroQueryBins};
|
|
5
|
+
const s={supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1,supportedStatistics:void 0,supportedNormalizationTypes:void 0},t={analytics:{supportsCacheHint:!1},attachment:{supportsContentType:!1,supportsExifInfo:!1,supportsKeywords:!1,supportsName:!1,supportsSize:!1,supportsCacheHint:!1,supportsOrderByFields:!1,supportsResize:!1,supportsTypeWildcard:!1},data:{isVersioned:!1,isBranchVersioned:!1,supportsAttachment:!1,supportsM:!1,supportsZ:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsAsyncApplyEdits:!1,zDefault:void 0},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},queryAttributeBins:s,query:{maxRecordCount:0,maxRecordCountFactor:0,maxUniqueIDCount:0,standardMaxRecordCount:0,supportsCacheHint:!1,supportsCentroid:!1,supportsCentroidOnDegeneratedQuantizedGeometry:!1,supportsCompactGeometry:!1,supportsCurrentUser:!1,supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDisjointSpatialRelationship:!1,supportsDistance:!1,supportsDistinct:!1,supportsExtent:!1,supportsFormatPBF:!1,supportsGeometryProperties:!1,supportsHavingClause:!1,supportsHistoricMoment:!1,supportsMaxRecordCountFactor:!1,supportsOrderBy:!1,supportsPagination:!1,supportsPaginationOnAggregatedQueries:!1,supportsPercentileStatistics:!1,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsSqlExpression:!1,supportsStandardizedQueriesOnly:!1,supportsTopFeaturesQuery:!1,supportsTrueCurve:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsStatistics:!1,tileMaxRecordCount:0}};export{t as zeroCapabilities,s as zeroQueryBins};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../request.js";import i from"../../../core/Error.js";import{JSONSupport as r}from"../../../core/JSONSupport.js";import o from"../../../core/Logger.js";import{onAbort as n}from"../../../core/promiseUtils.js";import{QueueProcessor as s}from"../../../core/QueueProcessor.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import{ensureClass as a}from"../../../core/accessorSupport/ensureType.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import f from"../../../geometry/Extent.js";import m from"../../../geometry/Point.js";import u from"../../../geometry/SpatialReference.js";import{sanitizeUrl as h}from"../arcgisLayerUrl.js";import{url as p}from"../commonProperties.js";import d from"../DimensionalDefinition.js";import x from"../LOD.js";import y from"../RasterStorageInfo.js";import g from"../TileInfo.js";import{isFunctionRaster as I,getPixelSpaceCoverage as R}from"./datasetUtils.js";import{isMultiSliceOrRangeDefinition as w,getSliceIndex as S,createSlices as k,getSliceIds as b}from"./multidimensionalUtils.js";import{getRasterId as v,getBlock as T,putBlock as P,deleteBlock as B,decreaseRefCount as _}from"./RawBlockCache.js";import{convertNoDataToMask as M}from"../rasterFormats/pixelRangeUtils.js";import{decode as C}from"../rasterFormats/RasterCodec.js";import{mosaic as W,approximateTransform as j,getLocalArithmeticNorthRotations as z}from"../rasterFunctions/pixelUtils.js";import{getWorldWidth as H,load as L,projectPoint as E,snapPyramid as D,shiftExtent as O,getWorldWrapCount as F,projectExtent as A,getProjectionOffsetGrid as G,getRasterDatasetAlignmentInfo as q,projectResolution as N}from"../rasterFunctions/rasterProjectionHelper.js";import{convertToLocalDirections as J,uvComponentToVector as V}from"../rasterFunctions/vectorFieldUtils.js";const U=8,Q=256;let $=0,X=class extends r{constructor(){super(...arguments),this._tileFetchQueue=new s({concurrency:32,process:(e,t)=>this._fetchRawTile(e.pyramidLevel,e.row,e.col,{...e.options,signal:t})}),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}normalizeCtorArgs(e){return e?.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:g.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){const{rasterInfo:e}=this,t=H(e.spatialReference);return null!=t&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){const{transform:e}=this.rasterInfo;return null==e||"gcs-shift"===e.type}set rasterJobHandler(e){this._set("rasterJobHandler",e),I(this)&&this.primaryRasters?.rasters?.forEach(t=>t.rasterJobHandler=e)}get rasterId(){return this.url||"rasterId-"+$++}set url(e){this._set("url",h(e,o.getLogger(this)))}async open(e){return this._openPromise??=L().then(()=>this._open(e)),this._openPromise}async fetchTile(e,t,i,r={}){const o=r.tileInfo||this.rasterInfo.storageInfo.tileInfo,n=this.getTileExtentFromTileInfo(e,t,i,o);return r={noClip:!0,...r},this.fetchPixels(n,o.size[0],o.size[1],r)}async identify(e,t={}){e=a(m,e).clone().normalize();const{multidimensionalDefinition:i,timeExtent:r}=t,{rasterInfo:o}=this,{hasMultidimensionalTranspose:n,multidimensionalInfo:s}=o;let{transposedVariableName:l}=t;const c=null!=s&&n&&(null!=r||w(i));if(c&&!l){l=null!=i&&i.length>0?i[0].variableName??void 0:s.variables[0].name,t={...t,transposedVariableName:l}}t=this._getRequestOptionsWithSliceId(t);const{spatialReference:u,extent:h}=o,{datumTransformation:p}=t;let d=E(e,u,p);if(!h.intersects(d))return{location:d,value:null};if(null!=o.transform){const e=o.transform.inverseTransform(d);if(!o.nativeExtent.intersects(e))return{location:e,value:null};d=e}let x=0;const y=null!=l&&null!=s&&o.hasMultidimensionalTranspose;if(I(this)){const e=this.primaryRasters.rasters[0];if(y)return e.identify(d,t);const{pixelSize:r}=o,n=3,s=r.x*n/2,l=r.y*n/2,a=new f({xmin:d.x-s,xmax:d.x+s,ymin:d.y-l,ymax:d.y+l,spatialReference:u}),c={interpolation:"nearest",multidimensionalDefinition:i,sliceId:t.sliceId,bandIds:t.bandIds},{pixelBlock:m}=await e.fetchPixels(a,n,n,c),{pixelBlock:h}=await this.fetchPixels(a,n,n,c);if(null==m)return{location:d,value:null};const p=Math.floor(n*n*.5),x=!m.mask||m.mask[p]?m.pixels.map(e=>e[p]):null;let g;return null!=h&&(g=!h.mask||h.mask[p]?h.pixels.map(e=>e[p]):void 0),{location:d,value:x,processedValue:g,pyramidLevel:0}}if(!y)if(t.srcResolution){x=D(t.srcResolution,o,this.ioConfig.sampling).pyramidLevel}else if(x=await this.computeBestPyramidLevelForLocation(e,t),null==x)return{location:d,value:null};const g=this.identifyPixelLocation(d,x,null,y);if(null===g)return{location:d,value:null};const{row:R,col:S,rowOffset:k,colOffset:b,blockWidth:v}=g,T=await this._tileFetchQueue.push({pyramidLevel:x,row:R,col:S,options:t},{signal:t.signal});if(!T?.pixels?.length)return{location:d,value:null};const P=k*v+b;return this._processIdentifyResult(T,{srcLocation:d,position:P,pyramidLevel:x,useTransposedTile:!!y,requestSomeSlices:c,identifyOptions:t})}async fetchPixels(e,t,i,r={}){e=O(e),r=this._getRequestOptionsWithSliceId(r);const{_hasNoneOrGCSShiftTransform:o}=this;if(r.requestRawData&&o)return this._fetchPixels(e,t,i,r);const n=H(e.spatialReference),s=F(e);if(null==n||0===s||1===s&&this._isGlobalWrappableSource&&o)return this._fetchPixels(e,t,i,r);if(s>=3)return{extent:e,pixelBlock:null};const l=[],{xmin:a,xmax:c}=e,m=Math.round(n/(c-a)*t),u=m-Math.round((n/2-a)/(c-a)*t);let h=0;const p=[];for(let g=0;g<=s;g++){const o=new f({xmin:0===g?a:-n/2,xmax:g===s?c-n*g:n/2,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),d=0===g?m-u:g===s?t-h:m;h+=d,p.push(d);const x=r.disableWrapAround&&g>0?null:this._fetchPixels(o,d,i,r);l.push(x)}const d=(await Promise.all(l)).map(e=>e?.pixelBlock);let x=null;const y={width:t,height:i};if(this.rasterJobHandler){x=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:d,srcMosaicSize:y,destDimension:null,coefs:null,sampleSpacing:null,interpolation:"nearest",alignmentInfo:null,blockWidths:p},r)).pixelBlock}else x=W(d,y,{blockWidths:p});return{extent:e,srcExtent:A(e,this.rasterInfo.spatialReference,r.datumTransformation),pixelBlock:x}}async fetchRawPixels(e,t,i,r={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};const o=await this._fetchRawTiles(e,t,i,r),{nativeExtent:n,nativePixelSize:s,storageInfo:l}=this.rasterInfo,a=2**e,c=s.x*a,m=s.y*a,u=new f({xmin:n.xmin+c*t.x,xmax:n.xmin+c*(t.x+i.width-1),ymin:n.ymax-m*(t.y+i.height-1),ymax:n.ymax-m*t.y,spatialReference:n.spatialReference});if(!o)return{extent:u,srcExtent:u,pixelBlock:null};const{pixelBlocks:h,mosaicSize:p}=o;if(1===h.length&&null!=h[0]&&h[0].width===i.width&&h[0].height===i.height)return{extent:u,srcExtent:u,pixelBlock:o.pixelBlocks[0]};const d=e>0?l.pyramidBlockWidth:l.blockWidth,x=e>0?l.pyramidBlockHeight:l.blockHeight,y={x:t.x%d,y:t.y%x};let g;if(this.rasterJobHandler){g=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:h,srcMosaicSize:p,destDimension:i,clipOffset:y,clipSize:i,coefs:null,sampleSpacing:null,interpolation:r.interpolation,alignmentInfo:null,blockWidths:null},r)).pixelBlock}else g=W(h,p,{clipOffset:y,clipSize:i});return{extent:u,srcExtent:u,pixelBlock:g}}fetchRawTile(e,t,r,o){throw new i("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return A(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return!this.rasterJobHandler||t.useCanvas?C(e,t):this.rasterJobHandler.decode({data:e,options:t})}async request(e,i,r=0){const{customFetchParameters:o}=this.ioConfig,{range:n,query:s,headers:l}=i;r=r??i.retryCount??this.ioConfig.retryCount;const a=n?{Range:`bytes=${n.from}-${n.to}`}:null;try{return await t(e,{...i,query:{...s,...o},headers:{...l,...a}})}catch(c){if(r>0)return r--,this.request(e,i,r);throw c}}getSliceIndex(e){const{multidimensionalInfo:t}=this.rasterInfo;return null==t||null==e||0===e.length?null:S(e,t)}getTileExtentFromTileInfo(e,t,i,r){const o=r.lodAt(e);return this.getTileExtent({x:o.resolution,y:o.resolution},t,i,r.origin,r.spatialReference,r.size)}updateTileInfo(){const{storageInfo:e,spatialReference:t,extent:i,pixelSize:r}=this.rasterInfo,{pyramidResolutions:o}=e;if(!e.tileInfo){const n=[],s=e.maximumPyramidLevel||0;let l=(r.x+r.y)/2,a=1/.0254*96*l;for(let e=0;e<=s&&(n.unshift(new x({level:s-e,resolution:l,scale:a})),e!==s);e++)if(o){const t=(o[e].x+o[e].y)/2;a*=t/l,l=t}else l*=2,a*=2;const c=new m({x:i.xmin,y:i.ymax,spatialReference:t});e.tileInfo=new g({origin:c,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:n}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,i=512,r){const{width:o,height:n,nativeExtent:s,pixelSize:l,spatialReference:a}=e,c=new m({x:s.xmin,y:s.ymax,spatialReference:a});null==r&&(r=Math.max(0,Math.round(Math.log(Math.max(o,n))/Math.LN2-8)));const f=this.computeBlockBoundary(s,512,512,{x:s.xmin,y:s.ymax},[l],r);e.storageInfo=new y({blockWidth:t,blockHeight:i,pyramidBlockWidth:t,pyramidBlockHeight:i,origin:c,firstPyramidLevel:1,maximumPyramidLevel:r,blockBoundary:f})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,i,r,o,n=0,s=2){if(1===o.length&&n>0){o=[...o];let{x:e,y:t}=o[0];for(let i=0;i<n;i++)e*=s,t*=s,o.push({x:e,y:t})}const l=[],{x:a,y:c}=r;for(let f=0;f<o.length;f++){const{x:r,y:n}=o[f];l.push({minCol:Math.floor((e.xmin-a+.1*r)/t/r),maxCol:Math.floor((e.xmax-a-.1*r)/t/r),minRow:Math.floor((c-e.ymax+.1*n)/i/n),maxRow:Math.floor((c-e.ymin-.1*n)/i/n)})}return l}getPyramidPixelSize(e){const{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:i,pyramidScalingFactor:r}=this.rasterInfo.storageInfo;if(0===e)return t;if(null!=i&&i.length)return i[e-1];const o=r**e;return{x:t.x*o,y:t.y*o}}identifyPixelLocation(e,t,i,r){const{spatialReference:o,nativeExtent:n,storageInfo:s}=this.rasterInfo,{maximumPyramidLevel:l,origin:a,transposeInfo:c}=s,f=r&&null!=c?c.tileSize[0]:s.blockWidth,m=r&&null!=c?c.tileSize[1]:s.blockHeight,u=E(e,o,i);if(!n.intersects(u))return null;if(t<0||t>l)return null;const h=this.getPyramidPixelSize(t),{x:p,y:d}=h,x=(a.y-u.y)/d/m,y=(u.x-a.x)/p/f,g=Math.min(m-1,Math.floor((x-Math.floor(x))*m)),I=Math.min(f-1,Math.floor((y-Math.floor(y))*f));return{pyramidLevel:t,row:Math.floor(x),col:Math.floor(y),rowOffset:g,colOffset:I,blockWidth:f,srcLocation:u}}getTileExtent(e,t,i,r,o,n){const[s,l]=n,a=r.x+i*s*e.x,c=a+s*e.x,m=r.y-t*l*e.y,u=m-l*e.y;return new f({xmin:a,xmax:c,ymin:u,ymax:m,spatialReference:o})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,i){const r=this.rasterInfo.storageInfo.blockBoundary[e];return!r||r.maxRow<t||r.maxCol<i||r.minRow>t||r.minCol>i}updateImageSpaceRasterInfo(e){const{pixelSize:t}=e,{width:i,height:r}=e,o=u.WebMercator;e.spatialReference=o,e.extent=e.nativeExtent=new f({xmin:-.5,ymax:.5,xmax:i-.5,ymin:.5-r,spatialReference:o}),e.isPseudoSpatialReference=!0,e.transform=null,e.pixelSize=new m({x:1,y:1,spatialReference:o});const{extent:n,storageInfo:s}=e;if(s){s.origin=new m({x:n.xmin,y:n.ymax,spatialReference:o});const{pyramidResolutions:i,tileInfo:r}=s;if(i&&i.forEach(e=>{e.x/=t.x,e.y/=t.y}),r){r.origin=s.origin;const t=(e.nativePixelSize.x+e.nativePixelSize.y)/2;r.lods.forEach((e,i)=>{e.resolution=t*2**i,e.scale=96*e.resolution/.0254})}}}async _fetchPixels(e,t,i,r={}){let o=F(e);if(o>=2)return{extent:e,pixelBlock:null};const n=this._getSourceDataInfo(e,t,i,r),{pyramidLevel:s,srcResolution:l,srcExtent:a,srcWidth:c,srcHeight:f,ul:u}=n;if(0===c||0===f)return{extent:e,srcExtent:a,pixelBlock:null};const{rasterInfo:h}=this,p=h.transform,d="gcs-shift"===p?.type,x=null!=H(e.spatialReference);!d&&x||(o=F(n.srcExtent,d));const y=await this._fetchRawTiles(s,u,{width:c,height:f,wrapCount:o},r);if(!y)return{extent:e,srcExtent:a,pixelBlock:null};const g=h.storageInfo,I=s>0?g.pyramidBlockWidth:g.blockWidth,R=s>0?g.pyramidBlockHeight:g.blockHeight;let{x:w,y:S}=h.pixelSize;if(s>0){const{pyramidResolutions:e,pyramidScalingFactor:t}=g;if(null!=e&&e[s-1])({x:w,y:S}=e[s-1]);else{const e=t**s;w*=e,S*=e}}const k=h.spatialReference,b=new m({x:w,y:S,spatialReference:k}),v=I===c&&R===f&&u.x%I===0&&u.y%R===0,T=new m({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference}),P=!e.spatialReference.equals(k),B=k.isGeographic?1e-9:1e-4,{datumTransformation:_}=r;if(!P&&v&&1===y.pixelBlocks.length&&I===t&&R===i&&K(l,T,B))return{extent:e,srcExtent:a,srcTilePixelSize:b,pixelBlock:y.pixelBlocks[0]};const M=x&&null!=H(a.spatialReference)&&this._hasNoneOrGCSShiftTransform,C=r.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith("vector");C&&!this.rasterJobHandler&&await L();const E=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:T.toJSON(),datumTransformation:_,rasterTransform:p,hasWrapAround:o>0||M,isAdaptive:!1!==this.ioConfig.optimizeProjectionAccuracy,includeGCSGrid:C},r):G({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:T,datumTransformation:_,rasterTransform:p,hasWrapAround:o>0||M,isAdaptive:!1,includeGCSGrid:C});let D;const O=!r.requestRawData,A={rows:E.spacing[0],cols:E.spacing[1]},q=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(s,y.extent.xmin):void 0,{pixelBlocks:N,mosaicSize:V,isPartiallyFilled:U}=y;let Q=null;if(this.rasterJobHandler){const e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:N,srcMosaicSize:V,destDimension:O?{width:t,height:i}:null,coefs:O?E.coefficients:null,sampleSpacing:O?A:null,projectDirections:C,gcsGrid:C?E.gcsGrid:null,isUV:"vector-uv"===this.rasterInfo.dataType,interpolation:r.interpolation,alignmentInfo:q,blockWidths:null},r);({pixelBlock:D,localNorthDirections:Q}=e)}else{const e=W(N,V,{alignmentInfo:q});D=O?j(e,{width:t,height:i},E.coefficients,A,r.interpolation):e,C&&E.gcsGrid&&(Q=z({width:t,height:i},E.gcsGrid),D=J(D,this.rasterInfo.dataType,Q))}return r.requestRawData||C?{extent:e,srcExtent:a,srcTilePixelSize:b,pixelBlock:D,transformGrid:E,localNorthDirections:Q,isPartiallyFilled:U}:{extent:e,srcExtent:a,srcTilePixelSize:b,pixelBlock:D}}async _fetchRawTiles(e,t,i,r){const{origin:o,blockBoundary:n}=this.rasterInfo.storageInfo,{blockWidth:s,blockHeight:l}=this.getBlockWidthHeight(e);let{x:a,y:c}=t,{width:m,height:u,wrapCount:h}=i;const p=this._getRasterTileAlignmentInfo(e,0);r.buffer&&(a-=r.buffer.cols,c-=r.buffer.rows,m+=2*r.buffer.cols,u+=2*r.buffer.rows);let d=0,x=0,y=0;if(h&&null!=p){({worldColumnCountFromOrigin:x,originColumnOffset:y,rightPadding:d}=p);x*p.blockWidth-d>=a+m&&(d=0)}const g=Math.floor(a/s),I=Math.floor(c/l),R=Math.floor((a+m+d-1)/s),w=Math.floor((c+u+d-1)/l),S=n[e];if(!S)return null;const{minRow:k,minCol:b,maxCol:v,maxRow:T}=S;if(0===h&&(w<k||R<b||I>T||g>v))return null;const P=new Array;let B=!1;const _=null==this.ioConfig.allowPartialFill?r.allowPartialFill:this.ioConfig.allowPartialFill;for(let f=I;f<=w;f++)for(let t=g;t<=R;t++){let i=t;if(!r.disableWrapAround&&h&&null!=p&&x<=t&&(i=t-x-y),f>=k&&i>=b&&T>=f&&v>=i){const t=this._tileFetchQueue.push({pyramidLevel:e,row:f,col:i,options:r},{signal:r.signal});_?P.push(new Promise(e=>{t.then(t=>e(t)).catch(()=>{B=!0,e(null)})})):P.push(t)}else P.push(Promise.resolve(null))}if(0===P.length)return null;const M=await Promise.all(P),C={height:(w-I+1)*l,width:(R-g+1)*s},{spatialReference:W}=this.rasterInfo,j=this.getPyramidPixelSize(e),{x:z,y:H}=j;return{extent:new f({xmin:o.x+g*s*z,xmax:o.x+(R+1)*s*z,ymin:o.y-(w+1)*l*H,ymax:o.y-I*l*H,spatialReference:W}),pixelBlocks:M,mosaicSize:C,isPartiallyFilled:B}}_fetchRawTile(e,t,i,r){const{storageInfo:o}=this.rasterInfo,s=null!=o.transposeInfo&&!!r.transposedVariableName;if(!s){const r=o.blockBoundary[e];if(!r)return Promise.resolve(null);const{minRow:n,minCol:s,maxCol:l,maxRow:a}=r;if(t<n||i<s||t>a||i>l)return Promise.resolve(null)}const l=s?r.transposeVariableName:r.sliceId,a=this.rasterInfo.storageInfo.isBsqTile?r.bandIds:null,c=v(this.rasterId,l,a),f=`${e}/${t}/${i}`;let m=T(c,r.registryId,f);if(null==m){const o=new AbortController;m=this.fetchRawTile(e,t,i,{...r,signal:o.signal}),P(c,r.registryId,f,m,o),m.catch(()=>B(c,r.registryId,f))}return r.signal&&n(r,()=>{_(c,r.registryId,f)}),m}_computeMagDirValues(e){const{bandCount:t,dataType:i}=this.rasterInfo;if(!(2===t&&"vector-magdir"===i||"vector-uv"===i)||2!==e?.length||!e[0]?.length)return null;const r=e[0].length;if("vector-magdir"===i){const t=e[1].map(e=>(e+360)%360);return[e[0],t]}const[o,n]=e,s=[],l=[];for(let a=0;a<r;a++){const[e,t]=V([o[a],n[a]]);s.push(e),l.push(t)}return[s,l]}_getRasterTileAlignmentInfo(e,t){return null==this._rasterTileAlignmentInfo&&(this._rasterTileAlignmentInfo=q(this.rasterInfo)),null==this._rasterTileAlignmentInfo.pyramidsInfo?null:{startX:t,halfWorldWidth:this._rasterTileAlignmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlignmentInfo.hasGCSSShiftTransform,...this._rasterTileAlignmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,i,r={}){const o={datumTransformation:r.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};r.srcResolution&&(o.srcResolution=r.srcResolution,this._updateSourceDataInfo(e,o));const n=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:s,srcHeight:l,pyramidLevel:a}=o,c=s/t,f=l/i,u=a<n&&c*f>=16,h=a===n&&this._requireTooManySrcTiles(s,l,t,i);if(u||h||(0===s||0===l)){const s=new m({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference});let l=N(s,this.rasterInfo.spatialReference,e,o.datumTransformation);const h=!l||r.srcResolution&&l.x+l.y<r.srcResolution.x+r.srcResolution.y;if(u&&r.srcResolution&&h){const e=Math.round(Math.log(Math.max(c,f))/Math.LN2)-1;if(n-a+3>=e){const t=2**e;l={x:r.srcResolution.x*t,y:r.srcResolution.y*t}}}l&&(o.srcResolution=l,this._updateSourceDataInfo(e,o))}return this._requireTooManySrcTiles(o.srcWidth,o.srcHeight,t,i)&&(o.srcWidth=0,o.srcHeight=0),o}_requireTooManySrcTiles(e,t,i,r){const{tileInfo:o}=this.rasterInfo.storageInfo,n=Math.ceil(e/o.size[0])*Math.ceil(t/o.size[1]),s=e/i,l=t/r,a=Math.max(1,(i+r)/1024);return n>=Q*a||s>U||l>U}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;const{rasterInfo:i}=this,r=i.spatialReference,{srcResolution:o,datumTransformation:n}=t,{pyramidLevel:s,pyramidResolution:l,excessiveReading:a}=D(o,i,this.ioConfig.sampling);if(a)return;let c=t.srcExtent||A(e,r,n);if(null==c)return;const f=i.transform;f&&(c=f.inverseTransform(c)),t.srcExtent=c;const{origin:m}=i.storageInfo,{width:u,height:h,ul:p}=R(c,m,l,s);t.pyramidLevel=s,t.pyramidResolution=l,t.srcWidth=u,t.srcHeight=h,t.ul=p}_getRequestOptionsWithSliceId(e){return null!=this.rasterInfo.multidimensionalInfo&&null==e.sliceId&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){const{srcLocation:i,position:r,pyramidLevel:o,useTransposedTile:n}=t,s=e.pixels[0].length/e.width/e.height;if(!(!e.mask||e.mask[r]))return{location:i,value:null};const{multidimensionalInfo:l}=this.rasterInfo;if(null==l||!n){const t=e.pixels.map(e=>e[r]),n={location:i,value:t,pyramidLevel:o},s=this._computeMagDirValues(t.map(e=>[e]));return s?.length&&(n.magdirValue=s.map(e=>e[0])),n}let a=e.pixels.map(e=>e.slice(r*s,r*s+s)),c=this._computeMagDirValues(a);const{requestSomeSlices:f,identifyOptions:m}=t;let u=k(l,m.transposedVariableName);if(f){const e=b(u,m.multidimensionalDefinition,m.timeExtent);a=a.map(t=>e.map(e=>t[e])),c=c?.map(t=>e.map(e=>t[e])),u=e.map(e=>u[e])}const h=e.noDataValues||this.rasterInfo.noDataValue,p={pixels:a,pixelType:e.pixelType};let x;null!=h&&(M(p,h),x=p.mask);return{location:i,value:null,dataSeries:u.map((e,t)=>{const i={value:0===x?.[t]?null:a.map(e=>e[t]),multidimensionalDefinition:e.multidimensionalDefinition.map(e=>new d({...e,isSlice:!0}))};return c?.length&&(i.magdirValue=[c[0][t],c[1][t]]),i}),pyramidLevel:o}}};function K(e,t,i){return Math.abs(e.x-t.x)<i&&Math.abs(e.y-t.y)<i}e([l()],X.prototype,"_rasterTileAlignmentInfo",void 0),e([l()],X.prototype,"_tileFetchQueue",void 0),e([l({readOnly:!0})],X.prototype,"_isGlobalWrappableSource",null),e([l({readOnly:!0})],X.prototype,"_hasNoneOrGCSShiftTransform",null),e([l()],X.prototype,"_openPromise",void 0),e([l()],X.prototype,"rasterJobHandler",null),e([l({readOnly:!0})],X.prototype,"rasterId",null),e([l(p)],X.prototype,"url",null),e([l({type:String,json:{write:!0}})],X.prototype,"datasetName",void 0),e([l({type:String,json:{write:!0}})],X.prototype,"datasetFormat",void 0),e([l()],X.prototype,"hasUniqueSourceStorageInfo",void 0),e([l()],X.prototype,"rasterInfo",void 0),e([l()],X.prototype,"ioConfig",void 0),e([l()],X.prototype,"sourceJSON",void 0),X=e([c("esri.layers.support.rasterDatasets.BaseRaster")],X);export{X as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../request.js";import i from"../../../core/Error.js";import{JSONSupport as o}from"../../../core/JSONSupport.js";import r from"../../../core/Logger.js";import{onAbort as n}from"../../../core/promiseUtils.js";import{QueueProcessor as s}from"../../../core/QueueProcessor.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import{ensureClass as a}from"../../../core/accessorSupport/ensureType.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import f from"../../../geometry/Extent.js";import u from"../../../geometry/Point.js";import m from"../../../geometry/SpatialReference.js";import{sanitizeUrl as h}from"../arcgisLayerUrl.js";import{url as p}from"../commonProperties.js";import d from"../DimensionalDefinition.js";import x from"../LOD.js";import y from"../RasterStorageInfo.js";import g from"../TileInfo.js";import{isFunctionRaster as I,getPixelSpaceCoverage as R}from"./datasetUtils.js";import{isMultiSliceOrRangeDefinition as w,getSliceIndex as S,createSlices as b,getSliceIds as k}from"./multidimensionalUtils.js";import{getRasterId as T,getBlock as v,putBlock as P,deleteBlock as B,decreaseRefCount as _}from"./RawBlockCache.js";import{convertNoDataToMask as M}from"../rasterFormats/pixelRangeUtils.js";import{decode as W}from"../rasterFormats/RasterCodec.js";import{mosaic as C,approximateTransform as H,getLocalArithmeticNorthRotations as L,compositeBands as j}from"../rasterFunctions/pixelUtils.js";import{getWorldWidth as z,load as E,projectPoint as D,snapPyramid as O,shiftExtent as F,getWorldWrapCount as A,projectExtent as q,getProjectionOffsetGrid as G,getRasterDatasetAlignmentInfo as J,projectResolution as N}from"../rasterFunctions/rasterProjectionHelper.js";import{convertToLocalDirections as V,uvComponentToVector as U}from"../rasterFunctions/vectorFieldUtils.js";const Q=8,$=256;let X=0,K=class extends o{constructor(){super(...arguments),this._tileFetchQueue=new s({concurrency:32,process:(e,t)=>this.fetchRawTile(e.pyramidLevel,e.row,e.col,{...e.options,signal:t})}),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}normalizeCtorArgs(e){return e?.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:g.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){const{rasterInfo:e}=this,t=z(e.spatialReference);return null!=t&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){const{transform:e}=this.rasterInfo;return null==e||"gcs-shift"===e.type}set rasterJobHandler(e){this._set("rasterJobHandler",e),I(this)&&this.primaryRasters?.rasters?.forEach(t=>t.rasterJobHandler=e)}get rasterId(){return this.url||"rasterId-"+X++}set url(e){this._set("url",h(e,r.getLogger(this)))}async open(e){return this._openPromise??=E().then(()=>this._open(e)),this._openPromise}async fetchTile(e,t,o,r={}){const n=r.tileInfo||this.rasterInfo.storageInfo.tileInfo,s=this.getTileExtentFromTileInfo(e,t,o,n);if(!s)throw new i("imagery-tile:out-of-bounds","Level for fetch tile out of range");return r={noClip:!0,...r},this.fetchPixels(s,n.size[0],n.size[1],r)}async identify(e,t={}){e=a(u,e).clone().normalize();const{multidimensionalDefinition:i,timeExtent:o}=t,{rasterInfo:r}=this,{hasMultidimensionalTranspose:n,multidimensionalInfo:s}=r;let{transposedVariableName:l}=t;const c=null!=s&&n&&(null!=o||w(i));if(c&&!l){l=null!=i&&i.length>0?i[0].variableName??void 0:s.variables[0].name,t={...t,transposedVariableName:l}}t=this._getRequestOptionsWithSliceId(t);const{spatialReference:m,extent:h}=r,{datumTransformation:p}=t;let d=D(e,m,p);if(!h.intersects(d))return{location:d,value:null};if(null!=r.transform){const e=r.transform.inverseTransform(d);if(!r.nativeExtent.intersects(e))return{location:e,value:null};d=e}let x=0;const y=null!=l&&null!=s&&r.hasMultidimensionalTranspose;if(I(this)){const e=this.primaryRasters.rasters[0];if(y)return e.identify(d,t);const{pixelSize:o}=r,n=3,s=o.x*n/2,l=o.y*n/2,a=new f({xmin:d.x-s,xmax:d.x+s,ymin:d.y-l,ymax:d.y+l,spatialReference:m}),c={interpolation:"nearest",multidimensionalDefinition:i,sliceId:t.sliceId,bandIds:t.bandIds},{pixelBlock:u}=await e.fetchPixels(a,n,n,c),{pixelBlock:h}=await this.fetchPixels(a,n,n,c);if(null==u)return{location:d,value:null};const p=Math.floor(n*n*.5),x=!u.mask||u.mask[p]?u.pixels.map(e=>e[p]):null;let g;return null!=h&&(g=!h.mask||h.mask[p]?h.pixels.map(e=>e[p]):void 0),{location:d,value:x,processedValue:g,pyramidLevel:0}}if(!y)if(t.srcResolution){x=O(t.srcResolution,r,this.ioConfig.sampling).pyramidLevel}else if(x=await this.computeBestPyramidLevelForLocation(e,t),null==x)return{location:d,value:null};const g=this.identifyPixelLocation(d,x,null,y);if(null===g)return{location:d,value:null};const{row:R,col:S,rowOffset:b,colOffset:k,blockWidth:T}=g,v=await this._fetchRawTile(x,R,S,t);if(!v?.pixels?.length)return{location:d,value:null};const P=b*T+k;return this._processIdentifyResult(v,{srcLocation:d,position:P,pyramidLevel:x,useTransposedTile:!!y,requestSomeSlices:c,identifyOptions:t})}async fetchPixels(e,t,i,o={}){e=F(e),o=this._getRequestOptionsWithSliceId(o);const{_hasNoneOrGCSShiftTransform:r}=this;if(o.requestRawData&&r)return this._fetchPixels(e,t,i,o);const n=z(e.spatialReference),s=A(e);if(null==n||0===s||1===s&&this._isGlobalWrappableSource&&r)return this._fetchPixels(e,t,i,o);if(s>=3)return{extent:e,pixelBlock:null};const l=[],{xmin:a,xmax:c}=e,u=Math.round(n/(c-a)*t),m=u-Math.round((n/2-a)/(c-a)*t);let h=0;const p=[];for(let g=0;g<=s;g++){const r=new f({xmin:0===g?a:-n/2,xmax:g===s?c-n*g:n/2,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),d=0===g?u-m:g===s?t-h:u;h+=d,p.push(d);const x=o.disableWrapAround&&g>0?null:this._fetchPixels(r,d,i,o);l.push(x)}const d=(await Promise.all(l)).map(e=>e?.pixelBlock);let x=null;const y={width:t,height:i};if(this.rasterJobHandler){x=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:d,srcMosaicSize:y,destDimension:null,coefs:null,sampleSpacing:null,interpolation:"nearest",alignmentInfo:null,blockWidths:p},o)).pixelBlock}else x=C(d,y,{blockWidths:p});return{extent:e,srcExtent:q(e,this.rasterInfo.spatialReference,o.datumTransformation),pixelBlock:x}}async fetchRawPixels(e,t,i,o={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};const r=await this._fetchRawTiles(e,t,i,o),{nativeExtent:n,nativePixelSize:s,storageInfo:l}=this.rasterInfo,a=2**e,c=s.x*a,u=s.y*a,m=new f({xmin:n.xmin+c*t.x,xmax:n.xmin+c*(t.x+i.width-1),ymin:n.ymax-u*(t.y+i.height-1),ymax:n.ymax-u*t.y,spatialReference:n.spatialReference});if(!r)return{extent:m,srcExtent:m,pixelBlock:null};const{pixelBlocks:h,mosaicSize:p}=r;if(1===h.length&&null!=h[0]&&h[0].width===i.width&&h[0].height===i.height)return{extent:m,srcExtent:m,pixelBlock:r.pixelBlocks[0]};const d=e>0?l.pyramidBlockWidth:l.blockWidth,x=e>0?l.pyramidBlockHeight:l.blockHeight,y={x:t.x%d,y:t.y%x};let g;if(this.rasterJobHandler){g=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:h,srcMosaicSize:p,destDimension:i,clipOffset:y,clipSize:i,coefs:null,sampleSpacing:null,interpolation:o.interpolation,alignmentInfo:null,blockWidths:null},o)).pixelBlock}else g=C(h,p,{clipOffset:y,clipSize:i});return{extent:m,srcExtent:m,pixelBlock:g}}fetchRawTile(e,t,o,r){throw new i("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return q(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return!this.rasterJobHandler||t.useCanvas?W(e,t):this.rasterJobHandler.decode({data:e,options:t})}async request(e,i,o=0){const{customFetchParameters:r}=this.ioConfig,{range:n,query:s,headers:l}=i;o=o??i.retryCount??this.ioConfig.retryCount;const a=n?{Range:`bytes=${n.from}-${n.to}`}:null;try{return await t(e,{...i,query:{...s,...r},headers:{...l,...a}})}catch(c){if(o>0)return o--,this.request(e,i,o);throw c}}getSliceIndex(e){const{multidimensionalInfo:t}=this.rasterInfo;return null==t||null==e||0===e.length?null:S(e,t)}getTileExtentFromTileInfo(e,t,i,o){const r=o.lodAt(e);return r?this.getTileExtent({x:r.resolution,y:r.resolution},t,i,o.origin,o.spatialReference,o.size):null}updateTileInfo(){const{storageInfo:e,spatialReference:t,extent:i,pixelSize:o}=this.rasterInfo,{pyramidResolutions:r}=e;if(!e.tileInfo){const n=[],s=e.maximumPyramidLevel||0;let l=(o.x+o.y)/2,a=1/.0254*96*l;for(let e=0;e<=s&&(n.unshift(new x({level:s-e,resolution:l,scale:a})),e!==s);e++)if(r){const t=(r[e].x+r[e].y)/2;a*=t/l,l=t}else l*=2,a*=2;const c=new u({x:i.xmin,y:i.ymax,spatialReference:t});e.tileInfo=new g({origin:c,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:n}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,i=512,o){const{width:r,height:n,nativeExtent:s,pixelSize:l,spatialReference:a}=e,c=new u({x:s.xmin,y:s.ymax,spatialReference:a});null==o&&(o=Math.max(0,Math.round(Math.log(Math.max(r,n))/Math.LN2-8)));const f=this.computeBlockBoundary(s,512,512,{x:s.xmin,y:s.ymax},[l],o);e.storageInfo=new y({blockWidth:t,blockHeight:i,pyramidBlockWidth:t,pyramidBlockHeight:i,origin:c,firstPyramidLevel:1,maximumPyramidLevel:o,blockBoundary:f})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,i,o,r,n=0,s=2){if(1===r.length&&n>0){r=[...r];let{x:e,y:t}=r[0];for(let i=0;i<n;i++)e*=s,t*=s,r.push({x:e,y:t})}const l=[],{x:a,y:c}=o;for(let f=0;f<r.length;f++){const{x:o,y:n}=r[f];l.push({minCol:Math.floor((e.xmin-a+.1*o)/t/o),maxCol:Math.floor((e.xmax-a-.1*o)/t/o),minRow:Math.floor((c-e.ymax+.1*n)/i/n),maxRow:Math.floor((c-e.ymin-.1*n)/i/n)})}return l}getPyramidPixelSize(e){const{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:i,pyramidScalingFactor:o}=this.rasterInfo.storageInfo;if(0===e)return t;if(null!=i&&i.length)return i[e-1];const r=o**e;return{x:t.x*r,y:t.y*r}}identifyPixelLocation(e,t,i,o){const{spatialReference:r,nativeExtent:n,storageInfo:s}=this.rasterInfo,{maximumPyramidLevel:l,origin:a,transposeInfo:c}=s,f=o&&null!=c?c.tileSize[0]:s.blockWidth,u=o&&null!=c?c.tileSize[1]:s.blockHeight,m=D(e,r,i);if(!n.intersects(m))return null;if(t<0||t>l)return null;const h=this.getPyramidPixelSize(t),{x:p,y:d}=h,x=(a.y-m.y)/d/u,y=(m.x-a.x)/p/f,g=Math.min(u-1,Math.floor((x-Math.floor(x))*u)),I=Math.min(f-1,Math.floor((y-Math.floor(y))*f));return{pyramidLevel:t,row:Math.floor(x),col:Math.floor(y),rowOffset:g,colOffset:I,blockWidth:f,srcLocation:m}}getTileExtent(e,t,i,o,r,n){const[s,l]=n,a=o.x+i*s*e.x,c=a+s*e.x,u=o.y-t*l*e.y,m=u-l*e.y;return new f({xmin:a,xmax:c,ymin:m,ymax:u,spatialReference:r})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,i){const o=this.rasterInfo.storageInfo.blockBoundary[e];return!o||o.maxRow<t||o.maxCol<i||o.minRow>t||o.minCol>i}updateImageSpaceRasterInfo(e){const{pixelSize:t}=e,{width:i,height:o}=e,r=m.WebMercator;e.spatialReference=r,e.extent=e.nativeExtent=new f({xmin:-.5,ymax:.5,xmax:i-.5,ymin:.5-o,spatialReference:r}),e.isPseudoSpatialReference=!0,e.transform=null,e.pixelSize=new u({x:1,y:1,spatialReference:r});const{extent:n,storageInfo:s}=e;if(s){s.origin=new u({x:n.xmin,y:n.ymax,spatialReference:r});const{pyramidResolutions:i,tileInfo:o}=s;if(i&&i.forEach(e=>{e.x/=t.x,e.y/=t.y}),o){o.origin=s.origin;const t=(e.nativePixelSize.x+e.nativePixelSize.y)/2;o.lods.forEach((e,i)=>{e.resolution=t*2**i,e.scale=96*e.resolution/.0254})}}}async _fetchPixels(e,t,i,o={}){let r=A(e);if(r>=2)return{extent:e,pixelBlock:null};const n=this._getSourceDataInfo(e,t,i,o),{pyramidLevel:s,srcResolution:l,srcExtent:a,srcWidth:c,srcHeight:f,ul:m}=n;if(0===c||0===f)return{extent:e,srcExtent:a,pixelBlock:null};const{rasterInfo:h}=this,p=h.transform,d="gcs-shift"===p?.type,x=null!=z(e.spatialReference);!d&&x||(r=A(n.srcExtent,d));const y=await this._fetchRawTiles(s,m,{width:c,height:f,wrapCount:r},o);if(!y)return{extent:e,srcExtent:a,pixelBlock:null};const g=h.storageInfo,I=s>0?g.pyramidBlockWidth:g.blockWidth,R=s>0?g.pyramidBlockHeight:g.blockHeight;let{x:w,y:S}=h.pixelSize;if(s>0){const{pyramidResolutions:e,pyramidScalingFactor:t}=g;if(null!=e&&e[s-1])({x:w,y:S}=e[s-1]);else{const e=t**s;w*=e,S*=e}}const b=h.spatialReference,k=new u({x:w,y:S,spatialReference:b}),T=I===c&&R===f&&m.x%I===0&&m.y%R===0,v=new u({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference}),P=!e.spatialReference.equals(b),B=b.isGeographic?1e-9:1e-4,{datumTransformation:_}=o;if(!P&&T&&1===y.pixelBlocks.length&&I===t&&R===i&&Y(l,v,B))return{extent:e,srcExtent:a,srcTilePixelSize:k,pixelBlock:y.pixelBlocks[0]};const M=x&&null!=z(a.spatialReference)&&this._hasNoneOrGCSShiftTransform,W=o.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith("vector");W&&!this.rasterJobHandler&&await E();const j=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:v.toJSON(),datumTransformation:_,rasterTransform:p,hasWrapAround:r>0||M,isAdaptive:!1!==this.ioConfig.optimizeProjectionAccuracy,includeGCSGrid:W},o):G({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:v,datumTransformation:_,rasterTransform:p,hasWrapAround:r>0||M,isAdaptive:!1,includeGCSGrid:W});let D;const O=!o.requestRawData,F={rows:j.spacing[0],cols:j.spacing[1]},q=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(s,y.extent.xmin):void 0,{pixelBlocks:J,mosaicSize:N,isPartiallyFilled:U}=y;let Q=null;if(this.rasterJobHandler){const e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:J,srcMosaicSize:N,destDimension:O?{width:t,height:i}:null,coefs:O?j.coefficients:null,sampleSpacing:O?F:null,projectDirections:W,gcsGrid:W?j.gcsGrid:null,isUV:"vector-uv"===this.rasterInfo.dataType,interpolation:o.interpolation,alignmentInfo:q,blockWidths:null},o);({pixelBlock:D,localNorthDirections:Q}=e)}else{const e=C(J,N,{alignmentInfo:q});D=O?H(e,{width:t,height:i},j.coefficients,F,o.interpolation):e,W&&j.gcsGrid&&(Q=L({width:t,height:i},j.gcsGrid),D=V(D,this.rasterInfo.dataType,Q))}return o.requestRawData||W?{extent:e,srcExtent:a,srcTilePixelSize:k,pixelBlock:D,transformGrid:j,localNorthDirections:Q,isPartiallyFilled:U}:{extent:e,srcExtent:a,srcTilePixelSize:k,pixelBlock:D}}async _fetchRawTiles(e,t,i,o){const{origin:r,blockBoundary:n}=this.rasterInfo.storageInfo,{blockWidth:s,blockHeight:l}=this.getBlockWidthHeight(e);let{x:a,y:c}=t,{width:u,height:m,wrapCount:h}=i;const p=this._getRasterTileAlignmentInfo(e,0);o.buffer&&(a-=o.buffer.cols,c-=o.buffer.rows,u+=2*o.buffer.cols,m+=2*o.buffer.rows);let d=0,x=0,y=0;if(h&&null!=p){({worldColumnCountFromOrigin:x,originColumnOffset:y,rightPadding:d}=p);x*p.blockWidth-d>=a+u&&(d=0)}const g=Math.floor(a/s),I=Math.floor(c/l),R=Math.floor((a+u+d-1)/s),w=Math.floor((c+m+d-1)/l),S=n[e];if(!S)return null;const{minRow:b,minCol:k,maxCol:T,maxRow:v}=S;if(0===h&&(w<b||R<k||I>v||g>T))return null;const P=new Array;let B=!1;const _=null==this.ioConfig.allowPartialFill?o.allowPartialFill:this.ioConfig.allowPartialFill;for(let f=I;f<=w;f++)for(let t=g;t<=R;t++){let i=t;if(!o.disableWrapAround&&h&&null!=p&&x<=t&&(i=t-x-y),f>=b&&i>=k&&v>=f&&T>=i){const t=this._fetchRawTile(e,f,i,o);_?P.push(new Promise(e=>{t.then(t=>e(t)).catch(()=>{B=!0,e(null)})})):P.push(t)}else P.push(Promise.resolve(null))}if(0===P.length)return null;const M=await Promise.all(P),W={height:(w-I+1)*l,width:(R-g+1)*s},{spatialReference:C}=this.rasterInfo,H=this.getPyramidPixelSize(e),{x:L,y:j}=H;return{extent:new f({xmin:r.x+g*s*L,xmax:r.x+(R+1)*s*L,ymin:r.y-(w+1)*l*j,ymax:r.y-I*l*j,spatialReference:C}),pixelBlocks:M,mosaicSize:W,isPartiallyFilled:B}}_fetchRawTile(e,t,i,o){const{storageInfo:r}=this.rasterInfo,s=null!=r.transposeInfo&&!!o.transposedVariableName;if(!s){const o=r.blockBoundary[e];if(!o)return Promise.resolve(null);const{minRow:n,minCol:s,maxCol:l,maxRow:a}=o;if(t<n||i<s||t>a||i>l)return Promise.resolve(null)}const l=s?o.transposeVariableName:o.sliceId,a=r.isBsqTile?o.bandIds:null,c=T(this.rasterId,l,a),f=`${e}/${t}/${i}`;let u=v(c,o.registryId,f);if(null==u){const n=new AbortController,s=o.bandIds?.slice();if(s?.length&&r.isBsqTile){const r=new Set(s),l=[],a=Array.from(r);for(const c of s)l.push(this._tileFetchQueue.push({pyramidLevel:e,row:t,col:i,options:{...o,bandIds:[c]}},{signal:n.signal}));u=Promise.all(l).then(e=>{if(e.some(e=>null==e))return null;if(a.length!==s.length){const t=[];for(const i of s){let o=e[a.indexOf(i)];t.includes(o)&&(o=o.clone()),t.push(o)}e=t}return this.rasterJobHandler?this.rasterJobHandler.compositeBands({pixelBlocks:e},{signal:n.signal,transferPixelsToWorker:!0}):j(e)})}else u=this._tileFetchQueue.push({pyramidLevel:e,row:t,col:i,options:o},{signal:n.signal});P(c,o.registryId,f,u,n),u.catch(()=>B(c,o.registryId,f))}return o.signal&&n(o,()=>{_(c,o.registryId,f)}),u}_computeMagDirValues(e){const{bandCount:t,dataType:i}=this.rasterInfo;if(!(2===t&&"vector-magdir"===i||"vector-uv"===i)||2!==e?.length||!e[0]?.length)return null;const o=e[0].length;if("vector-magdir"===i){const t=e[1].map(e=>(e+360)%360);return[e[0],t]}const[r,n]=e,s=[],l=[];for(let a=0;a<o;a++){const[e,t]=U([r[a],n[a]]);s.push(e),l.push(t)}return[s,l]}_getRasterTileAlignmentInfo(e,t){return null==this._rasterTileAlignmentInfo&&(this._rasterTileAlignmentInfo=J(this.rasterInfo)),null==this._rasterTileAlignmentInfo.pyramidsInfo?null:{startX:t,halfWorldWidth:this._rasterTileAlignmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlignmentInfo.hasGCSSShiftTransform,...this._rasterTileAlignmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,i,o={}){const r={datumTransformation:o.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};o.srcResolution&&(r.srcResolution=o.srcResolution,this._updateSourceDataInfo(e,r));const n=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:s,srcHeight:l,pyramidLevel:a}=r,c=s/t,f=l/i,m=a<n&&c*f>=16,h=a===n&&this._requireTooManySrcTiles(s,l,t,i);if(m||h||(0===s||0===l)){const s=new u({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference});let l=N(s,this.rasterInfo.spatialReference,e,r.datumTransformation);const h=!l||o.srcResolution&&l.x+l.y<o.srcResolution.x+o.srcResolution.y;if(m&&o.srcResolution&&h){const e=Math.round(Math.log(Math.max(c,f))/Math.LN2)-1;if(n-a+3>=e){const t=2**e;l={x:o.srcResolution.x*t,y:o.srcResolution.y*t}}}l&&(r.srcResolution=l,this._updateSourceDataInfo(e,r))}return this._requireTooManySrcTiles(r.srcWidth,r.srcHeight,t,i)&&(r.srcWidth=0,r.srcHeight=0),r}_requireTooManySrcTiles(e,t,i,o){const{tileInfo:r}=this.rasterInfo.storageInfo,n=Math.ceil(e/r.size[0])*Math.ceil(t/r.size[1]),s=e/i,l=t/o,a=Math.max(1,(i+o)/1024);return n>=$*a||s>Q||l>Q}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;const{rasterInfo:i}=this,o=i.spatialReference,{srcResolution:r,datumTransformation:n}=t,{pyramidLevel:s,pyramidResolution:l,excessiveReading:a}=O(r,i,this.ioConfig.sampling);if(a)return;let c=t.srcExtent||q(e,o,n);if(null==c)return;const f=i.transform;f&&(c=f.inverseTransform(c)),t.srcExtent=c;const{origin:u}=i.storageInfo,{width:m,height:h,ul:p}=R(c,u,l,s);t.pyramidLevel=s,t.pyramidResolution=l,t.srcWidth=m,t.srcHeight=h,t.ul=p}_getRequestOptionsWithSliceId(e){return null!=this.rasterInfo.multidimensionalInfo&&null==e.sliceId&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){const{srcLocation:i,position:o,pyramidLevel:r,useTransposedTile:n}=t,s=e.pixels[0].length/e.width/e.height;if(!(!e.mask||e.mask[o]))return{location:i,value:null};const{multidimensionalInfo:l}=this.rasterInfo;if(null==l||!n){const t=e.pixels.map(e=>e[o]),n={location:i,value:t,pyramidLevel:r},s=this._computeMagDirValues(t.map(e=>[e]));return s?.length&&(n.magdirValue=s.map(e=>e[0])),n}let a=e.pixels.map(e=>e.slice(o*s,o*s+s)),c=this._computeMagDirValues(a);const{requestSomeSlices:f,identifyOptions:u}=t;let m=b(l,u.transposedVariableName);if(f){const e=k(m,u.multidimensionalDefinition,u.timeExtent);a=a.map(t=>e.map(e=>t[e])),c=c?.map(t=>e.map(e=>t[e])),m=e.map(e=>m[e])}const h=e.noDataValues||this.rasterInfo.noDataValue,p={pixels:a,pixelType:e.pixelType};let x;null!=h&&(M(p,h),x=p.mask);return{location:i,value:null,dataSeries:m.map((e,t)=>{const i={value:0===x?.[t]?null:a.map(e=>e[t]),multidimensionalDefinition:e.multidimensionalDefinition.map(e=>new d({...e,isSlice:!0}))};return c?.length&&(i.magdirValue=[c[0][t],c[1][t]]),i}),pyramidLevel:r}}};function Y(e,t,i){return Math.abs(e.x-t.x)<i&&Math.abs(e.y-t.y)<i}e([l()],K.prototype,"_rasterTileAlignmentInfo",void 0),e([l()],K.prototype,"_tileFetchQueue",void 0),e([l({readOnly:!0})],K.prototype,"_isGlobalWrappableSource",null),e([l({readOnly:!0})],K.prototype,"_hasNoneOrGCSShiftTransform",null),e([l()],K.prototype,"_openPromise",void 0),e([l()],K.prototype,"rasterJobHandler",null),e([l({readOnly:!0})],K.prototype,"rasterId",null),e([l(p)],K.prototype,"url",null),e([l({type:String,json:{write:!0}})],K.prototype,"datasetName",void 0),e([l({type:String,json:{write:!0}})],K.prototype,"datasetFormat",void 0),e([l()],K.prototype,"hasUniqueSourceStorageInfo",void 0),e([l()],K.prototype,"rasterInfo",void 0),e([l()],K.prototype,"ioConfig",void 0),e([l()],K.prototype,"sourceJSON",void 0),K=e([c("esri.layers.support.rasterDatasets.BaseRaster")],K);export{K as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
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 r from"../Field.js";import o from"../PixelBlock.js";import{getByteCount as a}from"../rasterFormats/pixelRangeUtils.js";import{snapToRaster as s,clip as l}from"../rasterFunctions/clipUtils.js";import{mosaic as c,
|
|
5
|
+
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 r from"../Field.js";import o from"../PixelBlock.js";import{getByteCount as a}from"../rasterFormats/pixelRangeUtils.js";import{snapToRaster as s,clip as l}from"../rasterFunctions/clipUtils.js";import{mosaic as c,pixelIdFieldName as p,convertPixelBlockToFeatures as u,getValidPixels as f,countCategoricalPixels as m}from"../rasterFunctions/pixelUtils.js";import{load as x,projectPolygon as y}from"../rasterFunctions/rasterProjectionHelper.js";import{computeBoxStatistics as h,computeStatisticsHistograms as d}from"../rasterFunctions/stretchUtils.js";import{getBandNames as w}from"../../../renderers/support/rasterRendererHelper.js";import g from"../../../rest/support/ImageIdentifyParameters.js";const k=2**30,b=2048,B=2**20,S=20,j=100;async function R(e,t){return"imagery"===e.type?await e.generateRasterInfo(e.rasterFunction,t):e.raster.rasterInfo}function P(e){const t=[new r({name:p,alias:"Pixel ID",type:"oid"})],{pixelType:i}=e,n="f32"===i?"single":"f64"===i?"double":"integer";return w(e).forEach(e=>{t.push(new r({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<S){const e=(await import("../../../geometry/operators/lengthOperator.js")).execute(t,{unit:"meters"})/j;t=(await import("../../../geometry/operators/densifyOperator.js")).execute(t,e,{unit:"meters"}),await x(),t=y(t,i)}return t}async function I(e,t){const{spatialReference:i}=e,r=t?.geometry,o=await F(r??e.extent,i),a="extent"===o.type?o:o.extent,l=null==r||"extent"===r.type&&r.spatialReference.equals(i)?void 0:o,c=new n({x:e.pixelSize.x,y:e.pixelSize.y,spatialReference:i}),p=!!t?.autoResample,u=p?c:t?.pixelSize??c;let{extent:f,width:m,height:x}=s(e,a,u);if(!p)return{extent:f,clipGeometry:l,width:m,height:x,pixelSize:u};const y=e.storageInfo?.pyramidScalingFactor??2;let{x:h,y:d}=u;const w=t?.maxPixelCount??B;if(m*x>w)for(;m*x>w;)h*=y,d*=y,m/=y,x/=y;return m=Math.round(m),x=Math.round(x),{extent:f,clipGeometry:l,width:m,height:x,pixelSize:new n({x:h,y:d,spatialReference:i})}}async function*T(e,n,r=!1,o){const{extent:a,clipGeometry:s,width:c,height:p}=n,u=a.width/c,f=a.height/p,m=Math.ceil(c/b),x=Math.ceil(p/b),y=u*b,h=f*b,{xmin:d,xmax:w,ymin:g,ymax:k}=a,B=x*m,S={bandIds:n.bandIds?.length?n.bandIds:void 0,interpolation:"nearest",...o};for(let j=0;j<x;j++)for(let n=0;n<m;n++){t(S);const o=new i({xmin:d+n*y,xmax:r?Math.min(w,d+(n+1)*y):d+(n+1)*y,ymax:k-j*h,ymin:r?Math.max(g,k-(j+1)*h):k-(j+1)*h,spatialReference:a.spatialReference}),c={row:j,col:n},p=j*m+n+1;if(s&&!o.intersects(s)){yield{extent:o,pixelBlock:null,id:c,total:B,current:p};continue}const x=r?Math.round(o.width/u):b,R=r?Math.round(o.height/f):b;let{pixelBlock:P}=await e.fetchPixels(o,x,R,S).catch(()=>({pixelBlock:void 0}));P&&s&&(P=await l(P,o,s)),yield{extent:o,pixelBlock:P,id:c,total:B,current:p}}}async function*M(e,i,n){const r=await R(e,n),o=P(r),a={...i,geometry:i?.geometry??r.extent},s=T(e,await I(r,a),!0,n),l=r.width;for await(const c of s){if(!c.pixelBlock){yield{...c};continue}const a=L(e),{pixelBlock:s}=c,{statistics:p,histograms:u}=await W({pixelBlock:s,rasterJobHandler:a},n),f=c;f.statistics=p,f.histograms=u;const m=c.id.row*r.width*b+c.id.col*b;t(n),f.featureSet=await K({pixelBlock:s,extent:c.extent,fields:o,skipFactor:i?.skipFactor??1,rasterJobHandler:a,pixelIdOffset:m,imageRowSize:l},n),t(n),yield f}}function v(t,i,n){const r=a(i),{width:o,height:s}=t;if(o*s*r>k)throw new e("fetch-pixels","failed to fetch pixels as pixel byte count exceeds the 1GB limit");if(n&&o*s>n)throw new e("fetch-pixels",`failed to fetch pixels as pixel count exceeds the ${n} limit`)}async function z(t,i,n){if(!i.geometry)throw new e("fetch-pixels","geometry is required to fetch pixel feature set");const r=await R(t),o=await I(r,i);v(o,r.pixelType);const{extent:a,pixelSize:s}=o,l=Math.round(r.extent.width/s.x),c=P(r),p={fields:c,features:[]},u=p.features,f=T(t,o,!1,n);for await(const e of f){if(!e.pixelBlock)continue;const o=L(t),a=Math.floor((r.extent.ymax-e.extent.ymax)/s.y)*l+Math.floor((e.extent.xmin-r.extent.xmin)/s.x),p=await K({pixelBlock:e.pixelBlock,extent:e.extent,fields:c,skipFactor:i?.skipFactor??1,rasterJobHandler:o,pixelIdOffset:a,imageRowSize:l},n);if(p?.features?.length){const{features:e}=p,t=e.length;for(let i=0;i<t;i++){const t=e.pop();u.push(t)}}}return{extent:a,featureSet:p,pixelSize:s}}async function H(e,t,i){const{geometry:n}=t;if("multipoint"===n.type)return O(e,n,i);if("polyline"===n.type)return q(e,n,i);const r=await _(e,{geometry:n},i);if(!r)return null;return h(r)}async function O(e,t,i){const n=await R(e,i),r=t.points.map((e,i)=>t.getPoint(i)).map(t=>C(e,t,i)),a=(await Promise.all(r)).filter(e=>null!=e);if(a.length<=1)return J(a[0]);const s=a[0].map((e,t)=>a.map(e=>e[t]));return h(new o({pixels:s,pixelType:n.pixelType}))}async function C(e,t,i){if("imagery"===e.type){const n=await e.identify(new g({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 J(e){return e?.map(e=>({min:e,max:e,avg:e,median:e,quartile1:e,quartile3:e}))}async function q(e,t,i){const n=await G(e,{geometry:t},i),r=await R(e,i),{bandCount:a,pixelType:s}=r,l=new Array(a).fill(0).map(()=>o.createEmptyBand(s,n.length));let c=0;for(let o=0;o<n.length;o++){const e=n[o];if(null!=e.value){c++;for(let t=0;t<a;t++)l[t][o]=e.value[t]}}c!==n.length&&l.forEach((e,t)=>{l[t]=e.subarray(0,c)});return h(new o({pixels:l,pixelType:s}))}async function E(t,i,n){const r=await R(t,n);if(!r.attributeTable||!r.pixelType.startsWith("u"))return null;const o=r.attributeTable.clone(),a=o.fields.find(e=>"value"===e.name.toLowerCase()),s=o.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(r.pixelType.slice(1)),c=new Uint32Array(l),{geometry:p}=i;return await D(t,p,(e,t)=>m(e,c),n),o.features.forEach(e=>{const t=e.attributes[a.name];e.attributes[s.name]=c[t]}),o}async function N(e,t,i){const{geometry:n}=t;if("point"===n.type)return C(e,n,i);if("multipoint"===n.type){const t=n.points.map((e,t)=>n.getPoint(t)).map(t=>C(e,t,i)),r=(await Promise.all(t)).filter(e=>null!=e);if(0===r.length)return null;return U(r).map(e=>e/r.length)}const r=await D(e,n,(e,t)=>A(e),i),o=r?.filter(e=>e.count>0);if(!o?.length)return null;const a=U(o.map(e=>e.bandSum)),s=o.map(e=>e.count).reduce((e,t)=>e+t);return a.map(e=>e/s)}function U(e){return e.reduce((e,t)=>e.map((e,i)=>e+t[i]))}function A(e){const{width:t,height:i,pixels:n,mask:r}=e,o=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(!r||r[i]){for(let e=0;e<n.length;e++)o[e]+=n[e][i];a++}}return{bandSum:o,count:a}}async function G(e,t,i){const n=await D(e,t.geometry,f,i);return n?.flat()??[]}async function D(i,n,r,o){const a=i.spatialReference;if("polyline"===n.type&&!n.spatialReference.equals(a)){const t=(await import("../../../geometry/operators/projectOperator.js")).execute(n,a);if(null==t)throw new e("read-pixels","failed to fetch pixels");n=t}const s="polyline"===n.type?n.extent:n,c=await F(s,a),p="polyline"===n.type?n:c,u=await R(i,o),f={geometry:c,autoResample:!1},m=[],x=T(i,await I(u,f),!0,o);for await(const e of x){if(!e.pixelBlock)continue;const{extent:i}=e,n=r(await l(e.pixelBlock,i,p),i);m.push(n),t(o)}return m}async function W(e,t){const{rasterJobHandler:i}=e,{pixelBlock:n}=e,{statistics:r,histograms:o}=i?await i.computeStatisticsHistograms({pixelBlock:n},t):d(n);return{statistics:r,histograms:o}}async function K(e,t){const{extent:i,fields:n,skipFactor:r,rasterJobHandler:o,pixelIdOffset:a,imageRowSize:s}=e,{pixelBlock:l}=e,c=n.map(({name:e})=>e),p=o?await o.convertPixelBlockToFeatures({pixelBlock:l,extent:i,fieldNames:c,skipFactor:r,pixelIdOffset:a,imageRowSize:s},t):u({pixelBlock:l,extent:i,fieldNames:c,skipFactor:r,pixelIdOffset:a,imageRowSize:s});return p?{fields:n,features:p}:void 0}function L(e){return"_rasterJobHandler"in e?e._rasterJobHandler:null}async function _(e,t,i){const n=await R(e);t={...t,maxPixelCount:t.maxPixelCount??2**28};const r=await I(n,t);v(r,n.pixelType,t.maxPixelCount);const o=[],a=T(e,r,!1,i);for await(const c of a)o.push(c.pixelBlock);if(!o.some(e=>null!=e))return null;const{width:s,height:l}=r,p=Math.ceil(s/b),u=Math.ceil(l/b),f={width:p*b,height:u*b};let m;const x=L(e);if(x){const e=await x.mosaicAndTransform({srcPixelBlocks:o,srcMosaicSize:f,destDimension:f},{...i,transferPixelsToWorker:!0});m=e?.pixelBlock}else m=c(o,f);return m}async function V(t,i,n){if(!i.geometry)throw new e("compute-statistics-histograms","geometry is required to fetch pixel feature set");const r=await _(t,i,n);if(!r)throw new e("compute-statistics-histograms","failed to get intersecting pixels");const o=L(t);return o?await o.computeStatisticsHistograms({pixelBlock:r,includeSkewnessKurtosis:!0},{...n,transferPixelsToWorker:!0}):d(r,{includeSkewnessKurtosis:!0})}export{H as computeBoxStatistics,E as computeRasterAttributeTable,V as computeStatisticsHistograms,M as createPixelFeatureSetCursor,_ as fetchLargePixelBlock,z as fetchPixelFeatureSet,N as identifyAveragePixelValue,G as readIntersectingPixels};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"./Field.js";const
|
|
5
|
+
import e from"./Field.js";const a="Raster.",n="Raster.Dim.",t=".Max",i={servicePixelValue:"Raster.ServicePixelValue",rawServicePixelValue:"Raster.ServicePixelValue.Raw",itemPixelValue:"Raster.ItemPixelValue",magnitude:"Raster.Magnitude",direction:"Raster.Direction",variable:"Raster.Variable"},r=new Map([["quarters","Quarter"],["months","Month"],["weeks","Week of the year"],["days","Day of the year"]]);function l(a,n){return new e({name:a,alias:n,domain:null,editable:!1,length:50,type:"string"})}function s(a,n){return new e({name:a,alias:n,domain:null,editable:!1,type:"double"})}function u(a,n){return new e({name:a,alias:n,domain:null,editable:!1,type:"date"})}function o(e){return l(i.servicePixelValue,e??"Service Pixel Value")}function c(e){return l(i.rawServicePixelValue,e??"Raw Service Pixel Value")}function m(){return l(i.itemPixelValue,"Item Pixel Value")}function f(e){return l(`${i.servicePixelValue}.${e}`,e)}function d(e){return s(`${i.magnitude}`,"Magnitude"+(e?` (${e})`:""))}function $(){return s(`${i.direction}`,"Direction (°)")}function v(e){return e.fields.filter(e=>"oid"!==e.type&&"value"!==e.name.toLowerCase()).map(e=>{const n=e.clone();return n.name=`${a}${e.name}`,n})}function p(e){const a=new Set,r=new Set,o=new Map;e.variables.forEach(({dimensions:e})=>{e.forEach(e=>{if(e.recurring)o.set(e.name,e.unit);else{const n="ISO8601"===e.unit?.trim()||"stdtime"===e.name?.trim()?.toLowerCase()?a:r;n.add(e.name),e.hasRanges&&n.add(`${e.name}${t}`)}})});return[l(i.variable,"Variable"),...[...a].map(e=>u(`${n}${e}`,x(e))),...[...r].map(e=>s(`${n}${e}`,x(e))),...[...o].map(([e,a])=>s(`${n}${e}`,h(e,a)))]}function h(e,a){return a=a?.toLowerCase(),a&&r.has(a)?r.get(a):x(e)}function x(e){const a=e.endsWith(t),n=a?e.slice(0,-4):e,i="StdTime"===n?"Standard Time":"StdZ"===n?"Standard Z":n;return a?`${i} Max`:i}function w(e,a){return a?new Date(e):e}function V(e,a,r){r?.length&&(a[i.variable]=r[0].variableName,r.forEach(({dimensionName:i,values:r})=>{if(i&&r?.length){const l=`${n}${i}`,s=e.find(({name:e})=>e===l);if(!s)return;const u="date"===s.type,o=r[0];if(Array.isArray(o)){if(a[`${n}${i}`]=w(o[0],u),null!=o[1]){const r=`${n}${i}${t}`;if(e.some(({name:e})=>e===r)){const e=w(o[1],u);a[r]=e}}}else a[`${n}${i}`]=w(o,u)}}))}function b(e,a){if(a.pixelType.startsWith("f")&&e.forEach(({format:e,fieldName:a})=>{e&&a&&/^raster\.(item|service)pixelvalue/i.test(a)&&(e.places=2)}),a.multidimensionalInfo){const i=a.multidimensionalInfo.variables.flatMap(({dimensions:e})=>e);e.forEach(({format:e,fieldName:a})=>{if(e&&a?.startsWith(n)){const r=a.slice(n.length),l=`${r}${t}`,s=i.find(({name:e})=>e===r||e===l);s?.values?.every(e=>Number.isInteger(e))&&(e.places=0)}})}}export{V as addMultidimensionalFieldValues,i as commonRasterFieldNames,$ as getDirectionField,m as getItemPixelValueField,d as getMagnitudeField,p as getMultidimensionalFields,f as getProcessedServicePixelValueField,v as getRasterAttributeTableFields,c as getRawServicePixelValueField,o as getServicePixelValueField,n as rasterDimensionFieldPrefix,a as rasterFieldPrefix,b as setDefaultRasterFieldFormats};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{numberMaxFloat32 as t}from"../../../core/mathUtils.js";import e from"../PixelBlock.js";import{getPixelValueRange as n}from"../rasterFormats/pixelRangeUtils.js";const l=9;function i(t){return null!=t&&t.pixels?.length>0}function o(t,e){return e?.length&&i(t)?t.extractBands(e):t}function s(t){if(!t?.length||t.some(t=>!i(t)))return null;if(1===t.length)return t[0]?.clone()??null;const n=t,{width:l,height:o,pixelType:s}=n[0];if(n.some(t=>t.width!==l||t.height!==o))return null;const r=n.map(({mask:t})=>t).filter(t=>null!=t);let a=null;r.length&&(a=new Uint8Array(l*o),a.set(r[0]),r.length>1&&g(r.slice(1),a));const h=[];n.forEach(({pixels:t})=>h.push(...t));const f=n.map(({statistics:t})=>t).filter(t=>t?.length),c=[];return f.forEach(t=>c.push(...t)),new e({pixelType:s,width:l,height:o,mask:a,pixels:h,statistics:c.length?c:null})}function r(t){if(!t)return;const e=t.colormap;if(!e||0===e.length)return;const n=e.sort((t,e)=>t[0]-e[0]),l=n[0][0]<0?n[0][0]:0,i=Math.max(256,n[n.length-1][0]-l+1),o=new Uint8Array(4*i),s=[],r=5===n[0].length;if(i>65536)return n.forEach(t=>{s[t[0]-l]=r?t.slice(1):t.slice(1).concat([255])}),{indexed2DColormap:s,offset:l,alphaSpecified:r};if(t.fillUnspecified){let t=n[0];for(let e=t[0]-l,s=0;e<i;e++)o[4*e]=t[1],o[4*e+1]=t[2],o[4*e+2]=t[3],o[4*e+3]=r?t[4]:255,e===t[0]-l&&(t=s===n.length-1?t:n[++s])}else for(let a=0;a<n.length;a++){const t=n[a],e=4*(t[0]-l);o[e]=t[1],o[e+1]=t[2],o[e+2]=t[3],o[e+3]=r?t[4]:255}return{indexedColormap:o,offset:l,alphaSpecified:r}}function a(t,e){if(!i(t))return t;if(!e||!e.indexedColormap&&!e.indexed2DColormap)return t;const n=t.clone(),l=n.pixels;let o=n.mask;const s=n.width*n.height;if(1!==l.length)return t;const{indexedColormap:r,indexed2DColormap:a,offset:h,alphaSpecified:f}=e,c=l[0],u=new Uint8Array(c.length),p=new Uint8Array(c.length),x=new Uint8Array(c.length);let m,d=0;if(r){const t=r.length-1;if(null!=o)for(let e=0;e<s;e++)o[e]&&(d=4*(c[e]-h),d<h||d>t?o[e]=0:(u[e]=r[d],p[e]=r[d+1],x[e]=r[d+2],o[e]=r[d+3]));else{o=new Uint8Array(s);for(let e=0;e<s;e++)d=4*(c[e]-h),d<h||d>t?o[e]=0:(u[e]=r[d],p[e]=r[d+1],x[e]=r[d+2],o[e]=r[d+3]);n.mask=o}}else if(a)if(null!=o)for(let i=0;i<s;i++)o[i]&&(m=a[c[i]],u[i]=m[0],p[i]=m[1],x[i]=m[2],o[i]=m[3]);else{o=new Uint8Array(s);for(let t=0;t<s;t++)m=a[c[t]],u[t]=m[0],p[t]=m[1],x[t]=m[2],o[t]=m[3];n.mask=o}return n.pixels=[u,p,x],n.statistics=null,n.pixelType="u8",n.maskIsAlpha=f,n}function h(t,n){if(!i(t))return null;const{pixels:l,mask:o}=t,s=l.length;let r=n.lut;const{offset:a}=n;r&&1===r[0].length&&(r=l.map(()=>r));const h=[],c=n.outputPixelType||"u8";for(let e=0;e<s;e++){const t=f(l[e],o,r[e],a||0,c);h.push(t)}const u=new e({width:t.width,height:t.height,pixels:h,mask:o,pixelType:c});return u.updateStatistics(),u}function f(t,n,l,i,o){const s=t.length,r=e.createEmptyBand(o,s);if(n)for(let e=0;e<s;e++)n[e]&&(r[e]=l[t[e]-i]);else for(let e=0;e<s;e++)r[e]=l[t[e]-i];return r}function c(t,e,n){if(!i(t))return;const{width:l,height:o,pixels:s,mask:r}=t,a=l*o,h=new Uint8Array(a);for(let i=1;i<=n.length;i++){const{bandId:t,ranges:e}=n[i-1],l=s[t];if(!l)continue;const o=1===e.length,[f,c]=e[0];for(let n=0;n<a;n++)if(!r||r[n]){const t=l[n];if(o)t>=f&&t<=c&&(h[n]=i);else for(let l=0;l<e.length;l++){const[o,s]=e[l];if(t>=o&&t<=s){h[n]=i;break}}}}const{pixels:f}=e;1===f.length&&(f[1]=f[0].slice(),f[2]=f[0].slice());const c=n.map(t=>t.color);if(e.mask){const t=e.mask;for(let e=0;e<a;e++)if(t[e]){t[e]=255;const n=h[e];if(n){const l=c[n-1];f[0][e]=l[0],f[1][e]=l[1],f[2][e]=l[2],t[e]=l[3]}}}else{const t=new Uint8Array(a).fill(255);for(let e=0;e<a;e++){const n=h[e];if(n){const l=c[n-1];f[0][e]=l[0],f[1][e]=l[1],f[2][e]=l[2],t[e]=l[3]}}e.mask=t}e.maskIsAlpha=!0}function u(t,e){if(!i(t))return null;const n=t.clone(),{pixels:l}=n,o=n.width*n.height,s=e.length,r=Math.floor(s/2),a=e[Math.floor(r)],h=l[0],f=new Uint8Array(o),c=new Uint8Array(o),u=new Uint8Array(o);let p=n.mask;const x=4===e[0].mappedColor.length;p||(p=new Uint8Array(o),p.fill(x?255:1),n.mask=p);for(let i=0;i<o;i++)if(p[i]){const t=h[i];let n=!1,l=r,o=a,x=0,m=s-1;for(;m-x>1;){if(t===o.value){n=!0;break}t>o.value?x=l:m=l,l=Math.floor((x+m)/2),o=e[Math.floor(l)]}n||(t===e[x].value?(o=e[x],n=!0):t===e[m].value?(o=e[m],n=!0):t<e[x].value?n=!1:t>e[x].value&&(t<e[m].value?(o=e[x],n=!0):m===s-1?n=!1:(o=e[m],n=!0))),n?(f[i]=o.mappedColor[0],c[i]=o.mappedColor[1],u[i]=o.mappedColor[2],p[i]=o.mappedColor[3]):f[i]=c[i]=u[i]=p[i]=0}return n.pixels=[f,c,u],n.mask=p,n.pixelType="u8",n.maskIsAlpha=x,n}function p(e,n,i=!1){const o=1e-5,s=new Float32Array(3*l),r=n.length;for(let a=0;a<l;a++)s[3*a]=e[2*a]??t-1,s[3*a+1]=e[2*a+1]??t,s[3*a+2]=n[a]??0,a<r&&(a>0&&(s[3*a]-=o),e[2*a+1]!==e[2*a]&&(a<r-1||!i)&&(s[3*a+1]-=o));return s}function x(t,l){if(!i(t))return null;const{width:o,height:s}=t,{inputRanges:r,outputValues:a,outputPixelType:h,noDataRanges:f,allowUnmatched:c,replacementValue:u,isLastInputRangeInclusive:p}=l,x=t.pixels[0],m=e.createEmptyBand(h,x.length),d=t.mask,g=new Uint8Array(o*s);d?g.set(d):g.fill(255);const y=t.pixelType.startsWith("f")?1e-6:0,w=r.map(t=>t-y);w[0]=r[0],w[w.length-1]=r[r.length-1]+(p?1e-6:0);const k=r.length/2,[M,A]=n(h);for(let e=0;e<s;e++)for(let t=0;t<o;t++){const n=e*o+t;if(g[n]){const t=x[n];let e=!1;for(let l=k-1;l>=0;l--)if(t===r[2*l]||t>w[2*l]&&t<w[2*l+1]){m[n]=a[l],e=!0;break}e||(c?m[n]=t>A?A:t<M?M:u??t:g[n]=0)}}const U=f?.length;if(U)for(let e=0;e<s;e++)for(let t=0;t<o;t++){const n=e*o+t;if(!d||d[n]){const t=x[n];for(let e=0;e<U;e+=2)if(t>=f[e]&&t<=f[e+1]){m[n]=0,g[n]=0;break}}}return new e({width:o,height:s,pixelType:h,pixels:[m],mask:g})}function m(t,e,n,l){const i=null!=n&&n.length>=2?new Set(n):null,o=1===n?.length?n[0]:null,s=!!e?.length;for(let r=0;r<t.length;r++)if(l[r]){const n=t[r];if(s){let t=!1;for(let l=0;l<e.length;l+=2)if(n>=e[l]&&n<=e[l+1]){t=!0;break}t||(l[r]=0)}l[r]&&(n===o||i?.has(n))&&(l[r]=0)}}function d(t,e){const n=t[0].length;for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(t[e][l]){n=!0;break}n||(e[l]=0)}}function g(t,e){const n=t[0].length;for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(0===t[e][l]){n=!0;break}n&&(e[l]=0)}}function y(t,n){if(!i(t))return null;const{width:l,height:o,pixels:s}=t,r=l*o,a=new Uint8Array(r);t.mask?a.set(t.mask):a.fill(255);const h=s.length,{includedRanges:c,noDataValues:u,outputPixelType:p,matchAll:x,lookups:y}=n;if(y){const t=[];for(let e=0;e<h;e++){const n=y[e],l=f(s[e],a,n.lut,n.offset||0,"u8");t.push(l)}1===t.length?a.set(t[0]):x?d(t,a):g(t,a)}else if(x){const t=[];for(let e=0;e<h;e++){const n=new Uint8Array(r);n.set(a),m(s[e],c?.slice(2*e,2*e+2),u?.[e],n),t.push(n)}1===t.length?a.set(t[0]):d(t,a)}else for(let e=0;e<h;e++)m(s[e],c?.slice(2*e,2*e+2),u?.[e],a);return new e({width:l,height:o,pixelType:p,pixels:s,mask:a})}function w(t){const{srcPixelType:l,inputRanges:i,outputValues:o,allowUnmatched:s,noDataRanges:r,isLastInputRangeInclusive:a,outputPixelType:h}=t;if("u8"!==l&&"s8"!==l&&"u16"!==l&&"s16"!==l)return null;const f=l.includes("16")?65536:256,c=l.includes("s")?-f/2:0,u=e.createEmptyBand(h,f),p=new Uint8Array(f);s&&p.fill(255);const[x,m]=n(h);if(i?.length&&o?.length){const t=1e-6,e=i.map(e=>e-t);e[0]=i[0],a&&(e[e.length-1]=i[i.length-1]);for(let n=0;n<e.length;n++){const t=o[n]>m?m:o[n]<x?x:o[n],l=Math.ceil(e[2*n]-c),s=i[2*n+1]===i[2*n]?l:Math.floor(e[2*n+1]-c);for(let e=l;e<=s;e++)u[e]=t,p[e]=255}}if(r?.length)for(let e=0;e<r.length;e++){const t=Math.ceil(r[2*e]-c),n=Math.floor(r[2*e+1]-c);for(let e=t;e<=n;e++)p[e]=0}return{lut:u,offset:c,mask:p}}function k(t,e,n){if("u8"!==t&&"s8"!==t&&"u16"!==t&&"s16"!==t)return null;const l=t.includes("16")?65536:256,i=t.includes("s")?-l/2:0,o=new Uint8Array(l);if(e)for(let s=0;s<e.length;s++){const t=Math.ceil(e[2*s]-i),n=Math.floor(e[2*s+1]-i);for(let e=t;e<=n;e++)o[e]=255}else o.fill(255);if(n)for(let s=0;s<n.length;s++)o[n[s]-i]=0;return{lut:o,offset:i}}function M(t,e,n,l,i,o,s,r){return{xmin:i<=n*t?0:i<n*t+t?i-n*t:t,ymin:o<=l*e?0:o<l*e+e?o-l*e:e,xmax:i+s<=n*t?0:i+s<n*t+t?i+s-n*t:t,ymax:o+r<=l*e?0:o+r<l*e+e?o+r-l*e:e}}function A(t,e){if(!t||0===t.length)return null;const n=t.find(t=>t.pixelBlock);if(null==n?.pixelBlock)return null;const l=(n.extent.xmax-n.extent.xmin)/n.pixelBlock.width,i=(n.extent.ymax-n.extent.ymin)/n.pixelBlock.height,o=.01*Math.min(l,i),s=t.sort((t,e)=>Math.abs(t.extent.ymax-e.extent.ymax)>o?e.extent.ymax-t.extent.ymax:Math.abs(t.extent.xmin-e.extent.xmin)>o?t.extent.xmin-e.extent.xmin:0),r=Math.min.apply(null,s.map(t=>t.extent.xmin)),a=Math.min.apply(null,s.map(t=>t.extent.ymin)),h=Math.max.apply(null,s.map(t=>t.extent.xmax)),f=Math.max.apply(null,s.map(t=>t.extent.ymax)),c={x:Math.round((e.xmin-r)/l),y:Math.round((f-e.ymax)/i)},u={width:Math.round((h-r)/l),height:Math.round((f-a)/i)},p={width:Math.round((e.xmax-e.xmin)/l),height:Math.round((e.ymax-e.ymin)/i)};if(Math.round(u.width/n.pixelBlock.width)*Math.round(u.height/n.pixelBlock.height)!==s.length||c.x<0||c.y<0||u.width<p.width||u.height<p.height)return null;return{extent:e,pixelBlock:b(s.map(t=>t.pixelBlock),u,{clipOffset:c,clipSize:p})}}function U(t,e,n,l,i,o){const{width:s,height:r}=n.block,{x:a,y:h}=n.offset,{width:f,height:c}=n.mosaic,u=M(s,r,l,i,a,h,f,c);let p=0,x=0;if(o){const t=o.hasGCSSShiftTransform?360:o.halfWorldWidth??0,e=s*o.resolutionX,n=o.startX+l*e;n<t&&n+e>t?x=o.rightPadding:n>=t&&(p=o.leftMargin-o.rightPadding,x=0)}if(u.xmax-=x,"number"!=typeof e)for(let m=u.ymin;m<u.ymax;m++){const n=(i*r+m-h)*f+(l*s-a)+p,o=m*s;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e[o+l]}else for(let m=u.ymin;m<u.ymax;m++){const n=(i*r+m-h)*f+(l*s-a)+p;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e}}function b(t,n,l={}){const{clipOffset:o,clipSize:s,alignmentInfo:r,blockWidths:a}=l;if(a)return T(t,n,{blockWidths:a});const h=t.find(t=>i(t));if(null==h)return null;const f=s?s.width:n.width,c=s?s.height:n.height,u=h.width,p=h.height,x=n.width/u,m=n.height/p,d={offset:o||{x:0,y:0},mosaic:s||n,block:{width:u,height:p}},g=h.pixelType,y=e.getPixelArrayConstructor(g),w=h.pixels.length,k=[];let M,A;for(let e=0;e<w;e++){A=new y(f*c);for(let n=0;n<m;n++)for(let l=0;l<x;l++){const o=t[n*x+l];i(o)&&(M=o.pixels[e],U(A,M,d,l,n,r))}k.push(A)}const b=t.some(t=>null==t||null!=t.mask&&t.mask.length>0),S=t.some(t=>t?.bandMasks&&t.bandMasks.length>1),v=b?new Uint8Array(f*c):void 0,B=S?[]:void 0;if(v){for(let e=0;e<m;e++)for(let n=0;n<x;n++){const l=t[e*x+n],i=null!=l?l.mask:null;U(v,null!=i?i:l?255:0,d,n,e,r)}if(B)for(let e=0;e<w;e++){const n=new Uint8Array(f*c);for(let l=0;l<m;l++)for(let i=0;i<x;i++){const o=t[l*x+i],s=o?.bandMasks?.[e]??o?.mask;U(n,null!=s?s:o?255:0,d,i,l,r)}B.push(n)}}const C=new e({width:f,height:c,pixels:k,pixelType:g,bandMasks:B,mask:v});return C.updateStatistics(),C}function T(t,n,l){const o=t.find(t=>null!=t);if(null==o)return null;const s=t.some(t=>null==t||!!t.mask),{width:r,height:a}=n,h=s?new Uint8Array(r*a):null,{blockWidths:f}=l,c=[],u=o.getPlaneCount(),p=e.getPixelArrayConstructor(o.pixelType);if(s)for(let e=0,y=0;e<t.length;y+=f[e],e++){const n=t[e];if(!i(n))continue;const l=n.mask;for(let t=0;t<a;t++)for(let i=0;i<f[e];i++)h[t*r+i+y]=null==l?255:l[t*n.width+i]}const x=t.some(t=>t?.bandMasks&&t.bandMasks.length>1),m=x?[]:void 0,d=r*a;for(let e=0;e<u;e++){const n=new p(d),l=x?new Uint8Array(d):void 0;for(let o=0,s=0;o<t.length;s+=f[o],o++){const h=t[o];if(!i(h))continue;const c=h.pixels[e];if(null!=c){for(let t=0;t<a;t++)for(let e=0;e<f[o];e++)n[t*r+e+s]=c[t*h.width+e];if(l){const t=h.bandMasks?.[e]??h.mask;for(let e=0;e<a;e++)for(let n=0;n<f[o];n++)l[e*r+n+s]=t?t[e*h.width+n]:255}}}c.push(n),m&&l&&m.push(l)}const g=new e({width:r,height:a,mask:h,bandMasks:m,pixels:c,pixelType:o.pixelType});return g.updateStatistics(),g}function S(t,e,n){if(!i(t))return null;const{width:l,height:o}=t,s=e.x,r=e.y,a=n.width+s,h=n.height+r;if(s<0||r<0||a>l||h>o)return t;if(0===s&&0===r&&a===l&&h===o)return t;t.mask||(t.mask=new Uint8Array(l*o));const f=t.mask;for(let i=0;i<o;i++){const t=i*l;for(let e=0;e<l;e++)f[t+e]=i<r||i>=h||e<s||e>=a?0:1}return t.updateStatistics(),t}function v(t){if(!i(t))return null;const e=t.clone(),{width:n,height:l,pixels:o}=t,s=o[0],r=e.pixels[0],a=t.mask;for(let i=2;i<l-1;i++){const t=new Map;for(let l=i-2;l<i+2;l++)for(let e=0;e<4;e++){const i=l*n+e;R(t,s[i],a?a[i]:1)}r[i*n]=B(t),r[i*n+1]=r[i*n+2]=r[i*n];let e=3;for(;e<n-1;e++){let l=(i-2)*n+e+1;R(t,s[l],a?a[l]:1),l=(i-1)*n+e+1,R(t,s[l],a?a[l]:1),l=i*n+e+1,R(t,s[l],a?a[l]:1),l=(i+1)*n+e+1,R(t,s[l],a?a[l]:1),l=(i-2)*n+e-3,C(t,s[l],a?a[l]:1),l=(i-1)*n+e-3,C(t,s[l],a?a[l]:1),l=i*n+e-3,C(t,s[l],a?a[l]:1),l=(i+1)*n+e-3,C(t,s[l],a?a[l]:1),r[i*n+e]=B(t)}r[i*n+e+1]=r[i*n+e]}for(let i=0;i<n;i++)r[i]=r[n+i]=r[2*n+i],r[(l-1)*n+i]=r[(l-2)*n+i];return e.updateStatistics(),e}function B(t){if(0===t.size)return 0;let e=0,n=-1,l=0;const i=t.keys();let o=i.next();for(;!o.done;)l=t.get(o.value),l>e&&(n=o.value,e=l),o=i.next();return n}function C(t,e,n){if(0===n)return;const l=t.get(e);1===l?t.delete(e):t.set(e,l-1)}function R(t,e,n){0!==n&&t.set(e,t.has(e)?t.get(e)+1:1)}function P(t,n,l){let{x:o,y:s}=n;const{width:r,height:a}=l;if(0===o&&0===s&&a===t.height&&r===t.width)return t;const{width:h,height:f}=t,c=Math.max(0,s),u=Math.max(0,o),p=Math.min(o+r,h),x=Math.min(s+a,f);if(p<0||x<0||!i(t))return null;o=Math.max(0,-o),s=Math.max(0,-s);const{pixels:m}=t,d=r*a,g=m.length,y=[];for(let i=0;i<g;i++){const n=m[i],l=e.createEmptyBand(t.pixelType,d);for(let t=c;t<x;t++){const e=t*h;let i=(t+s-c)*r+o;for(let t=u;t<p;t++)l[i++]=n[e+t]}y.push(l)}const w=new Uint8Array(d),k=t.mask;for(let e=c;e<x;e++){const t=e*h;let n=(e+s-c)*r+o;for(let e=u;e<p;e++)w[n++]=k?k[t+e]:1}const M=new e({width:l.width,height:l.height,pixelType:t.pixelType,pixels:y,mask:w});return M.updateStatistics(),M}function I(t,n=!0){if(!i(t))return null;const{pixels:l,width:o,height:s,mask:r,pixelType:a}=t,h=[],f=Math.round(o/2),c=Math.round(s/2),u=s-1,p=o-1;for(let i=0;i<l.length;i++){const t=l[i],r=e.createEmptyBand(a,f*c);let x=0;for(let e=0;e<s;e+=2)for(let l=0;l<o;l+=2){const i=t[e*o+l];if(n){const n=l===p?i:t[e*o+l+1],s=e===u?i:t[e*o+l+o],a=l===p?s:e===u?n:t[e*o+l+o+1];r[x++]=(i+n+s+a)/4}else r[x++]=i}h.push(r)}let x=null;if(null!=r){x=new Uint8Array(f*c);let t=0;for(let e=0;e<s;e+=2)for(let l=0;l<o;l+=2){const i=r[e*o+l];if(n){const n=l===p?i:r[e*o+l+1],s=e===u?i:r[e*o+l+o],a=l===p?s:e===u?n:r[e*o+l+o+1];x[t++]=i*n*s*a?1:0}else x[t++]=i}}return new e({width:f,height:c,pixelType:a,pixels:h,mask:x})}function _(t,e,n=0,l=!0){if(!i(t))return null;const{width:o,height:s}=e;let{width:r,height:a}=t;const h=new Map,f={x:0,y:0},c=1+n;let u=t;for(let i=0;i<c;i++){const t=Math.ceil(r/o),n=Math.ceil(a/s);for(let l=0;l<n;l++){f.y=l*s;for(let n=0;n<t;n++){f.x=n*o;const t=P(u,f,e);h.set(`${i}/${l}/${n}`,t)}}i<c-1&&(u=I(u,l)),r=Math.round(r/2),a=Math.round(a/2)}return h}function W(t){const{pixelBlock:e,tileSize:n,level:l,row:o,col:s,useBilinear:r}=t;if(!i(e))return null;const{width:a,height:h}=n,f=2**l,c=f*a,u=f*h;let p=P(e,{y:o*u,x:s*c},{width:c,height:u});if(!p)return null;for(let i=l;i>0;i--)p=I(p,r);return p}function E(t,e,n,l,i=0){const{width:o,height:s}=t,{width:r,height:a}=e,h=l.cols,f=l.rows,c=Math.ceil(r/h-.1/h),u=Math.ceil(a/f-.1/f);let p,x,m,d,g,y,w;const k=c*h,M=k*u*f,A=new Float32Array(M),U=new Float32Array(M),b=new Uint32Array(M),T=new Uint32Array(M);let S,v,B=0;for(let C=0;C<u;C++)for(let t=0;t<c;t++){p=12*(C*c+t),x=n[p],m=n[p+1],d=n[p+2],g=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<f;e++){B=(C*f+e)*k+t*h,v=(e+.5)/f;for(let t=0;t<e;t++)S=(t+.5)/h,A[B+t]=(x*S+m*v+d)*o+i,U[B+t]=(g*S+y*v+w)*s+i,b[B+t]=Math.floor(A[B+t]),T[B+t]=Math.floor(U[B+t])}p+=6,x=n[p],m=n[p+1],d=n[p+2],g=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<f;e++){B=(C*f+e)*k+t*h,v=(e+.5)/f;for(let t=e;t<h;t++)S=(t+.5)/h,A[B+t]=(x*S+m*v+d)*o+i,U[B+t]=(g*S+y*v+w)*s+i,b[B+t]=Math.floor(A[B+t]),T[B+t]=Math.floor(U[B+t])}}return{offsets_x:A,offsets_y:U,offsets_xi:b,offsets_yi:T,gridWidth:k}}function F(t,e){const{coefficients:n,spacing:l}=e,{offsets_x:i,offsets_y:o,gridWidth:s}=E(t,t,n,{rows:l[0],cols:l[1]}),{width:r,height:a}=t,h=new Float32Array(r*a),f=180/Math.PI;for(let c=0;c<a;c++)for(let t=0;t<r;t++){const e=c*s+t,n=0===c?e:e-s,l=c===a-1?e:e+s,u=i[n]-i[l],p=o[l]-o[n];if(isNaN(u)||isNaN(p))h[c*r+t]=90;else{let e=Math.atan2(p,u)*f;e=(360+e)%360,h[c*r+t]=e}}return h}function j(t,n,l,o,s="nearest"){if(!i(t))return null;"majority"===s&&(t=v(t));const{pixels:r,mask:a,bandMasks:h,pixelType:f}=t,c=t.width,u=t.height,p=e.getPixelArrayConstructor(f),x=r.length,{width:m,height:d}=n;let g=!1;for(let e=0;e<l.length;e+=3)-1===l[e]&&-1===l[e+1]&&-1===l[e+2]&&(g=!0);const{offsets_x:y,offsets_y:w,offsets_xi:k,offsets_yi:M,gridWidth:A}=E({width:c,height:u},n,l,o,"majority"===s?.5:0);let U;const b=(t,e,n,l)=>{const i=t instanceof Float32Array||t instanceof Float64Array?0:.5;for(let o=0;o<d;o++){U=o*A;for(let s=0;s<m;s++){if(y[U]<0||w[U]<0)t[o*m+s]=0;else if(l)t[o*m+s]=e[k[U]+M[U]*c];else{const l=Math.floor(y[U]),r=Math.floor(w[U]),a=Math.ceil(y[U]),h=Math.ceil(w[U]),f=y[U]-l,u=w[U]-r;if(!n||n[l+r*c]&&n[a+r*c]&&n[l+h*c]&&n[a+h*c]){const n=(1-f)*e[l+r*c]+f*e[a+r*c],p=(1-f)*e[l+h*c]+f*e[a+h*c];t[o*m+s]=(1-u)*n+u*p+i}else t[o*m+s]=e[k[U]+M[U]*c]}U++}}},T=[];let S;const B=h?.length===x,C=[];for(let e=0;e<x;e++){if(B){const t=new Uint8Array(m*d);b(t,h[e],h[e],!0),C.push(t)}S=new p(m*d),b(S,r[e],B?h[e]:a,"nearest"===s||"majority"===s),T.push(S)}const R=new e({width:m,height:d,pixelType:f,pixels:T,bandMasks:B?C:void 0});if(null!=a)R.mask=new Uint8Array(m*d),b(R.mask,a,a,!0);else if(g){R.mask=new Uint8Array(m*d);for(let t=0;t<m*d;t++)R.mask[t]=y[t]<0||w[t]<0?0:1}return R.updateStatistics(),R}function N(t){const{pixelBlock:e,extent:n,fieldNames:l,skipFactor:i,skipSpatialReference:o=!1,pixelIdOffset:s=0}=t,r=[],{width:a,height:h,pixels:f,mask:c}=e,u=t.imageRowSize??a,p=n.width/a,x=n.height/h,m=f.length,d=Math.floor(i/2),{xmin:g,ymax:y}=n,w=o?void 0:n.spatialReference.toJSON();for(let k=d;k<h;k+=i)for(let t=d;t<a;t+=i){const e=k*a+t;if(!c||c[e]){const n={x:g+(t+.5)*p,y:y-(k+.5)*x,spatialReference:w},i={objectId:s+k*u+t};for(let t=0;t<m;t++)i[l[t+1]]=f[t][e];r.push({geometry:n,attributes:i})}}return r}function D(t,e){const{width:n,height:l,pixels:i,mask:o}=t,s=i[0];let r=0;for(let a=0;a<l;a++){let t=a*n;for(let l=0;l<n;l++,t++)o&&!o[t]||(e[s[t]]++,r++)}return r}function z(t,e){const{width:n,height:l,pixels:i,mask:o}=t,s=e.width/n,r=e.height/l,{xmin:a,ymax:h}=e,f=e.spatialReference.toJSON(),c=[];for(let u=0;u<l;u++)for(let t=0;t<n;t++){const e=u*n+t;if(!o||o[e]){const n={x:a+(t+.5)*s,y:h-(u+.5)*r,spatialReference:f},l=i.map(t=>t[e]);c.push({location:n,value:l})}}return c}export{j as approximateTransform,P as clip,W as clipTile,a as colorize,s as compositeBands,N as convertPixelBlockToFeatures,D as countCategoricalPixels,r as createColormapLUT,k as createMaskLUT,p as createRangeMaps,w as createRemapLUT,o as extractBands,M as getClipBounds,F as getLocalArithmeticNorthRotations,z as getValidPixels,c as highlightPixels,E as interpolateOffsets,i as isValidPixelBlock,f as lookupBandValues,h as lookupPixels,y as mask,l as maxMapSizeGpu,b as mosaic,A as mosaicPixelData,x as remap,u as remapColor,v as resampleByMajority,S as setValidBoundary,_ as split};
|
|
5
|
+
import{numberMaxFloat32 as t}from"../../../core/mathUtils.js";import e from"../PixelBlock.js";import{getPixelValueRange as n}from"../rasterFormats/pixelRangeUtils.js";const l=9,i="PixelID";function o(t){return null!=t&&t.pixels?.length>0}function s(t,e){return e?.length&&o(t)?t.extractBands(e):t}function r(t){if(!t?.length||t.some(t=>!o(t)))return null;if(1===t.length)return t[0]?.clone()??null;const n=t,{width:l,height:i,pixelType:s}=n[0];if(n.some(t=>t.width!==l||t.height!==i))return null;const r=n.map(({mask:t})=>t).filter(t=>null!=t);let a=null;r.length&&(a=new Uint8Array(l*i),a.set(r[0]),r.length>1&&w(r.slice(1),a));const h=[];n.forEach(({pixels:t})=>h.push(...t));const f=null!=a&&h.length===n.length?n.map(({width:t,height:e,mask:n})=>n??new Uint8Array(t*e).fill(255)):null,c=n.map(({statistics:t})=>t).filter(t=>t?.length),u=[];return c.forEach(t=>u.push(...t)),new e({pixelType:s,width:l,height:i,mask:a,bandMasks:f,pixels:h,statistics:u.length?u:null})}function a(t){if(!t)return;const e=t.colormap;if(!e||0===e.length)return;const n=e.sort((t,e)=>t[0]-e[0]),l=n[0][0]<0?n[0][0]:0,i=Math.max(256,n[n.length-1][0]-l+1),o=new Uint8Array(4*i),s=[],r=5===n[0].length;if(i>65536)return n.forEach(t=>{s[t[0]-l]=r?t.slice(1):t.slice(1).concat([255])}),{indexed2DColormap:s,offset:l,alphaSpecified:r};if(t.fillUnspecified){let t=n[0];for(let e=t[0]-l,s=0;e<i;e++)o[4*e]=t[1],o[4*e+1]=t[2],o[4*e+2]=t[3],o[4*e+3]=r?t[4]:255,e===t[0]-l&&(t=s===n.length-1?t:n[++s])}else for(let a=0;a<n.length;a++){const t=n[a],e=4*(t[0]-l);o[e]=t[1],o[e+1]=t[2],o[e+2]=t[3],o[e+3]=r?t[4]:255}return{indexedColormap:o,offset:l,alphaSpecified:r}}function h(t,e){if(!o(t))return t;if(!e||!e.indexedColormap&&!e.indexed2DColormap)return t;const n=t.clone(),l=n.pixels;let i=n.mask;const s=n.width*n.height;if(1!==l.length)return t;const{indexedColormap:r,indexed2DColormap:a,offset:h,alphaSpecified:f}=e,c=l[0],u=new Uint8Array(c.length),p=new Uint8Array(c.length),x=new Uint8Array(c.length);let m,d=0;if(r){const t=r.length-1;if(null!=i)for(let e=0;e<s;e++)i[e]&&(d=4*(c[e]-h),d<h||d>t?i[e]=0:(u[e]=r[d],p[e]=r[d+1],x[e]=r[d+2],i[e]=r[d+3]));else{i=new Uint8Array(s);for(let e=0;e<s;e++)d=4*(c[e]-h),d<h||d>t?i[e]=0:(u[e]=r[d],p[e]=r[d+1],x[e]=r[d+2],i[e]=r[d+3]);n.mask=i}}else if(a)if(null!=i)for(let o=0;o<s;o++)i[o]&&(m=a[c[o]],u[o]=m[0],p[o]=m[1],x[o]=m[2],i[o]=m[3]);else{i=new Uint8Array(s);for(let t=0;t<s;t++)m=a[c[t]],u[t]=m[0],p[t]=m[1],x[t]=m[2],i[t]=m[3];n.mask=i}return n.pixels=[u,p,x],n.statistics=null,n.pixelType="u8",n.maskIsAlpha=f,n}function f(t,n){if(!o(t))return null;const{pixels:l,mask:i}=t,s=l.length;let r=n.lut;const{offset:a}=n;r&&1===r[0].length&&(r=l.map(()=>r));const h=[],f=n.outputPixelType||"u8";for(let e=0;e<s;e++){const t=c(l[e],i,r[e],a||0,f);h.push(t)}const u=new e({width:t.width,height:t.height,pixels:h,mask:i,pixelType:f});return u.updateStatistics(),u}function c(t,n,l,i,o){const s=t.length,r=e.createEmptyBand(o,s);if(n)for(let e=0;e<s;e++)n[e]&&(r[e]=l[t[e]-i]);else for(let e=0;e<s;e++)r[e]=l[t[e]-i];return r}function u(t,e,n){if(!o(t))return;const{width:l,height:i,pixels:s,mask:r}=t,a=l*i,h=new Uint8Array(a);for(let o=1;o<=n.length;o++){const{bandId:t,ranges:e}=n[o-1],l=s[t];if(!l)continue;const i=1===e.length,[f,c]=e[0];for(let n=0;n<a;n++)if(!r||r[n]){const t=l[n];if(i)t>=f&&t<=c&&(h[n]=o);else for(let l=0;l<e.length;l++){const[i,s]=e[l];if(t>=i&&t<=s){h[n]=o;break}}}}const{pixels:f}=e;1===f.length&&(f[1]=f[0].slice(),f[2]=f[0].slice());const c=n.map(t=>t.color);if(e.mask){const t=e.mask;for(let e=0;e<a;e++)if(t[e]){t[e]=255;const n=h[e];if(n){const l=c[n-1];f[0][e]=l[0],f[1][e]=l[1],f[2][e]=l[2],t[e]=l[3]}}}else{const t=new Uint8Array(a).fill(255);for(let e=0;e<a;e++){const n=h[e];if(n){const l=c[n-1];f[0][e]=l[0],f[1][e]=l[1],f[2][e]=l[2],t[e]=l[3]}}e.mask=t}e.maskIsAlpha=!0}function p(t,e){if(!o(t))return null;const n=t.clone(),{pixels:l}=n,i=n.width*n.height,s=e.length,r=Math.floor(s/2),a=e[Math.floor(r)],h=l[0],f=new Uint8Array(i),c=new Uint8Array(i),u=new Uint8Array(i);let p=n.mask;const x=4===e[0].mappedColor.length;p||(p=new Uint8Array(i),p.fill(x?255:1),n.mask=p);for(let o=0;o<i;o++)if(p[o]){const t=h[o];let n=!1,l=r,i=a,x=0,m=s-1;for(;m-x>1;){if(t===i.value){n=!0;break}t>i.value?x=l:m=l,l=Math.floor((x+m)/2),i=e[Math.floor(l)]}n||(t===e[x].value?(i=e[x],n=!0):t===e[m].value?(i=e[m],n=!0):t<e[x].value?n=!1:t>e[x].value&&(t<e[m].value?(i=e[x],n=!0):m===s-1?n=!1:(i=e[m],n=!0))),n?(f[o]=i.mappedColor[0],c[o]=i.mappedColor[1],u[o]=i.mappedColor[2],p[o]=i.mappedColor[3]):f[o]=c[o]=u[o]=p[o]=0}return n.pixels=[f,c,u],n.mask=p,n.pixelType="u8",n.maskIsAlpha=x,n}function x(e,n,i=!1){const o=1e-5,s=new Float32Array(3*l),r=n.length;for(let a=0;a<l;a++)s[3*a]=e[2*a]??t-1,s[3*a+1]=e[2*a+1]??t,s[3*a+2]=n[a]??0,a<r&&(a>0&&(s[3*a]-=o),e[2*a+1]!==e[2*a]&&(a<r-1||!i)&&(s[3*a+1]-=o));return s}function m(t,l){if(!o(t))return null;const{width:i,height:s}=t,{inputRanges:r,outputValues:a,outputPixelType:h,noDataRanges:f,allowUnmatched:c,replacementValue:u,isLastInputRangeInclusive:p}=l,x=t.pixels[0],m=e.createEmptyBand(h,x.length),d=t.mask,g=new Uint8Array(i*s);d?g.set(d):g.fill(255);const w=t.pixelType.startsWith("f")?1e-6:0,y=r.map(t=>t-w);y[0]=r[0],y[y.length-1]=r[r.length-1]+(p?1e-6:0);const k=r.length/2,[M,A]=n(h);for(let e=0;e<s;e++)for(let t=0;t<i;t++){const n=e*i+t;if(g[n]){const t=x[n];let e=!1;for(let l=k-1;l>=0;l--)if(t===r[2*l]||t>y[2*l]&&t<y[2*l+1]){m[n]=a[l],e=!0;break}e||(c?m[n]=t>A?A:t<M?M:u??t:g[n]=0)}}const U=f?.length;if(U)for(let e=0;e<s;e++)for(let t=0;t<i;t++){const n=e*i+t;if(!d||d[n]){const t=x[n];for(let e=0;e<U;e+=2)if(t>=f[e]&&t<=f[e+1]){m[n]=0,g[n]=0;break}}}return new e({width:i,height:s,pixelType:h,pixels:[m],mask:g})}function d(t,e,n,l){const i=null!=n&&n.length>=2?new Set(n):null,o=1===n?.length?n[0]:null,s=!!e?.length;for(let r=0;r<t.length;r++)if(l[r]){const n=t[r];if(s){let t=!1;for(let l=0;l<e.length;l+=2)if(n>=e[l]&&n<=e[l+1]){t=!0;break}t||(l[r]=0)}l[r]&&(n===o||i?.has(n))&&(l[r]=0)}}function g(t,e){const n=t[0].length;for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(t[e][l]){n=!0;break}n||(e[l]=0)}}function w(t,e){const n=t[0].length;for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(0===t[e][l]){n=!0;break}n&&(e[l]=0)}}function y(t,n){if(!o(t))return null;const{width:l,height:i,pixels:s}=t,r=l*i,a=new Uint8Array(r);t.mask?a.set(t.mask):a.fill(255);const h=s.length,{includedRanges:f,noDataValues:u,outputPixelType:p,matchAll:x,lookups:m}=n;if(m){const t=[];for(let e=0;e<h;e++){const n=m[e],l=c(s[e],a,n.lut,n.offset||0,"u8");t.push(l)}1===t.length?a.set(t[0]):x?g(t,a):w(t,a)}else if(x){const t=[];for(let e=0;e<h;e++){const n=new Uint8Array(r);n.set(a),d(s[e],f?.slice(2*e,2*e+2),u?.[e],n),t.push(n)}1===t.length?a.set(t[0]):g(t,a)}else for(let e=0;e<h;e++)d(s[e],f?.slice(2*e,2*e+2),u?.[e],a);return new e({width:l,height:i,pixelType:p,pixels:s,mask:a})}function k(t){const{srcPixelType:l,inputRanges:i,outputValues:o,allowUnmatched:s,noDataRanges:r,isLastInputRangeInclusive:a,outputPixelType:h}=t;if("u8"!==l&&"s8"!==l&&"u16"!==l&&"s16"!==l)return null;const f=l.includes("16")?65536:256,c=l.includes("s")?-f/2:0,u=e.createEmptyBand(h,f),p=new Uint8Array(f);s&&p.fill(255);const[x,m]=n(h);if(i?.length&&o?.length){const t=1e-6,e=i.map(e=>e-t);e[0]=i[0],a&&(e[e.length-1]=i[i.length-1]);for(let n=0;n<e.length;n++){const t=o[n]>m?m:o[n]<x?x:o[n],l=Math.ceil(e[2*n]-c),s=i[2*n+1]===i[2*n]?l:Math.floor(e[2*n+1]-c);for(let e=l;e<=s;e++)u[e]=t,p[e]=255}}if(r?.length)for(let e=0;e<r.length;e++){const t=Math.ceil(r[2*e]-c),n=Math.floor(r[2*e+1]-c);for(let e=t;e<=n;e++)p[e]=0}return{lut:u,offset:c,mask:p}}function M(t,e,n){if("u8"!==t&&"s8"!==t&&"u16"!==t&&"s16"!==t)return null;const l=t.includes("16")?65536:256,i=t.includes("s")?-l/2:0,o=new Uint8Array(l);if(e)for(let s=0;s<e.length;s++){const t=Math.ceil(e[2*s]-i),n=Math.floor(e[2*s+1]-i);for(let e=t;e<=n;e++)o[e]=255}else o.fill(255);if(n)for(let s=0;s<n.length;s++)o[n[s]-i]=0;return{lut:o,offset:i}}function A(t,e,n,l,i,o,s,r){return{xmin:i<=n*t?0:i<n*t+t?i-n*t:t,ymin:o<=l*e?0:o<l*e+e?o-l*e:e,xmax:i+s<=n*t?0:i+s<n*t+t?i+s-n*t:t,ymax:o+r<=l*e?0:o+r<l*e+e?o+r-l*e:e}}function U(t,e){if(!t||0===t.length)return null;const n=t.find(t=>t.pixelBlock);if(null==n?.pixelBlock)return null;const l=(n.extent.xmax-n.extent.xmin)/n.pixelBlock.width,i=(n.extent.ymax-n.extent.ymin)/n.pixelBlock.height,o=.01*Math.min(l,i),s=t.sort((t,e)=>Math.abs(t.extent.ymax-e.extent.ymax)>o?e.extent.ymax-t.extent.ymax:Math.abs(t.extent.xmin-e.extent.xmin)>o?t.extent.xmin-e.extent.xmin:0),r=Math.min.apply(null,s.map(t=>t.extent.xmin)),a=Math.min.apply(null,s.map(t=>t.extent.ymin)),h=Math.max.apply(null,s.map(t=>t.extent.xmax)),f=Math.max.apply(null,s.map(t=>t.extent.ymax)),c={x:Math.round((e.xmin-r)/l),y:Math.round((f-e.ymax)/i)},u={width:Math.round((h-r)/l),height:Math.round((f-a)/i)},p={width:Math.round((e.xmax-e.xmin)/l),height:Math.round((e.ymax-e.ymin)/i)};if(Math.round(u.width/n.pixelBlock.width)*Math.round(u.height/n.pixelBlock.height)!==s.length||c.x<0||c.y<0||u.width<p.width||u.height<p.height)return null;return{extent:e,pixelBlock:T(s.map(t=>t.pixelBlock),u,{clipOffset:c,clipSize:p})}}function b(t,e,n,l,i,o){const{width:s,height:r}=n.block,{x:a,y:h}=n.offset,{width:f,height:c}=n.mosaic,u=A(s,r,l,i,a,h,f,c);let p=0,x=0;if(o){const t=o.hasGCSSShiftTransform?360:o.halfWorldWidth??0,e=s*o.resolutionX,n=o.startX+l*e;n<t&&n+e>t?x=o.rightPadding:n>=t&&(p=o.leftMargin-o.rightPadding,x=0)}if(u.xmax-=x,"number"!=typeof e)for(let m=u.ymin;m<u.ymax;m++){const n=(i*r+m-h)*f+(l*s-a)+p,o=m*s;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e[o+l]}else for(let m=u.ymin;m<u.ymax;m++){const n=(i*r+m-h)*f+(l*s-a)+p;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e}}function T(t,n,l={}){const{clipOffset:i,clipSize:s,alignmentInfo:r,blockWidths:a}=l;if(a)return S(t,n,{blockWidths:a});const h=t.find(t=>o(t));if(null==h)return null;const f=s?s.width:n.width,c=s?s.height:n.height,u=h.width,p=h.height,x=n.width/u,m=n.height/p,d={offset:i||{x:0,y:0},mosaic:s||n,block:{width:u,height:p}},g=h.pixelType,w=e.getPixelArrayConstructor(g),y=h.pixels.length,k=[];let M,A;for(let e=0;e<y;e++){A=new w(f*c);for(let n=0;n<m;n++)for(let l=0;l<x;l++){const i=t[n*x+l];o(i)&&(M=i.pixels[e],b(A,M,d,l,n,r))}k.push(A)}const U=t.some(t=>null==t||null!=t.mask&&t.mask.length>0),T=t.some(t=>t?.bandMasks&&t.bandMasks.length>1),v=U?new Uint8Array(f*c):void 0,B=T?[]:void 0;if(v){for(let e=0;e<m;e++)for(let n=0;n<x;n++){const l=t[e*x+n],i=null!=l?l.mask:null;b(v,null!=i?i:l?255:0,d,n,e,r)}if(B)for(let e=0;e<y;e++){const n=new Uint8Array(f*c);for(let l=0;l<m;l++)for(let i=0;i<x;i++){const o=t[l*x+i],s=o?.bandMasks?.[e]??o?.mask;b(n,null!=s?s:o?255:0,d,i,l,r)}B.push(n)}}const C=new e({width:f,height:c,pixels:k,pixelType:g,bandMasks:B,mask:v});return C.updateStatistics(),C}function S(t,n,l){const i=t.find(t=>null!=t);if(null==i)return null;const s=t.some(t=>null==t||!!t.mask),{width:r,height:a}=n,h=s?new Uint8Array(r*a):null,{blockWidths:f}=l,c=[],u=i.getPlaneCount(),p=e.getPixelArrayConstructor(i.pixelType);if(s)for(let e=0,w=0;e<t.length;w+=f[e],e++){const n=t[e];if(!o(n))continue;const l=n.mask;for(let t=0;t<a;t++)for(let i=0;i<f[e];i++)h[t*r+i+w]=null==l?255:l[t*n.width+i]}const x=t.some(t=>t?.bandMasks&&t.bandMasks.length>1),m=x?[]:void 0,d=r*a;for(let e=0;e<u;e++){const n=new p(d),l=x?new Uint8Array(d):void 0;for(let i=0,s=0;i<t.length;s+=f[i],i++){const h=t[i];if(!o(h))continue;const c=h.pixels[e];if(null!=c){for(let t=0;t<a;t++)for(let e=0;e<f[i];e++)n[t*r+e+s]=c[t*h.width+e];if(l){const t=h.bandMasks?.[e]??h.mask;for(let e=0;e<a;e++)for(let n=0;n<f[i];n++)l[e*r+n+s]=t?t[e*h.width+n]:255}}}c.push(n),m&&l&&m.push(l)}const g=new e({width:r,height:a,mask:h,bandMasks:m,pixels:c,pixelType:i.pixelType});return g.updateStatistics(),g}function v(t,e,n){if(!o(t))return null;const{width:l,height:i}=t,s=e.x,r=e.y,a=n.width+s,h=n.height+r;if(s<0||r<0||a>l||h>i)return t;if(0===s&&0===r&&a===l&&h===i)return t;t.mask||(t.mask=new Uint8Array(l*i));const f=t.mask;for(let o=0;o<i;o++){const t=o*l;for(let e=0;e<l;e++)f[t+e]=o<r||o>=h||e<s||e>=a?0:1}return t.updateStatistics(),t}function B(t){if(!o(t))return null;const e=t.clone(),{width:n,height:l,pixels:i}=t,s=i[0],r=e.pixels[0],a=t.mask;for(let o=2;o<l-1;o++){const t=new Map;for(let l=o-2;l<o+2;l++)for(let e=0;e<4;e++){const i=l*n+e;R(t,s[i],a?a[i]:1)}r[o*n]=C(t),r[o*n+1]=r[o*n+2]=r[o*n];let e=3;for(;e<n-1;e++){let l=(o-2)*n+e+1;R(t,s[l],a?a[l]:1),l=(o-1)*n+e+1,R(t,s[l],a?a[l]:1),l=o*n+e+1,R(t,s[l],a?a[l]:1),l=(o+1)*n+e+1,R(t,s[l],a?a[l]:1),l=(o-2)*n+e-3,P(t,s[l],a?a[l]:1),l=(o-1)*n+e-3,P(t,s[l],a?a[l]:1),l=o*n+e-3,P(t,s[l],a?a[l]:1),l=(o+1)*n+e-3,P(t,s[l],a?a[l]:1),r[o*n+e]=C(t)}r[o*n+e+1]=r[o*n+e]}for(let o=0;o<n;o++)r[o]=r[n+o]=r[2*n+o],r[(l-1)*n+o]=r[(l-2)*n+o];return e.updateStatistics(),e}function C(t){if(0===t.size)return 0;let e=0,n=-1,l=0;const i=t.keys();let o=i.next();for(;!o.done;)l=t.get(o.value),l>e&&(n=o.value,e=l),o=i.next();return n}function P(t,e,n){if(0===n)return;const l=t.get(e);1===l?t.delete(e):t.set(e,l-1)}function R(t,e,n){0!==n&&t.set(e,t.has(e)?t.get(e)+1:1)}function I(t,n,l){let{x:i,y:s}=n;const{width:r,height:a}=l;if(0===i&&0===s&&a===t.height&&r===t.width)return t;const{width:h,height:f}=t,c=Math.max(0,s),u=Math.max(0,i),p=Math.min(i+r,h),x=Math.min(s+a,f);if(p<0||x<0||!o(t))return null;i=Math.max(0,-i),s=Math.max(0,-s);const{pixels:m}=t,d=r*a,g=m.length,w=[];for(let o=0;o<g;o++){const n=m[o],l=e.createEmptyBand(t.pixelType,d);for(let t=c;t<x;t++){const e=t*h;let o=(t+s-c)*r+i;for(let t=u;t<p;t++)l[o++]=n[e+t]}w.push(l)}const y=new Uint8Array(d),k=t.mask;for(let e=c;e<x;e++){const t=e*h;let n=(e+s-c)*r+i;for(let e=u;e<p;e++)y[n++]=k?k[t+e]:1}const M=new e({width:l.width,height:l.height,pixelType:t.pixelType,pixels:w,mask:y});return M.updateStatistics(),M}function _(t,n=!0){if(!o(t))return null;const{pixels:l,width:i,height:s,mask:r,pixelType:a}=t,h=[],f=Math.round(i/2),c=Math.round(s/2),u=s-1,p=i-1;for(let o=0;o<l.length;o++){const t=l[o],r=e.createEmptyBand(a,f*c);let x=0;for(let e=0;e<s;e+=2)for(let l=0;l<i;l+=2){const o=t[e*i+l];if(n){const n=l===p?o:t[e*i+l+1],s=e===u?o:t[e*i+l+i],a=l===p?s:e===u?n:t[e*i+l+i+1];r[x++]=(o+n+s+a)/4}else r[x++]=o}h.push(r)}let x=null;if(null!=r){x=new Uint8Array(f*c);let t=0;for(let e=0;e<s;e+=2)for(let l=0;l<i;l+=2){const o=r[e*i+l];if(n){const n=l===p?o:r[e*i+l+1],s=e===u?o:r[e*i+l+i],a=l===p?s:e===u?n:r[e*i+l+i+1];x[t++]=o*n*s*a?1:0}else x[t++]=o}}return new e({width:f,height:c,pixelType:a,pixels:h,mask:x})}function W(t,e,n=0,l=!0){if(!o(t))return null;const{width:i,height:s}=e;let{width:r,height:a}=t;const h=new Map,f={x:0,y:0},c=1+n;let u=t;for(let o=0;o<c;o++){const t=Math.ceil(r/i),n=Math.ceil(a/s);for(let l=0;l<n;l++){f.y=l*s;for(let n=0;n<t;n++){f.x=n*i;const t=I(u,f,e);h.set(`${o}/${l}/${n}`,t)}}o<c-1&&(u=_(u,l)),r=Math.round(r/2),a=Math.round(a/2)}return h}function E(t){const{pixelBlock:e,tileSize:n,level:l,row:i,col:s,useBilinear:r}=t;if(!o(e))return null;const{width:a,height:h}=n,f=2**l,c=f*a,u=f*h;let p=I(e,{y:i*u,x:s*c},{width:c,height:u});if(!p)return null;for(let o=l;o>0;o--)p=_(p,r);return p}function F(t,e,n,l,i=0){const{width:o,height:s}=t,{width:r,height:a}=e,h=l.cols,f=l.rows,c=Math.ceil(r/h-.1/h),u=Math.ceil(a/f-.1/f);let p,x,m,d,g,w,y;const k=c*h,M=k*u*f,A=new Float32Array(M),U=new Float32Array(M),b=new Uint32Array(M),T=new Uint32Array(M);let S,v,B=0;for(let C=0;C<u;C++)for(let t=0;t<c;t++){p=12*(C*c+t),x=n[p],m=n[p+1],d=n[p+2],g=n[p+3],w=n[p+4],y=n[p+5];for(let e=0;e<f;e++){B=(C*f+e)*k+t*h,v=(e+.5)/f;for(let t=0;t<e;t++)S=(t+.5)/h,A[B+t]=(x*S+m*v+d)*o+i,U[B+t]=(g*S+w*v+y)*s+i,b[B+t]=Math.floor(A[B+t]),T[B+t]=Math.floor(U[B+t])}p+=6,x=n[p],m=n[p+1],d=n[p+2],g=n[p+3],w=n[p+4],y=n[p+5];for(let e=0;e<f;e++){B=(C*f+e)*k+t*h,v=(e+.5)/f;for(let t=e;t<h;t++)S=(t+.5)/h,A[B+t]=(x*S+m*v+d)*o+i,U[B+t]=(g*S+w*v+y)*s+i,b[B+t]=Math.floor(A[B+t]),T[B+t]=Math.floor(U[B+t])}}return{offsets_x:A,offsets_y:U,offsets_xi:b,offsets_yi:T,gridWidth:k}}function D(t,e){const{coefficients:n,spacing:l}=e,{offsets_x:i,offsets_y:o,gridWidth:s}=F(t,t,n,{rows:l[0],cols:l[1]}),{width:r,height:a}=t,h=new Float32Array(r*a),f=180/Math.PI;for(let c=0;c<a;c++)for(let t=0;t<r;t++){const e=c*s+t,n=0===c?e:e-s,l=c===a-1?e:e+s,u=i[n]-i[l],p=o[l]-o[n];if(isNaN(u)||isNaN(p))h[c*r+t]=90;else{let e=Math.atan2(p,u)*f;e=(360+e)%360,h[c*r+t]=e}}return h}function N(t,n,l,i,s="nearest"){if(!o(t))return null;"majority"===s&&(t=B(t));const{pixels:r,mask:a,bandMasks:h,pixelType:f}=t,c=t.width,u=t.height,p=e.getPixelArrayConstructor(f),x=r.length,{width:m,height:d}=n;let g=!1;for(let e=0;e<l.length;e+=3)-1===l[e]&&-1===l[e+1]&&-1===l[e+2]&&(g=!0);const{offsets_x:w,offsets_y:y,offsets_xi:k,offsets_yi:M,gridWidth:A}=F({width:c,height:u},n,l,i,"majority"===s?.5:0);let U;const b=(t,e,n,l)=>{const i=t instanceof Float32Array||t instanceof Float64Array?0:.5;for(let o=0;o<d;o++){U=o*A;for(let s=0;s<m;s++){if(w[U]<0||y[U]<0)t[o*m+s]=0;else if(l)t[o*m+s]=e[k[U]+M[U]*c];else{const l=Math.floor(w[U]),r=Math.floor(y[U]),a=Math.ceil(w[U]),h=Math.ceil(y[U]),f=w[U]-l,u=y[U]-r;if(!n||n[l+r*c]&&n[a+r*c]&&n[l+h*c]&&n[a+h*c]){const n=(1-f)*e[l+r*c]+f*e[a+r*c],p=(1-f)*e[l+h*c]+f*e[a+h*c];t[o*m+s]=(1-u)*n+u*p+i}else t[o*m+s]=e[k[U]+M[U]*c]}U++}}},T=[];let S;const v=h?.length===x,C=[];for(let e=0;e<x;e++){if(v){const t=new Uint8Array(m*d);b(t,h[e],h[e],!0),C.push(t)}S=new p(m*d),b(S,r[e],v?h[e]:a,"nearest"===s||"majority"===s),T.push(S)}const P=new e({width:m,height:d,pixelType:f,pixels:T,bandMasks:v?C:void 0});if(null!=a)P.mask=new Uint8Array(m*d),b(P.mask,a,a,!0);else if(g){P.mask=new Uint8Array(m*d);for(let t=0;t<m*d;t++)P.mask[t]=w[t]<0||y[t]<0?0:1}return P.updateStatistics(),P}function j(t){const{pixelBlock:e,extent:n,fieldNames:l,skipFactor:o,skipSpatialReference:s=!1,pixelIdOffset:r=0}=t,a=[],{width:h,height:f,pixels:c,mask:u}=e,p=t.imageRowSize??h,x=n.width/h,m=n.height/f,d=c.length,g=Math.floor(o/2),{xmin:w,ymax:y}=n,k=s?void 0:n.spatialReference.toJSON();for(let M=g;M<f;M+=o)for(let t=g;t<h;t+=o){const e=M*h+t;if(!u||u[e]){const n={x:w+(t+.5)*x,y:y-(M+.5)*m,spatialReference:k},o={[i]:r+M*p+t};for(let t=0;t<d;t++)o[l[t+1]]=c[t][e];a.push({geometry:n,attributes:o})}}return a}function z(t,e){const{width:n,height:l,pixels:i,mask:o}=t,s=i[0];let r=0;for(let a=0;a<l;a++){let t=a*n;for(let l=0;l<n;l++,t++)o&&!o[t]||(e[s[t]]++,r++)}return r}function O(t,e){const{width:n,height:l,pixels:i,mask:o}=t,s=e.width/n,r=e.height/l,{xmin:a,ymax:h}=e,f=e.spatialReference.toJSON(),c=[];for(let u=0;u<l;u++)for(let t=0;t<n;t++){const e=u*n+t;if(!o||o[e]){const n={x:a+(t+.5)*s,y:h-(u+.5)*r,spatialReference:f},l=i.map(t=>t[e]);c.push({location:n,value:l})}}return c}export{N as approximateTransform,I as clip,E as clipTile,h as colorize,r as compositeBands,j as convertPixelBlockToFeatures,z as countCategoricalPixels,a as createColormapLUT,M as createMaskLUT,x as createRangeMaps,k as createRemapLUT,s as extractBands,A as getClipBounds,D as getLocalArithmeticNorthRotations,O as getValidPixels,u as highlightPixels,F as interpolateOffsets,o as isValidPixelBlock,c as lookupBandValues,f as lookupPixels,y as mask,l as maxMapSizeGpu,T as mosaic,U as mosaicPixelData,i as pixelIdFieldName,m as remap,p as remapColor,B as resampleByMajority,v as setValidBoundary,W as split};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../core/has.js";import{isHostedAgolService as t,parse as s}from"./arcgisLayerUrl.js";import{getGltfQueryFormat as e}from"./infoFor3D.js";import{readNumber as r,readBoolean as p}from"../../rest/support/jsonUtils.js";const o={name:"supportsName",size:"supportsSize",contentType:"supportsContentType",keywords:"supportsKeywords",exifInfo:"supportsExifInfo"};function u(t){const s=t?.supportedSpatialAggregationStatistics?.map(t=>t.toLowerCase());return{envelope:!!s?.includes("envelopeaggregate"),centroid:!!s?.includes("centroidaggregate"),convexHull:!!s?.includes("convexhullaggregate")}}function n(t,s){const e=t?.supportedOperationsWithCacheHint?.map(t=>t.toLowerCase());return!!e?.includes(s.toLowerCase())}function i(t){const s=t?.supportedStatisticTypes?.map(t=>t.toLowerCase());return{count:!!s?.includes("count"),sum:!!s?.includes("sum"),min:!!s?.includes("min"),max:!!s?.includes("max"),avg:!!s?.includes("avg"),var:!!s?.includes("var"),stddev:!!s?.includes("stddev"),percentileContinuous:!!s?.includes("percentile_cont"),percentileDiscrete:!!s?.includes("percentile_disc"),envelope:!!s?.includes("envelopeaggregate"),centroid:!!s?.includes("centroidaggregate"),convexHull:!!s?.includes("convexhullaggregate")}}function a(t){const s=t?.supportedNormalizationTypes?.map(t=>t.toLowerCase());return{field:!!s?.includes("field"),log:!!s?.includes("log"),naturalLog:!!s?.includes("naturallog"),percentOfTotal:!!s?.includes("percentoftotal"),squareRoot:!!s?.includes("squareroot")}}function c(t,s){return{analytics:d(t),attachment:l(t),data:y(t),metadata:m(t),operations:g(t.capabilities,t,s),query:C(t,s),queryAttributeBins:Q(t),queryRelated:v(t),queryTopFeatures:h(t),editing:A(t)}}function d(t){return{supportsCacheHint:n(t.advancedQueryCapabilities,"queryAnalytics")}}function l(t){const s=t.attachmentProperties,e={supportsName:!1,supportsSize:!1,supportsContentType:!1,supportsKeywords:!1,supportsExifInfo:!1,supportsCacheHint:n(t.advancedQueryCapabilities,"queryAttachments"),supportsOrderByFields:p(t.advancedQueryCapabilities,"supportsQueryAttachmentOrderByFields",!1),supportsResize:p(t,"supportsAttachmentsResizing",!1),supportsTypeWildcard:p(t.advancedQueryCapabilities,"supportsQueryAttachmentWithTypeWildcard",!1)};return s&&Array.isArray(s)&&s.forEach(t=>{const s=o[t.name];s&&(e[s]=!!t.isEnabled)}),e}function y(t){return{isVersioned:p(t,"isDataVersioned",!1),isBranchVersioned:p(t,"isDataBranchVersioned",!1),supportsAttachment:p(t,"hasAttachments",!1),supportsM:p(t,"hasM",!1),supportsZ:p(t,"hasZ",!1)}}function m(t){return{supportsAdvancedFieldProperties:p(t,"supportsFieldDescriptionProperty",!1)}}function g(t,e,r){const o=t?.toLowerCase().split(",").map(t=>t.trim())??[],u=r?s(r):null,n=o.includes("MapServer"===u?.serverType?"data":"query"),i=o.includes("editing")&&!e.datesInUnknownTimezone&&!(!0===e.uniqueIdInfo?.OIDFieldContainsHashValue);let a=i&&o.includes("create"),c=i&&o.includes("delete"),d=i&&o.includes("update");const l=o.includes("changetracking"),y=e.advancedQueryCapabilities;return i&&!(a||c||d)&&(a=c=d=!0),{supportsCalculate:p(e,"supportsCalculate",!1),supportsTruncate:p(e,"supportsTruncate",!1),supportsValidateSql:p(e,"supportsValidateSql",!1),supportsAdd:a,supportsDelete:c,supportsEditing:i,supportsChangeTracking:l,supportsQuery:n,supportsQueryAnalytics:p(y,"supportsQueryAnalytic",!1),supportsQueryAttachments:p(y,"supportsQueryAttachments",!1),supportsQueryBins:p(y,"supportsQueryBins",!1)||!!e.queryBinsCapabilities,supportsQueryTopFeatures:p(y,"supportsTopFeaturesQuery",!1),supportsResizeAttachments:p(e,"supportsAttachmentsResizing",!1),supportsSync:o.includes("sync"),supportsUpdate:d,supportsExceedsLimitStatistics:p(e,"supportsExceedsLimitStatistics",!1),supportsAsyncConvert3D:p(e,"supportsAsyncConvert3D",!1)}}function C(s,o){const i=s.advancedQueryCapabilities,a=s.ownershipBasedAccessControlForFeatures,c=s.archivingInfo,d=s.currentVersion,l=o?.includes("MapServer"),y=!l||d>=has("mapserver-pbf-version-support"),m=t(o),g=new Set((s.supportedQueryFormats??"").split(",").map(t=>t.toLowerCase().trim()));return{maxRecordCount:r(s,"maxRecordCount",void 0),maxRecordCountFactor:r(s,"maxRecordCountFactor",void 0),maxUniqueIDCount:r(s,"maxUniqueIDCount",void 0),standardMaxRecordCount:r(s,"standardMaxRecordCount",void 0),supportedSpatialAggregationStatistics:u(i),supportsCacheHint:p(i,"supportsQueryWithCacheHint",!1)||n(i,"query"),supportsCentroid:p(i,"supportsReturningGeometryCentroid",!1),supportsCentroidOnDegeneratedQuantizedGeometry:m||null==o,supportsCompactGeometry:m,supportsCurrentUser:p(i,"supportsCurrentUserQueries",!1),supportsDefaultSpatialReference:p(i,"supportsDefaultSR",!1),supportsDegeneratedQuantizedGeometry:p(i,"supportsDegeneratedQuantizedGeometry",!1),supportsDisjointSpatialRelationship:p(i,"supportsDisjointSpatialRel",!1),supportsDistance:p(i,"supportsQueryWithDistance",!1),supportsDistinct:p(i,"supportsDistinct",s.supportsAdvancedQueries),supportsExtent:p(i,"supportsReturningQueryExtent",!1),supportsFormatPBF:y&&g.has("pbf"),supportsFullTextSearch:p(i,"supportsFullTextSearch",!1),supportsGeometryProperties:p(i,"supportsReturningGeometryProperties",!1),supportsHavingClause:p(i,"supportsHavingClause",!1),supportsHistoricMoment:p(c,"supportsQueryWithHistoricMoment",!1),supportsMaxRecordCountFactor:p(i,"supportsMaxRecordCountFactor",!1),supportsOrderBy:p(i,"supportsOrderBy",s.supportsAdvancedQueries),supportsPagination:p(i,"supportsPagination",!1),supportsPaginationOnAggregatedQueries:p(i,"supportsPaginationOnAggregatedQueries",!1),supportsPercentileStatistics:p(i,"supportsPercentileStatistics",!1),supportsQuantization:p(s,"supportsCoordinatesQuantization",!1),supportsQuantizationEditMode:p(s,"supportsQuantizationEditMode",!1),supportsQueryByAnonymous:p(a,"allowAnonymousToQuery",!0),supportsQueryByOthers:p(a,"allowOthersToQuery",!0),supportsQueryGeometry:p(s,"supportsReturningQueryGeometry",!1),supportsResultType:p(i,"supportsQueryWithResultType",!1),supportsReturnMesh:!!e(s.infoFor3D),supportsSpatialAggregationStatistics:p(i,"supportsSpatialAggregationStatistics",!1),supportsSqlExpression:p(i,"supportsSqlExpression",!1),supportsStandardizedQueriesOnly:p(s,"useStandardizedQueries",!1),supportsStatistics:p(i,"supportsStatistics",s.supportsStatistics),supportsTopFeaturesQuery:p(i,"supportsTopFeaturesQuery",!1),supportsTrueCurve:p(i,"supportsTrueCurve",!1),tileMaxRecordCount:r(s,"tileMaxRecordCount",void 0)}}function v(t){const s=t.advancedQueryCapabilities,e=p(s,"supportsAdvancedQueryRelated",!1);return{supportsPagination:p(s,"supportsQueryRelatedPagination",!1),supportsCount:e,supportsOrderBy:e,supportsCacheHint:n(s,"queryRelated")}}function h(t){return{supportsCacheHint:n(t.advancedQueryCapabilities,"queryTopFilter")}}function Q(t){const s=t?t.queryBinsCapabilities:void 0;return{supportsDate:p(s,"supportsDateBin",!1),supportsFixedInterval:p(s,"supportsFixedIntervalBin",!1),supportsAutoInterval:p(s,"supportsAutoIntervalBin",!1),supportsFixedBoundaries:p(s,"supportsFixedBoundariesBin",!1),supportsStackBy:p(s,"supportsStackBy",!1),supportsSplitBy:p(s,"supportsSplitBy",!1),supportsSnapToData:p(s,"supportsSnapToData",!1),supportsReturnFullIntervalBin:p(s,"supportsReturnFullIntervalBin",!1),supportsFirstDayOfWeek:p(s,"supportsFirstDayOfWeek",!1),supportsNormalization:p(s,"supportsNormalization",!1),supportedStatistics:i(s),supportedNormalizationTypes:a(s)}}function A(t){const s=t.ownershipBasedAccessControlForFeatures,e=t?t.advancedEditingCapabilities:void 0;return{supportsGeometryUpdate:p(t,"allowGeometryUpdates",!0),supportsGlobalId:p(t,"supportsApplyEditsWithGlobalIds",!1),supportsReturnServiceEditsInSourceSpatialReference:p(t,"supportsReturnServiceEditsInSourceSR",!1),supportsRollbackOnFailure:p(t,"supportsRollbackOnFailureParameter",!1),supportsUpdateWithoutM:p(t,"allowUpdateWithoutMValues",!1),supportsUploadWithItemId:p(t,"supportsAttachmentsByUploadId",!1),supportsDeleteByAnonymous:p(s,"allowAnonymousToDelete",!0),supportsDeleteByOthers:p(s,"allowOthersToDelete",!0),supportsUpdateByAnonymous:p(s,"allowAnonymousToUpdate",!0),supportsUpdateByOthers:p(s,"allowOthersToUpdate",!0),supportsAsyncApplyEdits:p(e,"supportsAsyncApplyEdits",!1),zDefault:r(t,"zDefault",void 0)}}function S(t){return{operations:{supportsAppend:p(t,"supportsAppend",!1),supportsCoverageQuery:t?.playbackInfo?.klv["0601"]??!1,supportsExportClip:p(t,"supportsExportClip",!1),supportsExportFrameset:p(t,"supportsExportFrameset",!1),supportsMensuration:p(t,"supportsMensuration",!1),supportsPreviews:p(t,"supportsPreviews",!1),supportsUpdate:p(t,"supportsUpdate",!1)}}}export{c as getFeatureLayerCapabilities,S as getVideoLayerCapabilities};
|
|
5
|
+
import has from"../../core/has.js";import{isHostedAgolService as t,parse as s}from"./arcgisLayerUrl.js";import{getGltfQueryFormat as e}from"./infoFor3D.js";import{readNumber as r,readBoolean as p}from"../../rest/support/jsonUtils.js";const o={name:"supportsName",size:"supportsSize",contentType:"supportsContentType",keywords:"supportsKeywords",exifInfo:"supportsExifInfo"};function u(t){const s=t?.supportedSpatialAggregationStatistics?.map(t=>t.toLowerCase());return{envelope:!!s?.includes("envelopeaggregate"),centroid:!!s?.includes("centroidaggregate"),convexHull:!!s?.includes("convexhullaggregate")}}function n(t,s){const e=t?.supportedOperationsWithCacheHint?.map(t=>t.toLowerCase());return!!e?.includes(s.toLowerCase())}function i(t){const s=t?.supportedStatisticTypes?.map(t=>t.toLowerCase());return{count:!!s?.includes("count"),sum:!!s?.includes("sum"),min:!!s?.includes("min"),max:!!s?.includes("max"),avg:!!s?.includes("avg"),var:!!s?.includes("var"),stddev:!!s?.includes("stddev"),percentileContinuous:!!s?.includes("percentile_cont"),percentileDiscrete:!!s?.includes("percentile_disc"),envelope:!!s?.includes("envelopeaggregate"),centroid:!!s?.includes("centroidaggregate"),convexHull:!!s?.includes("convexhullaggregate")}}function a(t){const s=t?.supportedNormalizationTypes?.map(t=>t.toLowerCase());return{field:!!s?.includes("field"),log:!!s?.includes("log"),naturalLog:!!s?.includes("naturallog"),percentOfTotal:!!s?.includes("percentoftotal"),squareRoot:!!s?.includes("squareroot")}}function c(t,s){return{analytics:d(t),attachment:l(t),data:y(t),metadata:m(t),operations:g(t.capabilities,t,s),query:C(t,s),queryAttributeBins:Q(t),queryRelated:v(t),queryTopFeatures:h(t),editing:A(t)}}function d(t){return{supportsCacheHint:n(t.advancedQueryCapabilities,"queryAnalytics")}}function l(t){const s=t.attachmentProperties,e={supportsName:!1,supportsSize:!1,supportsContentType:!1,supportsKeywords:!1,supportsExifInfo:!1,supportsCacheHint:n(t.advancedQueryCapabilities,"queryAttachments"),supportsOrderByFields:p(t.advancedQueryCapabilities,"supportsQueryAttachmentOrderByFields",!1),supportsResize:p(t,"supportsAttachmentsResizing",!1),supportsTypeWildcard:p(t.advancedQueryCapabilities,"supportsQueryAttachmentWithTypeWildcard",!1)};return s&&Array.isArray(s)&&s.forEach(t=>{const s=o[t.name];s&&(e[s]=!!t.isEnabled)}),e}function y(t){return{isVersioned:p(t,"isDataVersioned",!1),isBranchVersioned:p(t,"isDataBranchVersioned",!1),supportsAttachment:p(t,"hasAttachments",!1),supportsM:p(t,"hasM",!1),supportsZ:p(t,"hasZ",!1)}}function m(t){return{supportsAdvancedFieldProperties:p(t,"supportsFieldDescriptionProperty",!1)}}function g(t,e,r){const o=t?.toLowerCase().split(",").map(t=>t.trim())??[],u=r?s(r):null,n=o.includes("MapServer"===u?.serverType?"data":"query"),i=o.includes("editing")&&!e.datesInUnknownTimezone&&!(!0===e.uniqueIdInfo?.OIDFieldContainsHashValue);let a=i&&o.includes("create"),c=i&&o.includes("delete"),d=i&&o.includes("update");const l=o.includes("changetracking"),y=e.advancedQueryCapabilities;return i&&!(a||c||d)&&(a=c=d=!0),{supportsCalculate:p(e,"supportsCalculate",!1),supportsTruncate:p(e,"supportsTruncate",!1),supportsValidateSql:p(e,"supportsValidateSql",!1),supportsAdd:a,supportsDelete:c,supportsEditing:i,supportsChangeTracking:l,supportsQuery:n,supportsQueryAnalytics:p(y,"supportsQueryAnalytic",!1),supportsQueryAttachments:p(y,"supportsQueryAttachments",!1),supportsQueryBins:p(y,"supportsQueryBins",!1)||!!e.queryBinsCapabilities,supportsQueryPivot:p(y,"supportsQueryPivot",!1),supportsQueryTopFeatures:p(y,"supportsTopFeaturesQuery",!1),supportsResizeAttachments:p(e,"supportsAttachmentsResizing",!1),supportsSync:o.includes("sync"),supportsUpdate:d,supportsExceedsLimitStatistics:p(e,"supportsExceedsLimitStatistics",!1),supportsAsyncConvert3D:p(e,"supportsAsyncConvert3D",!1)}}function C(s,o){const i=s.advancedQueryCapabilities,a=s.ownershipBasedAccessControlForFeatures,c=s.archivingInfo,d=s.currentVersion,l=o?.includes("MapServer"),y=!l||d>=has("mapserver-pbf-version-support"),m=t(o),g=new Set((s.supportedQueryFormats??"").split(",").map(t=>t.toLowerCase().trim()));return{maxRecordCount:r(s,"maxRecordCount",void 0),maxRecordCountFactor:r(s,"maxRecordCountFactor",void 0),maxUniqueIDCount:r(s,"maxUniqueIDCount",void 0),standardMaxRecordCount:r(s,"standardMaxRecordCount",void 0),supportedSpatialAggregationStatistics:u(i),supportsCacheHint:p(i,"supportsQueryWithCacheHint",!1)||n(i,"query"),supportsCentroid:p(i,"supportsReturningGeometryCentroid",!1),supportsCentroidOnDegeneratedQuantizedGeometry:m||null==o,supportsCompactGeometry:m,supportsCurrentUser:p(i,"supportsCurrentUserQueries",!1),supportsDefaultSpatialReference:p(i,"supportsDefaultSR",!1),supportsDegeneratedQuantizedGeometry:p(i,"supportsDegeneratedQuantizedGeometry",!1),supportsDisjointSpatialRelationship:p(i,"supportsDisjointSpatialRel",!1),supportsDistance:p(i,"supportsQueryWithDistance",!1),supportsDistinct:p(i,"supportsDistinct",s.supportsAdvancedQueries),supportsExtent:p(i,"supportsReturningQueryExtent",!1),supportsFormatPBF:y&&g.has("pbf"),supportsFullTextSearch:p(i,"supportsFullTextSearch",!1),supportsGeometryProperties:p(i,"supportsReturningGeometryProperties",!1),supportsHavingClause:p(i,"supportsHavingClause",!1),supportsHistoricMoment:p(c,"supportsQueryWithHistoricMoment",!1),supportsMaxRecordCountFactor:p(i,"supportsMaxRecordCountFactor",!1),supportsOrderBy:p(i,"supportsOrderBy",s.supportsAdvancedQueries),supportsPagination:p(i,"supportsPagination",!1),supportsPaginationOnAggregatedQueries:p(i,"supportsPaginationOnAggregatedQueries",!1),supportsPercentileStatistics:p(i,"supportsPercentileStatistics",!1),supportsQuantization:p(s,"supportsCoordinatesQuantization",!1),supportsQuantizationEditMode:p(s,"supportsQuantizationEditMode",!1),supportsQueryByAnonymous:p(a,"allowAnonymousToQuery",!0),supportsQueryByOthers:p(a,"allowOthersToQuery",!0),supportsQueryGeometry:p(s,"supportsReturningQueryGeometry",!1),supportsResultType:p(i,"supportsQueryWithResultType",!1),supportsReturnMesh:!!e(s.infoFor3D),supportsSpatialAggregationStatistics:p(i,"supportsSpatialAggregationStatistics",!1),supportsSqlExpression:p(i,"supportsSqlExpression",!1),supportsStandardizedQueriesOnly:p(s,"useStandardizedQueries",!1),supportsStatistics:p(i,"supportsStatistics",s.supportsStatistics),supportsTopFeaturesQuery:p(i,"supportsTopFeaturesQuery",!1),supportsTrueCurve:p(i,"supportsTrueCurve",!1),tileMaxRecordCount:r(s,"tileMaxRecordCount",void 0)}}function v(t){const s=t.advancedQueryCapabilities,e=p(s,"supportsAdvancedQueryRelated",!1);return{supportsPagination:p(s,"supportsQueryRelatedPagination",!1),supportsCount:e,supportsOrderBy:e,supportsCacheHint:n(s,"queryRelated")}}function h(t){return{supportsCacheHint:n(t.advancedQueryCapabilities,"queryTopFilter")}}function Q(t){const s=t?t.queryBinsCapabilities:void 0;return{supportsDate:p(s,"supportsDateBin",!1),supportsFixedInterval:p(s,"supportsFixedIntervalBin",!1),supportsAutoInterval:p(s,"supportsAutoIntervalBin",!1),supportsFixedBoundaries:p(s,"supportsFixedBoundariesBin",!1),supportsStackBy:p(s,"supportsStackBy",!1),supportsSplitBy:p(s,"supportsSplitBy",!1),supportsSnapToData:p(s,"supportsSnapToData",!1),supportsReturnFullIntervalBin:p(s,"supportsReturnFullIntervalBin",!1),supportsFirstDayOfWeek:p(s,"supportsFirstDayOfWeek",!1),supportsNormalization:p(s,"supportsNormalization",!1),supportedStatistics:i(s),supportedNormalizationTypes:a(s)}}function A(t){const s=t.ownershipBasedAccessControlForFeatures,e=t?t.advancedEditingCapabilities:void 0;return{supportsGeometryUpdate:p(t,"allowGeometryUpdates",!0),supportsGlobalId:p(t,"supportsApplyEditsWithGlobalIds",!1),supportsReturnServiceEditsInSourceSpatialReference:p(t,"supportsReturnServiceEditsInSourceSR",!1),supportsRollbackOnFailure:p(t,"supportsRollbackOnFailureParameter",!1),supportsUpdateWithoutM:p(t,"allowUpdateWithoutMValues",!1),supportsUploadWithItemId:p(t,"supportsAttachmentsByUploadId",!1),supportsDeleteByAnonymous:p(s,"allowAnonymousToDelete",!0),supportsDeleteByOthers:p(s,"allowOthersToDelete",!0),supportsUpdateByAnonymous:p(s,"allowAnonymousToUpdate",!0),supportsUpdateByOthers:p(s,"allowOthersToUpdate",!0),supportsAsyncApplyEdits:p(e,"supportsAsyncApplyEdits",!1),zDefault:r(t,"zDefault",void 0)}}function S(t){return{operations:{supportsAppend:p(t,"supportsAppend",!1),supportsCoverageQuery:t?.playbackInfo?.klv["0601"]??!1,supportsExportClip:p(t,"supportsExportClip",!1),supportsExportFrameset:p(t,"supportsExportFrameset",!1),supportsMensuration:p(t,"supportsMensuration",!1),supportsPreviews:p(t,"supportsPreviews",!1),supportsUpdate:p(t,"supportsUpdate",!1)}}}export{c as getFeatureLayerCapabilities,S as getVideoLayerCapabilities};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/core",
|
|
3
|
-
"version": "5.0.0-next.
|
|
3
|
+
"version": "5.0.0-next.5",
|
|
4
4
|
"homepage": "https://js.arcgis.com",
|
|
5
5
|
"description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
|
|
6
6
|
"keywords": [
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
],
|
|
19
19
|
"license": "SEE LICENSE IN copyright.txt",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@amcharts/amcharts5": "~5.
|
|
22
|
-
"@arcgis/toolkit": "^4.34.0-next.
|
|
21
|
+
"@amcharts/amcharts5": "~5.14.1",
|
|
22
|
+
"@arcgis/toolkit": "^4.34.0-next.151",
|
|
23
23
|
"@esri/arcgis-html-sanitizer": "~4.1.0",
|
|
24
|
-
"@esri/calcite-components": "^3.3.
|
|
24
|
+
"@esri/calcite-components": "^3.3.1",
|
|
25
25
|
"@vaadin/grid": "~24.9.1",
|
|
26
|
-
"@zip.js/zip.js": "~2.8.
|
|
26
|
+
"@zip.js/zip.js": "~2.8.3",
|
|
27
27
|
"luxon": "~3.7.2",
|
|
28
28
|
"marked": "~16.3.0",
|
|
29
29
|
"tslib": "^2.8.1"
|
package/request.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"./config.js";import{id as r}from"./kernel.js";import t from"./core/Error.js";import has from"./core/has.js";import{clone as s}from"./core/lang.js";import{getOrCreateMapValue as o}from"./core/MapUtils.js";import{onAbort as n,createAbortError as a,isAbortError as i,isAborted as l}from"./core/promiseUtils.js";import{queryToObject as u,isDataProtocol as c,isBlobProtocol as d,normalize as p,getInterceptor as m,isTrustedServer as h,getOrigin as f,toHTTPS as y,objectToQuery as w,getProxyRule as g,getProxyUrl as q,addQueryParameters as b,hasSameOrigin as k,addProxyRule as S,getAppUrl as T}from"./core/urlUtils.js";import{isHostedAgolService as O}from"./layers/support/arcgisLayerUrl.js";import{isSecureProxyService as v}from"./portal/support/urlUtils.js";import{getApiKey as C}from"./support/apiKeyUtils.js";import{registerNoCorsDomains as x,setPreferredHost as L,getPreferredUrl as j,isNoCorsRequestRequired as E,sendNoCorsRequest as U,createTimeoutError as A,loadImageAsync as P}from"./support/requestUtils.js";async function H(e,r){e instanceof URL&&(e=e.toString()),r?.query instanceof URLSearchParams&&(r.query=u(r.query.toString().replaceAll("+"," ")));const t=c(e),s=d(e);s||t||(e=p(e));const o={url:e,requestOptions:{...r}},a=e=>({data:e,getAllHeaders:B,getHeader:B,httpStatus:200,requestOptions:o.requestOptions,url:o.url}),i=m(e,_.internalInterceptors);if(i){const e=await Y(i,o);if(null!=e)return a(e)}let l=m(e);if(l){const e=await Y(l,o);if(null!=e)return a(e);l.after||l.error||(l=null)}if(e=o.url,"image"===(r=o.requestOptions).responseType&&(has("host-webworker")||has("host-node")))throw W("request:invalid-parameters",new Error("responseType 'image' is not supported in Web Workers or Node environment"),o);if("head"===r.method){if(r.body)throw W("request:invalid-parameters",new Error("body parameter cannot be set when method is 'head'"),o);if(t||s)throw W("request:invalid-parameters",new Error("data and blob URLs are not supported for method 'head'"),o)}if(await G(),M)return M.execute(e,r);const h=new AbortController,f=n(r,()=>h.abort()),y={controller:h,credential:void 0,credentialToken:void 0,fetchOptions:void 0,hasToken:!1,interceptor:l,params:o,redoRequest:!1,useIdentity:_.useIdentity,useProxy:!1,useSSL:!1,withCredentials:!1},w=r.useRequestQueue?te(y):se(y),g=await w.finally(()=>f?.remove());return l?.after?.(g),g}let M,R=!1;const _=e.request,D="FormData"in globalThis,F=new Set([499,498,403,401]),I=new Set(["COM_0056","COM_0057","SB_0008"]),N=[/\/arcgis\/tokens/i,/\/sharing(\/rest)?\/generatetoken/i,/\/rest\/info/i],B=()=>null,$=Symbol();function z(e){const r=f(e);r&&!H._corsServers.includes(r)&&H._corsServers.push(r)}function Q(e){const r=f(e);return!r||r.endsWith(".arcgis.com")||H._corsServers.includes(r)||h(r)}function W(e,r,o,n){let l;const u={url:o.url,requestOptions:o.requestOptions,getAllHeaders:B,getHeader:B,ssl:!1};if(r instanceof t)return r.details?(r.details=s(r.details),r.details.url=o.url,r.details.requestOptions=o.requestOptions):r.details=u,r;if(r){const e=n&&(()=>Array.from(n.headers)),t=n&&(e=>n.headers.get(e)),s=n?.status,o=r.message;o&&(l=o),e&&t&&(u.getAllHeaders=e,u.getHeader=t),u.httpStatus=(null!=r.httpCode?r.httpCode:r.code)||s||0,u.subCode=r.subcode,u.messageCode=r.messageCode,"string"==typeof r.details?(u.messages=[r.details],l??=r.details):(u.messages=r.details,l??=u.messages?.[0]),u.raw=$ in r?r[$]:r}return l??="Error",i(r)?a():new t(e,l,u)}async function G(){has("host-webworker")&&(!M&&globalThis.invokeStaticMessage?M=await import("./core/workers/request.js"):R=!0)}async function J(){r||await import("./identity/IdentityManager.js")}async function K(e){const t=e.params.url,s=e.params.requestOptions,o=e.controller.signal,n=s.body;let a=null,i=null;if(D&&"HTMLFormElement"in globalThis&&(n instanceof FormData?a=n:n instanceof HTMLFormElement&&(a=new FormData(n))),"string"==typeof n&&(i=n),e.fetchOptions={cache:s.cacheBust?"no-cache":"default",credentials:"same-origin",headers:s.headers||{},keepalive:s.keepAlive??!1,method:"head"===s.method?"HEAD":"GET",mode:"cors",priority:_.priority,redirect:"follow",signal:o},(a||i)&&(e.fetchOptions.body=a||i),(R||"anonymous"===s.authMode)&&(e.useIdentity=!1),e.hasToken=!!(/token=/i.test(t)||s.query?.token||a?.get("token")),!e.hasToken){const r=C(t);r&&(s.query??={},s.query.token=r,e.hasToken=!0)}if(e.useIdentity&&!e.hasToken&&!e.credential&&!e.credentialToken&&!X(t)&&!l(o)){let n;"immediate"===s.authMode?(await J(),n=await r.getCredential(t,{signal:o})):"no-prompt"===s.authMode?(await J(),n=await r.getCredential(t,{prompt:!1,signal:o}).catch(()=>{})):r&&(n=r.findCredential(t)),n&&(e.credential=n,e.credentialToken=n.token,e.useSSL=!!n.ssl)}}function X(e){return N.some(r=>r.test(e))}async function V(e){let t=e.params.url,s=j(t);const o=e.params.requestOptions,n=e.fetchOptions??{},i=d(t)||c(t),l=o.responseType||"json",u=i?0:null!=o.timeout?o.timeout:_.timeout;let p=!1;if(!i){e.useSSL&&(t=y(t));let a={...o.query};e.credentialToken&&(a.token=e.credentialToken);let i=w(a);has("esri-url-encodes-apostrophe")&&(i=i.replaceAll("'","%27"));const l=s.length+1+i.length;let u;p="delete"===o.method||"post"===o.method||"put"===o.method||!!o.body||l>_.maxUrlLength;const c=o.useProxy||!!g(t);if(c){const e=q(t);u=e.path,!p&&u.length+1+l>_.maxUrlLength&&(p=!0),e.query&&(a={...e.query,...a})}if("HEAD"===n.method&&(p||c)){if(p){if(l>_.maxUrlLength)throw W("request:invalid-parameters",new Error("URL exceeds maximum length"),e.params);throw W("request:invalid-parameters",new Error("cannot use POST request when method is 'head'"),e.params)}if(c)throw W("request:invalid-parameters",new Error("cannot use proxy when method is 'head'"),e.params)}if(p?(n.method="delete"===o.method?"DELETE":"put"===o.method?"PUT":"POST",o.body?t=b(t,a):(n.body=w(a),n.headers||(n.headers={}),n.headers["Content-Type"]="application/x-www-form-urlencoded")):t=b(t,a),c&&(e.useProxy=!0,t=`${u}?${t}`),a.token&&D&&n.body instanceof FormData&&!v(t)&&n.body.set("token",a.token),o.hasOwnProperty("withCredentials"))e.withCredentials=o.withCredentials;else if(!k(t,T()))if(h(t))e.withCredentials=!0;else if(r){const s=r.findServerInfo(t);s?.webTierAuth&&(e.withCredentials=!0)}e.withCredentials&&(n.credentials="include",E(t)&&await U(p?b(t,a):t)),s=j(t)}let m,O,C=0,x=!1;u>0&&(C=setTimeout(()=>{x=!0,e.controller.abort()},u));try{if("native-request-init"===o.responseType)O=n,O.url=s,o.signal?O.signal=o.signal:delete O.signal;else if("image"!==o.responseType||"default"!==n.cache||n.keepalive||"GET"!==n.method||p||Z(o.headers)||!i&&!e.useProxy&&_.proxyUrl&&!Q(t)){if(H._beforeFetch&&await H._beforeFetch(t,n),m=await fetch(s,n),H._afterFetch&&await H._afterFetch(m),e.useProxy||z(t),"native"===o.responseType)O=m;else if("HEAD"!==n.method)if(m.ok){switch(l){case"array-buffer":O=await m.arrayBuffer();break;case"blob":case"image":O=await m.blob();break;default:O=await m.text()}if(C&&(clearTimeout(C),C=0),"json"===l||"xml"===l||"document"===l)if(O)switch(l){case"json":O=JSON.parse(O);break;case"xml":O=ee(O,"application/xml");break;case"document":O=ee(O,"text/html")}else O=null;if(O){if("array-buffer"===l||"blob"===l){const e=m.headers.get("Content-Type");if(e&&/application\/json|text\/plain/i.test(e)&&O["blob"===l?"size":"byteLength"]<=750)try{const e=await new Response(O).json();e.error&&(O=e)}catch{}}"image"===l&&O instanceof Blob&&(O=await ne(URL.createObjectURL(O),e,!0))}}else{O=await m.text();try{O=JSON.parse(O)}catch{}}}else O=await ne(s,e)}catch(L){if("AbortError"===L.name){if(x)throw A();throw a("Request canceled")}if(!(!m&&L instanceof TypeError&&_.proxyUrl)||o.body||"delete"===o.method||"head"===o.method||"post"===o.method||"put"===o.method||e.useProxy||Q(t))throw L;e.redoRequest=!0,S({proxyUrl:_.proxyUrl,urlPrefix:f(t)??""})}finally{C&&clearTimeout(C)}return[m,O]}async function Y(e,r){if(null!=e.responseData)return e.responseData;if(e.headers&&(r.requestOptions.headers={...r.requestOptions.headers,...e.headers}),e.query&&(r.requestOptions.query={...r.requestOptions.query,...e.query}),e.before){let o,n;try{n=await e.before(r)}catch(s){o=W("request:interceptor",s,r)}if((n instanceof Error||n instanceof t)&&(o=W("request:interceptor",n,r)),o)throw e.error&&e.error(o),o;return n}}function Z(e){if(e)for(const r of Object.getOwnPropertyNames(e))if(e[r])return!0;return!1}function ee(e,r){let t;try{t=(new DOMParser).parseFromString(e,r)}catch{}if(!t||t.getElementsByTagName("parsererror").length)throw new SyntaxError("XML Parse error");return t}H._corsServers=["https://server.arcgisonline.com","https://services.arcgisonline.com"],H._beforeFetch=void 0,H._afterFetch=void 0;const re=new Map;async function te(e){const r=ae(e.params.url);if(!r)return se(e);const{QueueProcessor:t}=await import("./core/QueueProcessor.js"),s=o(re,r.origin,()=>{const e=r.isHosted?has("request-queue-concurrency-hosted"):has("request-queue-concurrency-non-hosted");return new t({concurrency:e,process:e=>{if(l(e.params.requestOptions))throw W("",a("Request canceled"),e.params);return se(e)}})});return s.push(e)}async function se(e){let t,s;await K(e);try{do{[t,s]=await V(e)}while(!await oe(e,t,s))}catch(a){const r=W("request:server",a,e.params,t);throw r.details.ssl=e.useSSL,e.interceptor?.error&&e.interceptor.error(r),r}const o=e.params.url;if(s)if(/\/sharing\/rest\/(accounts|portals)\/self/i.test(o)){if(!e.hasToken&&!e.credentialToken&&s.user?.username&&!h(o)){const e=f(o,!0);e&&_.trustedServers.push(e)}Array.isArray(s.authorizedCrossOriginNoCorsDomains)&&x(s.authorizedCrossOriginNoCorsDomains)}else{"json"===(e.params.requestOptions.responseType||"json")&&L(o,s)}const n=e.credential;if(n&&r){const e=r.findServerInfo(n.server);let t=e?.owningSystemUrl;if(t){t=t.replace(/\/?$/,"/sharing");const e=r.findCredential(t,n.userId);e&&-1===r._getIdenticalSvcIdx(t,e)&&e.resources.unshift(t)}}return{data:s,getAllHeaders:t?()=>Array.from(t.headers):B,getHeader:t?e=>t.headers.get(e):B,httpStatus:t?.status??200,requestOptions:e.params.requestOptions,ssl:e.useSSL,url:e.params.url}}async function oe(e,t,s){if(e.redoRequest)return e.redoRequest=!1,!1;const o=e.params.requestOptions;if(!t||"native"===o.responseType||"native-request-init"===o.responseType)return!0;let n,a;if(s&&(s.error&&"object"==typeof s.error?n=s.error:"error"===s.status&&Array.isArray(s.messages)&&(n={...s},n[$]=s,n.details=s.messages)),!n&&!t.ok)throw n=new Error(`Unable to load ${t.url} status: ${t.status}`),n[$]=s,n;let i,l=null;n&&(a=Number(n.code),l=n.hasOwnProperty("subcode")?Number(n.subcode):null,i=n.messageCode,i=i?.toUpperCase());const u=o.authMode;if(403===a&&(4===l||n.message?.toLowerCase().includes("ssl")&&!n.message.toLowerCase().includes("permission"))){if(!e.useSSL)return e.useSSL=!0,!1}else if(!e.hasToken&&e.useIdentity&&("no-prompt"!==u||498===a)&&void 0!==a&&F.has(a)&&!X(e.params.url)&&(403!==a||(!i||!I.has(i))&&(null==l||2===l&&e.credentialToken))){await J();try{const t=await r.getCredential(e.params.url,{error:W("request:server",n,e.params),credential:e.credential,prompt:"no-prompt"!==u,signal:e.controller.signal,token:e.credentialToken});return e.credential=t,e.credentialToken=t.token,e.useSSL=e.useSSL||t.ssl,!1}catch(c){if("no-prompt"===u)return e.credential=void 0,e.credentialToken=void 0,!1;n=c}}if(n)throw n;return!0}function ne(e,r,t=!1){const s=r.controller.signal,o=new Image;return r.withCredentials?o.crossOrigin="use-credentials":o.crossOrigin="anonymous",o.alt="",o.fetchPriority=_.priority,o.src=e,P(o,e,t,s)}function ae(e){let r,t;return"string"==typeof e?(r=f(e,!0),t=O(e)):(r=e.origin,t=O(e.toString())),null==r?null:{origin:r,isHosted:t}}export{H as default};
|
|
5
|
+
import e from"./config.js";import{id as r}from"./kernel.js";import t from"./core/Error.js";import has from"./core/has.js";import{clone as s}from"./core/lang.js";import{getOrCreateMapValue as o}from"./core/MapUtils.js";import{onAbort as n,createAbortError as a,isAbortError as i,isAborted as l}from"./core/promiseUtils.js";import{queryToObject as u,isDataProtocol as c,isBlobProtocol as d,normalize as p,getInterceptor as m,isTrustedServer as h,getOrigin as f,toHTTPS as y,objectToQuery as w,getProxyRule as g,getProxyUrl as q,addQueryParameters as b,hasSameOrigin as k,addProxyRule as S,getAppUrl as T}from"./core/urlUtils.js";import{isHostedAgolService as O}from"./layers/support/arcgisLayerUrl.js";import{isSecureProxyService as v}from"./portal/support/urlUtils.js";import{getApiKey as C}from"./support/apiKeyUtils.js";import{registerNoCorsDomains as x,setPreferredHost as L,getPreferredUrl as j,isNoCorsRequestRequired as E,sendNoCorsRequest as U,createTimeoutError as A,loadImageAsync as P}from"./support/requestUtils.js";async function H(e,r){e instanceof URL&&(e=e.toString()),r?.query instanceof URLSearchParams&&(r.query=u(r.query.toString().replaceAll("+"," ")));const t=c(e),s=d(e);s||t||(e=p(e));const o={url:e,requestOptions:{...r}},a=e=>({data:e,getAllHeaders:B,getHeader:B,httpStatus:200,requestOptions:o.requestOptions,url:o.url}),i=m(e,D.internalInterceptors);if(i){const e=await Y(i,o);if(null!=e)return a(e)}let l=m(e);if(l){const e=await Y(l,o);if(null!=e)return a(e);l.after||l.error||(l=null)}if(e=o.url,"image"===(r=o.requestOptions).responseType&&(has("host-webworker")||has("host-node")))throw W("request:invalid-parameters",new Error("responseType 'image' is not supported in Web Workers or Node environment"),o);if("head"===r.method){if(r.body)throw W("request:invalid-parameters",new Error("body parameter cannot be set when method is 'head'"),o);if(t||s)throw W("request:invalid-parameters",new Error("data and blob URLs are not supported for method 'head'"),o)}if(await G(),M)return M.execute(e,r);const h=new AbortController,f=n(r,()=>h.abort()),y={controller:h,credential:void 0,credentialToken:void 0,fetchOptions:void 0,hasToken:!1,interceptor:l,params:o,redoRequest:!1,useIdentity:D.useIdentity,useProxy:!1,useSSL:!1,withCredentials:!1},w=r.useRequestQueue?te(y):se(y),g=await w.finally(()=>f?.remove());return l?.after?.(g),g}let M,R=!1;const D=e.request,I="FormData"in globalThis,_=new Set([499,498,403,401]),F=new Set(["COM_0056","COM_0057","SB_0008"]),N=[/\/arcgis\/tokens/i,/\/sharing(\/rest)?\/generatetoken/i,/\/rest\/info/i],B=()=>null,$=Symbol();function z(e){const r=f(e);r&&!H._corsServers.includes(r)&&H._corsServers.push(r)}function Q(e){const r=f(e);return!r||r.endsWith(".arcgis.com")||H._corsServers.includes(r)||h(r)}function W(e,r,o,n){let l;const u={url:o.url,requestOptions:o.requestOptions,getAllHeaders:B,getHeader:B,ssl:!1};if(r instanceof t)return r.details?(r.details=s(r.details),r.details.url=o.url,r.details.requestOptions=o.requestOptions):r.details=u,r;if(r){const e=n&&(()=>Array.from(n.headers)),t=n&&(e=>n.headers.get(e)),s=n?.status,o=r.message;o&&(l=o),e&&t&&(u.getAllHeaders=e,u.getHeader=t),u.httpStatus=(null!=r.httpCode?r.httpCode:r.code)||s||0,u.subCode=r.subcode,u.messageCode=r.messageCode,"string"==typeof r.details?(u.messages=[r.details],l??=r.details):(u.messages=r.details,l??=u.messages?.[0]),u.raw=$ in r?r[$]:r}return l??="Error",i(r)?a():new t(e,l,u)}async function G(){has("host-webworker")&&(!M&&globalThis.invokeStaticMessage?M=await import("./core/workers/request.js"):R=!0)}async function J(){r||await import("./identity/IdentityManager.js")}async function K(e){const t=e.params.url,s=e.params.requestOptions,o=e.controller.signal,n=s.body;let a=null,i=null;if(I&&"HTMLFormElement"in globalThis&&(n instanceof FormData?a=n:n instanceof HTMLFormElement&&(a=new FormData(n))),"string"==typeof n&&(i=n),e.fetchOptions={cache:s.cacheBust?"no-cache":"default",credentials:"same-origin",headers:s.headers||{},keepalive:s.keepAlive??!1,method:"head"===s.method?"HEAD":"GET",mode:"cors",priority:D.priority,redirect:"follow",signal:o},(a||i)&&(e.fetchOptions.body=a||i),(R||"anonymous"===s.authMode)&&(e.useIdentity=!1),e.hasToken=!!(/token=/i.test(t)||s.query?.token||a?.get("token")),!e.hasToken){const r=C(t);r&&(s.query??={},s.query.token=r,e.hasToken=!0)}if(e.useIdentity&&!e.hasToken&&!e.credential&&!e.credentialToken&&!X(t)&&!l(o)){let n;"immediate"===s.authMode?(await J(),n=await r.getCredential(t,{signal:o})):"no-prompt"===s.authMode?(await J(),n=await r.getCredential(t,{prompt:!1,signal:o}).catch(()=>{})):r&&(n=r.findCredential(t)),n&&(e.credential=n,e.credentialToken=n.token,e.useSSL=!!n.ssl)}}function X(e){return N.some(r=>r.test(e))}async function V(e){let t=e.params.url,s=j(t);const o=e.params.requestOptions,n=e.fetchOptions??{},i=d(t)||c(t),l=o.responseType||"json",u=i?0:null!=o.timeout?o.timeout:D.timeout;let p=!1;if(!i){e.useSSL&&(t=y(t));let a={...o.query};e.credentialToken&&(a.token=e.credentialToken);let i=w(a);has("esri-url-encodes-apostrophe")&&(i=i.replaceAll("'","%27"));const l=s.length+1+i.length;let u;p="delete"===o.method||"post"===o.method||"put"===o.method||!!o.body||l>D.maxUrlLength;const c=o.useProxy||!!g(t);if(c){const e=q(t);u=e.path,!p&&u.length+1+l>D.maxUrlLength&&(p=!0),e.query&&(a={...e.query,...a})}if("HEAD"===n.method&&(p||c)){if(p){if(l>D.maxUrlLength)throw W("request:invalid-parameters",new Error("URL exceeds maximum length"),e.params);throw W("request:invalid-parameters",new Error("cannot use POST request when method is 'head'"),e.params)}if(c)throw W("request:invalid-parameters",new Error("cannot use proxy when method is 'head'"),e.params)}if(p?(n.method="delete"===o.method?"DELETE":"put"===o.method?"PUT":"POST",o.body?t=b(t,a):(n.body=w(a),n.headers||(n.headers={}),n.headers["Content-Type"]="application/x-www-form-urlencoded")):t=b(t,a),c&&(e.useProxy=!0,t=`${u}?${t}`),a.token&&I&&n.body instanceof FormData&&!v(t)&&n.body.set("token",a.token),o.hasOwnProperty("withCredentials"))e.withCredentials=o.withCredentials;else if(!k(t,T()))if(h(t))e.withCredentials=!0;else if(r){const s=r.findServerInfo(t);s?.webTierAuth&&(e.withCredentials=!0)}e.withCredentials&&(n.credentials="include",E(t)&&await U(p?b(t,a):t)),s=j(t)}let m,O,C=0,x=!1;u>0&&(C=setTimeout(()=>{x=!0,e.controller.abort()},u));try{if("native-request-init"===o.responseType)O=n,O.url=s,o.signal?O.signal=o.signal:delete O.signal;else if("image"!==o.responseType||"default"!==n.cache||n.keepalive||"GET"!==n.method||p||Z(o.headers)||!i&&!e.useProxy&&D.proxyUrl&&!Q(t)){if(await(H._beforeFetch?.(t,n)),m=await fetch(s,n),await(H._afterFetch?.(m)),e.useProxy||z(t),"native"===o.responseType)O=m;else if("HEAD"!==n.method)if(m.ok){switch(l){case"array-buffer":O=await m.arrayBuffer();break;case"blob":case"image":O=await m.blob();break;default:O=await m.text()}if(C&&(clearTimeout(C),C=0),"json"===l||"xml"===l||"document"===l)if(O)switch(l){case"json":O=JSON.parse(O);break;case"xml":O=ee(O,"application/xml");break;case"document":O=ee(O,"text/html")}else O=null;if(O){if("array-buffer"===l||"blob"===l){const e=m.headers.get("Content-Type");if(e&&/application\/json|text\/plain/i.test(e)&&O["blob"===l?"size":"byteLength"]<=750)try{const e=await new Response(O).json();e.error&&(O=e)}catch{}}"image"===l&&O instanceof Blob&&(O=await ne(URL.createObjectURL(O),e,!0))}}else{O=await m.text();try{O=JSON.parse(O)}catch{}}}else O=await ne(s,e)}catch(L){if("AbortError"===L.name){if(x)throw A();throw a("Request canceled")}if(!(!m&&L instanceof TypeError&&D.proxyUrl)||o.body||"delete"===o.method||"head"===o.method||"post"===o.method||"put"===o.method||e.useProxy||Q(t))throw L;e.redoRequest=!0,S({proxyUrl:D.proxyUrl,urlPrefix:f(t)??""})}finally{C&&clearTimeout(C)}return[m,O]}async function Y(e,r){if(null!=e.responseData)return e.responseData;if(e.headers&&(r.requestOptions.headers={...r.requestOptions.headers,...e.headers}),e.query&&(r.requestOptions.query={...r.requestOptions.query,...e.query}),e.before){let o,n;try{n=await e.before(r)}catch(s){o=W("request:interceptor",s,r)}if((n instanceof Error||n instanceof t)&&(o=W("request:interceptor",n,r)),o)throw e.error&&e.error(o),o;return n}}function Z(e){if(e)for(const r of Object.getOwnPropertyNames(e))if(e[r])return!0;return!1}function ee(e,r){let t;try{t=(new DOMParser).parseFromString(e,r)}catch{}if(!t||t.getElementsByTagName("parsererror").length)throw new SyntaxError("XML Parse error");return t}H._corsServers=["https://server.arcgisonline.com","https://services.arcgisonline.com"],H._beforeFetch=void 0,H._afterFetch=void 0;const re=new Map;async function te(e){const r=ae(e.params.url);if(!r)return se(e);const{QueueProcessor:t}=await import("./core/QueueProcessor.js"),s=o(re,r.origin,()=>{const e=r.isHosted?has("request-queue-concurrency-hosted"):has("request-queue-concurrency-non-hosted");return new t({concurrency:e,process:e=>{if(l(e.params.requestOptions))throw W("",a("Request canceled"),e.params);return se(e)}})});return s.push(e)}async function se(e){let t,s;await K(e);try{do{[t,s]=await V(e)}while(!await oe(e,t,s))}catch(a){const r=W("request:server",a,e.params,t);throw r.details.ssl=e.useSSL,e.interceptor?.error&&e.interceptor.error(r),r}const o=e.params.url;if(s)if(/\/sharing\/rest\/(accounts|portals)\/self/i.test(o)){if(!e.hasToken&&!e.credentialToken&&s.user?.username&&!h(o)){const e=f(o,!0);e&&D.trustedServers.push(e)}Array.isArray(s.authorizedCrossOriginNoCorsDomains)&&x(s.authorizedCrossOriginNoCorsDomains)}else{"json"===(e.params.requestOptions.responseType||"json")&&L(o,s)}const n=e.credential;if(n&&r){const e=r.findServerInfo(n.server);let t=e?.owningSystemUrl;if(t){t=t.replace(/\/?$/,"/sharing");const e=r.findCredential(t,n.userId);e&&-1===r._getIdenticalSvcIdx(t,e)&&e.resources.unshift(t)}}return{data:s,getAllHeaders:t?()=>Array.from(t.headers):B,getHeader:t?e=>t.headers.get(e):B,httpStatus:t?.status??200,requestOptions:e.params.requestOptions,ssl:e.useSSL,url:e.params.url}}async function oe(e,t,s){if(e.redoRequest)return e.redoRequest=!1,!1;const o=e.params.requestOptions;if(!t||"native"===o.responseType||"native-request-init"===o.responseType)return!0;let n,a;if(s&&(s.error&&"object"==typeof s.error?n=s.error:"error"===s.status&&Array.isArray(s.messages)&&(n={...s},n[$]=s,n.details=s.messages)),!n&&!t.ok)throw n=new Error(`Unable to load ${t.url} status: ${t.status}`),n[$]=s,n;let i,l=null;n&&(a=Number(n.code),l=n.hasOwnProperty("subcode")?Number(n.subcode):null,i=n.messageCode,i=i?.toUpperCase());const u=o.authMode;if(403===a&&(4===l||n.message?.toLowerCase().includes("ssl")&&!n.message.toLowerCase().includes("permission"))){if(!e.useSSL)return e.useSSL=!0,!1}else if(!e.hasToken&&e.useIdentity&&("no-prompt"!==u||498===a)&&void 0!==a&&_.has(a)&&!X(e.params.url)&&(403!==a||(!i||!F.has(i))&&(null==l||2===l&&e.credentialToken))){await J();try{const t=await r.getCredential(e.params.url,{error:W("request:server",n,e.params),credential:e.credential,prompt:"no-prompt"!==u,signal:e.controller.signal,token:e.credentialToken});return e.credential=t,e.credentialToken=t.token,e.useSSL=e.useSSL||t.ssl,!1}catch(c){if("no-prompt"===u)return e.credential=void 0,e.credentialToken=void 0,!1;n=c}}if(n)throw n;return!0}function ne(e,r,t=!1){const s=r.controller.signal,o=new Image;return r.withCredentials?o.crossOrigin="use-credentials":o.crossOrigin="anonymous",o.alt="",o.fetchPriority=D.priority,o.src=e,P(o,e,t,s)}function ae(e){let r,t;return"string"==typeof e?(r=f(e,!0),t=O(e)):(r=e.origin,t=O(e.toString())),null==r?null:{origin:r,isHosted:t}}export{H as default};
|