@arcgis/core 4.22.0-next.20211021 → 4.22.0-next.20211025
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/00ac1ce56f9885a8be83.js +1 -0
- package/assets/esri/core/workers/chunks/01c9afe41ab4ccc597c9.js +1 -0
- package/assets/esri/core/workers/chunks/02a3d14adc504a51fa24.js +1 -0
- package/assets/esri/core/workers/chunks/035a9ab0202d5386b782.js +1 -0
- package/assets/esri/core/workers/chunks/062bace5505f13689c7d.js +1 -0
- package/assets/esri/core/workers/chunks/06c7745d813bcb540ce8.js +1 -0
- package/assets/esri/core/workers/chunks/0950b488a60b2abc21fc.js +1 -0
- package/assets/esri/core/workers/chunks/0af396f2e0de681113ef.js +1 -0
- package/assets/esri/core/workers/chunks/131838059f0f81d8eaee.js +1 -0
- package/assets/esri/core/workers/chunks/146cba0d172ec2f4eba2.js +1 -0
- package/assets/esri/core/workers/chunks/17e49c0dfa5a5a6213e2.js +1 -0
- package/assets/esri/core/workers/chunks/1a0b08190274725dc956.js +1 -0
- package/assets/esri/core/workers/chunks/1add7f0779accdf8d204.js +1 -0
- package/assets/esri/core/workers/chunks/20b81d11e6286d347bfc.js +1 -0
- package/assets/esri/core/workers/chunks/{e596bd3de960d1dc1c57.js → 2207580a78ee292ed9b8.js} +1 -1
- package/assets/esri/core/workers/chunks/2d3646a83465c75986f9.js +1 -0
- package/assets/esri/core/workers/chunks/2d38ee3ef3ebe32a1194.js +1 -0
- package/assets/esri/core/workers/chunks/3737dcc3c0dea3ca05d5.js +1 -0
- package/assets/esri/core/workers/chunks/3e2042e70647c1afa6aa.js +1 -0
- package/assets/esri/core/workers/chunks/3ebfaab2855a2236a95d.js +1 -0
- package/assets/esri/core/workers/chunks/{d6fe616192a8efbfbc3e.js → 440f8101402a4c0d7019.js} +1 -1
- package/assets/esri/core/workers/chunks/4587d770767966985e22.js +1 -0
- package/assets/esri/core/workers/chunks/487b8892fae85810a8c0.js +1 -0
- package/assets/esri/core/workers/chunks/4901a78f32c3ea6b823b.js +1 -0
- package/assets/esri/core/workers/chunks/496fe47fc4d28e1a716d.js +1 -0
- package/assets/esri/core/workers/chunks/{9f22f47d4b2e72d7bdcf.js → 4c010119c24510ea31bb.js} +2 -2
- package/assets/esri/core/workers/chunks/{9f22f47d4b2e72d7bdcf.js.LICENSE.txt → 4c010119c24510ea31bb.js.LICENSE.txt} +0 -0
- package/assets/esri/core/workers/chunks/4f5076e1f2b18ce8156d.js +1 -0
- package/assets/esri/core/workers/chunks/{f291ebc4b089bd1f0a3f.js → 50e86a6bb13042b1dbac.js} +1 -1
- package/assets/esri/core/workers/chunks/{64d9a062c1f1ac08a3ac.js → 565020b1c02a8cb33c2b.js} +1 -1
- package/assets/esri/core/workers/chunks/{d78c60a22f76df7c48c7.js → 59640d78295e2e363f18.js} +1 -1
- package/assets/esri/core/workers/chunks/{a0356f320a1b2fbd03f0.js → 5ac2b2598245aa17cdbd.js} +1 -1
- package/assets/esri/core/workers/chunks/5b4a8cce5601cc92c8a3.js +1 -0
- package/assets/esri/core/workers/chunks/5b92d5d4049622531109.js +1 -0
- package/assets/esri/core/workers/chunks/{751c1a2838b54a74a9a6.js → 5f3caa0ddb215342c728.js} +2 -2
- package/assets/esri/core/workers/chunks/615e995d5ce8fa044b09.js +1 -0
- package/assets/esri/core/workers/chunks/62a2453699e0dd2393b9.js +1 -0
- package/assets/esri/core/workers/chunks/67013547be1a7ae1670a.js +1 -0
- package/assets/esri/core/workers/chunks/67eddf4808f8888faeb4.js +1 -0
- package/assets/esri/core/workers/chunks/695dbedff2340aa019ba.js +1 -0
- package/assets/esri/core/workers/chunks/6a7e388c94206d2f61ff.js +1 -0
- package/assets/esri/core/workers/chunks/6e22b69d55e791ab3d9a.js +1 -0
- package/assets/esri/core/workers/chunks/71e6c0c5ef0aa7eb1703.js +1 -0
- package/assets/esri/core/workers/chunks/7a74e230439c5111f852.js +1 -0
- package/assets/esri/core/workers/chunks/7e76a8e6fa67e607d09e.js +1 -0
- package/assets/esri/core/workers/chunks/7fe4985ca0cb3e6d35c6.js +1 -0
- package/assets/esri/core/workers/chunks/8027330714ff5ffb020e.js +1 -0
- package/assets/esri/core/workers/chunks/844b564d1a422a17f6ac.js +1 -0
- package/assets/esri/core/workers/chunks/856f9281a08cb032238e.js +1 -0
- package/assets/esri/core/workers/chunks/89b4983de872780e9aa1.js +1 -0
- package/assets/esri/core/workers/chunks/8f3bc0cd2c2b01ab80cd.js +1 -0
- package/assets/esri/core/workers/chunks/8fd912e325ccd48b98a9.js +1 -0
- package/assets/esri/core/workers/chunks/901907a5c01f0fd1478f.js +1 -0
- package/assets/esri/core/workers/chunks/92a0b88a14c92239df8a.js +1 -0
- package/assets/esri/core/workers/chunks/972e9aeb3c29c9bf441a.js +1 -0
- package/assets/esri/core/workers/chunks/9758c34ce61c3714515a.js +1 -0
- package/assets/esri/core/workers/chunks/{457ea4feaa006d60c6b1.js → 9a04d087a29f0f3937a3.js} +1 -1
- package/assets/esri/core/workers/chunks/9b0bb171224b35ce2031.js +1 -0
- package/assets/esri/core/workers/chunks/9cbe7afdaef8720dfc8d.js +1 -0
- package/assets/esri/core/workers/chunks/9ccde5b6562f0007fe45.js +1 -0
- package/assets/esri/core/workers/chunks/9d320bbeedeea15522ab.js +1 -0
- package/assets/esri/core/workers/chunks/a001b3b4527817548094.js +1 -0
- package/assets/esri/core/workers/chunks/{197b72bca45065e0eb4a.js → a0c580d4a1915ddd3fe4.js} +1 -1
- package/assets/esri/core/workers/chunks/a4a9c15929b43d83701f.js +1 -0
- package/assets/esri/core/workers/chunks/a54d11f44721f808b82f.js +1 -0
- package/assets/esri/core/workers/chunks/a646a11673d513c00e7a.js +1 -0
- package/assets/esri/core/workers/chunks/a792e2bc7cafdc29f05e.js +1 -0
- package/assets/esri/core/workers/chunks/acae1771697034f265b1.js +1 -0
- package/assets/esri/core/workers/chunks/af2ee804a9c63eea610c.js +1 -0
- package/assets/esri/core/workers/chunks/b28b487047da3aeef3fd.js +1 -0
- package/assets/esri/core/workers/chunks/b3e57824a5855cb37a96.js +1 -0
- package/assets/esri/core/workers/chunks/b89449ead32e4cd21edd.js +1 -0
- package/assets/esri/core/workers/chunks/b99891ed5a02cab02173.js +1 -0
- package/assets/esri/core/workers/chunks/bac84bc621be73a7a4bc.js +1 -0
- package/assets/esri/core/workers/chunks/{25037dcf8a0c72b7b647.js → bbe068388167e9dd0c11.js} +1 -1
- package/assets/esri/core/workers/chunks/c271a1857bcc4e9a36dd.js +1 -0
- package/assets/esri/core/workers/chunks/{eb3035e49a45ecc82575.js → c5030664720fcdc6d85e.js} +1 -1
- package/assets/esri/core/workers/chunks/c534ed122f8a1202d3a3.js +1 -0
- package/assets/esri/core/workers/chunks/c5ef2e28b0c539ddb6a7.js +1 -0
- package/assets/esri/core/workers/chunks/c65e5ccfae03d148d82b.js +1 -0
- package/assets/esri/core/workers/chunks/c91660f3982be4e03705.js +1 -0
- package/assets/esri/core/workers/chunks/ce93113b99bdbeddd07b.js +1 -0
- package/assets/esri/core/workers/chunks/cf2d408e669cfa2c65be.js +1 -0
- package/assets/esri/core/workers/chunks/d08f63ffeecefa02ad91.js +1 -0
- package/assets/esri/core/workers/chunks/{8d33644192c01e5416b4.js → d1a71b58ef62e71979c5.js} +1 -1
- package/assets/esri/core/workers/chunks/d30eade5afecd334f6cb.js +1 -0
- package/assets/esri/core/workers/chunks/d8782d0856b9d815cb6c.js +1 -0
- package/assets/esri/core/workers/chunks/db16c21b650001502e6c.js +1 -0
- package/assets/esri/core/workers/chunks/db18110c57253a31ac96.js +1 -0
- package/assets/esri/core/workers/chunks/dbaa5fb466d6c0214f24.js +1 -0
- package/assets/esri/core/workers/chunks/deae370788a7aacf4dd5.js +1 -0
- package/assets/esri/core/workers/chunks/e6ca132e1eeea3aa174e.js +1 -0
- package/assets/esri/core/workers/chunks/e878ccc431729ef3360f.js +1 -0
- package/assets/esri/core/workers/chunks/eb124f15ad4b9193f00a.js +1 -0
- package/assets/esri/core/workers/chunks/ebc71c06c1c22aaef54e.js +1 -0
- package/assets/esri/core/workers/chunks/f183da283af0836421ab.js +1 -0
- package/assets/esri/core/workers/chunks/f42bdc2a134833d33b4e.js +1 -0
- package/assets/esri/core/workers/chunks/{736d628cda4e02d40337.js → f8612c2fc5739e98be58.js} +1 -1
- package/assets/esri/core/workers/chunks/f965e3e5f6f4f9ba54ac.js +1 -0
- package/assets/esri/core/workers/chunks/fa4089640f480b69962e.js +1 -0
- package/assets/esri/core/workers/chunks/fb219563e5169ea67d68.js +1 -0
- package/assets/esri/libs/i3s/i3s.wasm +0 -0
- package/chunks/ChapmanAtmosphere.glsl.js +56 -77
- package/chunks/Clouds.glsl.js +1 -1
- package/chunks/Pattern.glsl.js +9 -11
- package/chunks/RibbonLine.glsl.js +60 -68
- package/chunks/i3s.js +1 -1
- package/chunks/mat4.js +1 -1
- package/chunks/vec3.js +1 -1
- package/core/Collection.js +1 -1
- package/core/Loadable.js +1 -1
- package/core/accessorSupport/ensureType.js +1 -1
- package/core/promiseUtils.js +1 -1
- package/core/support/OwningCollection.js +1 -1
- package/core/workers/RemoteClient.js +1 -1
- package/core/workers/WorkerOwner.js +1 -1
- package/core/workers/workers.js +2 -2
- package/geometry/projection.js +1 -1
- package/identity/IdentityManagerBase.js +1 -1
- package/interfaces.d.ts +205 -497
- package/layers/ElevationLayer.js +1 -1
- package/layers/GeoJSONLayer.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/VectorTileLayer.js +1 -1
- package/layers/VoxelWasmPerScene.js +1 -1
- package/layers/WCSLayer.js +1 -1
- package/layers/analyses/AreaMeasurement3D.js +1 -1
- package/layers/analyses/DirectLineMeasurement3D.js +1 -1
- package/layers/analyses/Slice.js +1 -1
- package/layers/effects/EffectList.js +1 -1
- package/layers/effects/effects.js +1 -1
- package/layers/effects/jsonUtils.js +1 -1
- package/layers/effects/parser.js +1 -1
- package/layers/effects/utils.js +5 -0
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/sources/connections/GeoEventConnection.js +1 -1
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/support/RasterWorker.js +1 -1
- package/layers/support/TilemapCache.js +1 -1
- package/layers/support/rasterDatasets/BaseRaster.js +1 -1
- package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
- package/layers/support/rasterDatasets/WCSRaster.js +1 -1
- package/layers/support/rasterFunctions/pixelUtils.js +1 -1
- package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
- package/package.json +2 -2
- package/portal/support/portalLayers.js +1 -1
- package/request.js +1 -1
- package/smartMapping/renderers/support/utils.js +1 -1
- package/smartMapping/statistics/support/WorkerClient.js +1 -1
- package/smartMapping/statistics/support/statsWorker.js +1 -1
- package/smartMapping/statistics/support/utils.js +1 -1
- package/smartMapping/support/adapters/CSVLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/statistics/utils.js +1 -1
- package/support/GraphicsCollection.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/FillSymbol3DLayer.js +1 -1
- package/symbols/IconSymbol3DLayer.js +1 -1
- package/symbols/LineSymbol3DLayer.js +1 -1
- package/symbols/patterns/LinePattern3D.js +5 -0
- package/symbols/patterns/LineStylePattern3D.d.ts +4 -0
- package/symbols/patterns/LineStylePattern3D.js +5 -0
- package/symbols/patterns/StylePattern3D.js +1 -1
- package/symbols/patterns/lineStyles.js +5 -0
- package/symbols/patterns/utils.js +1 -1
- package/symbols/support/Symbol3DFillMaterial.js +1 -1
- package/symbols/support/Symbol3DIconOutline.js +5 -0
- package/symbols/support/Symbol3DMaterial.js +1 -1
- package/symbols/support/Symbol3DOutline.js +1 -1
- package/symbols/support/defaults3D.js +1 -1
- package/symbols/support/previewSymbol3D.js +1 -1
- package/symbols/support/symbolLayerUtils3D.js +1 -1
- package/views/2d/engine/vectorTiles/TileParser.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
- package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
- package/views/2d/engine/webgl/effects/HittestEffect.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/ImageryLayerView2D.js +1 -1
- package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
- package/views/2d/layers/VectorTileLayerView2D.js +1 -1
- package/views/2d/layers/features/controllers/EditsQueue.js +1 -1
- package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/2d/layers/support/FeatureLayerProxy.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/ChapmanAtmosphereTechnique.js +1 -1
- package/views/3d/environment/CloudsGenerator.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/environment/PanoramicAtmosphere.js +1 -1
- package/views/3d/environment/SimpleAtmosphere.js +1 -1
- package/views/3d/externalRenderers/ExternalRendererStore.js +1 -1
- package/views/3d/externalRenderers.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/analysisTools/slice/SliceTool.js +1 -1
- package/views/3d/interactive/analysisTools/slice/images/Factory.js +5 -0
- package/views/3d/interactive/analysisTools/slice/sliceToolConfig.js +1 -1
- package/views/3d/interactive/analysisTools/slice/sliceToolUtils.js +1 -1
- package/views/3d/interactive/editingTools/settings.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/ExtentTransformTool.js +1 -1
- package/views/3d/interactive/graphics/Slice/SliceController.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/LaserlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/SlicePlaneVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
- package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
- package/views/3d/layers/DynamicLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/VectorTileLayerView3D.js +1 -1
- package/views/3d/layers/analyses/AreaMeasurement3D/AreaMeasurementView3D.js +1 -1
- package/views/3d/layers/analyses/AreaMeasurement3D/support/AreaMeasurementPathHelper.js +1 -1
- package/views/3d/layers/analyses/AreaMeasurement3D/support/AreaMeasurementVisualization.js +1 -1
- package/views/3d/layers/analyses/DirectLineMeasurement3D/DirectLineMeasurementView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/ElevationAligners.js +1 -1
- package/views/3d/layers/graphics/ElevationQuery.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLodInstanceGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/Loadable.js +1 -1
- package/views/3d/layers/graphics/ObjectResourceCache.js +1 -1
- package/views/3d/layers/graphics/elevationAlignmentUtils.js +1 -1
- package/views/3d/layers/graphics/graphicUtils.js +1 -1
- package/views/3d/layers/graphics/labelPlacement.js +1 -1
- package/views/3d/layers/graphics/pointUtils.js +1 -1
- package/views/3d/layers/i3s/I3SAttributeOverrides.js +1 -1
- package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
- package/views/3d/layers/i3s/I3SStreamDataController.js +1 -1
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/patternUtils.js +1 -1
- package/views/3d/state/GoToOperation.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/support/LaserLineRenderer.js +1 -1
- package/views/3d/support/SharedSymbolResources.js +1 -1
- package/views/3d/support/StreamDataLoader.js +1 -1
- package/views/3d/support/StreamTextureCollection.js +5 -0
- package/views/3d/support/TextureCollection.js +1 -1
- package/views/3d/support/debugFlags.js +1 -1
- package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/OverlayRenderTarget.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/core/material/RenderTexture.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +13 -12
- package/views/3d/webgl-engine/core/shaderLibrary/shading/Reprojection.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +10 -3
- package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js +1 -1
- package/views/3d/webgl-engine/lib/Camera.js +1 -1
- package/views/3d/webgl-engine/lib/GLMaterialRepository.js +1 -1
- package/views/3d/webgl-engine/lib/GLMaterialTexture.js +1 -1
- package/views/3d/webgl-engine/lib/GLMaterials.js +1 -1
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/ModelDirtySet.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/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/SmaaRenderPass.js +1 -1
- package/views/3d/webgl-engine/lib/TextTexture.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/Texture.js +1 -1
- package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodLevel.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
- package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterGLMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/lineStippleUtils.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/parts/Model.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/LayerViewManager.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/ToolViewManager.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
- package/views/support/AllocationTracer.js +1 -1
- package/views/support/DefaultsFromMap.js +1 -1
- package/views/support/QueueProcessor.js +1 -1
- package/views/webgl/capabilities/load.js +1 -1
- package/webscene/Slide.js +1 -1
- package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
- package/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel.js +1 -1
- package/widgets/BuildingExplorer/support/layerUtils.js +1 -1
- package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Feature/FeatureViewModel.js +1 -1
- package/widgets/Home/HomeViewModel.js +1 -1
- package/widgets/Locate/LocateViewModel.js +1 -1
- package/widgets/Popup/PopupViewModel.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Slice/SliceViewModel.js +1 -1
- package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/0283801d442984997abe.js +0 -1
- package/assets/esri/core/workers/chunks/0419e14a520b8fcf3e7a.js +0 -1
- package/assets/esri/core/workers/chunks/05318446b6a40caea361.js +0 -1
- package/assets/esri/core/workers/chunks/09e714d4381649348ac9.js +0 -1
- package/assets/esri/core/workers/chunks/0cecd668b9d5d3f83293.js +0 -1
- package/assets/esri/core/workers/chunks/13a73a88efd4f464173e.js +0 -1
- package/assets/esri/core/workers/chunks/1576727e8174d672555b.js +0 -1
- package/assets/esri/core/workers/chunks/1a3cbeb0a53d03a51dad.js +0 -1
- package/assets/esri/core/workers/chunks/1b8524b617bfc6fe422c.js +0 -1
- package/assets/esri/core/workers/chunks/1dc1d750046912ff6cef.js +0 -1
- package/assets/esri/core/workers/chunks/21fa174c114640be5e40.js +0 -1
- package/assets/esri/core/workers/chunks/2a3f6e56079620421a02.js +0 -1
- package/assets/esri/core/workers/chunks/2a5bcc73e55986ad93fe.js +0 -1
- package/assets/esri/core/workers/chunks/2a6f2e3d639aae491171.js +0 -1
- package/assets/esri/core/workers/chunks/2c17d1bad17bcee53f7d.js +0 -1
- package/assets/esri/core/workers/chunks/2cea27a0d07aa9a88ad4.js +0 -1
- package/assets/esri/core/workers/chunks/2e193d97d199b29b00c2.js +0 -1
- package/assets/esri/core/workers/chunks/2eb41fdf0d0a3b0c3232.js +0 -1
- package/assets/esri/core/workers/chunks/2f09ea639ca5d1d6ca7e.js +0 -1
- package/assets/esri/core/workers/chunks/2fb847ab1440bd1bdf15.js +0 -1
- package/assets/esri/core/workers/chunks/402d22ebbae608760b4f.js +0 -1
- package/assets/esri/core/workers/chunks/44daef7f0cbc6f6af09f.js +0 -1
- package/assets/esri/core/workers/chunks/46899156159e398c693f.js +0 -1
- package/assets/esri/core/workers/chunks/46bf8921db25845c63c0.js +0 -1
- package/assets/esri/core/workers/chunks/4eb23554e375350f73b5.js +0 -1
- package/assets/esri/core/workers/chunks/551917be63a513dfa4de.js +0 -1
- package/assets/esri/core/workers/chunks/564f6f5484bcb13ebb2b.js +0 -1
- package/assets/esri/core/workers/chunks/61df67ae47b7fb5875d9.js +0 -1
- package/assets/esri/core/workers/chunks/62642a8fc7bafe339984.js +0 -1
- package/assets/esri/core/workers/chunks/6304f4e53027df04eb8f.js +0 -1
- package/assets/esri/core/workers/chunks/6331987617ad166ea098.js +0 -1
- package/assets/esri/core/workers/chunks/6b13fcbc71c0088d317e.js +0 -1
- package/assets/esri/core/workers/chunks/6f7a6841e7269d2764ad.js +0 -1
- package/assets/esri/core/workers/chunks/70110efd2de23d9a5263.js +0 -1
- package/assets/esri/core/workers/chunks/7eae3f0588cde44fce39.js +0 -1
- package/assets/esri/core/workers/chunks/80d3c7a429c6412f1a8d.js +0 -1
- package/assets/esri/core/workers/chunks/80deebdf54bea04a0889.js +0 -1
- package/assets/esri/core/workers/chunks/81aa5fe7dcb4fdeb0974.js +0 -1
- package/assets/esri/core/workers/chunks/840d08b41913cad4df89.js +0 -1
- package/assets/esri/core/workers/chunks/85d154aeb511c5d70bb1.js +0 -1
- package/assets/esri/core/workers/chunks/8681e99e2bc9ece61c43.js +0 -1
- package/assets/esri/core/workers/chunks/8e5ef967f6518f4c93b1.js +0 -1
- package/assets/esri/core/workers/chunks/8edd7f70c8b95c34125c.js +0 -1
- package/assets/esri/core/workers/chunks/9044a7b90a53312b6392.js +0 -1
- package/assets/esri/core/workers/chunks/905b4dfc1ce57a225fa4.js +0 -1
- package/assets/esri/core/workers/chunks/945f90b31ebfae623ea0.js +0 -1
- package/assets/esri/core/workers/chunks/9943fd69b67cd1871d68.js +0 -1
- package/assets/esri/core/workers/chunks/9ad91c23480ffb656030.js +0 -1
- package/assets/esri/core/workers/chunks/9d103681372ab01a4147.js +0 -1
- package/assets/esri/core/workers/chunks/9d3230f59b4c4d1b2713.js +0 -1
- package/assets/esri/core/workers/chunks/9db75bc0980d16b730a1.js +0 -1
- package/assets/esri/core/workers/chunks/a0659b8bdc067da7badd.js +0 -1
- package/assets/esri/core/workers/chunks/a480ee9a994410177961.js +0 -1
- package/assets/esri/core/workers/chunks/a9b279975d7df0f295d7.js +0 -1
- package/assets/esri/core/workers/chunks/aa3abaa5ad4a5a3bcb84.js +0 -1
- package/assets/esri/core/workers/chunks/aa8e607f908297786675.js +0 -1
- package/assets/esri/core/workers/chunks/ab5a302b5f62d38293f9.js +0 -1
- package/assets/esri/core/workers/chunks/abd6a84396e0eb3f01ad.js +0 -1
- package/assets/esri/core/workers/chunks/abe9f8516b03a3fb0477.js +0 -1
- package/assets/esri/core/workers/chunks/aff6aa5c7f75f8e052d9.js +0 -1
- package/assets/esri/core/workers/chunks/b601cc5304b132536239.js +0 -1
- package/assets/esri/core/workers/chunks/b85f614ddbddd3c3007e.js +0 -1
- package/assets/esri/core/workers/chunks/b944f4ab25a691b3e611.js +0 -1
- package/assets/esri/core/workers/chunks/bbdacddb61e651ca0098.js +0 -1
- package/assets/esri/core/workers/chunks/c2fa728e805637a1783e.js +0 -1
- package/assets/esri/core/workers/chunks/c901f5f85d962254fc2c.js +0 -1
- package/assets/esri/core/workers/chunks/ca173b908d89a4e334f6.js +0 -1
- package/assets/esri/core/workers/chunks/cc2ef3bfa1f614d7452c.js +0 -1
- package/assets/esri/core/workers/chunks/cdb32a9ac9f5804c4212.js +0 -1
- package/assets/esri/core/workers/chunks/ce9a4997973da80141a5.js +0 -1
- package/assets/esri/core/workers/chunks/d0674b50a358d3bb9db2.js +0 -1
- package/assets/esri/core/workers/chunks/d18b7b4b3b9bea7204b0.js +0 -1
- package/assets/esri/core/workers/chunks/d2ce983f7babdf18a0ed.js +0 -1
- package/assets/esri/core/workers/chunks/d38a0d867dc6cecdc551.js +0 -1
- package/assets/esri/core/workers/chunks/e39ca33e9e463c1d6060.js +0 -1
- package/assets/esri/core/workers/chunks/e471d103205018a5cf7f.js +0 -1
- package/assets/esri/core/workers/chunks/e542fb044fc96f7e8af2.js +0 -1
- package/assets/esri/core/workers/chunks/e94e00a28591337b2def.js +0 -1
- package/assets/esri/core/workers/chunks/eb2709ccbc001f42ac1b.js +0 -1
- package/assets/esri/core/workers/chunks/f905511ca5f9b59fc17f.js +0 -1
- package/assets/esri/core/workers/chunks/f910e80dd87727af5184.js +0 -1
- package/assets/esri/core/workers/chunks/f9300a24305b0af1d227.js +0 -1
- package/assets/esri/core/workers/chunks/fa1e1ac5b3ef7bdf8a78.js +0 -1
- package/assets/esri/core/workers/chunks/fce76a84c7d25d8d47e8.js +0 -1
- package/assets/esri/core/workers/chunks/fef4f97fbe861a1b60e8.js +0 -1
- package/layers/AreaMeasurementLayer.d.ts +0 -4
- package/layers/DirectLineMeasurementLayer.d.ts +0 -4
- package/symbols/support/symbolPreview.d.ts +0 -4
- package/symbols/support/symbolPreview.js +0 -5
- package/views/3d/layers/AreaMeasurementLayerView3D.d.ts +0 -4
- package/views/3d/layers/DirectLineMeasurementLayerView3D.d.ts +0 -4
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.22/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../request.js";import r from"../../../core/Error.js";import{JSONSupport as o}from"../../../core/JSONSupport.js";import i from"../../../core/Logger.js";import{isSome as n,isNone as s,unwrap as a}from"../../../core/maybe.js";import{EsriPromiseMixin as l}from"../../../core/Promise.js";import{createAbortController as c,onAbort as u}from"../../../core/promiseUtils.js";import{property as f}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../../core/accessorSupport/decorators/subclass.js";import{sanitizeUrl as h}from"../arcgisLayerUrl.js";import{url as d}from"../commonProperties.js";import p from"../RasterStorageInfo.js";import g from"../TileInfo.js";import{getRasterId as x,getBlock as y,putBlock as I,deleteBlock as w,decreaseRefCount as v}from"./RawBlockCache.js";import{decode as k}from"../rasterFormats/RasterCodec.js";import{mosaic as R,approximateTransform as b}from"../rasterFunctions/pixelUtils.js";import{load as C,projectPoint as M,snapPyramid as T,snapExtent as P,getWorldWrapCount as S,projectResolution as B,projectExtent as F,getProjectionOffsetGrid as j,getRasterDatasetAlignmentInfo as L}from"../rasterFunctions/rasterProjectionHelper.js";import{uvComponentToVector as _}from"../rasterFunctions/vectorFieldUtils.js";import D from"../../../geometry/Point.js";import H from"../../../geometry/Extent.js";let W=class extends(l(o)){constructor(){super(...arguments),this.rasterJobHandler=null,this.datasetName=null,this.datasetFormat=null,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}async init(){const e=C();this.addResolvingPromise(e),await this.when()}normalizeCtorArgs(e){return e&&e.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:g.create(),...e.ioConfig}}),e}set url(e){this._set("url",h(e,i.getLogger(this.declaredClass)))}async open(e){throw new r("BaseRaster:open-not-implemented","open() is not implemented")}async fetchTile(e,t,r,o={}){const{tileInfo:i}=o,n=i.lodAt(e),s=this.getTileExtent({x:n.resolution,y:n.resolution},t,r,i.origin,i.spatialReference,i.size);return o=this._getRequestOptionsWithSliceId(o),this.fetchPixels(s,i.size[0],i.size[1],o)}async identify(e,t={}){t=this._getRequestOptionsWithSliceId(t);const{spatialReference:r,extent:o}=this.rasterInfo,{datumTransformation:i}=t;let a=M(e,r,i);if(!o.intersects(a))return{location:a,value:null};if(n(this.rasterInfo.transform)){const e=this.rasterInfo.transform.inverseTransform(a);if(!this.rasterInfo.nativeExtent.intersects(e))return{location:e,value:null};a=e}let l=0;if(t.srcResolution){l=T(t.srcResolution,this.rasterInfo,this.ioConfig.sampling).pyramidLevel}else if(l=await this.computeBestPyramidLevelForLocation(e,t),null==l)return{location:a,value:null};const c=this.identifyPixelLocation(a,l,null);if(null===c)return{location:a,value:null};const{row:u,col:f,rowOffset:m,colOffset:h}=c,d=x(this.url,t.sliceId),p=`${l}/${u}/${f}`;let g=y(d,null,p);s(g)&&(g=this.fetchRawTile(l,u,f,t),I(d,null,p,g));const w=await g;if(s(w)||!w.pixels||0===w.pixels.length)return{location:a,value:null};const v=m*this.rasterInfo.storageInfo.blockHeight+h,k=!w.mask||w.mask[v]?w.pixels.map((e=>e[v])):null,R=this.rasterInfo.dataType;if(("vector-magdir"===R||"vector-uv"===R)&&(null==k?void 0:k.length)>1){return{location:a,value:k,magdirValue:"vector-magdir"===R?[k[0],k[1]]:_([k[0],k[1]]),pyramidLevel:l}}return{location:a,value:k,pyramidLevel:l}}async fetchPixels(e,t,r,o={}){e=P(e);const i=S(e),n=this.rasterInfo.spatialReference,s=!e.spatialReference.equals(n),{datumTransformation:l}=o,c=new D({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/r,spatialReference:e.spatialReference}),u=o.srcResolution||(s?B(c,n,e,l):c);if(!u)return null;const{pyramidLevel:f,pyramidResolution:m,excessiveReading:h}=T(u,this.rasterInfo,this.ioConfig.sampling);if(h)return null;const d=this.rasterInfo.storageInfo;let p=s?F(e,n,l):e;const g=a(this.rasterInfo.transform);if(g&&(p=g.inverseTransform(p)),null==p)return null;const x={x:Math.floor((p.xmin-d.origin.x)/m.x+.1),y:Math.floor((d.origin.y-p.ymax)/m.y+.1)},y=Math.ceil((p.xmax-p.xmin)/m.x-.1),I=Math.ceil((p.ymax-p.ymin)/m.y-.1);if(y/t>8||I/r>8||i>=2)return null;const w=await this.fetchRawPixels(f,x,{width:y,height:I,wrapCount:i},o);if(!w)return null;const v=f>0?d.pyramidBlockWidth:d.blockWidth,k=f>0?d.pyramidBlockHeight:d.blockHeight,C=v===y&&k===I&&x.x%v==0&&x.y%k==0;if(!s&&C&&1===w.pixelBlocks.length&&v===t&&k===r&&u.x===c.x&&u.y===c.y)return{extent:e,srcExtent:p,pixelBlock:w.pixelBlocks[0]};const M=j(e,w.extent,c,l,g,i>0);let L;const _=!o.requestRawData,H={rows:M.spacing[0],cols:M.spacing[1]},W=a(this._getRasterTileAlignmentInfo(f,w.extent.xmin)),{pixelBlocks:A,mosaicSize:O,isPartiallyFilled:U}=w;if(this.rasterJobHandler)L=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:A,srcMosaicSize:O,destDimension:_?{width:t,height:r}:null,coefs:_?M.coefficients:null,sampleSpacing:_?H:null,interpolation:o.interpolation,alignmentInfo:W},o);else{const e=R(A,O,null,null,W);L=_?b(e,{width:t,height:r},M.coefficients,H,o.interpolation):e}return o.requestRawData?{srcExtent:p,pixelBlock:L,transformGrid:M,extent:e,isPartiallyFilled:U}:{srcExtent:p,extent:e,pixelBlock:L}}async fetchRawPixels(e,t,r,o){const{origin:i,blockBoundary:n}=this.rasterInfo.storageInfo,{blockWidth:s,blockHeight:l}=this.getBlockWidthHeight(e);let{x:c,y:u}=t,{width:f,height:m,wrapCount:h}=r;const d=a(this._getRasterTileAlignmentInfo(e,0));o.buffer&&(c-=o.buffer.cols,u-=o.buffer.rows,f+=2*o.buffer.cols,m+=2*o.buffer.rows);const p=Math.floor(c/s),g=Math.floor(u/l),x=Math.floor((c+f-1)/s),y=Math.floor((u+m-1)/l),I=n[e];if(!I)return null;const{minRow:w,minCol:v,maxCol:k,maxRow:R}=I;if(y<w||x<v||g>R||p>k)return null;const b=new Array;let C=!1;const M=null==this.ioConfig.allowPartialFill?o.allowPartialFill:this.ioConfig.allowPartialFill;for(let a=g;a<=y;a++)for(let t=p;t<=x;t++){const r=0===h||null==d||t<d.worldColumnCountFromOrigin?t:t%d.worldColumnCountFromOrigin-d.originColumnOffset;if(a>=w&&r>=v&&R>=a&&k>=r){const t=this._fetchRawTile(e,a,r,o);M?b.push(new Promise((e=>{t.then((t=>e(t))).catch((()=>{C=!0,e(null)}))}))):b.push(t)}else b.push(null)}if(0===b.length)return null;const T=await Promise.all(b),P={height:(y-g+1)*l,width:(x-p+1)*s},{spatialReference:S}=this.rasterInfo,B=this.getPyramidPixelSize(e),{x:F,y:j}=B;return{extent:new H({xmin:i.x+p*s*F,xmax:i.x+(x+1)*s*F,ymin:i.y-(y+1)*l*j,ymax:i.y-g*l*j,spatialReference:S}),pixelBlocks:T,mosaicSize:P,isPartiallyFilled:C}}fetchRawTile(e,t,o,i){throw new r("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return F(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return!this.rasterJobHandler||t.useCanvas?k(e,t):this.rasterJobHandler.decode({data:e,options:t})}async request(e,r,o){var i,n;const{customFetchParameters:s}=this.ioConfig,{range:a,query:l,headers:c}=r;o=null!=(i=null!=(n=o)?n:r.retryCount)?i:this.ioConfig.retryCount;const u=a?{Range:`bytes=${a.from}-${a.to}`}:null;try{return await t(e,{...r,query:{...l,...s},headers:{...c,...u}})}catch(f){if(o>0)return o--,this.request(e,r,o);throw f}}getSliceIndex(e){const{multidimensionalInfo:t}=this.rasterInfo;if(!n(t)||null==e||!e.length)return null;let r=0;const o=e[0].variableName;for(let i=0;i<t.variables.length;i++){const n=t.variables[i],s=n.dimensions;if(n.name!==o){r+=s.map((e=>this._getDimensionValuesCount(e))).reduce(((e,t)=>e+t));break}const a=s.map((e=>this._getDimensionValuesCount(e))),l=s.length;for(let t=0;t<l;t++){const o=e.filter((e=>e.dimensionName===s[t].name))[0];if(null==o)return null;const i=Array.isArray(o.values[0])?o.values[0][0]:o.values[0],n=this._getIndexFromDimensions(i,s[t]);if(-1===n)return null;a.shift(),r+=t===l-1?n:n*a.reduce(((e,t)=>e+t))}}return r}updateTileInfo(){const{storageInfo:e,spatialReference:t,extent:r,pixelSize:o}=this.rasterInfo;if(!e.tileInfo){const i=[],n=e.maximumPyramidLevel||0;let s=Math.max(o.x,o.y),a=1/.0254*96*s;for(let e=0;e<=n;e++)i.push({level:n-e,resolution:s,scale:a}),s*=2,a*=2;const l=new D({x:r.xmin,y:r.ymax,spatialReference:t});e.tileInfo=new g({origin:l,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:i}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,r=512,o){const{width:i,height:n,nativeExtent:s,pixelSize:a,spatialReference:l}=e,c=new D({x:s.xmin,y:s.ymax,spatialReference:l});null==o&&(o=Math.max(0,Math.round(Math.log(Math.max(i,n))/Math.LN2-8)));const u=this.computeBlockBoundary(s,512,512,{x:s.xmin,y:s.ymax},[a],o);e.storageInfo=new p({blockWidth:t,blockHeight:r,pyramidBlockWidth:t,pyramidBlockHeight:r,origin:c,firstPyramidLevel:1,maximumPyramidLevel:o,blockBoundary:u})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,r,o,i,n=0,s=2){if(1===i.length&&n>0){i=[...i];let{x:e,y:t}=i[0];for(let r=0;r<n;r++)e*=s,t*=s,i.push({x:e,y:t})}const a=[],{x:l,y:c}=o;for(let u=0;u<i.length;u++){const{x:o,y:n}=i[u];a.push({minCol:Math.floor((e.xmin-l+.1*o)/t/o),maxCol:Math.floor((e.xmax-l-.1*o)/t/o),minRow:Math.floor((c-e.ymax+.1*n)/r/n),maxRow:Math.floor((c-e.ymin-.1*n)/r/n)})}return a}getPyramidPixelSize(e){const{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:r,pyramidScalingFactor:o}=this.rasterInfo.storageInfo;if(0===e)return t;if(n(r)&&r.length)return r[e-1];const i=o**e;return{x:t.x*i,y:t.y*i}}identifyPixelLocation(e,t,r){const{spatialReference:o,nativeExtent:i}=this.rasterInfo,{blockWidth:n,blockHeight:s,maximumPyramidLevel:a,origin:l}=this.rasterInfo.storageInfo,c=M(e,o,r);if(!i.intersects(c))return null;if(t<0||t>a)return null;const u=this.getPyramidPixelSize(t),{x:f,y:m}=u,h=(l.y-c.y)/m/s,d=(c.x-l.x)/f/n,p=Math.min(s-1,Math.floor((h-Math.floor(h))*s)),g=Math.min(n-1,Math.floor((d-Math.floor(d))*n));return{pyramidLevel:t,row:Math.floor(h),col:Math.floor(d),rowOffset:p,colOffset:g,srcLocation:c}}getTileExtent(e,t,r,o,i,n){const[s,a]=n,l=o.x+r*s*e.x,c=l+s*e.x,u=o.y-t*a*e.y,f=u-a*e.y;return new H({xmin:l,xmax:c,ymin:f,ymax:u,spatialReference:i})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,r){const o=this.rasterInfo.storageInfo.blockBoundary[e];return!o||o.maxRow<t||o.maxCol<r||o.minRow>t||o.minCol>r}_fetchRawTile(e,t,r,o){const i=this.rasterInfo.storageInfo.blockBoundary[e];if(!i)return Promise.resolve(null);const{minRow:n,minCol:a,maxCol:l,maxRow:f}=i;if(t<n||r<a||t>f||r>l)return Promise.resolve(null);const m=x(this.url,o.sliceId),h=`${e}/${t}/${r}`;let d=y(m,o.registryId,h);if(s(d)){const i=c();d=this.fetchRawTile(e,t,r,{...o,signal:i.signal}),I(m,o.registryId,h,d,i),d.catch((()=>w(m,o.registryId,h)))}return o.signal&&u(o,(()=>{v(m,o.registryId,h)})),d}_getIndexFromDimensions(e,t){const{extent:r,interval:o,unit:i,values:n}=t;if(null!=n&&n.length)return Array.isArray(n[0])?n.findIndex((t=>t[0]<=e&&t[1]>=e)):n.indexOf(e);if(e>r[1])return-1;const s=r[0];let a=-1;if("ISO8601"===i){var l;switch((null==(l=t.intervalUnit)?void 0:l.toLowerCase())||"seconds"){case"seconds":a=Math.round((e-s)/1e3/o);break;case"minutes":a=Math.round((e-s)/6e4/o);break;case"hours":a=Math.round((e-s)/36e5/o);break;case"days":a=Math.round((e-s)/864e5/o);break;case"years":a=Math.round((new Date(e).getUTCFullYear()-new Date(s).getUTCFullYear())/o);break;case"decades":a=Math.round((new Date(e).getUTCFullYear()-new Date(s).getUTCFullYear())/10/o)}return a}return Math.round((e-s)/o)}_getDimensionValuesCount(e){const{extent:t,interval:r,unit:o,values:i}=e;let n=(null==i?void 0:i.length)||0;if(n)return n;const s=t[0];if(0===n&&"ISO8601"===o){var a;switch((null==(a=e.intervalUnit)?void 0:a.toLowerCase())||"seconds"){case"seconds":n=Math.round((t[1]-t[0])/1e3/r);break;case"minutes":n=Math.round((t[1]-t[0])/6e4/r);break;case"hours":n=Math.round((t[1]-t[0])/36e5/r);break;case"days":n=Math.round((t[1]-t[0])/864e5/r);break;case"years":n=Math.round((new Date(t[1]).getUTCFullYear()-new Date(s).getUTCFullYear())/r);break;case"decades":n=Math.round((new Date(t[1]).getUTCFullYear()-new Date(s).getUTCFullYear())/10/r)}return n}return Math.round((t[1]-t[0])/r)}_getRasterTileAlignmentInfo(e,t){return null==this._rasterTileAlighmentInfo&&(this._rasterTileAlighmentInfo=L(this.rasterInfo)),n(this._rasterTileAlighmentInfo.pyramidsInfo)?{startX:t,halfWorldWidth:this._rasterTileAlighmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlighmentInfo.hasGCSSShiftTransform,...this._rasterTileAlighmentInfo.pyramidsInfo[e]}:null}_getRequestOptionsWithSliceId(e){var t;return null!=(t=e.multidimensionalDefinition)&&t.length&&n(this.rasterInfo.multidimensionalInfo)&&null==e.sliceId&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)||0}),e}};e([f()],W.prototype,"_rasterTileAlighmentInfo",void 0),e([f(d)],W.prototype,"url",null),e([f({type:String,json:{write:!0}})],W.prototype,"datasetName",void 0),e([f({type:String,json:{write:!0}})],W.prototype,"datasetFormat",void 0),e([f()],W.prototype,"rasterInfo",void 0),e([f()],W.prototype,"ioConfig",void 0),e([f()],W.prototype,"sourceJSON",void 0),W=e([m("esri.layers.support.rasterDatasets.BaseRaster")],W);const A=W;export{A as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../request.js";import r from"../../../core/Error.js";import{JSONSupport as o}from"../../../core/JSONSupport.js";import i from"../../../core/Logger.js";import{isSome as n,isNone as s,unwrap as l}from"../../../core/maybe.js";import{EsriPromiseMixin as a}from"../../../core/Promise.js";import{onAbort as c}from"../../../core/promiseUtils.js";import{property as f}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{sanitizeUrl as m}from"../arcgisLayerUrl.js";import{url as h}from"../commonProperties.js";import d from"../RasterStorageInfo.js";import p from"../TileInfo.js";import{getRasterId as x,getBlock as g,putBlock as y,deleteBlock as I,decreaseRefCount as w}from"./RawBlockCache.js";import{decode as k}from"../rasterFormats/RasterCodec.js";import{mosaic as v,approximateTransform as R}from"../rasterFunctions/pixelUtils.js";import{load as b,projectPoint as C,snapPyramid as T,snapExtent as M,getWorldWidth as P,getWorldWrapCount as B,projectExtent as S,projectResolution as F,getProjectionOffsetGrid as j,getRasterDatasetAlignmentInfo as _}from"../rasterFunctions/rasterProjectionHelper.js";import{uvComponentToVector as L}from"../rasterFunctions/vectorFieldUtils.js";import W from"../../../geometry/Extent.js";import H from"../../../geometry/Point.js";let A=class extends(a(o)){constructor(){super(...arguments),this.rasterJobHandler=null,this.datasetName=null,this.datasetFormat=null,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}async init(){const e=b();this.addResolvingPromise(e),await this.when()}normalizeCtorArgs(e){return e&&e.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:p.create(),...e.ioConfig}}),e}set url(e){this._set("url",m(e,i.getLogger(this.declaredClass)))}async open(e){throw new r("BaseRaster:open-not-implemented","open() is not implemented")}async fetchTile(e,t,r,o={}){const i=o.tileInfo||this.rasterInfo.storageInfo.tileInfo,n=this.getTileExtentFromTileInfo(e,t,r,i);return this.fetchPixels(n,i.size[0],i.size[1],o)}async identify(e,t={}){t=this._getRequestOptionsWithSliceId(t);const{spatialReference:r,extent:o}=this.rasterInfo,{datumTransformation:i}=t;let l=C(e,r,i);if(!o.intersects(l))return{location:l,value:null};if(n(this.rasterInfo.transform)){const e=this.rasterInfo.transform.inverseTransform(l);if(!this.rasterInfo.nativeExtent.intersects(e))return{location:e,value:null};l=e}let a=0;if(t.srcResolution){a=T(t.srcResolution,this.rasterInfo,this.ioConfig.sampling).pyramidLevel}else if(a=await this.computeBestPyramidLevelForLocation(e,t),null==a)return{location:l,value:null};const c=this.identifyPixelLocation(l,a,null);if(null===c)return{location:l,value:null};const{row:f,col:u,rowOffset:m,colOffset:h}=c,d=x(this.url,t.sliceId),p=`${a}/${f}/${u}`;let I=g(d,null,p);s(I)&&(I=this.fetchRawTile(a,f,u,t),y(d,null,p,I));const w=await I;if(s(w)||!w.pixels||0===w.pixels.length)return{location:l,value:null};const k=m*this.rasterInfo.storageInfo.blockHeight+h,v=!w.mask||w.mask[k]?w.pixels.map((e=>e[k])):null,R=this.rasterInfo.dataType;if(("vector-magdir"===R||"vector-uv"===R)&&(null==v?void 0:v.length)>1){return{location:l,value:v,magdirValue:"vector-magdir"===R?[v[0],v[1]]:L([v[0],v[1]]),pyramidLevel:a}}return{location:l,value:v,pyramidLevel:a}}async fetchPixels(e,t,r,o={}){e=M(e);const i=P(e.spatialReference),l=B(e),a=P(this.rasterInfo.spatialReference),c=n(a)&&this.rasterInfo.extent.width>=a/2;if(o=this._getRequestOptionsWithSliceId(o),s(i)||0===l||1===l&&c)return this._fetchPixels(e,t,r,o);if(l>=3)return{extent:e,pixelBlock:null};const f=[],{xmin:u,xmax:m}=e,h=Math.round(i/(m-u)*t),d=h-Math.round((i/2-u)/(m-u)*t);let p=0;const x=[];for(let n=0;n<=l;n++){const s=new W({xmin:0===n?u:-i/2,xmax:n===l?m-i*n:i/2,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),a=0===n?h-d:n===l?t-p:h;p+=a,x.push(a);const c=this._fetchPixels(s,a,r,o);f.push(c)}const g=(await Promise.all(f)).map((e=>null==e?void 0:e.pixelBlock));let y=null;const I={width:t,height:r};y=this.rasterJobHandler?await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:g,srcMosaicSize:I,destDimension:null,coefs:null,sampleSpacing:null,interpolation:"nearest",alignmentInfo:null,blockWidths:x},o):v(g,I,{blockWidths:x});return{extent:e,srcExtent:S(e,this.rasterInfo.spatialReference,o.datumTransformation),pixelBlock:y}}async fetchRawPixels(e,t,r,o){const{origin:i,blockBoundary:n}=this.rasterInfo.storageInfo,{blockWidth:s,blockHeight:a}=this.getBlockWidthHeight(e);let{x:c,y:f}=t,{width:u,height:m,wrapCount:h}=r;const d=l(this._getRasterTileAlignmentInfo(e,0));o.buffer&&(c-=o.buffer.cols,f-=o.buffer.rows,u+=2*o.buffer.cols,m+=2*o.buffer.rows);const p=Math.floor(c/s),x=Math.floor(f/a),g=Math.floor((c+u-1)/s),y=Math.floor((f+m-1)/a),I=n[e];if(!I)return null;const{minRow:w,minCol:k,maxCol:v,maxRow:R}=I;if(0===h&&(y<w||g<k||x>R||p>v))return null;const b=new Array;let C=!1;const T=null==this.ioConfig.allowPartialFill?o.allowPartialFill:this.ioConfig.allowPartialFill;for(let l=x;l<=y;l++)for(let t=p;t<=g;t++){const r=0===h||null==d||t<d.worldColumnCountFromOrigin?t:t%d.worldColumnCountFromOrigin-d.originColumnOffset;if(l>=w&&r>=k&&R>=l&&v>=r){const t=this._fetchRawTile(e,l,r,o);T?b.push(new Promise((e=>{t.then((t=>e(t))).catch((()=>{C=!0,e(null)}))}))):b.push(t)}else b.push(null)}if(0===b.length)return null;const M=await Promise.all(b),P={height:(y-x+1)*a,width:(g-p+1)*s},{spatialReference:B}=this.rasterInfo,S=this.getPyramidPixelSize(e),{x:F,y:j}=S;return{extent:new W({xmin:i.x+p*s*F,xmax:i.x+(g+1)*s*F,ymin:i.y-(y+1)*a*j,ymax:i.y-x*a*j,spatialReference:B}),pixelBlocks:M,mosaicSize:P,isPartiallyFilled:C}}fetchRawTile(e,t,o,i){throw new r("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return S(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return!this.rasterJobHandler||t.useCanvas?k(e,t):this.rasterJobHandler.decode({data:e,options:t})}async request(e,r,o){var i,n;const{customFetchParameters:s}=this.ioConfig,{range:l,query:a,headers:c}=r;o=null!=(i=null!=(n=o)?n:r.retryCount)?i:this.ioConfig.retryCount;const f=l?{Range:`bytes=${l.from}-${l.to}`}:null;try{return await t(e,{...r,query:{...a,...s},headers:{...c,...f}})}catch(u){if(o>0)return o--,this.request(e,r,o);throw u}}getSliceIndex(e){const{multidimensionalInfo:t}=this.rasterInfo;if(!n(t))return null;if(!n(e)||0===e.length)return null;let r=0;const o=e[0].variableName;for(let i=0;i<t.variables.length;i++){const n=t.variables[i],s=n.dimensions;if(n.name!==o){r+=s.map((e=>this._getDimensionValuesCount(e))).reduce(((e,t)=>e+t));break}const l=s.map((e=>this._getDimensionValuesCount(e))),a=s.length;for(let t=0;t<a;t++){const o=e.filter((e=>e.dimensionName===s[t].name))[0];if(null==o)return null;const i=Array.isArray(o.values[0])?o.values[0][0]:o.values[0],n=this._getIndexFromDimensions(i,s[t]);if(-1===n)return null;l.shift(),r+=t===a-1?n:n*l.reduce(((e,t)=>e+t))}}return r}getTileExtentFromTileInfo(e,t,r,o){const i=o.lodAt(e);return this.getTileExtent({x:i.resolution,y:i.resolution},t,r,o.origin,o.spatialReference,o.size)}updateTileInfo(){const{storageInfo:e,spatialReference:t,extent:r,pixelSize:o}=this.rasterInfo;if(!e.tileInfo){const i=[],n=e.maximumPyramidLevel||0;let s=Math.max(o.x,o.y),l=1/.0254*96*s;for(let e=0;e<=n;e++)i.push({level:n-e,resolution:s,scale:l}),s*=2,l*=2;const a=new H({x:r.xmin,y:r.ymax,spatialReference:t});e.tileInfo=new p({origin:a,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:i}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,r=512,o){const{width:i,height:n,nativeExtent:s,pixelSize:l,spatialReference:a}=e,c=new H({x:s.xmin,y:s.ymax,spatialReference:a});null==o&&(o=Math.max(0,Math.round(Math.log(Math.max(i,n))/Math.LN2-8)));const f=this.computeBlockBoundary(s,512,512,{x:s.xmin,y:s.ymax},[l],o);e.storageInfo=new d({blockWidth:t,blockHeight:r,pyramidBlockWidth:t,pyramidBlockHeight:r,origin:c,firstPyramidLevel:1,maximumPyramidLevel:o,blockBoundary:f})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,r,o,i,n=0,s=2){if(1===i.length&&n>0){i=[...i];let{x:e,y:t}=i[0];for(let r=0;r<n;r++)e*=s,t*=s,i.push({x:e,y:t})}const l=[],{x:a,y:c}=o;for(let f=0;f<i.length;f++){const{x:o,y:n}=i[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)/r/n),maxRow:Math.floor((c-e.ymin-.1*n)/r/n)})}return l}getPyramidPixelSize(e){const{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:r,pyramidScalingFactor:o}=this.rasterInfo.storageInfo;if(0===e)return t;if(n(r)&&r.length)return r[e-1];const i=o**e;return{x:t.x*i,y:t.y*i}}identifyPixelLocation(e,t,r){const{spatialReference:o,nativeExtent:i}=this.rasterInfo,{blockWidth:n,blockHeight:s,maximumPyramidLevel:l,origin:a}=this.rasterInfo.storageInfo,c=C(e,o,r);if(!i.intersects(c))return null;if(t<0||t>l)return null;const f=this.getPyramidPixelSize(t),{x:u,y:m}=f,h=(a.y-c.y)/m/s,d=(c.x-a.x)/u/n,p=Math.min(s-1,Math.floor((h-Math.floor(h))*s)),x=Math.min(n-1,Math.floor((d-Math.floor(d))*n));return{pyramidLevel:t,row:Math.floor(h),col:Math.floor(d),rowOffset:p,colOffset:x,srcLocation:c}}getTileExtent(e,t,r,o,i,n){const[s,l]=n,a=o.x+r*s*e.x,c=a+s*e.x,f=o.y-t*l*e.y,u=f-l*e.y;return new W({xmin:a,xmax:c,ymin:u,ymax:f,spatialReference:i})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,r){const o=this.rasterInfo.storageInfo.blockBoundary[e];return!o||o.maxRow<t||o.maxCol<r||o.minRow>t||o.minCol>r}async _fetchPixels(e,t,r,o={}){const i=this.rasterInfo.spatialReference,n=!e.spatialReference.equals(i),{datumTransformation:s}=o,a=new H({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/r,spatialReference:e.spatialReference}),c=o.srcResolution||(n?F(a,i,e,s):a);if(!c)return{extent:e,pixelBlock:null};const{pyramidLevel:f,pyramidResolution:u,excessiveReading:m}=T(c,this.rasterInfo,this.ioConfig.sampling);if(m)return{extent:e,pixelBlock:null};const h=this.rasterInfo.storageInfo;let d=n?S(e,i,s):e;const p=l(this.rasterInfo.transform);if(p&&(d=p.inverseTransform(d)),null==d)return{extent:e,srcExtent:d,pixelBlock:null};const x={x:Math.floor((d.xmin-h.origin.x)/u.x+.1),y:Math.floor((h.origin.y-d.ymax)/u.y+.1)},g=Math.ceil((d.xmax-d.xmin)/u.x-.1),y=Math.ceil((d.ymax-d.ymin)/u.y-.1),I=B(e);if(g/t>8||y/r>8||I>=2)return{extent:e,srcExtent:d,pixelBlock:null};const w=await this.fetchRawPixels(f,x,{width:g,height:y,wrapCount:I},o);if(!w)return{extent:e,srcExtent:d,pixelBlock:null};const k=f>0?h.pyramidBlockWidth:h.blockWidth,b=f>0?h.pyramidBlockHeight:h.blockHeight,C=k===g&&b===y&&x.x%k==0&&x.y%b==0;if(!n&&C&&1===w.pixelBlocks.length&&k===t&&b===r&&c.x===a.x&&c.y===a.y)return{extent:e,srcExtent:d,pixelBlock:w.pixelBlocks[0]};const M=j(e,w.extent,a,s,p,I>0);let P;const _=!o.requestRawData,L={rows:M.spacing[0],cols:M.spacing[1]},W=l(this._getRasterTileAlignmentInfo(f,w.extent.xmin)),{pixelBlocks:A,mosaicSize:D,isPartiallyFilled:E}=w;if(this.rasterJobHandler)P=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:A,srcMosaicSize:D,destDimension:_?{width:t,height:r}:null,coefs:_?M.coefficients:null,sampleSpacing:_?L:null,interpolation:o.interpolation,alignmentInfo:W,blockWidths:null},o);else{const e=v(A,D,{alignmentInfo:W});P=_?R(e,{width:t,height:r},M.coefficients,L,o.interpolation):e}return o.requestRawData?{srcExtent:d,pixelBlock:P,transformGrid:M,extent:e,isPartiallyFilled:E}:{srcExtent:d,extent:e,pixelBlock:P}}_fetchRawTile(e,t,r,o){const i=this.rasterInfo.storageInfo.blockBoundary[e];if(!i)return Promise.resolve(null);const{minRow:n,minCol:l,maxCol:a,maxRow:f}=i;if(t<n||r<l||t>f||r>a)return Promise.resolve(null);const u=x(this.url,o.sliceId),m=`${e}/${t}/${r}`;let h=g(u,o.registryId,m);if(s(h)){const i=new AbortController;h=this.fetchRawTile(e,t,r,{...o,signal:i.signal}),y(u,o.registryId,m,h,i),h.catch((()=>I(u,o.registryId,m)))}return o.signal&&c(o,(()=>{w(u,o.registryId,m)})),h}_getIndexFromDimensions(e,t){const{extent:r,interval:o,unit:i,values:n}=t;if(null!=n&&n.length)return Array.isArray(n[0])?n.findIndex((t=>t[0]<=e&&t[1]>=e)):n.indexOf(e);if(e>r[1])return-1;const s=r[0];let l=-1;if("ISO8601"===i){var a;switch((null==(a=t.intervalUnit)?void 0:a.toLowerCase())||"seconds"){case"seconds":l=Math.round((e-s)/1e3/o);break;case"minutes":l=Math.round((e-s)/6e4/o);break;case"hours":l=Math.round((e-s)/36e5/o);break;case"days":l=Math.round((e-s)/864e5/o);break;case"years":l=Math.round((new Date(e).getUTCFullYear()-new Date(s).getUTCFullYear())/o);break;case"decades":l=Math.round((new Date(e).getUTCFullYear()-new Date(s).getUTCFullYear())/10/o)}return l}return Math.round((e-s)/o)}_getDimensionValuesCount(e){const{extent:t,interval:r,unit:o,values:i}=e;let n=(null==i?void 0:i.length)||0;if(n)return n;const s=t[0];if(0===n&&"ISO8601"===o){var l;switch((null==(l=e.intervalUnit)?void 0:l.toLowerCase())||"seconds"){case"seconds":n=Math.round((t[1]-t[0])/1e3/r);break;case"minutes":n=Math.round((t[1]-t[0])/6e4/r);break;case"hours":n=Math.round((t[1]-t[0])/36e5/r);break;case"days":n=Math.round((t[1]-t[0])/864e5/r);break;case"years":n=Math.round((new Date(t[1]).getUTCFullYear()-new Date(s).getUTCFullYear())/r);break;case"decades":n=Math.round((new Date(t[1]).getUTCFullYear()-new Date(s).getUTCFullYear())/10/r)}return n}return Math.round((t[1]-t[0])/r)}_getRasterTileAlignmentInfo(e,t){return null==this._rasterTileAlighmentInfo&&(this._rasterTileAlighmentInfo=_(this.rasterInfo)),n(this._rasterTileAlighmentInfo.pyramidsInfo)?{startX:t,halfWorldWidth:this._rasterTileAlighmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlighmentInfo.hasGCSSShiftTransform,...this._rasterTileAlighmentInfo.pyramidsInfo[e]}:null}_getRequestOptionsWithSliceId(e){return n(this.rasterInfo.multidimensionalInfo)&&null==e.sliceId&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}};e([f()],A.prototype,"_rasterTileAlighmentInfo",void 0),e([f(h)],A.prototype,"url",null),e([f({type:String,json:{write:!0}})],A.prototype,"datasetName",void 0),e([f({type:String,json:{write:!0}})],A.prototype,"datasetFormat",void 0),e([f()],A.prototype,"rasterInfo",void 0),e([f()],A.prototype,"ioConfig",void 0),e([f()],A.prototype,"sourceJSON",void 0),A=e([u("esri.layers.support.rasterDatasets.BaseRaster")],A);const D=A;export{D 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/4.22/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../core/Error.js";import{isSome as i,unwrap as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../core/Error.js";import{isSome as i,isNone as s,unwrap as a}from"../../../core/maybe.js";import{urlToObject as l}from"../../../core/urlUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import o from"../RasterInfo.js";import m from"../RasterStorageInfo.js";import{readServiceTileInfo as c}from"../serviceTileInfoProperty.js";import h from"../TileInfo.js";import{TilemapCache as u}from"../TilemapCache.js";import f from"./BaseRaster.js";import{setValidBoundary as p}from"../rasterFunctions/pixelUtils.js";import d from"../rasterTransforms/GCSShiftTransform.js";import y from"../../../rest/support/FeatureSet.js";import x from"../../../geometry/SpatialReference.js";import g from"../../../geometry/Extent.js";import v from"../../../geometry/Point.js";let S=class extends f{constructor(){super(...arguments),this._levelOffset=0,this._slices=null,this._tilemapCache=null,this.datasetFormat="RasterTileServer"}async open(e){await this.init();const s=e&&e.signal,a=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:s});a.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));const r=a.data;if(this.sourceJSON=r,!r)throw new t("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!r.tileInfo)throw new t("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo();const n=["jpg","jpeg","png","png8","png24","png32","mixed"];this.tileType=r.cacheType,null==this.tileType&&(n.indexOf(r.tileInfo.format.toLowerCase())>-1?this.tileType="Map":"lerc"===r.tileInfo.format.toLowerCase()?this.tileType="Elevation":this.tileType="Raster"),this.datasetName=r.name.slice(r.name.indexOf("/")+1);const o=await this._fetchRasterInfo({signal:s});if(!i(o))throw new t("image-server-raster:open","cannot initialize image service");{const e="Map"===this.tileType?c(r.tileInfo,r):h.fromJSON(r.tileInfo),{extent:t,pixelSize:i}=o,s=.5/o.width*i.x;let a,l;const n=e.lodAt(Math.max.apply(null,e.lods.map((e=>e.level))));"Map"!==this.tileType&&0!==r.maxScale&&("Raster"===this.tileType?(a=e.lods.filter((e=>e.resolution===i.x))[0],a||(a=e.lods[e.lods.length-1])):(a=e.lods.filter((e=>Math.abs(e.scale-r.maxScale)<s))[0],a||(a=e.lods.filter((e=>e.scale>r.maxScale)).sort(((e,t)=>e.scale>t.scale?1:-1))[0])),i.x=i.y=a.resolution,o.width=Math.ceil((t.xmax-t.xmin)/i.x-.1),o.height=Math.ceil((t.ymax-t.ymin)/i.y-.1)),a||(a=n);const u=e.lodAt(Math.min.apply(null,e.lods.map((e=>e.level))));"Map"===this.tileType?this._levelOffset=e.lods[0].level:0!==r.minScale&&"Elevation"===this.tileType&&(l=e.lods.filter((e=>Math.abs(e.scale-r.minScale)<s))[0],this._levelOffset=l.level-u.level),l||(l=u);const f=Math.max(i.x,i.y);(Math.abs(i.x-i.y)>s||!e.lods.some((e=>Math.abs(e.resolution-f)<s)))&&(i.x=i.y=a.resolution,o.width=Math.ceil((t.xmax-t.xmin)/i.x-.1),o.height=Math.ceil((t.ymax-t.ymin)/i.y-.1));const p=a.level-l.level,[d,y]=e.size,x=[];e.lods.forEach((e=>{e.level>=l.level&&e.level<=a.level&&x.push({x:e.resolution,y:e.resolution})})),x.sort(((e,t)=>e.x-t.x));const g=this.computeBlockBoundary(t,d,y,e.origin,x,p),v=x.length>1?x.slice(1):null;o.storageInfo=new m({blockWidth:e.size[0],blockHeight:e.size[1],pyramidBlockWidth:e.size[0],pyramidBlockHeight:e.size[1],pyramidResolutions:v,compression:e.format,origin:e.origin,firstPyramidLevel:1,maximumPyramidLevel:p,tileInfo:e,blockBoundary:g}),this._fixGCSShift(o),this._set("rasterInfo",o)}if(r.capabilities.toLowerCase().indexOf("tilemap")>-1){const e={tileInfo:o.storageInfo.tileInfo,parsedUrl:l(this.url),url:this.url,tileServers:[],type:"tile"};this._tilemapCache=new u({layer:e})}}async fetchRawTile(e,t,i,s={}){if(this._slices&&null==s.sliceId)return null;const{storageInfo:a,extent:l}=this.rasterInfo,r=a.maximumPyramidLevel-e+this._levelOffset,n=`${this.url}/tile/${r}/${t}/${i}`,o=this._slices?{sliceId:s.sliceId||0}:null,{data:m}=await this.request(n,{query:o,responseType:"array-buffer",signal:s.signal});if(!m)return null;const c=await this.decodePixelBlock(m,{width:a.tileInfo.size[0],height:a.tileInfo.size[1],planes:null,pixelType:null,isPoint:"Elevation"===this.tileType}),h=a.blockBoundary[e];if("jpg"!==a.compression||i>h.minCol&&i<h.maxCol&&t>h.minRow&&t<h.maxRow)return c;const{origin:u,blockWidth:f,blockHeight:d}=a,{x:y,y:x}=this.getPyramidPixelSize(e),g=Math.round((l.xmin-u.x)/y)%f,v=Math.round((l.xmax-u.x)/y)%f,S=Math.round((u.y-l.ymax)/x)%d,w=Math.round((u.y-l.ymin)/x)%d,I=i===h.minCol?g:0,b=t===h.minRow?S:0,j=i===h.maxCol?v:f,T=t===h.maxRow?w:d;return p(c,{x:I,y:b},{width:j-I,height:T-b}),c}getSliceIndex(e){if(!this._slices||s(e)||0===e.length)return null;const t=e;for(let i=0;i<this._slices.length;i++){const e=this._slices[i].multidimensionalDefinition;if(e.length===t.length&&!e.some((e=>{const i=t.filter((t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName))[0];if(!i)return!0;return(Array.isArray(e.values[0])?`${e.values[0][0]}-${e.values[0][1]}`:e.values[0])!==(Array.isArray(i.values[0])?`${i.values[0][0]}-${i.values[0][1]}`:i.values[0])})))return i}return null}async fetchVariableStatisticsHistograms(e,t){const i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then((e=>{var t;return null==(t=e.data)?void 0:t.statistics})),s=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then((e=>{var t;return null==(t=e.data)?void 0:t.histograms})),a=await Promise.all([i,s]);return a[0]&&a[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:a[0]||null,histograms:a[1]||null}}async computeBestPyramidLevelForLocation(e,t={}){if(!this._tilemapCache)return 0;let i=this.identifyPixelLocation(e,0,a(t.datumTransformation));if(null===i)return null;let s=0;const{maximumPyramidLevel:l}=this.rasterInfo.storageInfo;let r=l-s+this._levelOffset;const n=i.srcLocation;for(;r>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(r,i.row,i.col,t))break}catch{}if(r--,s++,i=this.identifyPixelLocation(n,s,a(t.datumTransformation)),null===i)return null}return-1===r||null==i?null:s}async _fetchRasterInfo(e){const t=this.sourceJSON,i=Math.ceil((t.extent.xmax-t.extent.xmin)/t.pixelSizeX-.1),s=Math.ceil((t.extent.ymax-t.extent.ymin)/t.pixelSizeY-.1),a=x.fromJSON(t.spatialReference||t.extent.spatialReference);if("Map"===this.tileType)return new o({width:i,height:s,bandCount:3,extent:g.fromJSON(t.extent),spatialReference:a,pixelSize:new v({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:a}),pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}});const{slice:l,signal:r}=e,n=!!t.hasRasterAttributeTable&&this.request(this.url+"/rasterAttributeTable",{query:{slice:l,f:"json"},signal:r}).then((e=>y.fromJSON(e.data))).catch((()=>null)),m=!!t.hasColormap&&this.request(this.url+"/colormap",{query:{slice:l,f:"json"},signal:r}).then((e=>{var t;return null==(t=e.data)?void 0:t.colormap})),c=!!t.hasHistograms&&this.request(this.url+"/histograms",{query:{slice:l,f:"json"},signal:r}).then((e=>{var t;return null==(t=e.data)?void 0:t.histograms})),h=this.request(this.url+"/keyProperties",{query:{f:"json"},signal:r}).then((e=>e.data)).catch((()=>{})),u=!!t.hasMultidimensions&&this._fetchMultidimensionalInfo(),f=!!t.hasMultidimensions&&this.request(this.url+"/slices",{query:{f:"json"},signal:r}).then((e=>e.data&&e.data.slices)).catch((()=>{}));return Promise.all([n,m,c,h,u,f]).then((e=>{let l=null;if(t.minValues&&t.minValues.length===t.bandCount){l=[];for(let e=0;e<t.minValues.length;e++)l.push({min:t.minValues[e],max:t.maxValues[e],avg:t.meanValues[e],stddev:t.stdvValues[e]})}return this._slices=e[5]||null,new o({width:i,height:s,bandCount:t.bandCount,extent:g.fromJSON(t.extent),spatialReference:a,pixelSize:new v({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:a}),pixelType:t.pixelType.toLowerCase(),statistics:l,attributeTable:e[0]||null,colormap:e[1]||null,histograms:e[2]||null,keyProperties:e[3]||{},multidimensionalInfo:e[4]||null})}))}async _fetchMultidimensionalInfo(e){var t;const i=await this.request(this.url+"/multidimensionalInfo",{query:{f:"json"},signal:e}).then((e=>{var t;return null==(t=e.data)?void 0:t.multidimensionalInfo}));return null!=(t=i.variables)&&t.length&&i.variables.forEach((e=>{var t;null!=(t=e.statistics)&&t.length&&e.statistics.forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation}))})),i}_fixScaleInServiceInfo(){const{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_fixGCSShift(e){const{extent:t,spatialReference:i}=e;0===t.xmin&&360===t.xmax&&i.wkid&&i.isGeographic&&(e.nativeExtent=e.extent,e.transform=new d,e.extent=e.transform.forwardTransform(t))}};e([r({type:String,json:{write:!0}})],S.prototype,"datasetFormat",void 0),e([r()],S.prototype,"tileType",void 0),S=e([n("esri.layers.support.rasterDatasets.ImageServerRaster")],S);const w=S;export{w 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/4.22/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../core/Error.js";import{isSome as i,isNone as s,unwrap as n}from"../../../core/maybe.js";import{isAbortError as o}from"../../../core/promiseUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import l from"../DimensionalDefinition.js";import{coordsReversedForWKID as c}from"../wmsUtils.js";import p from"./BaseRaster.js";import{parse as d}from"./multipartParser.js";import{parseCapabilities as h}from"./wcsCapabilitiesParser.js";import{standardizeInterpolations as u,parseCoverages as f}from"./wcsCoverageParser.js";import{clip as g}from"../rasterFunctions/pixelUtils.js";import m from"../../../geometry/Extent.js";const v=["nearest neighbor","bilinear","bicubic"],w=["nearest","linear","cubic"];let x=class extends p{constructor(){super(...arguments),this.datasetFormat="WCSServer"}async open(e){await this.init();const i=null==e?void 0:e.signal,s=await this._getCapabilities(i);if(this.capabilities=s,!this.version){var n;let e=null==(n=s.capabilitiesVersion)?void 0:n.slice(0,3);"2.0"===e||"1.1"===e||"1.0"===e?this.version=s.capabilitiesVersion:(e=s.supportedVersions.find((e=>"2.0.1"===e))||s.supportedVersions.find((e=>"2.0"===e.slice(0,3)))||s.supportedVersions.find((e=>"1.1"===e.slice(0,3)))||s.supportedVersions.find((e=>"1.0"===e.slice(0,3)))||"1.0.0",this.version=e)}null==this.coverageId&&(this.coverageId=s.coverages[0].id);const o=s.coverages.filter((e=>e.id===this.coverageId))[0];if(null==o)throw new t("wcsraster-open",`the coverageId ${this.coverageId} does not exist in capabilities`);const r=await this._describeCoverage(i);this.coverageInfo=r[0],"2.0"===this.version.slice(0,3)&&(this.coverageInfo.lonLatEnvelope=o.lonLatEnvelope,this.coverageInfo.supportedInterpolations=u(s.supportedInterpolations)),this.datasetName=this.coverageInfo.title;const{rasterInfo:a}=this.coverageInfo;if(this.createRemoteDatasetStorageInfo(a,512,512),this._set("rasterInfo",a),null==a.spatialReference)throw new t("wcsraster-open",`coverage without spatial referernce is not supported: ${this.coverageId}`);const{pixelType:l,bandCount:c}=await this._getPixelTypeAndBandCount(i);a.pixelType=l,1===a.bandCount&&c>1&&(a.bandCount=c),this.updateTileInfo()}async fetchRawTile(e,n,o,r={}){if(this.isBlockOutside(e,n,o))return null;const{nativePixelSize:a,spatialReference:l}=this.rasterInfo,c=2**e,p=a.x*c,d=a.y*c,{blockWidth:h,blockHeight:u}=this.getBlockWidthHeight(e),{origin:f}=this.rasterInfo.storageInfo.tileInfo,m=this.getTileExtent({x:p,y:d},n,o,f,l,[h,u]),v=this.rasterInfo.extent,w=m.xmax>v.xmax||m.ymin<v.ymin;let x=m,y=h,I=u;if(w&&(x=m.clone().intersection(v),i(x)&&(y=Math.floor((x.xmax-x.xmin)/p),I=Math.floor((x.ymax-x.ymin)/d),x.xmax=x.xmin+p*y,x.ymin=x.ymax-d*I)),s(x)||y<=1||I<=1)return null;const b=await this._getCoverage(x,y,I,c,r);if(!b)return null;const C=await this.decodePixelBlock(b,{width:y,height:I,planes:null,pixelType:null});if(C&&(C.width!==y||C.height!==I))throw new t("wcsraster-fetch",`the reponse has unexpected dimension width: ${C.width}, height: {pixelBlock.height}`);return w?g(C,{x:0,y:0},{width:u,height:u}):C}async _getCapabilities(e){const i={service:"WCS",request:"GetCapabilities"};this.version&&(i.version=this.version,i.acceptVersions=this.version);try{const{data:t}=await this.request(this.url,{query:i,responseType:"xml",signal:e});return h(t)}catch(s){if(!o(s))throw new t("wcslayer:open","wcs capabilities is not valid or supported");throw s}}async _describeCoverage(e){const i={service:"WCS",request:"DescribeCoverage",version:this.version},s=this.version.slice(0,3);"1.0"===s?i.coverage=this.coverageId:"1.1"===s?i.identifiers=this.coverageId:"2.0"===s&&(i.coverageId=this.coverageId);try{const{data:t}=await this.request(this.url,{query:i,responseType:"xml",signal:e});return f(t,this.version)}catch(n){if(!o(n))throw new t("wcslayer:open","wcs coverage description is not valid or supported");throw n}}async _getPixelTypeAndBandCount(e){const{pixelSize:s,extent:o,multidimensionalInfo:r}=this.rasterInfo,a=o.center,c=new m({xmin:a.x-s.x,xmax:a.x+s.x,ymin:a.y-s.y,ymax:a.y+s.y,spatialReference:o.spatialReference});let p;if(i(r)){const e=r.variables[0];p=[],e.dimensions.forEach((t=>{p.push(new l({variableName:e.name,dimensionName:t.name,values:t.hasRegularIntervals?t.extent[0]:t.values[0],isSlice:!0}))}))}const d=await this._getCoverage(c,2,2,1,{multidimensionalDefinition:p,signal:n(e)});if(!d)throw new t("wcsraster-open","unable to determine pixel type");const h=await this.decodePixelBlock(d,{width:2,height:2,planes:null,pixelType:null});return{pixelType:h.pixelType,bandCount:h.getPlaneCount()}}async _getCoverage(e,i,s,n,o){const{coverageDescription:r}=this.coverageInfo,{version:a}=r,l="2.0"===r.version?this._getCoverage201Parameters(e,i,s,n,o,r):"1.1"===r.version?this._getCoverage110Parameters(e,i,s,o,r):this._getCoverage100Parameters(e,i,s,o),c="2.0"===r.version?await this.request(this._constructWCS201Url(l),{signal:o.signal,responseType:"array-buffer"}):await this.request(this.url,{query:l,signal:o.signal,responseType:"array-buffer"});if("1.0"===a)return c.data;const p=d(c);if(p.isMultipart&&p.data){const e=p.data.filter((e=>{var t;return(null==(t=e.contentType)?void 0:t.toLowerCase().includes("image"))&&null!=e.contentData}))[0];return null==e?void 0:e.contentData}if(this.ioConfig.allowAnyMediaType)return c.data;throw new t("wcsraster:getcoverage","response is not a valid coverage, multipart response is expected")}_getInterpolationIndex(e){return-1===this.coverageInfo.supportedInterpolations.indexOf(e)||"nearest"===e?0:"bilinear"===e?1:"cubic"===e?2:0}_getCoverage100Parameters(e,t,i,s){const n=`${e.xmin},${e.ymin},${e.xmax},${e.ymax}`,o=e.spatialReference.wkid,r=(this.coverageInfo.supportedFormats||[]).find((e=>e.toLowerCase().indexOf("tiff")>-1))||"GEOTIFF",{bandIds:a,interpolation:l}=s,c=this._getInterpolationIndex(l),p=a?a.map((e=>this.coverageInfo.bandNames[e])):null,d=v[c];return{service:"WCS",request:"GetCoverage",version:this.version,coverage:this.coverageId,format:r,crs:`EPSG:${o}`,bbox:n,width:t,height:i,interpolation:d,band:null==p?void 0:p.join(",")}}_getCoverage110Parameters(e,t,i,s,n){var o;const{multidimensionalDefinition:r,bandIds:a,interpolation:l}=s,p=e.spatialReference.wkid,d=`urn:ogc:def:crs:EPSG::${p}`,h=(this.coverageInfo.supportedFormats||[]).find((e=>e.toLowerCase().indexOf("tiff")>-1))||"image/tiff",u=this._getInterpolationIndex(l),f=w[u],g=null==l||0===(null==(o=this.coverageInfo.supportedInterpolations)?void 0:o.indexOf(l)),m=n.domain.spatialDomain,v=m.origin.x<=m.envelope.xmin&&m.origin.y<=m.envelope.ymin,x=e.width/t,y=e.height/i*(v?1:-1),I=v?[e.xmin,e.ymin]:[e.xmin,e.ymax],b=m.useEPSGAxis&&c(p),C=b?`${I[1]},${I[0]}`:`${I[0]},${I[1]}`,$=b?`${y},0,0,${x}`:`${x},0,0,${y}`,S=x/2,j=e.xmin+S,T=e.xmax-S,_=Math.abs(y)/2,O=e.ymin+_,P=e.ymax-_,L=b?`${O},${j},${P},${T},${d}`:`${j},${O},${T},${P},${d}`,E=n.range.filter((e=>e.axis.some((e=>e.identifier.toLowerCase().indexOf("band")>-1))))[0];let R,q=E&&f&&a?g?`${E.identifier}[${E.axis[0].identifier}[${a.join(",")}]]`:`${E.identifier}:${f}[${E.axis[0].identifier}[${a.join(",")}]]`:null;if(null!=r&&r.length)for(let c=0;c<r.length;c++){let e=r[c].values;const t=r[c].dimensionName.toLowerCase(),i=r[c].variableName.toLowerCase();if(e.length>0)if(e[0]instanceof Array&&(e=e[0]),"stdtime"===t)R=e.map((e=>this._convertToISOTime(e))).join(",");else{const s=n.range.filter((e=>e.identifier.toLowerCase()===i))[0];if(s){const i=s.axis.filter((e=>e.identifier.toLowerCase()===t))[0];i&&(q=g?s.identifier+"["+i.identifier+"["+e.join(",")+"]]":s.identifier+":"+f+"["+i.identifier+"["+e.join(",")+"]]")}}}return{service:"WCS",request:"GetCoverage",version:this.version,identifier:this.coverageId,format:h,crs:`EPSG:${p}`,boundingbox:L,gridCS:"urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS",gridType:"urn:ogc:def:method:WCS:1.1:2dGridIn2dCrs",gridOrigin:C,gridOffsets:$,gridBaseCRS:d,timeSequence:R,rangeSubset:q}}_convertToISOTime(e,t=!1){return(t?new Date(24*(e-25569)*60*60*1e3):new Date(e)).toISOString()}_getCoverage201Parameters(e,t,i,s,n,o){const{multidimensionalDefinition:r,interpolation:a}=n,l=this._getInterpolationIndex(a);let c=null;const{supportedInterpolations:p}=this.capabilities;if(null!=p&&p.length)switch(l){case 0:c=p.find((e=>e.includes("nearest")));break;case 1:c=p.find((e=>e.includes("linear")));break;case 2:c=p.find((e=>e.includes("cubic")||e.includes("quadratic")))}const d=(this.coverageInfo.supportedFormats||[]).find((e=>e.toLowerCase().indexOf("tiff")>-1))||"image/tiff",{bandNames:h}=this.coverageInfo,{boundedBy:u,domainSet:f,rangeType:g}=o,m=u.isEastFirst?0:1,v=1-m,{axisLabels:w}=u,x=w[m],y=w[v],I=`http://www.opengis.net/def/crs/EPSG/0/${e.spatialReference.wkid}`,b=I,C=[];C.push(`${x}(${e.xmin},${e.xmax})`),C.push(`${y}(${e.ymin},${e.ymax})`);const $=[];if(w.length>2)for(let P=2;P<w.length;P++){const e=f.origin[P];if(w[P].toLowerCase().indexOf("time")>-1){let t=e.toString();u.uomLabels[P].toLowerCase().indexOf("ole")>-1&&($.push(w[P]),t=this._convertToISOTime(e,!0)),C.push(w[P]+",http://www.opengis.net("+t+")")}else C.push(w[P]+",http://www.opengis.net("+e+")")}let S=null;if(null!=r&&r.length){const e=[];g.forEach((t=>t.forEach((t=>e.push(t.name)))));const t=[];for(let i=0;i<r.length;i++){const s=w.find((e=>e===r[i].dimensionName)),n=e.find((e=>e===r[i].variableName));if(-1===t.indexOf(n)&&t.push(n),s){let e=r[i].values;if(e.length>0){Array.isArray(e[0])&&(e=e[0]);let t="";t=s.toLowerCase().indexOf("time")>-1?e.map((e=>this._convertToISOTime(e))).join(","):e.join(",");const i=C.findIndex((e=>0===e.indexOf(s+",http://www.opengis.net")));-1===i&&C.push(s+",http://www.opengis.net("+t+")"),-1!==i&&-1===C[i].indexOf("("+t+")")&&C.splice(i,1,s+",http://www.opengis.net("+t+")")}}}t.length&&(S=t.join(","))}else if(null!=h&&h.length){S=(n.bandIds?n.bandIds.map((e=>h[e])):h).join(",")}const j=C.join("&subset="),T=!(o.domainSet.axisLabels.join("")===o.boundedBy.axisLabels.join(""))&&!1!==this.ioConfig.allowScaleFactor,_=T?null:`${x}(${t}),${y}(${i})`,O=T?1/s:null;return{service:"WCS",request:"GetCoverage",version:this.version,coverageId:this.coverageId,rangesubset:S,interpolation:c,scaleSize:_,scaleFactor:O,subset:j,format:d,mediaType:this.ioConfig.allowAnyMediaType?null:"multipart/related",outputcrs:I,subsettingcrs:b}}_constructWCS201Url(e){const t={...this.ioConfig.customFetchParameters,...e},i=[];Object.keys(t).forEach((e=>{const s=t[e];null!=s&&("subset"===e?s.split("&subset=").forEach((e=>{e&&i.push(`subset=${encodeURIComponent(e)}`)})):i.push(`${e}=${encodeURIComponent(s)}`))}));return`${encodeURI(this.url)}?${i.join("&")}`}};e([r({type:String,json:{write:!0}})],x.prototype,"datasetFormat",void 0),e([r()],x.prototype,"tileType",void 0),e([r({type:String,json:{write:!0}})],x.prototype,"version",void 0),e([r({type:String,json:{write:!0}})],x.prototype,"coverageId",void 0),x=e([a("esri.layers.support.rasterDatasets.ImageServerRaster")],x);const y=x;export{y as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../core/Error.js";import{isSome as i,isNone as s,unwrap as n}from"../../../core/maybe.js";import{isAbortError as o}from"../../../core/promiseUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import l from"../DimensionalDefinition.js";import{coordsReversedForWKID as c}from"../wmsUtils.js";import p from"./BaseRaster.js";import{parse as d}from"./multipartParser.js";import{parseCapabilities as h}from"./wcsCapabilitiesParser.js";import{standardizeInterpolations as f,parseCoverages as u}from"./wcsCoverageParser.js";import{clip as g}from"../rasterFunctions/pixelUtils.js";import m from"../../../geometry/Extent.js";const v=["nearest neighbor","bilinear","bicubic"],w=["nearest","linear","cubic"];let x=class extends p{constructor(){super(...arguments),this.datasetFormat="WCSServer"}async open(e){await this.init();const i=null==e?void 0:e.signal,s=await this._getCapabilities(i);if(this.capabilities=s,!this.version){var n;let e=null==(n=s.capabilitiesVersion)?void 0:n.slice(0,3);"2.0"===e||"1.1"===e||"1.0"===e?this.version=s.capabilitiesVersion:(e=s.supportedVersions.find((e=>"2.0.1"===e))||s.supportedVersions.find((e=>"2.0"===e.slice(0,3)))||s.supportedVersions.find((e=>"1.1"===e.slice(0,3)))||s.supportedVersions.find((e=>"1.0"===e.slice(0,3)))||"1.0.0",this.version=e)}null==this.coverageId&&(this.coverageId=s.coverages[0].id);const o=s.coverages.filter((e=>e.id===this.coverageId))[0];if(null==o)throw new t("wcsraster-open",`the coverageId ${this.coverageId} does not exist in capabilities`);const r=await this._describeCoverage(i);this.coverageInfo=r[0],"2.0"===this.version.slice(0,3)&&(this.coverageInfo.lonLatEnvelope=o.lonLatEnvelope,this.coverageInfo.supportedInterpolations=f(s.supportedInterpolations)),this.datasetName=this.coverageInfo.title;const{rasterInfo:a}=this.coverageInfo;if(this.createRemoteDatasetStorageInfo(a,512,512),this._set("rasterInfo",a),null==a.spatialReference)throw new t("wcsraster-open",`coverage without spatial referernce is not supported: ${this.coverageId}`);const{pixelType:l,bandCount:c}=await this._getPixelTypeAndBandCount(i);a.pixelType=l,1===a.bandCount&&c>1&&(a.bandCount=c),this.updateTileInfo()}async fetchRawTile(e,n,o,r={}){if(this.isBlockOutside(e,n,o))return null;const{nativePixelSize:a,spatialReference:l}=this.rasterInfo,c=2**e,p=a.x*c,d=a.y*c,{blockWidth:h,blockHeight:f}=this.getBlockWidthHeight(e),{origin:u}=this.rasterInfo.storageInfo.tileInfo,m=this.getTileExtent({x:p,y:d},n,o,u,l,[h,f]),v=this.rasterInfo.extent,w=m.xmax>v.xmax||m.ymin<v.ymin;let x=m,y=h,I=f;if(w&&(x=m.clone().intersection(v),i(x)&&(y=Math.floor((x.xmax-x.xmin)/p),I=Math.floor((x.ymax-x.ymin)/d),x.xmax=x.xmin+p*y,x.ymin=x.ymax-d*I)),s(x)||y<=1||I<=1)return null;const b=await this._getCoverage(x,y,I,c,r);if(!b)return null;const C=await this.decodePixelBlock(b,{width:y,height:I,planes:null,pixelType:null});if(C&&(C.width!==y||C.height!==I))throw new t("wcsraster-fetch",`the reponse has unexpected dimension width: ${C.width}, height: {pixelBlock.height}`);return w?g(C,{x:0,y:0},{width:f,height:f}):C}async _getCapabilities(e){const i={service:"WCS",request:"GetCapabilities"};this.version&&(i.version=this.version,i.acceptVersions=this.version);try{const{data:t}=await this.request(this.url,{query:i,responseType:"xml",signal:e});return h(t)}catch(s){if(!o(s))throw new t("wcslayer:open","wcs capabilities is not valid or supported");throw s}}async _describeCoverage(e){const i={service:"WCS",request:"DescribeCoverage",version:this.version},s=this.version.slice(0,3);"1.0"===s?i.coverage=this.coverageId:"1.1"===s?i.identifiers=this.coverageId:"2.0"===s&&(i.coverageId=this.coverageId);try{const{data:t}=await this.request(this.url,{query:i,responseType:"xml",signal:e});return u(t,this.version)}catch(n){if(!o(n))throw new t("wcslayer:open","wcs coverage description is not valid or supported");throw n}}async _getPixelTypeAndBandCount(e){const{pixelSize:s,extent:o,multidimensionalInfo:r}=this.rasterInfo,a=o.center,c=new m({xmin:a.x-s.x,xmax:a.x+s.x,ymin:a.y-s.y,ymax:a.y+s.y,spatialReference:o.spatialReference});let p;if(i(r)){const e=r.variables[0];p=[],e.dimensions.forEach((t=>{p.push(new l({variableName:e.name,dimensionName:t.name,values:t.hasRegularIntervals?t.extent[0]:t.values[0],isSlice:!0}))}))}const d=await this._getCoverage(c,2,2,1,{multidimensionalDefinition:p,signal:n(e)});if(!d)throw new t("wcsraster-open","unable to determine pixel type");const h=await this.decodePixelBlock(d,{width:2,height:2,planes:null,pixelType:null});return{pixelType:h.pixelType,bandCount:h.getPlaneCount()}}async _getCoverage(e,i,s,n,o){const{coverageDescription:r}=this.coverageInfo,{version:a}=r,l="2.0"===r.version?this._getCoverage201Parameters(e,i,s,n,o,r):"1.1"===r.version?this._getCoverage110Parameters(e,i,s,o,r):this._getCoverage100Parameters(e,i,s,o),c="2.0"===r.version?await this.request(this._constructWCS201Url(l),{signal:o.signal,responseType:"array-buffer"}):await this.request(this.url,{query:l,signal:o.signal,responseType:"array-buffer"});if("1.0"===a)return c.data;const p=d(c);if(p.isMultipart&&p.data){const e=p.data.filter((e=>{var t;return(null==(t=e.contentType)?void 0:t.toLowerCase().includes("image"))&&null!=e.contentData}))[0];return null==e?void 0:e.contentData}if(this.ioConfig.allowAnyMediaType)return c.data;throw new t("wcsraster:getcoverage","response is not a valid coverage, multipart response is expected")}_getInterpolationIndex(e){return-1===this.coverageInfo.supportedInterpolations.indexOf(e)||"nearest"===e?0:"bilinear"===e?1:"cubic"===e?2:0}_getCoverage100Parameters(e,t,i,s){const n=`${e.xmin},${e.ymin},${e.xmax},${e.ymax}`,o=e.spatialReference.wkid,r=(this.coverageInfo.supportedFormats||[]).find((e=>e.toLowerCase().indexOf("tiff")>-1))||"GEOTIFF",{bandIds:a,interpolation:l}=s,c=this._getInterpolationIndex(l),p=a?a.map((e=>this.coverageInfo.bandNames[e])):null,d=v[c];return{service:"WCS",request:"GetCoverage",version:this.version,coverage:this.coverageId,format:r,crs:`EPSG:${o}`,bbox:n,width:t,height:i,interpolation:d,band:null==p?void 0:p.join(",")}}_getCoverage110Parameters(e,t,s,n,o){var r;const{multidimensionalDefinition:a,bandIds:l,interpolation:p}=n,d=e.spatialReference.wkid,h=`urn:ogc:def:crs:EPSG::${d}`,f=(this.coverageInfo.supportedFormats||[]).find((e=>e.toLowerCase().indexOf("tiff")>-1))||"image/tiff",u=this._getInterpolationIndex(p),g=w[u],m=null==p||0===(null==(r=this.coverageInfo.supportedInterpolations)?void 0:r.indexOf(p)),v=o.domain.spatialDomain,x=v.origin.x<=v.envelope.xmin&&v.origin.y<=v.envelope.ymin,y=e.width/t,I=e.height/s*(x?1:-1),b=x?[e.xmin,e.ymin]:[e.xmin,e.ymax],C=v.useEPSGAxis&&c(d),$=C?`${b[1]},${b[0]}`:`${b[0]},${b[1]}`,S=C?`${I},0,0,${y}`:`${y},0,0,${I}`,j=y/2,T=e.xmin+j,_=e.xmax-j,O=Math.abs(I)/2,P=e.ymin+O,L=e.ymax-O,E=C?`${P},${T},${L},${_},${h}`:`${T},${P},${_},${L},${h}`,R=o.range.filter((e=>e.axis.some((e=>e.identifier.toLowerCase().indexOf("band")>-1))))[0];let q,k=R&&g&&l?m?`${R.identifier}[${R.axis[0].identifier}[${l.join(",")}]]`:`${R.identifier}:${g}[${R.axis[0].identifier}[${l.join(",")}]]`:null;if(i(a)&&a.length)for(let i=0;i<a.length;i++){let e=a[i].values;const t=a[i].dimensionName.toLowerCase(),s=a[i].variableName.toLowerCase();if(e.length>0)if(e[0]instanceof Array&&(e=e[0]),"stdtime"===t)q=e.map((e=>this._convertToISOTime(e))).join(",");else{const i=o.range.filter((e=>e.identifier.toLowerCase()===s))[0];if(i){const s=i.axis.filter((e=>e.identifier.toLowerCase()===t))[0];s&&(k=m?i.identifier+"["+s.identifier+"["+e.join(",")+"]]":i.identifier+":"+g+"["+s.identifier+"["+e.join(",")+"]]")}}}return{service:"WCS",request:"GetCoverage",version:this.version,identifier:this.coverageId,format:f,crs:`EPSG:${d}`,boundingbox:E,gridCS:"urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS",gridType:"urn:ogc:def:method:WCS:1.1:2dGridIn2dCrs",gridOrigin:$,gridOffsets:S,gridBaseCRS:h,timeSequence:q,rangeSubset:k}}_convertToISOTime(e,t=!1){return(t?new Date(24*(e-25569)*60*60*1e3):new Date(e)).toISOString()}_getCoverage201Parameters(e,t,s,n,o,r){const{multidimensionalDefinition:a,interpolation:l}=o,c=this._getInterpolationIndex(l);let p=null;const{supportedInterpolations:d}=this.capabilities;if(null!=d&&d.length)switch(c){case 0:p=d.find((e=>e.includes("nearest")));break;case 1:p=d.find((e=>e.includes("linear")));break;case 2:p=d.find((e=>e.includes("cubic")||e.includes("quadratic")))}const h=(this.coverageInfo.supportedFormats||[]).find((e=>e.toLowerCase().indexOf("tiff")>-1))||"image/tiff",{bandNames:f}=this.coverageInfo,{boundedBy:u,domainSet:g,rangeType:m}=r,v=u.isEastFirst?0:1,w=1-v,{axisLabels:x}=u,y=x[v],I=x[w],b=`http://www.opengis.net/def/crs/EPSG/0/${e.spatialReference.wkid}`,C=b,$=[];$.push(`${y}(${e.xmin},${e.xmax})`),$.push(`${I}(${e.ymin},${e.ymax})`);const S=[];if(x.length>2)for(let i=2;i<x.length;i++){const e=g.origin[i];if(x[i].toLowerCase().indexOf("time")>-1){let t=e.toString();u.uomLabels[i].toLowerCase().indexOf("ole")>-1&&(S.push(x[i]),t=this._convertToISOTime(e,!0)),$.push(x[i]+",http://www.opengis.net("+t+")")}else $.push(x[i]+",http://www.opengis.net("+e+")")}let j=null;if(i(a)&&a.length){const e=[];m.forEach((t=>t.forEach((t=>e.push(t.name)))));const t=[];for(let i=0;i<a.length;i++){const s=x.find((e=>e===a[i].dimensionName)),n=e.find((e=>e===a[i].variableName));if(-1===t.indexOf(n)&&t.push(n),s){let e=a[i].values;if(e.length>0){Array.isArray(e[0])&&(e=e[0]);let t="";t=s.toLowerCase().indexOf("time")>-1?e.map((e=>this._convertToISOTime(e))).join(","):e.join(",");const i=$.findIndex((e=>0===e.indexOf(s+",http://www.opengis.net")));-1===i&&$.push(s+",http://www.opengis.net("+t+")"),-1!==i&&-1===$[i].indexOf("("+t+")")&&$.splice(i,1,s+",http://www.opengis.net("+t+")")}}}t.length&&(j=t.join(","))}else if(null!=f&&f.length){j=(o.bandIds?o.bandIds.map((e=>f[e])):f).join(",")}const T=$.join("&subset="),_=!(r.domainSet.axisLabels.join("")===r.boundedBy.axisLabels.join(""))&&!1!==this.ioConfig.allowScaleFactor,O=_?null:`${y}(${t}),${I}(${s})`,P=_?1/n:null;return{service:"WCS",request:"GetCoverage",version:this.version,coverageId:this.coverageId,rangesubset:j,interpolation:p,scaleSize:O,scaleFactor:P,subset:T,format:h,mediaType:this.ioConfig.allowAnyMediaType?null:"multipart/related",outputcrs:b,subsettingcrs:C}}_constructWCS201Url(e){const t={...this.ioConfig.customFetchParameters,...e},i=[];Object.keys(t).forEach((e=>{const s=t[e];null!=s&&("subset"===e?s.split("&subset=").forEach((e=>{e&&i.push(`subset=${encodeURIComponent(e)}`)})):i.push(`${e}=${encodeURIComponent(s)}`))}));return`${encodeURI(this.url)}?${i.join("&")}`}};e([r({type:String,json:{write:!0}})],x.prototype,"datasetFormat",void 0),e([r()],x.prototype,"tileType",void 0),e([r({type:String,json:{write:!0}})],x.prototype,"version",void 0),e([r({type:String,json:{write:!0}})],x.prototype,"coverageId",void 0),x=e([a("esri.layers.support.rasterDatasets.ImageServerRaster")],x);const y=x;export{y 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/4.22/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as t,isNone as e}from"../../../core/maybe.js";import n from"../PixelBlock.js";function i(e){return t(e)&&"esri.layers.support.PixelBlock"===e.declaredClass&&e.pixels&&e.pixels.length>0}function l(t,e){if(null==e||!e.length||!i(t))return t;const l=t.pixels.length;return e&&e.some((t=>t>=l))||1===l&&1===e.length&&0===e[0]?t:l!==e.length||e.some(((t,e)=>t!==e))?new n({pixelType:t.pixelType,width:t.width,height:t.height,mask:t.mask,validPixelCount:t.validPixelCount,maskIsAlpha:t.maskIsAlpha,pixels:e.map((e=>t.pixels[e])),statistics:t.statistics&&e.map((e=>t.statistics[e]))}):t}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]));let i=0;n[0][0]<0&&(i=n[0][0]);const l=Math.max(256,n[n.length-1][0]-i+1),r=new Uint8Array(4*l),o=[];let s,a=0,f=0;const h=5===n[0].length;if(l>65536)return n.forEach((t=>{o[t[0]-i]=h?t.slice(1):t.slice(1).concat([255])})),{indexed2DColormap:o,offset:i,alphaSpecified:h};if(t.fillUnspecified)for(s=n[f],a=s[0]-i;a<l;a++)r[4*a]=s[1],r[4*a+1]=s[2],r[4*a+2]=s[3],r[4*a+3]=h?s[4]:255,a===s[0]-i&&(s=f===n.length-1?s:n[++f]);else for(a=0;a<n.length;a++)s=n[a],f=4*(s[0]-i),r[f]=s[1],r[f+1]=s[2],r[f+2]=s[3],r[f+3]=h?s[4]:255;return{indexedColormap:r,offset:i,alphaSpecified:h}}function o(t,e){if(!i(t))return t;if(!e&&(e.indexedColormap||e.indexed2DColormap))return t;const n=t.clone(),l=n.pixels;let r=n.mask;const o=n.width*n.height;if(1!==l.length)return t;const{indexedColormap:s,indexed2DColormap:a,offset:f,alphaSpecified:h}=e,u=s.length-1;let c=0;const x=l[0],m=new Uint8Array(x.length),p=new Uint8Array(x.length),d=new Uint8Array(x.length);let g,y=0;if(s)if(r)for(c=0;c<o;c++)r[c]&&(y=4*(x[c]-f),y<f||y>u?r[c]=0:(m[c]=s[y],p[c]=s[y+1],d[c]=s[y+2],r[c]=s[y+3]));else{for(r=new Uint8Array(o),c=0;c<o;c++)y=4*(x[c]-f),y<f||y>u?r[c]=0:(m[c]=s[y],p[c]=s[y+1],d[c]=s[y+2],r[c]=s[y+3]);n.mask=r}else if(r)for(c=0;c<o;c++)r[c]&&(g=a[x[c]],m[c]=g[0],p[c]=g[1],d[c]=g[2],r[c]=g[3]);else{for(r=new Uint8Array(o),c=0;c<o;c++)g=a[x[c]],m[c]=g[0],p[c]=g[1],d[c]=g[2],r[c]=g[3];n.mask=r}return n.pixels=[m,p,d],n.statistics=null,n.pixelType="u8",n.maskIsAlpha=h,n}function s(t){if(!i(t))return null;t.statistics||t.updateStatistics();const{pixels:e,mask:n,pixelType:l,statistics:r}=t,o=t.width*t.height,s=e.length;let a,f,h,u,c;const x=[],m=[];let p,d,g,y,w,M,k,A,U,C;const T=256;for(u=0;u<s;u++){if(p=new Uint32Array(T),g=e[u],"u8"===l)if(a=-.5,f=255.5,n)for(c=0;c<o;c++)n[c]&&p[g[c]]++;else for(c=0;c<o;c++)p[g[c]]++;else{if(a=r[u].minValue,f=r[u].maxValue,h=(f-a)/T,d=new Uint32Array(T+1),n)for(c=0;c<o;c++)n[c]&&d[Math.floor((g[c]-a)/h)]++;else for(c=0;c<o;c++)d[Math.floor((g[c]-a)/h)]++;for(c=0;c<255;c++)p[c]=d[c];p[255]=d[255]+d[256]}for(x.push({min:a,max:f,size:T,counts:p}),y=0,w=0,A=0,c=0;c<T;c++)y+=p[c],w+=c*p[c];for(U=w/y,c=0;c<T;c++)A+=p[c]*(c-U)**2;C=Math.sqrt(A/(y-1)),h=(f-a)/T,M=(U+.5)*h+a,k=C*h,m.push({min:a,max:f,avg:M,stddev:k})}return{statistics:m,histograms:x}}function a(t){const e=[];for(let n=0;n<t.length;n++){const{min:i,max:l,size:r,counts:o}=t[n];let s=0,a=0;for(let t=0;t<r;t++)s+=o[t],a+=t*o[t];const f=a/s;let h=0;for(let t=0;t<r;t++)h+=o[t]*(t-f)**2;const u=(l-i)/r,c=(f+.5)*u+i,x=Math.sqrt(h/(s-1))*u;e.push({min:i,max:l,avg:c,stddev:x})}return e}function f(t){const{minCutOff:e,maxCutOff:n,gamma:i,pixelType:l}=t,r=t.outMin||0,o=t.outMax||255;if(-1===["u8","u16","s8","s16"].indexOf(l))return null;const s=e.length;let a,f,u=0;"s8"===l?u=-127:"s16"===l&&(u=-32767);let c=256;["u16","s16"].indexOf(l)>-1&&(c=65536);const x=[],m=[],p=o-r;for(a=0;a<s;a++)m[a]=n[a]-e[a],x[a]=p/(n[a]-e[a]);const d=i&&i.length>=s,g=[];if(d)for(a=0;a<s;a++)i[a]>1?i[a]>2?g[a]=6.5+(i[a]-2)**2.5:g[a]=6.5+100*(2-i[a])**4:g[a]=1;let y;const w=[];let M,k,A;if(d)for(a=0;a<s;a++){for(A=[],f=0;f<c;f++)M=f+u,y=(M-e[a])/m[a],k=1,i[a]>1&&(k-=(1/p)**(y*g[a])),M<n[a]&&M>e[a]?A[f]=Math.floor(k*p*y**(1/i[a]))+r:M>=n[a]?A[f]=o:A[f]=r;w[a]=A}else for(a=0;a<s;a++){for(A=[],f=0;f<c;f++)M=f+u,M<=e[a]?A[f]=r:M>=n[a]?A[f]=o:A[f]=Math.floor((M-e[a])/m[a]*p)+r;w[a]=A}if(null!=t.contrastOffset){const e=h(t.contrastOffset,t.brightnessOffset);for(a=0;a<s;a++)for(A=w[a],f=0;f<c;f++)A[f]=e[A[f]]}return{lut:w,offset:u}}function h(t,e){const n=Math.min(Math.max(t,-100),100),i=Math.min(Math.max(e,-100),100),l=255,r=128;let o,s;const a=new Uint8Array(256);for(o=0;o<256;o++)n>0&&n<100?s=(200*o-100*l+2*l*i)/(2*(100-n))+r:n<=0&&n>-100?s=(200*o-100*l+2*l*i)*(100+n)/2e4+r:100===n?(s=200*o-100*l+(l+1)*(100-n)+2*l*i,s=s>0?l:0):-100===n&&(s=r),a[o]=s>l?l:s<0?0:s;return a}function u(t,e=256){e=Math.min(e,256);const{size:n,counts:i}=t,l=new Uint8Array(n),r=i.reduce(((t,n)=>t+n/e),0);let o=0,s=0,a=0,f=r;for(let h=0;h<n;h++)if(a+=i[h],!(h<n-1&&a+i[h+1]<f)){for(;o<e-1&&f<a;)o++,f+=r;for(let t=s;t<=h;t++)l[t]=o;s=h+1}for(let h=s;h<n;h++)l[h]=e-1;return l}function c(t,e){if(!i(t))return null;const n=t.clone(),{pixels:l,mask:r}=n,{minCutOff:o,maxCutOff:s,gamma:a}=e,f=e.outMin||0,h=e.outMax||255,u=n.width*n.height,c=l.length;let x,m,p,d,g;const y=h-f,w=[],M=[];for(x=0;x<c;x++)M[x]=s[x]-o[x],w[x]=y/(s[x]-o[x]);const k=a&&a.length>=c,A=[];if(k)for(x=0;x<c;x++)a[x]>1?a[x]>2?A[x]=6.5+(a[x]-2)**2.5:A[x]=6.5+100*(2-a[x])**4:A[x]=1;if(k)if(null!=r){for(m=0;m<u;m++)if(r[m])for(x=0;x<c;x++)p=l[x][m],g=(p-o[x])/M[x],d=1,a[x]>1&&(d-=(1/y)**(g*A[x])),p<s[x]&&p>o[x]?l[x][m]=Math.floor(d*y*g**(1/a[x]))+f:p>=s[x]?l[x][m]=h:l[x][m]=f}else for(m=0;m<u;m++)for(x=0;x<c;x++)p=l[x][m],g=(p-o[x])/M[x],d=1,a[x]>1&&(d-=(1/y)**(g*A[x])),p<s[x]&&p>o[x]?l[x][m]=Math.floor(d*y*g**(1/a[x]))+f:p>=s[x]?l[x][m]=h:l[x][m]=f;else if(null!=r){for(m=0;m<u;m++)if(r[m])for(x=0;x<c;x++)p=l[x][m],p<s[x]&&p>o[x]?l[x][m]=Math.floor((p-o[x])/M[x]*y)+f:p>=s[x]?l[x][m]=h:l[x][m]=f}else for(m=0;m<u;m++)for(x=0;x<c;x++)p=l[x][m],p<s[x]&&p>o[x]?l[x][m]=Math.floor((p-o[x])/M[x]*y)+f:p>=s[x]?l[x][m]=h:l[x][m]=f;return n.pixelType="u8",n.updateStatistics(),n}function x(t,e){if(!i(t))return null;const{pixels:l,mask:r}=t,o=t.width*t.height,s=l.length;let a=e.lut;const{offset:f}=e;let h,u;a&&1===a[0].length&&(a=l.map((()=>a)));const c=[];let x,m,p;if(f)if(null==r)for(h=0;h<s;h++){for(x=l[h],m=a[h],p=new Uint8Array(o),u=0;u<o;u++)p[u]=m[x[u]-f];c.push(p)}else for(h=0;h<s;h++){for(x=l[h],m=a[h],p=new Uint8Array(o),u=0;u<o;u++)r[u]&&(p[u]=m[x[u]-f]);c.push(p)}else if(null==r)for(h=0;h<s;h++){for(x=l[h],m=a[h],p=new Uint8Array(o),u=0;u<o;u++)p[u]=m[x[u]];c.push(p)}else for(h=0;h<s;h++){for(x=l[h],m=a[h],p=new Uint8Array(o),u=0;u<o;u++)r[u]&&(p[u]=m[x[u]]);c.push(p)}const d=new n({width:t.width,height:t.height,pixels:c,mask:r,pixelType:"u8"});return d.updateStatistics(),d}function m(t,e){if(!i(t))return null;const n=t.clone(),{pixels:l}=n,r=n.width*n.height,o=e.length,s=Math.floor(o/2),a=e[Math.floor(s)],f=l[0];let h,u,c,x,m,p,d=!1;const g=new Uint8Array(r),y=new Uint8Array(r),w=new Uint8Array(r);let M=n.mask;const k=4===e[0].mappedColor.length;for(M||(M=new Uint8Array(r),M.fill(k?255:1),n.mask=M),m=0;m<r;m++)if(M[m]){for(h=f[m],d=!1,p=s,u=a,c=0,x=o-1;x-c>1;){if(h===u.value){d=!0;break}h>u.value?c=p:x=p,p=Math.floor((c+x)/2),u=e[Math.floor(p)]}d||(h===e[c].value?(u=e[c],d=!0):h===e[x].value?(u=e[x],d=!0):h<e[c].value?(d=!1,u=null):h>e[c].value&&(h<e[x].value?(u=e[c],d=!0):x===o-1?(d=!1,u=null):(u=e[x],d=!0))),d?(g[m]=u.mappedColor[0],y[m]=u.mappedColor[1],w[m]=u.mappedColor[2],M[m]=u.mappedColor[3]):g[m]=y[m]=w[m]=M[m]=0}return n.pixels=[g,y,w],n.mask=M,n.pixelType="u8",n.maskIsAlpha=k,n}function p(t,e,n,i,l,r,o,s){return{xmin:l<=n*t?0:l<n*t+t?l-n*t:t,ymin:r<=i*e?0:r<i*e+e?r-i*e:e,xmax:l+o<=n*t?0:l+o<n*t+t?l+o-n*t:t,ymax:r+s<=i*e?0:r+s<i*e+e?r+s-i*e:e}}function d(t,n){if(!t||0===t.length)return null;const i=t.filter((t=>t.pixelBlock))[0];if(!i||e(i.pixelBlock))return null;const l=(i.extent.xmax-i.extent.xmin)/i.pixelBlock.width,r=(i.extent.ymax-i.extent.ymin)/i.pixelBlock.height,o=.01*Math.min(l,r),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)),a=Math.min.apply(null,s.map((t=>t.extent.xmin))),f=Math.min.apply(null,s.map((t=>t.extent.ymin))),h=Math.max.apply(null,s.map((t=>t.extent.xmax))),u=Math.max.apply(null,s.map((t=>t.extent.ymax))),c={x:Math.round((n.xmin-a)/l),y:Math.round((u-n.ymax)/r)},x={width:Math.round((h-a)/l),height:Math.round((u-f)/r)},m={width:Math.round((n.xmax-n.xmin)/l),height:Math.round((n.ymax-n.ymin)/r)};if(Math.round(x.width/i.pixelBlock.width)*Math.round(x.height/i.pixelBlock.height)!==s.length||c.x<0||c.y<0||x.width<m.width||x.height<m.height)return null;return{extent:n,pixelBlock:y(s.map((t=>t.pixelBlock)),x,c,m)}}function g(t,e,n,i,l,r){const{width:o,height:s}=n.block,{x:a,y:f}=n.offset,{width:h,height:u}=n.mosaic,c=p(o,s,i,l,a,f,h,u);let x=0,m=0;if(r){const t=r.hasGCSSShiftTransform?360:r.halfWorldWidth,e=o*r.resolutionX,n=r.startX+i*e,l=n+e;n<t&&l>t?m=r.rightPadding:n>=t&&(x=r.leftMargin-r.rightPadding,m=0)}if(c.xmax-=m,"number"!=typeof e)for(let p=c.ymin;p<c.ymax;p++){const n=(l*s+p-f)*h+(i*o-a)+x,r=p*o;for(let i=c.xmin;i<c.xmax;i++)t[n+i]=e[r+i]}else for(let p=c.ymin;p<c.ymax;p++){const n=(l*s+p-f)*h+(i*o-a)+x;for(let i=c.xmin;i<c.xmax;i++)t[n+i]=e}}function y(l,r,o,s,a){const f=l.filter((t=>i(t)))[0];if(e(f))return null;const h=s?s.width:r.width,u=s?s.height:r.height,c=f.width,x=f.height,m=r.width/c,p=r.height/x,d={offset:o||{x:0,y:0},mosaic:s||r,block:{width:c,height:x}},y=f.pixelType,w=n.getPixelArrayConstructor(y),M=f.pixels.length,k=[];let A,U;for(let t=0;t<M;t++){U=new w(h*u);for(let e=0;e<p;e++)for(let n=0;n<m;n++){const r=l[e*m+n];i(r)&&(A=r.pixels[t],g(U,A,d,n,e,a))}k.push(U)}let C;if(l.some((t=>e(t)||t.mask&&t.mask.length>0))){C=new Uint8Array(h*u);for(let e=0;e<p;e++)for(let n=0;n<m;n++){const i=l[e*m+n],r=t(i)?i.mask:null;g(C,r||(i?1:0),d,n,e,a)}}const T=new n({width:h,height:u,pixels:k,pixelType:y,mask:C});return T.updateStatistics(),T}function w(t,e,n){if(!i(t))return null;const{width:l,height:r}=t,o=e.x,s=e.y,a=n.width+o,f=n.height+s;if(o<0||s<0||a>l||f>r)return t;if(0===o&&0===s&&a===l&&f===r)return t;t.mask||(t.mask=new Uint8Array(l*r));const h=t.mask;for(let i=0;i<r;i++){const t=i*l;for(let e=0;e<l;e++)h[t+e]=i<s||i>=f||e<o||e>=a?0:1}return t.updateStatistics(),t}function M(t){if(!i(t))return null;const e=t.clone(),{width:n,height:l,pixels:r,mask:o}=t,s=r[0],a=e.pixels[0];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;U(t,s[i],o?o[i]:1)}a[i*n]=k(t),a[i*n+1]=a[i*n+2]=a[i*n];let e=3;for(;e<n-1;e++){let l=(i-2)*n+e+1;U(t,s[l],o?o[l]:1),l=(i-1)*n+e+1,U(t,s[l],o?o[l]:1),l=i*n+e+1,U(t,s[l],o?o[l]:1),l=(i+1)*n+e+1,U(t,s[l],o?o[l]:1),l=(i-2)*n+e-3,A(t,s[l],o?o[l]:1),l=(i-1)*n+e-3,A(t,s[l],o?o[l]:1),l=i*n+e-3,A(t,s[l],o?o[l]:1),l=(i+1)*n+e-3,A(t,s[l],o?o[l]:1),a[i*n+e]=k(t)}a[i*n+e+1]=a[i*n+e]}for(let i=0;i<n;i++)a[i]=a[n+i]=a[2*n+i],a[(l-1)*n+i]=a[(l-2)*n+i];return e.updateStatistics(),e}function k(t){if(0===t.size)return 0;let e=0,n=-1,i=0;const l=t.keys();let r=l.next();for(;!r.done;)i=t.get(r.value),i>e&&(n=r.value,e=i),r=l.next();return n}function A(t,e,n){if(0===n)return;const i=t.get(e);1===i?t.delete(e):t.set(e,i-1)}function U(t,e,n){0!==n&&t.set(e,t.has(e)?t.get(e)+1:1)}function C(t,e,l){let{x:r,y:o}=e;const{width:s,height:a}=l;if(0===r&&0===o&&a===t.height&&s===t.width)return t;const{width:f,height:h}=t,u=Math.max(0,o),c=Math.max(0,r),x=Math.min(r+s,f),m=Math.min(o+a,h);if(x<0||m<0||!i(t))return null;r=Math.max(0,-r),o=Math.max(0,-o);const{pixels:p,mask:d}=t,g=s*a,y=p.length,w=[];for(let i=0;i<y;i++){const e=p[i],l=n.createEmptyBand(t.pixelType,g);for(let t=u;t<m;t++){const n=t*f;let i=(t+o-u)*s+r;for(let t=c;t<x;t++)l[i++]=e[n+t]}w.push(l)}const M=new Uint8Array(g);for(let n=u;n<m;n++){const t=n*f;let e=(n+o-u)*s+r;for(let n=c;n<x;n++)M[e++]=d?d[t+n]:1}const k=new n({width:l.width,height:l.height,pixelType:t.pixelType,pixels:w,mask:M});return k.updateStatistics(),k}function T(t,e=!0){if(!i(t))return null;const{pixels:l,width:r,height:o,mask:s,pixelType:a}=t,f=[],h=Math.round(r/2),u=Math.round(o/2),c=o-1,x=r-1;for(let i=0;i<l.length;i++){const t=l[i],s=n.createEmptyBand(a,h*u);let m=0;for(let n=0;n<o;n+=2)for(let i=0;i<r;i+=2){const l=t[n*r+i];if(e){const e=i===x?l:t[n*r+i+1],o=n===c?l:t[n*r+i+r],a=i===x?o:n===c?e:t[n*r+i+r+1];s[m++]=(l+e+o+a)/4}else s[m++]=l}f.push(s)}let m=null;if(s){m=new Uint8Array(h*u);let t=0;for(let n=0;n<o;n+=2)for(let i=0;i<r;i+=2){const l=s[n*r+i];if(e){const e=i===x?l:s[n*r+i+1],o=n===c?l:s[n*r+i+r],a=i===x?o:n===c?e:s[n*r+i+r+1];m[t++]=l*e*o*a?1:0}else m[t++]=l}}return new n({width:h,height:u,pixelType:a,pixels:f,mask:m})}function v(t,e,n){if(!i(t))return null;const{width:l,height:r}=e;let{width:o,height:s}=t;const a=new Map,f={x:0,y:0},h=null==n?1:1+n;let u=t;for(let i=0;i<h;i++){const t=Math.ceil(o/l),n=Math.ceil(s/r);for(let o=0;o<n;o++){f.y=o*r;for(let n=0;n<t;n++){f.x=n*l;const t=C(u,f,e);a.set(`${i}/${o}/${n}`,t)}}i<h-1&&(u=T(u)),o=Math.round(o/2),s=Math.round(s/2)}return a}function S(t,e,l,r,o="nearest"){if(!i(t))return null;"majority"===o&&(t=M(t));const{pixels:s,mask:a,pixelType:f}=t,h=t.width,u=t.height,c=n.getPixelArrayConstructor(f),x=s.length,{width:m,height:p}=e,d=r.cols,g=r.rows,y=Math.ceil(m/d-.1/d),w=Math.ceil(p/g-.1/g);let k,A,U,C,T,v,S,B=!1;for(let n=0;n<l.length;n+=3)-1===l[n]&&-1===l[n+1]&&-1===l[n+2]&&(B=!0);const O=y*d,b=O*w*g,P=new Float32Array(b),j=new Float32Array(b);let z,I,D=0;const E="majority"===o?0:.5;for(let n=0;n<w;n++)for(let t=0;t<y;t++){k=12*(n*y+t),A=l[k],U=l[k+1],C=l[k+2],T=l[k+3],v=l[k+4],S=l[k+5];for(let e=0;e<g;e++){D=(n*g+e)*O+t*d,I=(e+.5)/g;for(let t=0;t<e;t++)z=(t+.5)/d,P[D+t]=Math.round((A*z+U*I+C)*h-E),j[D+t]=Math.round((T*z+v*I+S)*u-E)}k+=6,A=l[k],U=l[k+1],C=l[k+2],T=l[k+3],v=l[k+4],S=l[k+5];for(let e=0;e<g;e++){D=(n*g+e)*O+t*d,I=(e+.5)/g;for(let t=e;t<d;t++)z=(t+.5)/d,P[D+t]=Math.round((A*z+U*I+C)*h-E),j[D+t]=Math.round((T*z+v*I+S)*u-E)}}const $=(t,e)=>{for(let n=0;n<p;n++){k=n*O;for(let i=0;i<m;i++)P[k]<0||j[k]<0?t[n*m+i]=0:t[n*m+i]=e[P[k]+j[k]*h],k++}},q=[];let F;for(let n=0;n<x;n++)F=new c(m*p),$(F,s[n]),q.push(F);const V=new n({width:m,height:p,pixelType:f,pixels:q});if(a)V.mask=new Uint8Array(m*p),$(V.mask,a);else if(B){V.mask=new Uint8Array(m*p);for(let t=0;t<m*p;t++)V.mask[t]=P[t]<0||j[t]<0?0:1}return V.updateStatistics(),V}export{S as approximateTransform,C as clip,o as colorize,r as createColormapLUT,h as createContrastBrightnessLUT,u as createHistogramEqualizationLUT,f as createStretchLUT,a as estimateStatisticsFromHistograms,s as estimateStatisticsHistograms,l as extractBands,p as getClipBounds,i as isValidPixelBlock,x as lookupPixels,y as mosaic,d as mosaicPixelData,m as remapColor,M as resampleByMajority,w as setValidBoundary,v as split,c as stretch};
|
|
5
|
+
import{isSome as t,isNone as e}from"../../../core/maybe.js";import n from"../PixelBlock.js";function i(e){return t(e)&&"esri.layers.support.PixelBlock"===e.declaredClass&&e.pixels&&e.pixels.length>0}function l(t,e){if(null==e||!e.length||!i(t))return t;const l=t.pixels.length;return e&&e.some((t=>t>=l))||1===l&&1===e.length&&0===e[0]?t:l!==e.length||e.some(((t,e)=>t!==e))?new n({pixelType:t.pixelType,width:t.width,height:t.height,mask:t.mask,validPixelCount:t.validPixelCount,maskIsAlpha:t.maskIsAlpha,pixels:e.map((e=>t.pixels[e])),statistics:t.statistics&&e.map((e=>t.statistics[e]))}):t}function o(t){if(!t)return;const e=t.colormap;if(!e||0===e.length)return;const n=e.sort(((t,e)=>t[0]-e[0]));let i=0;n[0][0]<0&&(i=n[0][0]);const l=Math.max(256,n[n.length-1][0]-i+1),o=new Uint8Array(4*l),r=[];let s,a=0,f=0;const h=5===n[0].length;if(l>65536)return n.forEach((t=>{r[t[0]-i]=h?t.slice(1):t.slice(1).concat([255])})),{indexed2DColormap:r,offset:i,alphaSpecified:h};if(t.fillUnspecified)for(s=n[f],a=s[0]-i;a<l;a++)o[4*a]=s[1],o[4*a+1]=s[2],o[4*a+2]=s[3],o[4*a+3]=h?s[4]:255,a===s[0]-i&&(s=f===n.length-1?s:n[++f]);else for(a=0;a<n.length;a++)s=n[a],f=4*(s[0]-i),o[f]=s[1],o[f+1]=s[2],o[f+2]=s[3],o[f+3]=h?s[4]:255;return{indexedColormap:o,offset:i,alphaSpecified:h}}function r(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 r=n.width*n.height;if(1!==l.length)return t;const{indexedColormap:s,indexed2DColormap:a,offset:f,alphaSpecified:h}=e,u=s.length-1;let c=0;const p=l[0],x=new Uint8Array(p.length),m=new Uint8Array(p.length),d=new Uint8Array(p.length);let g,y=0;if(s)if(o)for(c=0;c<r;c++)o[c]&&(y=4*(p[c]-f),y<f||y>u?o[c]=0:(x[c]=s[y],m[c]=s[y+1],d[c]=s[y+2],o[c]=s[y+3]));else{for(o=new Uint8Array(r),c=0;c<r;c++)y=4*(p[c]-f),y<f||y>u?o[c]=0:(x[c]=s[y],m[c]=s[y+1],d[c]=s[y+2],o[c]=s[y+3]);n.mask=o}else if(o)for(c=0;c<r;c++)o[c]&&(g=a[p[c]],x[c]=g[0],m[c]=g[1],d[c]=g[2],o[c]=g[3]);else{for(o=new Uint8Array(r),c=0;c<r;c++)g=a[p[c]],x[c]=g[0],m[c]=g[1],d[c]=g[2],o[c]=g[3];n.mask=o}return n.pixels=[x,m,d],n.statistics=null,n.pixelType="u8",n.maskIsAlpha=h,n}function s(t){if(!i(t))return null;t.statistics||t.updateStatistics();const{pixels:e,mask:n,pixelType:l,statistics:o}=t,r=t.width*t.height,s=e.length;let a,f,h,u,c;const p=[],x=[];let m,d,g,y,w,M,k,A,U,C;const T=256;for(u=0;u<s;u++){if(m=new Uint32Array(T),g=e[u],"u8"===l)if(a=-.5,f=255.5,n)for(c=0;c<r;c++)n[c]&&m[g[c]]++;else for(c=0;c<r;c++)m[g[c]]++;else{if(a=o[u].minValue,f=o[u].maxValue,h=(f-a)/T,d=new Uint32Array(T+1),n)for(c=0;c<r;c++)n[c]&&d[Math.floor((g[c]-a)/h)]++;else for(c=0;c<r;c++)d[Math.floor((g[c]-a)/h)]++;for(c=0;c<255;c++)m[c]=d[c];m[255]=d[255]+d[256]}for(p.push({min:a,max:f,size:T,counts:m}),y=0,w=0,A=0,c=0;c<T;c++)y+=m[c],w+=c*m[c];for(U=w/y,c=0;c<T;c++)A+=m[c]*(c-U)**2;C=Math.sqrt(A/(y-1)),h=(f-a)/T,M=(U+.5)*h+a,k=C*h,x.push({min:a,max:f,avg:M,stddev:k})}return{statistics:x,histograms:p}}function a(t){const e=[];for(let n=0;n<t.length;n++){const{min:i,max:l,size:o,counts:r}=t[n];let s=0,a=0;for(let t=0;t<o;t++)s+=r[t],a+=t*r[t];const f=a/s;let h=0;for(let t=0;t<o;t++)h+=r[t]*(t-f)**2;const u=(l-i)/o,c=(f+.5)*u+i,p=Math.sqrt(h/(s-1))*u;e.push({min:i,max:l,avg:c,stddev:p})}return e}function f(t){const{minCutOff:e,maxCutOff:n,gamma:i,pixelType:l}=t,o=t.outMin||0,r=t.outMax||255;if(-1===["u8","u16","s8","s16"].indexOf(l))return null;const s=e.length;let a,f,u=0;"s8"===l?u=-127:"s16"===l&&(u=-32767);let c=256;["u16","s16"].indexOf(l)>-1&&(c=65536);const p=[],x=[],m=r-o;for(a=0;a<s;a++)x[a]=n[a]-e[a],p[a]=m/(n[a]-e[a]);const d=i&&i.length>=s,g=[];if(d)for(a=0;a<s;a++)i[a]>1?i[a]>2?g[a]=6.5+(i[a]-2)**2.5:g[a]=6.5+100*(2-i[a])**4:g[a]=1;let y;const w=[];let M,k,A;if(d)for(a=0;a<s;a++){for(A=[],f=0;f<c;f++)M=f+u,y=(M-e[a])/x[a],k=1,i[a]>1&&(k-=(1/m)**(y*g[a])),M<n[a]&&M>e[a]?A[f]=Math.floor(k*m*y**(1/i[a]))+o:M>=n[a]?A[f]=r:A[f]=o;w[a]=A}else for(a=0;a<s;a++){for(A=[],f=0;f<c;f++)M=f+u,M<=e[a]?A[f]=o:M>=n[a]?A[f]=r:A[f]=Math.floor((M-e[a])/x[a]*m)+o;w[a]=A}if(null!=t.contrastOffset){const e=h(t.contrastOffset,t.brightnessOffset);for(a=0;a<s;a++)for(A=w[a],f=0;f<c;f++)A[f]=e[A[f]]}return{lut:w,offset:u}}function h(t,e){const n=Math.min(Math.max(t,-100),100),i=Math.min(Math.max(e,-100),100),l=255,o=128;let r,s;const a=new Uint8Array(256);for(r=0;r<256;r++)n>0&&n<100?s=(200*r-100*l+2*l*i)/(2*(100-n))+o:n<=0&&n>-100?s=(200*r-100*l+2*l*i)*(100+n)/2e4+o:100===n?(s=200*r-100*l+(l+1)*(100-n)+2*l*i,s=s>0?l:0):-100===n&&(s=o),a[r]=s>l?l:s<0?0:s;return a}function u(t,e=256){e=Math.min(e,256);const{size:n,counts:i}=t,l=new Uint8Array(n),o=i.reduce(((t,n)=>t+n/e),0);let r=0,s=0,a=0,f=o;for(let h=0;h<n;h++)if(a+=i[h],!(h<n-1&&a+i[h+1]<f)){for(;r<e-1&&f<a;)r++,f+=o;for(let t=s;t<=h;t++)l[t]=r;s=h+1}for(let h=s;h<n;h++)l[h]=e-1;return l}function c(t,e){if(!i(t))return null;const n=t.clone(),{pixels:l,mask:o}=n,{minCutOff:r,maxCutOff:s,gamma:a}=e,f=e.outMin||0,h=e.outMax||255,u=n.width*n.height,c=l.length;let p,x,m,d,g;const y=h-f,w=[],M=[];for(p=0;p<c;p++)M[p]=s[p]-r[p],w[p]=y/(s[p]-r[p]);const k=a&&a.length>=c,A=[];if(k)for(p=0;p<c;p++)a[p]>1?a[p]>2?A[p]=6.5+(a[p]-2)**2.5:A[p]=6.5+100*(2-a[p])**4:A[p]=1;if(k)if(null!=o){for(x=0;x<u;x++)if(o[x])for(p=0;p<c;p++)m=l[p][x],g=(m-r[p])/M[p],d=1,a[p]>1&&(d-=(1/y)**(g*A[p])),m<s[p]&&m>r[p]?l[p][x]=Math.floor(d*y*g**(1/a[p]))+f:m>=s[p]?l[p][x]=h:l[p][x]=f}else for(x=0;x<u;x++)for(p=0;p<c;p++)m=l[p][x],g=(m-r[p])/M[p],d=1,a[p]>1&&(d-=(1/y)**(g*A[p])),m<s[p]&&m>r[p]?l[p][x]=Math.floor(d*y*g**(1/a[p]))+f:m>=s[p]?l[p][x]=h:l[p][x]=f;else if(null!=o){for(x=0;x<u;x++)if(o[x])for(p=0;p<c;p++)m=l[p][x],m<s[p]&&m>r[p]?l[p][x]=Math.floor((m-r[p])/M[p]*y)+f:m>=s[p]?l[p][x]=h:l[p][x]=f}else for(x=0;x<u;x++)for(p=0;p<c;p++)m=l[p][x],m<s[p]&&m>r[p]?l[p][x]=Math.floor((m-r[p])/M[p]*y)+f:m>=s[p]?l[p][x]=h:l[p][x]=f;return n.pixelType="u8",n.updateStatistics(),n}function p(t,e){if(!i(t))return null;const{pixels:l,mask:o}=t,r=t.width*t.height,s=l.length;let a=e.lut;const{offset:f}=e;let h,u;a&&1===a[0].length&&(a=l.map((()=>a)));const c=[];let p,x,m;if(f)if(null==o)for(h=0;h<s;h++){for(p=l[h],x=a[h],m=new Uint8Array(r),u=0;u<r;u++)m[u]=x[p[u]-f];c.push(m)}else for(h=0;h<s;h++){for(p=l[h],x=a[h],m=new Uint8Array(r),u=0;u<r;u++)o[u]&&(m[u]=x[p[u]-f]);c.push(m)}else if(null==o)for(h=0;h<s;h++){for(p=l[h],x=a[h],m=new Uint8Array(r),u=0;u<r;u++)m[u]=x[p[u]];c.push(m)}else for(h=0;h<s;h++){for(p=l[h],x=a[h],m=new Uint8Array(r),u=0;u<r;u++)o[u]&&(m[u]=x[p[u]]);c.push(m)}const d=new n({width:t.width,height:t.height,pixels:c,mask:o,pixelType:"u8"});return d.updateStatistics(),d}function x(t,e){if(!i(t))return null;const n=t.clone(),{pixels:l}=n,o=n.width*n.height,r=e.length,s=Math.floor(r/2),a=e[Math.floor(s)],f=l[0];let h,u,c,p,x,m,d=!1;const g=new Uint8Array(o),y=new Uint8Array(o),w=new Uint8Array(o);let M=n.mask;const k=4===e[0].mappedColor.length;for(M||(M=new Uint8Array(o),M.fill(k?255:1),n.mask=M),x=0;x<o;x++)if(M[x]){for(h=f[x],d=!1,m=s,u=a,c=0,p=r-1;p-c>1;){if(h===u.value){d=!0;break}h>u.value?c=m:p=m,m=Math.floor((c+p)/2),u=e[Math.floor(m)]}d||(h===e[c].value?(u=e[c],d=!0):h===e[p].value?(u=e[p],d=!0):h<e[c].value?(d=!1,u=null):h>e[c].value&&(h<e[p].value?(u=e[c],d=!0):p===r-1?(d=!1,u=null):(u=e[p],d=!0))),d?(g[x]=u.mappedColor[0],y[x]=u.mappedColor[1],w[x]=u.mappedColor[2],M[x]=u.mappedColor[3]):g[x]=y[x]=w[x]=M[x]=0}return n.pixels=[g,y,w],n.mask=M,n.pixelType="u8",n.maskIsAlpha=k,n}function m(t,e,n,i,l,o,r,s){return{xmin:l<=n*t?0:l<n*t+t?l-n*t:t,ymin:o<=i*e?0:o<i*e+e?o-i*e:e,xmax:l+r<=n*t?0:l+r<n*t+t?l+r-n*t:t,ymax:o+s<=i*e?0:o+s<i*e+e?o+s-i*e:e}}function d(t,n){if(!t||0===t.length)return null;const i=t.filter((t=>t.pixelBlock))[0];if(!i||e(i.pixelBlock))return null;const l=(i.extent.xmax-i.extent.xmin)/i.pixelBlock.width,o=(i.extent.ymax-i.extent.ymin)/i.pixelBlock.height,r=.01*Math.min(l,o),s=t.sort(((t,e)=>Math.abs(t.extent.ymax-e.extent.ymax)>r?e.extent.ymax-t.extent.ymax:Math.abs(t.extent.xmin-e.extent.xmin)>r?t.extent.xmin-e.extent.xmin:0)),a=Math.min.apply(null,s.map((t=>t.extent.xmin))),f=Math.min.apply(null,s.map((t=>t.extent.ymin))),h=Math.max.apply(null,s.map((t=>t.extent.xmax))),u=Math.max.apply(null,s.map((t=>t.extent.ymax))),c={x:Math.round((n.xmin-a)/l),y:Math.round((u-n.ymax)/o)},p={width:Math.round((h-a)/l),height:Math.round((u-f)/o)},x={width:Math.round((n.xmax-n.xmin)/l),height:Math.round((n.ymax-n.ymin)/o)};if(Math.round(p.width/i.pixelBlock.width)*Math.round(p.height/i.pixelBlock.height)!==s.length||c.x<0||c.y<0||p.width<x.width||p.height<x.height)return null;return{extent:n,pixelBlock:y(s.map((t=>t.pixelBlock)),p,{clipOffset:c,clipSize:x})}}function g(t,e,n,i,l,o){const{width:r,height:s}=n.block,{x:a,y:f}=n.offset,{width:h,height:u}=n.mosaic,c=m(r,s,i,l,a,f,h,u);let p=0,x=0;if(o){const t=o.hasGCSSShiftTransform?360:o.halfWorldWidth,e=r*o.resolutionX,n=o.startX+i*e,l=n+e;n<t&&l>t?x=o.rightPadding:n>=t&&(p=o.leftMargin-o.rightPadding,x=0)}if(c.xmax-=x,"number"!=typeof e)for(let m=c.ymin;m<c.ymax;m++){const n=(l*s+m-f)*h+(i*r-a)+p,o=m*r;for(let i=c.xmin;i<c.xmax;i++)t[n+i]=e[o+i]}else for(let m=c.ymin;m<c.ymax;m++){const n=(l*s+m-f)*h+(i*r-a)+p;for(let i=c.xmin;i<c.xmax;i++)t[n+i]=e}}function y(l,o,r={}){const{clipOffset:s,clipSize:a,alignmentInfo:f,blockWidths:h}=r;if(h)return w(l,o,{blockWidths:h});const u=l.filter((t=>i(t)))[0];if(e(u))return null;const c=a?a.width:o.width,p=a?a.height:o.height,x=u.width,m=u.height,d=o.width/x,y=o.height/m,M={offset:s||{x:0,y:0},mosaic:a||o,block:{width:x,height:m}},k=u.pixelType,A=n.getPixelArrayConstructor(k),U=u.pixels.length,C=[];let T,S;for(let t=0;t<U;t++){S=new A(c*p);for(let e=0;e<y;e++)for(let n=0;n<d;n++){const o=l[e*d+n];i(o)&&(T=o.pixels[t],g(S,T,M,n,e,f))}C.push(S)}let v;if(l.some((t=>e(t)||t.mask&&t.mask.length>0))){v=new Uint8Array(c*p);for(let e=0;e<y;e++)for(let n=0;n<d;n++){const i=l[e*d+n],o=t(i)?i.mask:null;g(v,o||(i?1:0),M,n,e,f)}}const B=new n({width:c,height:p,pixels:C,pixelType:k,mask:v});return B.updateStatistics(),B}function w(e,l,o){const r=e.find((e=>t(e)));if(!t(r))return null;const s=e.some((e=>!t(e)||!!e.mask)),{width:a,height:f}=l,h=s?new Uint8Array(a*f):null,{blockWidths:u}=o,c=[],p=r.getPlaneCount(),x=n.getPixelArrayConstructor(r.pixelType);if(s)for(let t=0,n=0;t<e.length;n+=u[t],t++){const l=e[t];if(!i(l))continue;const o=l.mask;for(let e=0;e<f;e++)for(let i=0;i<u[t];i++)h[e*a+i+n]=null==o?255:o[e*l.width+i]}for(let t=0;t<p;t++){const n=new x(a*f);for(let l=0,o=0;l<e.length;o+=u[l],l++){const r=e[l];if(!i(r))continue;const s=r.pixels[t];if(null!=s)for(let t=0;t<f;t++)for(let e=0;e<u[l];e++)n[t*a+e+o]=s[t*r.width+e]}c.push(n)}const m=new n({width:a,height:f,mask:h,pixels:c,pixelType:r.pixelType});return m.updateStatistics(),m}function M(t,e,n){if(!i(t))return null;const{width:l,height:o}=t,r=e.x,s=e.y,a=n.width+r,f=n.height+s;if(r<0||s<0||a>l||f>o)return t;if(0===r&&0===s&&a===l&&f===o)return t;t.mask||(t.mask=new Uint8Array(l*o));const h=t.mask;for(let i=0;i<o;i++){const t=i*l;for(let e=0;e<l;e++)h[t+e]=i<s||i>=f||e<r||e>=a?0:1}return t.updateStatistics(),t}function k(t){if(!i(t))return null;const e=t.clone(),{width:n,height:l,pixels:o,mask:r}=t,s=o[0],a=e.pixels[0];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;C(t,s[i],r?r[i]:1)}a[i*n]=A(t),a[i*n+1]=a[i*n+2]=a[i*n];let e=3;for(;e<n-1;e++){let l=(i-2)*n+e+1;C(t,s[l],r?r[l]:1),l=(i-1)*n+e+1,C(t,s[l],r?r[l]:1),l=i*n+e+1,C(t,s[l],r?r[l]:1),l=(i+1)*n+e+1,C(t,s[l],r?r[l]:1),l=(i-2)*n+e-3,U(t,s[l],r?r[l]:1),l=(i-1)*n+e-3,U(t,s[l],r?r[l]:1),l=i*n+e-3,U(t,s[l],r?r[l]:1),l=(i+1)*n+e-3,U(t,s[l],r?r[l]:1),a[i*n+e]=A(t)}a[i*n+e+1]=a[i*n+e]}for(let i=0;i<n;i++)a[i]=a[n+i]=a[2*n+i],a[(l-1)*n+i]=a[(l-2)*n+i];return e.updateStatistics(),e}function A(t){if(0===t.size)return 0;let e=0,n=-1,i=0;const l=t.keys();let o=l.next();for(;!o.done;)i=t.get(o.value),i>e&&(n=o.value,e=i),o=l.next();return n}function U(t,e,n){if(0===n)return;const i=t.get(e);1===i?t.delete(e):t.set(e,i-1)}function C(t,e,n){0!==n&&t.set(e,t.has(e)?t.get(e)+1:1)}function T(t,e,l){let{x:o,y:r}=e;const{width:s,height:a}=l;if(0===o&&0===r&&a===t.height&&s===t.width)return t;const{width:f,height:h}=t,u=Math.max(0,r),c=Math.max(0,o),p=Math.min(o+s,f),x=Math.min(r+a,h);if(p<0||x<0||!i(t))return null;o=Math.max(0,-o),r=Math.max(0,-r);const{pixels:m,mask:d}=t,g=s*a,y=m.length,w=[];for(let i=0;i<y;i++){const e=m[i],l=n.createEmptyBand(t.pixelType,g);for(let t=u;t<x;t++){const n=t*f;let i=(t+r-u)*s+o;for(let t=c;t<p;t++)l[i++]=e[n+t]}w.push(l)}const M=new Uint8Array(g);for(let n=u;n<x;n++){const t=n*f;let e=(n+r-u)*s+o;for(let n=c;n<p;n++)M[e++]=d?d[t+n]:1}const k=new n({width:l.width,height:l.height,pixelType:t.pixelType,pixels:w,mask:M});return k.updateStatistics(),k}function S(t,e=!0){if(!i(t))return null;const{pixels:l,width:o,height:r,mask:s,pixelType:a}=t,f=[],h=Math.round(o/2),u=Math.round(r/2),c=r-1,p=o-1;for(let i=0;i<l.length;i++){const t=l[i],s=n.createEmptyBand(a,h*u);let x=0;for(let n=0;n<r;n+=2)for(let i=0;i<o;i+=2){const l=t[n*o+i];if(e){const e=i===p?l:t[n*o+i+1],r=n===c?l:t[n*o+i+o],a=i===p?r:n===c?e:t[n*o+i+o+1];s[x++]=(l+e+r+a)/4}else s[x++]=l}f.push(s)}let x=null;if(s){x=new Uint8Array(h*u);let t=0;for(let n=0;n<r;n+=2)for(let i=0;i<o;i+=2){const l=s[n*o+i];if(e){const e=i===p?l:s[n*o+i+1],r=n===c?l:s[n*o+i+o],a=i===p?r:n===c?e:s[n*o+i+o+1];x[t++]=l*e*r*a?1:0}else x[t++]=l}}return new n({width:h,height:u,pixelType:a,pixels:f,mask:x})}function v(t,e,n){if(!i(t))return null;const{width:l,height:o}=e;let{width:r,height:s}=t;const a=new Map,f={x:0,y:0},h=null==n?1:1+n;let u=t;for(let i=0;i<h;i++){const t=Math.ceil(r/l),n=Math.ceil(s/o);for(let r=0;r<n;r++){f.y=r*o;for(let n=0;n<t;n++){f.x=n*l;const t=T(u,f,e);a.set(`${i}/${r}/${n}`,t)}}i<h-1&&(u=S(u)),r=Math.round(r/2),s=Math.round(s/2)}return a}function B(t,e,l,o,r="nearest"){if(!i(t))return null;"majority"===r&&(t=k(t));const{pixels:s,mask:a,pixelType:f}=t,h=t.width,u=t.height,c=n.getPixelArrayConstructor(f),p=s.length,{width:x,height:m}=e,d=o.cols,g=o.rows,y=Math.ceil(x/d-.1/d),w=Math.ceil(m/g-.1/g);let M,A,U,C,T,S,v,B=!1;for(let n=0;n<l.length;n+=3)-1===l[n]&&-1===l[n+1]&&-1===l[n+2]&&(B=!0);const b=y*d,O=b*w*g,P=new Float32Array(O),z=new Float32Array(O);let I,W,j=0;const D="majority"===r?0:.5;for(let n=0;n<w;n++)for(let t=0;t<y;t++){M=12*(n*y+t),A=l[M],U=l[M+1],C=l[M+2],T=l[M+3],S=l[M+4],v=l[M+5];for(let e=0;e<g;e++){j=(n*g+e)*b+t*d,W=(e+.5)/g;for(let t=0;t<e;t++)I=(t+.5)/d,P[j+t]=Math.round((A*I+U*W+C)*h-D),z[j+t]=Math.round((T*I+S*W+v)*u-D)}M+=6,A=l[M],U=l[M+1],C=l[M+2],T=l[M+3],S=l[M+4],v=l[M+5];for(let e=0;e<g;e++){j=(n*g+e)*b+t*d,W=(e+.5)/g;for(let t=e;t<d;t++)I=(t+.5)/d,P[j+t]=Math.round((A*I+U*W+C)*h-D),z[j+t]=Math.round((T*I+S*W+v)*u-D)}}const E=(t,e)=>{for(let n=0;n<m;n++){M=n*b;for(let i=0;i<x;i++)P[M]<0||z[M]<0?t[n*x+i]=0:t[n*x+i]=e[P[M]+z[M]*h],M++}},$=[];let q;for(let n=0;n<p;n++)q=new c(x*m),E(q,s[n]),$.push(q);const F=new n({width:x,height:m,pixelType:f,pixels:$});if(a)F.mask=new Uint8Array(x*m),E(F.mask,a);else if(B){F.mask=new Uint8Array(x*m);for(let t=0;t<x*m;t++)F.mask[t]=P[t]<0||z[t]<0?0:1}return F.updateStatistics(),F}export{B as approximateTransform,T as clip,r as colorize,o as createColormapLUT,h as createContrastBrightnessLUT,u as createHistogramEqualizationLUT,f as createStretchLUT,a as estimateStatisticsFromHistograms,s as estimateStatisticsHistograms,l as extractBands,m as getClipBounds,i as isValidPixelBlock,p as lookupPixels,y as mosaic,d as mosaicPixelData,x as remapColor,k as resampleByMajority,M as setValidBoundary,v as split,c as stretch};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.22/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../geometry.js";import e from"../../../core/Error.js";import{isNone as t,isSome as n}from"../../../core/maybe.js";import{getMetersPerUnitForSR as o}from"../../../core/unitUtils.js";import{isLoaded as r,
|
|
5
|
+
import"../../../geometry.js";import e from"../../../core/Error.js";import{isNone as t,isSome as n}from"../../../core/maybe.js";import{getMetersPerUnitForSR as o}from"../../../core/unitUtils.js";import{isLoaded as r,load as i,getTransformation as a,project as s}from"../../../geometry/projection.js";import{project as l}from"../../../geometry/support/webMercatorUtils.js";import c from"../../../geometry/Extent.js";import x from"../../../geometry/Point.js";const m=5e-4,f=function(e,t){const n=(e.isWGS84||e.isWebMercator)&&(t.isWGS84||t.isWebMercator);return!(e.equals(t)||n)},u=function(e,t){const n=(e[0]+e[4]+e[4*t.cols]+e[4*t.cols+4])/4,o=(e[1]+e[5]+e[4*t.rows+1]+e[4*t.rows+5])/4;return[Math.abs(n-e[2*t.rows+2]),Math.abs(o-e[2*t.rows+3])]},p={3395:20037508.342789244,3410:17334193.943686873,3832:3339584.723798206,3857:20037508.342788905,3975:17367530.445161372,4087:20037508.342789244,4088:20015108.787169147,6933:17367530.445161372,8858:7396237.374497803,8859:2465412.4581659334,32662:20037508.342789244,53001:20015086.79602057,53002:10007543.39801029,53003:20015086.79602057,53004:20015086.79602057,53016:14152803.599503474,53017:17333573.624304302,53025:7276828.3848298555,53031:10384677.558821043,53034:20015086.79602057,53036:7389443.187332862,53037:2463147.729110953,53079:20015114.352186374,53080:20015114.352186374,54001:20037508.342789244,54002:10018754.171394624,54003:20037508.342789244,54004:20037508.342789244,54016:14168658.027268292,54017:17367530.44516137,54025:7311399.09166516,54031:10396310.810074743,54034:20037508.342789244,54050:808820.9223376509,54053:1920897.3915568967,54079:20037508.342789244,54080:20037508.342789244,54100:20037508.342789244,54101:20037508.342789244,102038:4297258.582585486,102299:5013965.117483125},h=32;async function y(){if(r())return null;await i()}function M(t,n,o){if(!f(t.spatialReference,n))return null;if(!r())throw new e("rasterprojectionhelper-projectResolution","projection engine is not loaded");return o?a(n,t.spatialReference,t):a(t.spatialReference,n,t)}function d(n,o,i,a=null){if(n.spatialReference.equals(o))return n;const x=f(n.spatialReference,o);if(x&&!r())throw new e("rasterprojectionhelper-projectResolution","projection engine is not loaded");const m=i.center,u=new c({xmin:m.x-n.x/2,xmax:m.x+n.x/2,ymin:m.y-n.y/2,ymax:m.y+n.y/2,spatialReference:n.spatialReference}),p=x?s(u,o,a):l(u,o);if(t(p))return null;return{x:p.xmax-p.xmin,y:p.ymax-p.ymin}}function g(e,t=.01){return o(e)?t/o(e):0}function w(n,o,i=null,a=!0){const c=n.spatialReference;if(c.equals(o))return n;let x=l(n,o);if(t(x)){if(!r())throw new e("rasterprojectionhelper-projectResolution","projection engine is not loaded");x=s(n,o,i)}if(a&&o.isGeographic){const[e,t]=S(c,!0),o=g(c);o&&null!=e&&null!=t&&(Math.abs(n.x-e)<o&&Math.abs(180-x.x)<m?x.x-=360:Math.abs(n.x-t)<o&&Math.abs(180+x.x)<m&&(x.x+=360))}return x}function R(e){const t=v(e[0].spatialReference);if(e.length<2||!n(t))return e[0];let{xmin:o,xmax:r,ymin:i,ymax:a}=e[0];for(let n=1;n<e.length;n++){const o=e[n];r=o.xmax+t*n,i=Math.min(i,o.ymin),a=Math.max(a,o.ymax)}return new c({xmin:o,xmax:r,ymin:i,ymax:a,spatialReference:e[0].spatialReference})}function j(e,t,o=null,r=!0){if(e.spatialReference.equals(t))return e;const i=W(e),a=v(e.spatialReference,!0);if(!n(a)||0===i)return b(e,t,o,r);return R(e.clone().normalize().map((e=>b(e,t,o,r))))}function b(n,o,i=null,a=!0){const c=n.spatialReference;if(c.equals(o))return n;if(f(c,o)&&!r())throw new e("rasterprojectionhelper-projectExtent","projection engine is not loaded");let u=l(n,o);t(u)&&(u=s(n,o,i));let[p,h]=S(c,!0);if(u&&a&&c.isWebMercator&&o.isGeographic&&null!=p&&null!=h){const e=.001,t=1e3;if(Math.abs(n.xmin-p)<e&&Math.abs(h-n.xmax)>t&&Math.abs(180-u.xmax)<m){u.xmin=-180;const e=[];e.push(new x(n.xmax,n.ymin,c)),e.push(new x(n.xmax,(n.ymin+n.ymax)/2,c)),e.push(new x(n.xmax,n.ymax,c));const t=e.map((e=>w(e,o,i))).filter((e=>!isNaN(null==e?void 0:e.x))).map((e=>e.x));u.xmax=Math.max.apply(null,t)}if(Math.abs(n.xmax-h)<e&&Math.abs(p-n.xmin)>t&&Math.abs(180+u.xmin)<m){u.xmax=180;const e=[];e.push(new x(n.xmin,n.ymin,c)),e.push(new x(n.xmin,(n.ymin+n.ymax)/2,c)),e.push(new x(n.xmin,n.ymax,c));const t=e.map((e=>w(e,o,i))).filter((e=>!isNaN(null==e?void 0:e.x))).map((e=>e.x));u.xmin=Math.min.apply(null,t)}}[p,h]=S(o,!0);const y=g(o);return y&&null!=p&&null!=h&&(Math.abs(u.xmin-p)<y&&(u.xmin=p),Math.abs(u.xmax-h)<y&&(u.xmax=h)),u}function v(e,t=!1){const n=t?20037508.342787:20037508.342788905;return e.isWebMercator?2*n:e.wkid&&e.isGeographic?360:2*p[e.wkid]||null}function S(e,t=!1){const o=[],r=v(e,t);return n(r)&&(o.push(-r/2),o.push(r/2)),o}function N(e,t,n,o){let r=(e-t)/n;return r-Math.floor(r)!=0?r=Math.floor(r):o&&(r-=1),r}function W(e,t=!1){const o=v(e.spatialReference);if(!n(o))return 0;const r=t?0:-(o/2);return N(e.xmax,r,o,!0)-N(e.xmin,r,o,!1)}function z(e){const t=e.storageInfo.origin.x,o=v(e.spatialReference,!0);if(!n(o))return{originX:t,halfWorldWidth:null,pyramidsInfo:null};const r=o/2,{nativePixelSize:i,storageInfo:a,extent:s}=e,{maximumPyramidLevel:l,blockWidth:c,pyramidScalingFactor:x}=a;let m=i.x;const f=[],u=n(e.transform)&&"gcs-shift"===e.transform.type,p=t+r,h=u?o-t:r-t;for(let n=0;n<=l;n++){const e=(s.xmax-t)/m/c,n=e-Math.floor(e)==0?e:Math.ceil(e),r=(o/2-t)/m/c,i=r-Math.floor(r)==0?r:Math.ceil(r),a=Math.floor(p/m/c),l=Math.round(p/m)%c,u=(c-Math.round(h/m)%c)%c;f.push({resolutionX:m,blockWidth:c,datsetColumnCount:n,worldColumnCountFromOrigin:i,leftMargin:l,rightPadding:u,originColumnOffset:a}),m*=x}return{originX:t,halfWorldWidth:r,pyramidsInfo:f,hasGCSSShiftTransform:u}}function G(t,o,i,a=null,s=null,l=!1,c=[h,h]){if(f(t.spatialReference,o.spatialReference)&&!r())throw new e("rasterprojectionhelper-projectResolution","projection engine is not loaded");if(!(t&&o&&i))return null;const{xmin:m,ymin:p,xmax:y,ymax:M}=t,d=t.spatialReference,g=o.spatialReference,R=v(g);l=l||"gcs-shift"===(null==s?void 0:s.type);const j={x:c[0]*i.x,y:c[1]*i.y},b={cols:Math.ceil((y-m)/j.x-.1/c[0])+1,rows:Math.ceil((M-p)/j.y-.1/c[1])+1},S=j.x,N=j.y,W=[];let z,G=!1;for(let e=0;e<b.cols;e++){const t=[];for(let r=0;r<b.rows;r++){let i=w(new x({x:m+S*e,y:M-N*r,spatialReference:d}),g,a);s&&(i=s.inverseTransform(i)),t.push(i),e>0&&l&&i&&z[r]&&n(R)&&i.x<z[r].x&&(i.x+=R),i?(W.push((i.x-o.xmin)/(o.xmax-o.xmin)),W.push((o.ymax-i.y)/(o.ymax-o.ymin))):(W.push(NaN),W.push(NaN),G=!0)}z=t}const P=u(W,b),C=new Float32Array((b.cols-1)*(b.rows-1)*2*6),L=new Float32Array([-0,-1,1,-1,1,-0,1,-0,-0]),k=new Float32Array([-1,1,0,0,-1,1,1,0,0]);for(let e=0;e<b.cols-1;e++){for(let t=0;t<b.rows-1;t++){let n=e*b.rows*2+2*t;const o=W[n],r=W[n+1],i=W[n+2],a=W[n+3];n+=2*b.rows;const s=W[n],l=W[n+1],c=W[n+2],x=W[n+3];let m=0,f=12*(t*(b.cols-1)+e);for(let e=0;e<3;e++)C[f++]=L[m++]*o+L[m++]*i+L[m++]*c;m=0;for(let e=0;e<3;e++)C[f++]=L[m++]*r+L[m++]*a+L[m++]*x;m=0;for(let e=0;e<3;e++)C[f++]=k[m++]*o+k[m++]*s+k[m++]*c;m=0;for(let e=0;e<3;e++)C[f++]=k[m++]*r+k[m++]*l+k[m++]*x}if(G)for(let e=0;e<C.length;e++)isNaN(C[e])&&(C[e]=-1)}return{offsets:W,error:P,coefficients:C,spacing:c,size:[b.cols-1,b.rows-1]}}function P(e){const t=e.clone().normalize();return 1===t.length?t[0]:R(t)}function C(e,t,o){const{storageInfo:r,pixelSize:i}=t;let a,s=!1;const{pyramidResolutions:l}=r;if(n(l)&&l.length){const n=(e.x+e.y)/2,r=l[l.length-1],c=(r.x+r.y)/2,m=(i.x+i.y)/2;if(n<=m)a=0;else if(n>=c)a=l.length,s=n/c>8;else{let e,t=m;for(let r=1;r<=l.length;r++){if(e=(l[r-1].x+l[r-1].y)/2,n<=e){n===e?a=r:"down"===o?(a=r-1,s=n/t>8):a="up"===o||n-t>e-n||n/t>2?r:r-1;break}t=e}}const f=0===a?i:l[a-1];return{pyramidLevel:a,pyramidResolution:new x({x:f.x,y:f.y,spatialReference:t.spatialReference}),excessiveReading:s}}const c=Math.log(e.x/i.x)/Math.LN2,m=Math.log(e.y/i.y)/Math.LN2,f=t.storageInfo.maximumPyramidLevel||0;a="down"===o?Math.floor(Math.min(c,m)):"up"===o?Math.ceil(Math.max(c,m)):Math.round((c+m)/2),a<0?a=0:a>f&&(s=a>f+3,a=f);const u=2**a;return{pyramidLevel:a,pyramidResolution:new x({x:u*t.nativePixelSize.x,y:u*t.nativePixelSize.y,spatialReference:t.spatialReference}),excessiveReading:s}}function L(e,t,n=512,r=!0){const{extent:i,spatialReference:a,pixelSize:s}=e,l=d(new x({x:s.x,y:s.y,spatialReference:a}),t,i);if(null==l)return{projectedPixelSize:null,scales:null,srcResolutions:null,isCustomTilingScheme:!1};const c=(l.x+l.y)/2,m=o(t),f=c*m*96*39.37,u=t.isGeographic?256/n*295828763.7958547:256/n*591657527.591555;let p="vector-magdir"===e.dataType||"vector-uv"===e.dataType;const h=j(i,t);p||r&&(t.isGeographic||t.isWebMercator)&&(p=h.xmin*h.xmax<0);let y,M=f;const g=1.001;if(p){M=u;const e=t.isGeographic?1341104507446289e-21:.29858214164761665,n=e*(96*m*39.37),o=t.isGeographic?4326:3857;y=d(new x({x:e,y:e,spatialReference:{wkid:o}}),a,h),y.x*=M/n,y.y*=M/n}else{y={x:s.x,y:s.y};const t=Math.ceil(Math.log(Math.min(e.width,e.height)/32)/Math.LN2);let n=0;for(;M<u*(g/2)&&n<t;)n++,M*=2,y.x*=2,y.y*=2;Math.max(M,u)/Math.min(M,u)<=g&&(M=u)}const w=[M],R=[{x:y.x,y:y.y}],b=70.5310735,v=Math.min(b,f)/g;for(;M>=v;)M/=2,y.x/=2,y.y/=2,w.push(M),R.push({x:y.x,y:y.y});return{projectedPixelSize:l,scales:w,srcResolutions:R,isCustomTilingScheme:!p}}export{L as computeProjectedScales,h as defaultGridSpacing,M as getDefaultDatumTransformationForDataset,G as getProjectionOffsetGrid,z as getRasterDatasetAlignmentInfo,v as getWorldWidth,W as getWorldWrapCount,y as load,j as projectExtent,w as projectPoint,d as projectResolution,P as snapExtent,C as snapPyramid};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/core",
|
|
3
|
-
"version": "4.22.0-next.
|
|
3
|
+
"version": "4.22.0-next.20211025",
|
|
4
4
|
"homepage": "https://js.arcgis.com",
|
|
5
5
|
"description": "ArcGIS API for JavaScript: A complete 2D and 3D mapping and data visualization API",
|
|
6
6
|
"keywords": [
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"process": false
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@esri/arcgis-html-sanitizer": "~2.
|
|
28
|
+
"@esri/arcgis-html-sanitizer": "~2.9.0-next.1",
|
|
29
29
|
"@esri/calcite-colors": "~6.0.1",
|
|
30
30
|
"@esri/calcite-components": "1.0.0-beta.67",
|
|
31
31
|
"@popperjs/core": "~2.10.2",
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.22/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../core/Error.js";import{layerLookupMap as r}from"../../layers/support/lazyLayerLoader.js";import t from"../PortalItem.js";import{getNumLayersAndTables as a,preprocessFSItemData as n,getFirstLayerOrTableId as o}from"./layersLoader.js";import{hasTypeKeyword as s}from"./portalItemUtils.js";import{requestArcGISServiceJSON as c}from"../../support/requestPresets.js";function
|
|
5
|
+
import e from"../../core/Error.js";import{layerLookupMap as r}from"../../layers/support/lazyLayerLoader.js";import t from"../PortalItem.js";import{getNumLayersAndTables as a,preprocessFSItemData as n,getFirstLayerOrTableId as o}from"./layersLoader.js";import{hasTypeKeyword as s}from"./portalItemUtils.js";import{requestArcGISServiceJSON as c}from"../../support/requestPresets.js";function u(e){return!e.portalItem||e.portalItem instanceof t||(e={...e,portalItem:new t(e.portalItem)}),l(e.portalItem).then((r=>{const t={portalItem:e.portalItem,...r.properties},a=r.constructor;return Promise.resolve(new a(t))}))}function l(e){return e.load().then(i).then(y)}function i(r){switch(r.type){case"Map Service":return m(r);case"Feature Service":return p(r);case"Feature Collection":return L(r);case"Scene Service":return f(r);case"Image Service":return d(r);case"Stream Service":return N();case"Vector Tile Service":return S();case"KML":return I();case"WFS":return h();case"WMTS":return v();case"WMS":return g();case"Feed":return w();default:return Promise.reject(new e("portal:unknown-item-type","Unknown item type '${type}'",{type:r.type}))}}function y(e){return(0,r[e.className])().then((r=>({constructor:r,properties:e.properties})))}function m(e){return T(e).then((e=>e?{className:"TileLayer"}:{className:"MapImageLayer"}))}function p(e){return M(e).then((e=>{if("object"==typeof e){const r={};return null!=e.id&&(r.layerId=e.id),{className:"FeatureLayer",properties:r}}return{className:"GroupLayer"}}))}function f(e){return M(e).then((r=>{if("object"==typeof r){const t={};let a;if(null!=r.id?(t.layerId=r.id,a=`${e.url}/layers/${r.id}`):a=e.url,Array.isArray(e.typeKeywords)&&e.typeKeywords.length>0){const r={IntegratedMesh:"IntegratedMeshLayer","3DObject":"SceneLayer",Point:"SceneLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};for(const t of Object.keys(r))if(-1!==e.typeKeywords.indexOf(t))return{className:r[t]}}return c(a).then((e=>{let r="SceneLayer";const a={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};return e&&e.layerType&&a[e.layerType]&&(r=a[e.layerType]),{className:r,properties:t}}))}return!1===r?c(e.url).then((e=>"Voxel"===(null==e?void 0:e.layerType)?{className:"VoxelLayer"}:{className:"GroupLayer"})):{className:"GroupLayer"}}))}async function L(e){await e.load();if(s(e,"Map Notes"))return{className:"MapNotesLayer"};if(s(e,"Route Layer"))return{className:"RouteLayer"};const r=await e.fetchData();return 1===a(r)?{className:"FeatureLayer"}:{className:"GroupLayer"}}async function d(e){var r,t,a;await e.load();const n=null!=(r=null==(t=e.typeKeywords)?void 0:t.map((e=>e.toLowerCase())))?r:[];if(n.indexOf("elevation 3d layer")>-1)return{className:"ElevationLayer"};if(n.indexOf("tiled imagery")>-1)return{className:"ImageryTileLayer"};const o=await e.fetchData(),s=null==o?void 0:o.layerType;if("ArcGISTiledImageServiceLayer"===s)return{className:"ImageryTileLayer"};if("ArcGISImageServiceLayer"===s)return{className:"ImageryLayer"};return"map"===(null==(a=(await c(e.url)).cacheType)?void 0:a.toLowerCase())?{className:"ImageryTileLayer"}:{className:"ImageryLayer"}}function N(){return{className:"StreamLayer"}}function S(){return{className:"VectorTileLayer"}}function I(){return{className:"KMLLayer"}}function h(){return{className:"WFSLayer"}}function g(){return{className:"WMSLayer"}}function v(){return{className:"WMTSLayer"}}function w(){return{className:"StreamLayer"}}function T(e){return c(e.url).then((e=>e.tileInfo))}function M(e){return!e.url||e.url.match(/\/\d+$/)?Promise.resolve({}):e.load().then((()=>e.fetchData())).then((async r=>{if("Feature Service"===e.type)return j(r=await n(r,e.url));return a(r)>0?j(r):c(e.url).then(j)}))}function j(e){return 1===a(e)&&{id:o(e)}}export{u as fromItem,i as selectLayerClassPath};
|
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/4.22/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"./config.js";import{id as t}from"./kernel.js";import r from"./core/Error.js";import s from"./core/global.js";import o from"./core/has.js";import{clone as n}from"./core/lang.js";import{unwrap as a}from"./core/maybe.js";import{createAbortController as i,onAbort as l,isAbortError as u,createAbortError as c,isAborted as d}from"./core/promiseUtils.js";import{isDataProtocol as p,isBlobProtocol as m,normalize as f,getInterceptor as h,isTrustedServer as y,getOrigin as w,toHTTPS as g,addQueryParameter as b,objectToQuery as q,getProxyRule as k,getProxyUrl as T,addQueryParameters as O,hasSameOrigin as S,appUrl as x,addProxyRule as v}from"./core/urlUtils.js";import{supportsApiKey as C}from"./support/apiKeyUtils.js";import{loadImageAsync as E}from"./support/requestUtils.js";async function L(e,t){var r;const s=p(e),n=m(e);n||s||(e=f(e));const u={url:e,requestOptions:{...a(t)}};let c=h(e);if(c){const e=await G(c,u);if(null!=e)return{data:e,getHeader:I,requestOptions:u.requestOptions,url:u.url};c.after||c.error||(c=null)}if(e=u.url,"image"===(t=u.requestOptions).responseType){if(o("host-webworker")||o("host-node"))throw B("request:invalid-parameters",new Error("responseType 'image' is not supported in Web Workers or Node environment"),u)}else if(s)throw B("request:invalid-parameters",new Error("Data URLs are not supported for responseType = "+t.responseType),u);if("head"===t.method){if(t.body)throw B("request:invalid-parameters",new Error("body parameter cannot be set when method is 'head'"),u);if(s||n)throw B("request:invalid-parameters",new Error("data and blob URLs are not supported for method 'head'"),u)}if(await N(),j)return j.execute(e,t);const d=i();l(t,(()=>d.abort()));const y={controller:d,credential:null,credentialToken:null,fetchOptions:null,hasToken:!1,interceptor:c,params:u,redoRequest:!1,useIdentity:U.useIdentity,useProxy:!1,useSSL:!1,withCredentials:!1},w=await X(y);return null==(r=c)||null==r.after||r.after(w),w}let j;const U=e.request,P="FormData"in s,D=[499,498,403,401],_=["COM_0056","COM_0057","SB_0008"],F=[/\/arcgis\/tokens/i,/\/sharing(\/rest)?\/generatetoken/i,/\/rest\/info/i],I=()=>null,M=Symbol();function R(e){const t=w(e);t&&!L._corsServers.includes(t)&&L._corsServers.push(t)}function H(e){const t=w(e);return!t||t.endsWith(".arcgis.com")||L._corsServers.includes(t)||y(t)}function B(e,t,s,o){let a="Error";const i={url:s.url,requestOptions:s.requestOptions,getHeader:I,ssl:!1};if(t instanceof r)return t.details?(t.details=n(t.details),t.details.url=s.url,t.details.requestOptions=s.requestOptions):t.details=i,t;if(t){const e=o&&(e=>o.headers.get(e)),r=o&&o.status,s=t.message;s&&(a=s),e&&(i.getHeader=e),i.httpStatus=(null!=t.httpCode?t.httpCode:t.code)||r||0,i.subCode=t.subcode,i.messageCode=t.messageCode,"string"==typeof t.details?i.messages=[t.details]:i.messages=t.details,i.raw=M in t?t[M]:t}return u(t)?c():new r(e,a,i)}async function N(){o("host-webworker")?j||(j=await import("./core/workers/request.js")):L._abortableFetch||(L._abortableFetch=s.fetch.bind(s))}async function A(){t||await import("./identity/IdentityManager.js")}async function $(r){const o=r.params.url,n=r.params.requestOptions,a=r.controller.signal,i=n.body;let l=null,u=null,c=null;if(P&&"HTMLFormElement"in s&&(i instanceof FormData?l=i:i instanceof HTMLFormElement&&(u=i,l=new FormData(u))),"string"==typeof i&&(c=i),r.fetchOptions={cache:n.cacheBust&&!L._abortableFetch.polyfill?"no-cache":"default",credentials:"same-origin",headers:n.headers||{},method:"head"===n.method?"HEAD":"GET",mode:"cors",redirect:"follow",signal:a},(l||c)&&(r.fetchOptions.body=l||c),"anonymous"===n.authMode&&(r.useIdentity=!1),r.hasToken=!!(/token=/i.test(o)||n.query&&n.query.token||l&&l.get&&l.get("token")||u&&u.elements.token),!r.hasToken&&e.apiKey&&C(o)&&(n.query||(n.query={}),n.query.token=e.apiKey,r.hasToken=!0),r.useIdentity&&!r.hasToken&&!r.credentialToken&&!K(o)&&!d(a)){let e;"immediate"===n.authMode?(await A(),e=await t.getCredential(o,{signal:a}),r.credential=e):"no-prompt"===n.authMode?(await A(),e=await t.getCredential(o,{prompt:!1,signal:a}).catch((()=>{})),r.credential=e):t&&(e=t.findCredential(o)),e&&(r.credentialToken=e.token,r.useSSL=!!e.ssl)}}function K(e){return F.some((t=>t.test(e)))}async function W(e){let r=e.params.url;const s=e.params.requestOptions,n=e.fetchOptions,a=m(r)||p(r),i=s.responseType||"json",l=a?0:null!=s.timeout?s.timeout:U.timeout;let u=!1;if(!a){e.useSSL&&(r=g(r)),s.cacheBust&&"default"===n.cache&&(r=b(r,"request.preventCache",Date.now()));let a={...s.query};e.credentialToken&&(a.token=e.credentialToken);let i=q(a);o("esri-url-encodes-apostrophe")&&(i=i.replace(/'/g,"%27"));const l=r.length+1+i.length;let c;u="delete"===s.method||"post"===s.method||"put"===s.method||!!s.body||l>U.maxUrlLength;const d=s.useProxy||!!k(r);if(d){const e=T(r);c=e.path,!u&&c.length+1+l>U.maxUrlLength&&(u=!0),e.query&&(a={...e.query,...a})}if("HEAD"===n.method&&(u||d)){if(u){if(l>U.maxUrlLength)throw B("request:invalid-parameters",new Error("URL exceeds maximum length"),e.params);throw B("request:invalid-parameters",new Error("cannot use POST request when method is 'head'"),e.params)}if(d)throw B("request:invalid-parameters",new Error("cannot use proxy when method is 'head'"),e.params)}if(u?(n.method="delete"===s.method?"DELETE":"put"===s.method?"PUT":"POST",s.body?r=O(r,a):(n.body=q(a),n.headers["Content-Type"]="application/x-www-form-urlencoded")):r=O(r,a),d&&(e.useProxy=!0,r=`${c}?${r}`),a.token&&P&&n.body instanceof FormData){const e=n.body;e.set?e.set("token",a.token):e.append("token",a.token)}if(s.hasOwnProperty("withCredentials"))e.withCredentials=s.withCredentials;else if(!S(r,x))if(y(r))e.withCredentials=!0;else if(t){const s=t.findServerInfo(r);s&&s.webTierAuth&&(e.withCredentials=!0)}e.withCredentials&&(n.credentials="include")}let d,f,h=0,C=!1;l>0&&(h=setTimeout((()=>{C=!0,e.controller.abort()}),l));try{if("native-request-init"===s.responseType)f=n,f.url=r;else if("image"!==s.responseType||"default"!==n.cache||"GET"!==n.method||u||z(s.headers)||!a&&!e.useProxy&&U.proxyUrl&&!H(r)){if(d=await L._abortableFetch(r,n),e.useProxy||R(r),"native"===s.responseType)f=d;else if("HEAD"!==n.method)if(d.ok){switch(i){case"array-buffer":f=await d.arrayBuffer();break;case"blob":case"image":f=await d.blob();break;default:f=await d.text()}if(h&&(clearTimeout(h),h=0),"json"===i||"xml"===i||"document"===i)if(f)switch(i){case"json":f=JSON.parse(f);break;case"xml":f=J(f,"application/xml");break;case"document":f=J(f,"text/html")}else f=null;if(f){if("array-buffer"===i||"blob"===i){const e=d.headers.get("Content-Type");if(/application\/json|text\/plain/i.test(e)&&f["blob"===i?"size":"byteLength"]<=750)try{const e=await new Response(f).json();e.error&&(f=e)}catch{}}"image"===i&&f instanceof Blob&&(f=await V(URL.createObjectURL(f),e,!0))}}else f=await d.text()}else f=await V(r,e)}catch(E){if("AbortError"===E.name){if(C)throw new Error("Timeout exceeded");throw c("Request canceled")}if(!(!d&&E instanceof TypeError&&U.proxyUrl)||s.body||"delete"===s.method||"head"===s.method||"post"===s.method||"put"===s.method||e.useProxy||H(r))throw E;e.redoRequest=!0,v({proxyUrl:U.proxyUrl,urlPrefix:w(r)})}finally{h&&clearTimeout(h)}return[d,f]}async function G(e,t){if(null!=e.responseData)return e.responseData;if(e.headers&&(t.requestOptions.headers={...t.requestOptions.headers,...e.headers}),e.query&&(t.requestOptions.query={...t.requestOptions.query,...e.query}),e.before){let o,n;try{n=await e.before(t)}catch(s){o=B("request:interceptor",s,t)}if((n instanceof Error||n instanceof r)&&(o=B("request:interceptor",n,t)),o)throw e.error&&e.error(o),o;return n}}function z(e){if(e)for(const t of Object.getOwnPropertyNames(e))if(e[t])return!0;return!1}function J(e,t){let r;try{r=(new DOMParser).parseFromString(e,t)}catch{}if(!r||r.getElementsByTagName("parsererror").length)throw new SyntaxError("XML Parse error");return r}async function X(e){var r,s;let o,n;await $(e);try{do{[o,n]=await W(e)}while(!await Q(e,o,n))}catch(l){const t=B("request:server",l,e.params,o);throw t.details.ssl=e.useSSL,e.interceptor&&e.interceptor.error&&e.interceptor.error(t),t}const a=e.params.url;if(/\/sharing\/rest\/(accounts|portals)\/self/i.test(a)&&!e.hasToken&&!e.credentialToken&&null!=(r=n)&&null!=(s=r.user)&&s.username&&!y(a)){const e=w(a,!0);e&&U.trustedServers.push(e)}const i=e.credential;if(i&&t){const e=t.findServerInfo(i.server);let r=e&&e.owningSystemUrl;if(r){r=r.replace(/\/?$/,"/sharing");const e=t.findCredential(r,i.userId);e&&-1===t._getIdenticalSvcIdx(r,e)&&e.resources.unshift(r)}}return{data:n,getHeader:o?e=>o.headers.get(e):I,requestOptions:e.params.requestOptions,ssl:e.useSSL,url:e.params.url}}async function Q(e,r,s){if(e.redoRequest)return e.redoRequest=!1,!1;const o=e.params.requestOptions;if(!r||"native"===o.responseType||"native-request-init"===o.responseType)return!0;let n,a,i,l;if(!r.ok)throw n=new Error(`Unable to load ${r.url} status: ${r.status}`),n[M]=s,n;null!=s&&s.error&&(n=s.error),n&&(a=Number(n.code),i=n.hasOwnProperty("subcode")?Number(n.subcode):null,l=n.messageCode,l=l&&l.toUpperCase());const u=o.authMode;if(403===a&&(4===i||n.message&&n.message.toLowerCase().indexOf("ssl")>-1&&-1===n.message.toLowerCase().indexOf("permission"))){if(!e.useSSL)return e.useSSL=!0,!1}else if(!e.hasToken&&e.useIdentity&&("no-prompt"!==u||498===a)&&-1!==D.indexOf(a)&&!K(e.params.url)&&(403!==a||-1===_.indexOf(l)&&(null==i||2===i&&e.credentialToken))){await A();try{const r=await t.getCredential(e.params.url,{error:B("request:server",n,e.params),prompt:"no-prompt"!==u,signal:e.controller.signal,token:e.credentialToken});return e.credential=r,e.credentialToken=r.token,e.useSSL=e.useSSL||r.ssl,!1}catch(c){if("no-prompt"===u)return e.credential=null,e.credentialToken=null,!1;n=c}}if(n)throw n;return!0}function V(e,t,r=!1){const s=t.controller.signal,o=new Image;return t.withCredentials?o.crossOrigin="use-credentials":o.crossOrigin="anonymous",o.alt="",o.src=e,E(o,e,r,s)}L._abortableFetch=null,L._corsServers=["https://server.arcgisonline.com","https://services.arcgisonline.com"];export{L as default};
|
|
5
|
+
import e from"./config.js";import{id as t}from"./kernel.js";import r from"./core/Error.js";import s from"./core/global.js";import o from"./core/has.js";import{clone as n}from"./core/lang.js";import{unwrap as a}from"./core/maybe.js";import{onAbort as i,isAbortError as l,createAbortError as u,isAborted as c}from"./core/promiseUtils.js";import{isDataProtocol as d,isBlobProtocol as p,normalize as m,getInterceptor as f,isTrustedServer as h,getOrigin as y,toHTTPS as w,addQueryParameter as g,objectToQuery as b,getProxyRule as q,getProxyUrl as k,addQueryParameters as T,hasSameOrigin as O,appUrl as S,addProxyRule as x}from"./core/urlUtils.js";import{supportsApiKey as v}from"./support/apiKeyUtils.js";import{loadImageAsync as C}from"./support/requestUtils.js";async function E(e,t){var r;const s=d(e),n=p(e);n||s||(e=m(e));const l={url:e,requestOptions:{...a(t)}};let u=f(e);if(u){const e=await W(u,l);if(null!=e)return{data:e,getHeader:F,requestOptions:l.requestOptions,url:l.url};u.after||u.error||(u=null)}if(e=l.url,"image"===(t=l.requestOptions).responseType){if(o("host-webworker")||o("host-node"))throw H("request:invalid-parameters",new Error("responseType 'image' is not supported in Web Workers or Node environment"),l)}else if(s)throw H("request:invalid-parameters",new Error("Data URLs are not supported for responseType = "+t.responseType),l);if("head"===t.method){if(t.body)throw H("request:invalid-parameters",new Error("body parameter cannot be set when method is 'head'"),l);if(s||n)throw H("request:invalid-parameters",new Error("data and blob URLs are not supported for method 'head'"),l)}if(await A(),L)return L.execute(e,t);const c=new AbortController;i(t,(()=>c.abort()));const h={controller:c,credential:null,credentialToken:null,fetchOptions:null,hasToken:!1,interceptor:u,params:l,redoRequest:!1,useIdentity:j.useIdentity,useProxy:!1,useSSL:!1,withCredentials:!1},y=await J(h);return null==(r=u)||null==r.after||r.after(y),y}let L;const j=e.request,U="FormData"in s,P=[499,498,403,401],D=["COM_0056","COM_0057","SB_0008"],_=[/\/arcgis\/tokens/i,/\/sharing(\/rest)?\/generatetoken/i,/\/rest\/info/i],F=()=>null,I=Symbol();function M(e){const t=y(e);t&&!E._corsServers.includes(t)&&E._corsServers.push(t)}function R(e){const t=y(e);return!t||t.endsWith(".arcgis.com")||E._corsServers.includes(t)||h(t)}function H(e,t,s,o){let a="Error";const i={url:s.url,requestOptions:s.requestOptions,getHeader:F,ssl:!1};if(t instanceof r)return t.details?(t.details=n(t.details),t.details.url=s.url,t.details.requestOptions=s.requestOptions):t.details=i,t;if(t){const e=o&&(e=>o.headers.get(e)),r=o&&o.status,s=t.message;s&&(a=s),e&&(i.getHeader=e),i.httpStatus=(null!=t.httpCode?t.httpCode:t.code)||r||0,i.subCode=t.subcode,i.messageCode=t.messageCode,"string"==typeof t.details?i.messages=[t.details]:i.messages=t.details,i.raw=I in t?t[I]:t}return l(t)?u():new r(e,a,i)}async function A(){o("host-webworker")?L||(L=await import("./core/workers/request.js")):E._abortableFetch||(E._abortableFetch=s.fetch.bind(s))}async function B(){t||await import("./identity/IdentityManager.js")}async function N(r){const o=r.params.url,n=r.params.requestOptions,a=r.controller.signal,i=n.body;let l=null,u=null,d=null;if(U&&"HTMLFormElement"in s&&(i instanceof FormData?l=i:i instanceof HTMLFormElement&&(u=i,l=new FormData(u))),"string"==typeof i&&(d=i),r.fetchOptions={cache:n.cacheBust&&!E._abortableFetch.polyfill?"no-cache":"default",credentials:"same-origin",headers:n.headers||{},method:"head"===n.method?"HEAD":"GET",mode:"cors",redirect:"follow",signal:a},(l||d)&&(r.fetchOptions.body=l||d),"anonymous"===n.authMode&&(r.useIdentity=!1),r.hasToken=!!(/token=/i.test(o)||n.query&&n.query.token||l&&l.get&&l.get("token")||u&&u.elements.token),!r.hasToken&&e.apiKey&&v(o)&&(n.query||(n.query={}),n.query.token=e.apiKey,r.hasToken=!0),r.useIdentity&&!r.hasToken&&!r.credentialToken&&!$(o)&&!c(a)){let e;"immediate"===n.authMode?(await B(),e=await t.getCredential(o,{signal:a}),r.credential=e):"no-prompt"===n.authMode?(await B(),e=await t.getCredential(o,{prompt:!1,signal:a}).catch((()=>{})),r.credential=e):t&&(e=t.findCredential(o)),e&&(r.credentialToken=e.token,r.useSSL=!!e.ssl)}}function $(e){return _.some((t=>t.test(e)))}async function K(e){let r=e.params.url;const s=e.params.requestOptions,n=e.fetchOptions,a=p(r)||d(r),i=s.responseType||"json",l=a?0:null!=s.timeout?s.timeout:j.timeout;let c=!1;if(!a){e.useSSL&&(r=w(r)),s.cacheBust&&"default"===n.cache&&(r=g(r,"request.preventCache",Date.now()));let a={...s.query};e.credentialToken&&(a.token=e.credentialToken);let i=b(a);o("esri-url-encodes-apostrophe")&&(i=i.replace(/'/g,"%27"));const l=r.length+1+i.length;let u;c="delete"===s.method||"post"===s.method||"put"===s.method||!!s.body||l>j.maxUrlLength;const d=s.useProxy||!!q(r);if(d){const e=k(r);u=e.path,!c&&u.length+1+l>j.maxUrlLength&&(c=!0),e.query&&(a={...e.query,...a})}if("HEAD"===n.method&&(c||d)){if(c){if(l>j.maxUrlLength)throw H("request:invalid-parameters",new Error("URL exceeds maximum length"),e.params);throw H("request:invalid-parameters",new Error("cannot use POST request when method is 'head'"),e.params)}if(d)throw H("request:invalid-parameters",new Error("cannot use proxy when method is 'head'"),e.params)}if(c?(n.method="delete"===s.method?"DELETE":"put"===s.method?"PUT":"POST",s.body?r=T(r,a):(n.body=b(a),n.headers["Content-Type"]="application/x-www-form-urlencoded")):r=T(r,a),d&&(e.useProxy=!0,r=`${u}?${r}`),a.token&&U&&n.body instanceof FormData){const e=n.body;e.set?e.set("token",a.token):e.append("token",a.token)}if(s.hasOwnProperty("withCredentials"))e.withCredentials=s.withCredentials;else if(!O(r,S))if(h(r))e.withCredentials=!0;else if(t){const s=t.findServerInfo(r);s&&s.webTierAuth&&(e.withCredentials=!0)}e.withCredentials&&(n.credentials="include")}let m,f,v=0,C=!1;l>0&&(v=setTimeout((()=>{C=!0,e.controller.abort()}),l));try{if("native-request-init"===s.responseType)f=n,f.url=r;else if("image"!==s.responseType||"default"!==n.cache||"GET"!==n.method||c||G(s.headers)||!a&&!e.useProxy&&j.proxyUrl&&!R(r)){if(m=await E._abortableFetch(r,n),e.useProxy||M(r),"native"===s.responseType)f=m;else if("HEAD"!==n.method)if(m.ok){switch(i){case"array-buffer":f=await m.arrayBuffer();break;case"blob":case"image":f=await m.blob();break;default:f=await m.text()}if(v&&(clearTimeout(v),v=0),"json"===i||"xml"===i||"document"===i)if(f)switch(i){case"json":f=JSON.parse(f);break;case"xml":f=z(f,"application/xml");break;case"document":f=z(f,"text/html")}else f=null;if(f){if("array-buffer"===i||"blob"===i){const e=m.headers.get("Content-Type");if(/application\/json|text\/plain/i.test(e)&&f["blob"===i?"size":"byteLength"]<=750)try{const e=await new Response(f).json();e.error&&(f=e)}catch{}}"image"===i&&f instanceof Blob&&(f=await Q(URL.createObjectURL(f),e,!0))}}else f=await m.text()}else f=await Q(r,e)}catch(L){if("AbortError"===L.name){if(C)throw new Error("Timeout exceeded");throw u("Request canceled")}if(!(!m&&L instanceof TypeError&&j.proxyUrl)||s.body||"delete"===s.method||"head"===s.method||"post"===s.method||"put"===s.method||e.useProxy||R(r))throw L;e.redoRequest=!0,x({proxyUrl:j.proxyUrl,urlPrefix:y(r)})}finally{v&&clearTimeout(v)}return[m,f]}async function W(e,t){if(null!=e.responseData)return e.responseData;if(e.headers&&(t.requestOptions.headers={...t.requestOptions.headers,...e.headers}),e.query&&(t.requestOptions.query={...t.requestOptions.query,...e.query}),e.before){let o,n;try{n=await e.before(t)}catch(s){o=H("request:interceptor",s,t)}if((n instanceof Error||n instanceof r)&&(o=H("request:interceptor",n,t)),o)throw e.error&&e.error(o),o;return n}}function G(e){if(e)for(const t of Object.getOwnPropertyNames(e))if(e[t])return!0;return!1}function z(e,t){let r;try{r=(new DOMParser).parseFromString(e,t)}catch{}if(!r||r.getElementsByTagName("parsererror").length)throw new SyntaxError("XML Parse error");return r}async function J(e){var r,s;let o,n;await N(e);try{do{[o,n]=await K(e)}while(!await X(e,o,n))}catch(l){const t=H("request:server",l,e.params,o);throw t.details.ssl=e.useSSL,e.interceptor&&e.interceptor.error&&e.interceptor.error(t),t}const a=e.params.url;if(/\/sharing\/rest\/(accounts|portals)\/self/i.test(a)&&!e.hasToken&&!e.credentialToken&&null!=(r=n)&&null!=(s=r.user)&&s.username&&!h(a)){const e=y(a,!0);e&&j.trustedServers.push(e)}const i=e.credential;if(i&&t){const e=t.findServerInfo(i.server);let r=e&&e.owningSystemUrl;if(r){r=r.replace(/\/?$/,"/sharing");const e=t.findCredential(r,i.userId);e&&-1===t._getIdenticalSvcIdx(r,e)&&e.resources.unshift(r)}}return{data:n,getHeader:o?e=>o.headers.get(e):F,requestOptions:e.params.requestOptions,ssl:e.useSSL,url:e.params.url}}async function X(e,r,s){if(e.redoRequest)return e.redoRequest=!1,!1;const o=e.params.requestOptions;if(!r||"native"===o.responseType||"native-request-init"===o.responseType)return!0;let n,a,i,l;if(!r.ok)throw n=new Error(`Unable to load ${r.url} status: ${r.status}`),n[I]=s,n;null!=s&&s.error&&(n=s.error),n&&(a=Number(n.code),i=n.hasOwnProperty("subcode")?Number(n.subcode):null,l=n.messageCode,l=l&&l.toUpperCase());const u=o.authMode;if(403===a&&(4===i||n.message&&n.message.toLowerCase().indexOf("ssl")>-1&&-1===n.message.toLowerCase().indexOf("permission"))){if(!e.useSSL)return e.useSSL=!0,!1}else if(!e.hasToken&&e.useIdentity&&("no-prompt"!==u||498===a)&&-1!==P.indexOf(a)&&!$(e.params.url)&&(403!==a||-1===D.indexOf(l)&&(null==i||2===i&&e.credentialToken))){await B();try{const r=await t.getCredential(e.params.url,{error:H("request:server",n,e.params),prompt:"no-prompt"!==u,signal:e.controller.signal,token:e.credentialToken});return e.credential=r,e.credentialToken=r.token,e.useSSL=e.useSSL||r.ssl,!1}catch(c){if("no-prompt"===u)return e.credential=null,e.credentialToken=null,!1;n=c}}if(n)throw n;return!0}function Q(e,t,r=!1){const s=t.controller.signal,o=new Image;return t.withCredentials?o.crossOrigin="use-credentials":o.crossOrigin="anonymous",o.alt="",o.src=e,C(o,e,r,s)}E._abortableFetch=null,E._corsServers=["https://server.arcgisonline.com","https://services.arcgisonline.com"];export{E 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/4.22/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../Color.js";import"../../../symbols.js";import"../../../core/has.js";import t from"../../../core/Error.js";import{isSome as
|
|
5
|
+
import e from"../../../Color.js";import"../../../symbols.js";import"../../../core/has.js";import t from"../../../core/Error.js";import{isSome as o}from"../../../core/maybe.js";import{formatDate as n,convertDateFormatToIntlOptions as s}from"../../../intl/date.js";import{round as i}from"../../../renderers/support/numberUtils.js";import l from"../../../renderers/support/pointCloud/PointSizeSplatAlgorithm.js";import r from"../../heuristics/outline.js";import a from"../../statistics/classBreaks.js";import m from"../../statistics/summaryStatistics.js";import{defaultBasemapGroups as u,getBasemapId as c,getBasemapGroup as f}from"../../support/utils.js";import d from"../../../symbols/edges/SketchEdges3D.js";import p from"../../../symbols/edges/SolidEdges3D.js";import{getBackgroundColorTheme as y}from"../../../views/support/colorUtils.js";import h from"../../../symbols/MeshSymbol3D.js";import b from"../../../symbols/FillSymbol3DLayer.js";import w from"../../../symbols/SimpleFillSymbol.js";import g from"../../../symbols/PolygonSymbol3D.js";import D from"../../../symbols/ExtrudeSymbol3DLayer.js";import j from"../../../symbols/SimpleLineSymbol.js";import v from"../../../symbols/LineSymbol3D.js";import x from"../../../symbols/LineSymbol3DLayer.js";import S from"../../../symbols/PathSymbol3DLayer.js";import z from"../../../symbols/SimpleMarkerSymbol.js";import V from"../../../symbols/PointSymbol3D.js";import L from"../../../symbols/IconSymbol3DLayer.js";import k from"../../../symbols/ObjectSymbol3DLayer.js";const U=/^(\d+(\.\d+)?)\s*(%)$/i,I=[0,0,0,.4],T=["hours","minutes","seconds"],F=[].concat(u.light).concat(u.dark);function B(e,t,o){if("string"==typeof e){const t=o.getField(e);if(t&&"date"===t.type)return t.alias||t.name}else if("number"==typeof e||e instanceof Date){const o=T.indexOf(t)>-1?"short-date-short-time":"short-date";return n(e,s(o))}return e}function M(e,o){return new t(e,o)}function C(e,t,o){return e+t>0&&0>e-t&&o<0?0:e}function P(e,t,o,n,s=!0){const i="90-10"===o&&t?{min:t.classBreakInfos[0].maxValue,max:t.classBreakInfos[t.classBreakInfos.length-1].minValue,avg:null,stddev:null}:e,{avg:l,stddev:r,min:a,max:m}=i,u=E(i,n,s);let c=u?u[0]:a,f=u?u[1]:m;return u?{minDataValue:c,maxDataValue:f,defaultValuesUsed:!0}:("above"===o?c=C(l,r,a):"below"===o&&(f=C(l,r,a)),{minDataValue:c,maxDataValue:f,defaultValuesUsed:!1})}function E(e,t,o){let n,s;const i=A({statistics:e,isDate:t});return i.defaultValuesUsed?(n=i.min,s=i.max):!o||null!=e.avg&&e.stddev||(n=e.min,s=e.max),null!=n?[n,s]:null}function A(e){let t,o,n=e&&e.statistics;if(n||(n={}),null==n.min)if(e.isDate){const e=O();t=e[0],o=e[1]}else t=0,o=100;else if(n.min===n.max)if(e.isDate){const e=O(n.min);t=e[0],o=e[1]}else n.min<0?(t=2*n.min,o=0):n.min>0?(t=0,o=2*n.min):(t=0,o=100);return{min:null!=t?t:n.min,max:null!=o?o:n.max,defaultValuesUsed:null!=t||null!=o}}function O(e){const t=("number"==typeof e?new Date(e):new Date).getUTCFullYear();let o=Date.UTC(t,0,1,12,0,0,0),n=Date.UTC(t,11,31,12,0,0,0);return"number"==typeof e&&(e<o&&(o=e),e>n&&(n=e)),[o,n]}function R(t,o){const n=[],s=t.length;for(let i=0;i<o;i++)n.push(new e(t[i%s]));return n}function Y(e,t,o,n=!0){const{minDataValue:s,maxDataValue:i,defaultValuesUsed:l}=e;return l||"above"===o||"below"===o||"90-10"===o?N(s,i,5):$(t,n)}function W(e){const{avg:t,stddev:o,min:n,max:s}=e;if(null==t||null==o)return N(n,s,5);const l=C(t,o,n),r=s-l,a=l-n,m=Math.max(r,a);return i([l-m,l-m/2,l,m/2+l,l+m],{strictBounds:!0})}function q(e,t){const{min:o,max:n}=t,[s,l,r,a,m]=e,u=null!=o&&s<o,c=null!=n&&m>n;if(null==o||null==n||!u&&!c)return e;const f=u?o:s,d=c?n:m;return i([f,u?f+(r-f)/2:l,r,c?r+(d-r)/2:a,d],{strictBounds:!0})}function N(e,t,o){const n=(t-e)/(o-1),s=[e];for(let i=1;i<=o-2;i++)s.push(e+i*n);return s.push(t),i(s,{strictBounds:!0})}function $(e,t=!0){let o=e.avg,n=o-e.stddev,s=o+e.stddev;n<e.min&&(n=e.min),s>e.max&&(s=e.max),t&&(o=n+(s-n)/2);let l=i([n,s],{strictBounds:!0});return n=l[0],s=l[1],l=[n,n+(o-n)/2,o,o+(s-o)/2,s],i(l,{strictBounds:!0})}function G(e,t,o){switch(t){case"point":case"multipoint":return o?"noDataSize"in e?e.noDataSize:null:"size"in e?e.size:null;case"polyline":return o?"noDataWidth"in e?e.noDataWidth:null:"width"in e?e.width:null;case"polygon":return"size"in e?e.size:null;default:return}}function H(e,t,o){switch(t){case"point":case"multipoint":case"polygon":{if(!("outline"in e))return null;const t={color:e.outline.color,width:e.outline.width};if(null!=o&&t.color){const e=t.color.clone();e.a=o,t.color=e}return t}default:return}}function J(e,t){const{type:o,size:n,color:s,outline:i}=t;let l;switch(e){case"point":case"multipoint":if("2d"===o)l=new z({color:s,size:n,outline:{color:i.color,width:i.width}});else if("3d-flat"===o)l=new V({symbolLayers:[new L({size:n,resource:{primitive:"circle"},material:{color:s},outline:{color:i.color,size:i.width}})]});else if(o.indexOf("3d-volumetric")>-1){const e="3d-volumetric-uniform"===o,i=new k({height:n,resource:{primitive:e?"sphere":"cylinder"},material:{color:s}});e||(i.width=t.widthAndDepth,i.depth=t.widthAndDepth),l=new V({symbolLayers:[i]})}break;case"polyline":"2d"===o?l=new j({color:s,width:n}):"3d-flat"===o?l=new v({symbolLayers:[new x({size:n,material:{color:s}})]}):"3d-volumetric"===o&&(l=new v({symbolLayers:[new S({width:"number"==typeof n?n:parseFloat(n),height:"number"==typeof n?n:parseFloat(n),material:{color:s}})]}));break;case"polygon":"2d"===o?l=new w({color:s,outline:{color:i.color,width:i.width}}):"3d-flat"===o?l=new g({symbolLayers:[new b({material:{color:s},outline:{color:i.color,size:i.width}})]}):"3d-volumetric"===o&&(l=new g({symbolLayers:[new D({size:n,material:{color:s}})]}));break;case"mesh":{const e=t.meshInfo&&t.meshInfo.colorMixMode,o=t.meshInfo&&t.meshInfo.edgesType;l=new h({symbolLayers:[new b({material:{color:s,colorMixMode:e||null},edges:"solid"===o?new p({color:I}):"sketch"===o?new d({color:I}):null})]});break}}return l}function K(e,t,o){const n=Q({layer:e,fields:t});if(n.length)return M(o,"Unknown fields: "+n.join(", ")+". You can only use fields defined in the layer schema");const s=X({layer:e,fields:t});return s.length?M(o,"Unsupported fields: "+s.join(", ")+". You can only use fields that are accessible to the renderer i.e. FieldUsageInfo.supportsRenderer must be true"):void 0}function Q(e){const t=e.layer;return e.fields.filter((e=>!t.getField(e)))}function X(e){const t=e.layer;return e.fields.filter((e=>{const o=t.getFieldUsageInfo(e);return!o||!o.supportsRenderer}))}async function Z(e,t){const o={layer:e.layer,view:e.view,signal:e.signal},[n,s]=await Promise.all([a(e),t?r(o):null]),i=E({min:n.minValue,max:n.maxValue,avg:null,stddev:null},!1,!1);return{result:i?await a({...e,classificationMethod:"equal-interval",numClasses:1,analyzeData:!1,minValue:i[0],maxValue:i[1],normalizationTotal:i[0]+i[1]}):n,defaultValuesUsed:!!i,outlineResult:s}}function _(e){return m(e)}function ee(e,t){let{minSize:o,maxSize:n}=e;if("height"===t){o=((n-o)/2+o)/(2*2.3),n*=2}return{minSize:o,maxSize:n}}function te(e){return U.test(e)}function oe(e){const t=e.match(U),o=Number(t[1]);if("%"===t[3])return new l({scaleFactor:o/100})}function ne(e,t,o,n){e.startTime=t instanceof Date?t.getTime():t,e.endTime=o instanceof Date?o.getTime():o,e.units=n,e.field="string"==typeof t?t:"string"==typeof o?o:null}async function se(e,t){let n=null,s=null;if(!e&&!t)return{basemapId:n,basemapTheme:s};var i;!e&&t&&(e=t&&(null==(i=t.map)?void 0:i.basemap));if(e&&(n=c(e,F,!1),n)){const e=f(n);o(e)&&(s=e)}return n||"2d"!==(null==t?void 0:t.type)||(s=await y(t),o(s)&&(n="dark"===s?"dark-gray":"gray")),{basemapId:n,basemapTheme:s}}export{q as clampAboveAndBelowStopValues,R as createColors,Y as createDataValues,N as createDefaultStopValues,M as createError,$ as createStopValues,W as createStopValuesForAboveBelow,J as createSymbol,B as formatDate,C as getBaseValueForAboveBelow,se as getBasemapInfo,Z as getClassBreaks,P as getDataRange,E as getDefaultDataRange,oe as getPointSizeAlgorithm,ee as getSizeRangeForAxis,_ as getSummaryStatistics,H as getSymbolOutlineFromScheme,G as getSymbolSizeFromScheme,te as isValidPointSize,ne as updateAgeRendererAuthoringInfoVV,K as verifyBasicFieldValidity};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.22/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import e from"../../../core/Error.js";import{open as t}from"../../../core/workers/workers.js";class n{async open(e){this.connection=await t("statsWorker",{strategy:"distributed",signal:e})}destroy(){var e;null==(e=this.connection)||e.close()}static getInstance(){return n.instance||(n.instance=new n),n.instance}async summaryStatistics(t,n){if(!this.connection)throw new e("worker-client:summary-statistics","connection is required");return this.connection.invoke("summaryStatistics",{attribute:t,featuresJSON:n})}async uniqueValues(t,n){if(!this.connection)throw new e("worker-client:unique-values","connection is required");return this.connection.invoke("uniqueValues",{attribute:t,featuresJSON:n})}async classBreaks(t,n){if(!this.connection)throw new e("worker-client:class-breaks","connection is required");return this.connection.invoke("classBreaks",{attribute:t,featuresJSON:n})}}export{n as WorkerClient};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.22/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import{getDataValues as a}from"./utils.js";import{isNullCountSupported as i,calculateStringStatistics as n,calculateStatistics as e,processStatsResult as o,calculateUniqueValuesCount as t,createUVResult as l,calculateClassBreaks as r,resolveCBResult as s}from"../../../statistics/utils.js";async function u(t){const{attribute:l,featuresJSON:r}=t,{normalizationType:s,normalizationField:u,minValue:m,maxValue:d,fieldType:f}=l,p=await a({field:l.field,valueExpression:l.valueExpression,normalizationType:s,normalizationField:u,normalizationTotal:l.normalizationTotal,viewInfoParams:l.viewInfoParams},r),v=i({normalizationType:s,normalizationField:u,minValue:m,maxValue:d}),z="string"===f?n({values:p,supportsNullCount:v}):e({values:p,minValue:m,maxValue:d,useSampleStdDev:!s,supportsNullCount:v});return o(z,"date"===f)}async function m(i){const{attribute:n,featuresJSON:e}=i,o=await a({field:n.field,valueExpression:n.valueExpression,viewInfoParams:n.viewInfoParams},e),r=t(o);return l(r,n.domain,n.returnAllCodedValues)}async function d(i){const{attribute:n,featuresJSON:e}=i,{field:o,normalizationType:t,normalizationField:l,normalizationTotal:u,classificationMethod:m}=n,d=await a({field:o,valueExpression:n.valueExpression,normalizationType:t,normalizationField:l,normalizationTotal:u,viewInfoParams:n.viewInfoParams},e),f=r(d,{field:o,normalizationType:t,normalizationField:l,normalizationTotal:u,classificationMethod:m,standardDeviationInterval:n.standardDeviationInterval,numClasses:n.numClasses,minValue:n.minValue,maxValue:n.maxValue});return s(f,m)}export{d as classBreaks,u as summaryStatistics,m as uniqueValues};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.22/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Error.js";import{isSome as
|
|
5
|
+
import e from"../../../core/Error.js";import{isSome as t}from"../../../core/maybe.js";import n from"../../../geometry/SpatialReference.js";import{isNumericField as i,numericTypes as o}from"../../../layers/support/fieldUtils.js";import{getNormalizedValue as r}from"../../../statistics/utils.js";import{loadArcade as l}from"../../../support/arcadeOnDemand.js";let s=null;async function a(e,t){if(!t)return[];const i=e.field,o=e.valueExpression,a=e.normalizationType,f=e.normalizationField,c=e.normalizationTotal,u=[],d=e.viewInfoParams;let p=null,m=null;if(o){if(!s){const{arcadeUtils:e}=await l();s=e}p=s.createFunction(o),m=d&&s.getViewInfo({viewingMode:d.viewingMode,scale:d.scale,spatialReference:new n(d.spatialReference)})}return t.forEach((e=>{const t=e.attributes;let n;if(o){const t=s.createExecContext(e,m);n=s.executeFunction(p,t)}else t&&(n=t[i]);if(a&&isFinite(n)){const e=t&&parseFloat(t[f]);n=r(n,a,e,c)}u.push(n)})),u}function f(e){const t=e.field,n=e.normalizationType,i=e.normalizationField;let o;return"log"===n?o="(NOT "+t+" = 0)":"field"===n?o="(NOT "+i+" = 0)":"natural-log"!==n&&"square-root"!==n||(o=`(${t} > 0)`),o}function c(t,n){return new e(t,n)}function u(e,t,n){const i=null!=t?e+" >= "+t:"",o=null!=n?e+" <= "+n:"";let r="";return r=i&&o?m(i,o):i||o,r?"("+r+")":""}function d(e,t,n,i){let o=null;return t?t.name!==e.objectIdField&&-1!==i.indexOf(t.type)||(o=c(n,"'field' should be one of these types: "+i.join(","))):o=c(n,"'field' is not defined in the layer schema"),o}function p(e,t,n){let r;return t?t.name!==e.objectIdField&&i(t)||(r=c(n,"'field' should be one of these numeric types: "+o.join(","))):r=c(n,"'field' is not defined in the layer schema"),r}function m(e,n){let i=t(e)?e:"";return t(n)&&n&&(i=i?"("+i+") AND ("+n+")":n),i}function y(e,t,n){const i=h({layer:e,fields:t});if(i.length)return c(n,"Unknown fields: "+i.join(", ")+". You can only use fields defined in the layer schema");const o=g({layer:e,fields:t});return o.length?c(n,"Unsupported fields: "+o.join(", ")+". You can only use fields that can be fetched i.e. AdapterFieldUsageInfo.supportsStatistics must be true"):void 0}function h(e){const t=e.layer;return e.fields.filter((e=>!t.getField(e)))}function g(e){const t=e.layer;return e.fields.filter((e=>{const n=t.getFieldUsageInfo(e);return!n||!n.supportsStatistics}))}export{c as createError,a as getDataValues,u as getRangeExpr,f as getSQLFilterForNormalization,m as mergeWhereClauses,y as verifyBasicFieldValidity,d as verifyFieldType,p as verifyNumericField};
|