@arcgis/core 5.0.0-next.43 → 5.0.0-next.44
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/applications/Components/imageryUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{f97a7cb367634353177d.js → 001a7a4cf6fe74432ed6.js} +1 -1
- package/assets/esri/core/workers/chunks/{324d66962aeec17d3e28.js → 1e0e7cef7ef947894bbe.js} +1 -1
- package/assets/esri/core/workers/chunks/20ad34f9d45c64392022.js +1 -0
- package/assets/esri/core/workers/chunks/23396a6318edf9264c1f.js +1 -0
- package/assets/esri/core/workers/chunks/{ad891ac388fa6c1c9b94.js → 2b34a010f76e5f289868.js} +1 -1
- package/assets/esri/core/workers/chunks/2ef4c0092c59a98a5532.js +1 -0
- package/assets/esri/core/workers/chunks/35272810c2ed04eb403d.js +1 -0
- package/assets/esri/core/workers/chunks/{d1f4152b2b8d47cbf586.js → 72fbee59d5d909615408.js} +1 -1
- package/assets/esri/core/workers/chunks/75c66e38bdc1c786c599.js +1 -0
- package/assets/esri/core/workers/chunks/7d3c2a063598bdd015e2.js +1 -0
- package/assets/esri/core/workers/chunks/897ce6fc9cefb1e14a64.js +1 -0
- package/assets/esri/core/workers/chunks/992e9bbdf9d3787ddb0e.js +1 -0
- package/assets/esri/core/workers/chunks/a2442549c5daf3653eb4.js +1 -0
- package/assets/esri/core/workers/chunks/a7cd795042ebb8585906.js +1 -0
- package/assets/esri/core/workers/chunks/{385cfd3087f00dbd1146.js → ca1c65eb7f5900c60170.js} +1 -1
- package/assets/esri/core/workers/chunks/cddce67919e13e2f365e.js +1 -0
- package/assets/esri/core/workers/chunks/e6784251bbb8b71ead93.js +1 -0
- package/assets/esri/core/workers/chunks/{96f798ee286b59396131.js → ea3cba01c60d9bc72719.js} +1 -1
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
- package/config.js +1 -1
- package/interfaces.d.ts +78 -2
- package/kernel.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/WCSLayer.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/mixins/RasterJobHandlerMixin.js +1 -1
- package/layers/ogc/wcsUtils.js +1 -1
- package/layers/raster/datasets/BaseRaster.js +5 -0
- package/layers/raster/datasets/CovJSONRaster.js +5 -0
- package/layers/raster/datasets/FunctionRaster.js +5 -0
- package/layers/raster/datasets/ImageAuxRaster.js +5 -0
- package/layers/raster/datasets/ImageServerRaster.js +5 -0
- package/layers/raster/datasets/InMemoryRaster.js +5 -0
- package/layers/raster/datasets/MRFRaster.js +5 -0
- package/layers/raster/datasets/RawBlockCache.js +5 -0
- package/layers/raster/datasets/TIFFRaster.js +5 -0
- package/layers/raster/datasets/WCSRaster.js +5 -0
- package/layers/raster/datasets/covJSONParser.js +5 -0
- package/layers/raster/datasets/multidimensionalUtils.js +5 -0
- package/layers/raster/datasets/pamParser.js +5 -0
- package/layers/raster/datasets/pixelReader.js +5 -0
- package/layers/raster/datasets/wcsCoverageParser.js +5 -0
- package/layers/raster/formats/Lerc.js +5 -0
- package/layers/raster/formats/Qb3.js +5 -0
- package/layers/raster/formats/RasterCodec.js +5 -0
- package/layers/raster/formats/TiffDecoder.js +5 -0
- package/layers/raster/functions/ArithmeticFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/ArithmeticFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/AspectFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/AspectFunctionArguments.js +1 -1
- package/layers/raster/functions/BandArithmeticFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/BandArithmeticFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/BaseFunctionArguments.js +1 -1
- package/layers/raster/functions/BaseRasterFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/ClipFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/ClipFunctionArguments.js +1 -1
- package/layers/raster/functions/ColormapFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/ColormapFunctionArguments.js +1 -1
- package/layers/raster/functions/ColormapToRGBFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/ColormapToRGBFunctionArguments.js +1 -1
- package/layers/raster/functions/CompositeBandFunction.js +5 -0
- package/layers/raster/functions/CompositeBandFunctionArguments.js +5 -0
- package/layers/raster/functions/ComputeChangeFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/ComputeChangeFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/ContrastBrightnessFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/ContrastBrightnessFunctionArguments.js +1 -1
- package/layers/raster/functions/ConvolutionFunction.js +5 -0
- package/layers/raster/functions/ConvolutionFunctionArguments.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/CurvatureFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/CurvatureFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/ExtractBandFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/ExtractBandFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/GrayscaleFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/GrayscaleFunctionArguments.js +1 -1
- package/layers/raster/functions/HillshadeFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/HillshadeFunctionArguments.js +1 -1
- package/layers/raster/functions/LocalFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/LocalFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/MaskFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/MaskFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/NDVIFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/NDVIFunctionArguments.js +1 -1
- package/layers/raster/functions/RemapFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/RemapFunctionArguments.js +1 -1
- package/layers/raster/functions/ShadedReliefFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/ShadedReliefFunctionArguments.js +1 -1
- package/layers/raster/functions/SlopeFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/SlopeFunctionArguments.js +1 -1
- package/layers/raster/functions/StatisticsFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/StatisticsFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/StatisticsHistogramFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/StatisticsHistogramFunctionArguments.js +1 -1
- package/layers/raster/functions/StretchFunction.js +5 -0
- package/layers/{support/rasterFunctions → raster/functions}/StretchFunctionArguments.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/TableFunction.js +1 -1
- package/layers/{support/rasterFunctions → raster/functions}/TableFunctionArguments.js +1 -1
- package/layers/raster/functions/bandIndexUtils.js +5 -0
- package/layers/raster/functions/changeDetectionUtils.js +5 -0
- package/layers/raster/functions/clipUtils.js +5 -0
- package/layers/raster/functions/conversionUtils.js +5 -0
- package/layers/raster/functions/convolutionUtils.js +5 -0
- package/layers/raster/functions/creators/createDataManagementFunctions.js +5 -0
- package/layers/raster/functions/creators/utils.js +5 -0
- package/layers/raster/functions/focalStatUtils.js +5 -0
- package/layers/raster/functions/localUtils.js +5 -0
- package/layers/raster/functions/pixelTransformUtils.js +5 -0
- package/layers/raster/functions/pixelUtils.js +5 -0
- package/layers/raster/functions/stretchUtils.js +5 -0
- package/layers/raster/functions/surfaceUtils.js +5 -0
- package/layers/raster/functions/vectorFieldUtils.js +5 -0
- package/layers/raster/transforms/BaseRasterTransform.js +5 -0
- package/layers/{support/rasterTransforms → raster/transforms}/GCSShiftTransform.js +1 -1
- package/layers/{support/rasterTransforms → raster/transforms}/IdentityTransform.js +1 -1
- package/layers/{support/rasterTransforms → raster/transforms}/PolynomialTransform.js +1 -1
- package/layers/save/imageryUtils.js +1 -1
- package/layers/support/PixelBlock.js +1 -1
- package/layers/support/RasterWorker.js +1 -1
- package/layers/support/imageryRendererUtils.js +1 -1
- package/layers/support/rasterFunctionUtils.js +1 -1
- package/package.json +1 -1
- package/renderers/VectorFieldRenderer.js +1 -1
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/renderers/support/rasterRendererHelper.js +1 -1
- package/rest/locator/addressToLocations.js +1 -1
- package/rest/locator/addressesToLocations.js +1 -1
- package/rest/locator/suggestLocations.js +1 -1
- package/rest/networks/support/Association.js +1 -1
- package/smartMapping/raster/support/adapters/ImageryLayerAdapter.js +1 -1
- package/smartMapping/raster/support/adapters/ImageryTileLayerAdapter.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterRangeHighlightShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/MaskShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/RemapShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/math.js +1 -1
- package/views/2d/layers/ImageryLayerView2D.js +1 -1
- package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryView2D.js +1 -1
- package/views/2d/layers/imagery/VectorFieldTileView2D.js +1 -1
- package/views/2d/layers/imagery/VectorFieldView2D.js +1 -1
- package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBufferView.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DrawParameters.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/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.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/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/Instance.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/PerOriginData.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
- package/views/DOMContainer.js +1 -1
- package/views/GroundView.js +1 -1
- package/views/layers/ImageryLayerViewMixin.js +1 -1
- package/views/layers/ImageryTileLayerViewMixin.js +1 -1
- package/views/support/imageReprojection.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/BuildingExplorer/BuildingExplorerViewModel.js +1 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
- package/widgets/CoordinateConversion.js +1 -1
- package/widgets/DirectLineMeasurement3D.js +1 -1
- package/widgets/DistanceMeasurement2D.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/ElevationProfile.js +1 -1
- package/widgets/Feature.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
- package/widgets/FeatureTable/support/GroupColumnTemplate.js +1 -1
- package/widgets/FeatureTable/support/TableTemplate.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/FeatureTemplates.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Legend.js +1 -1
- package/widgets/LineOfSight.js +1 -1
- package/widgets/Locate.js +1 -1
- package/widgets/OrientedImageryViewer/galleryUtils.js +1 -1
- package/widgets/OrientedImageryViewer/services/DepthImageService.js +1 -1
- package/widgets/PanoramicViewer/support/importUtils.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/ScaleBar.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/Search/SearchResultRenderer.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/Search/types.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/ShadowCast.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/assets/esri/core/workers/chunks/1f6ead46b723630db897.js +0 -1
- package/assets/esri/core/workers/chunks/3a16347e17312556e02c.js +0 -1
- package/assets/esri/core/workers/chunks/478def691ae6763686f3.js +0 -1
- package/assets/esri/core/workers/chunks/4c4a55be41ba105c091c.js +0 -1
- package/assets/esri/core/workers/chunks/4cbf5a97b2b3c6553f6f.js +0 -1
- package/assets/esri/core/workers/chunks/646f58b69d2354f1ef27.js +0 -1
- package/assets/esri/core/workers/chunks/93d11075f65a5b6625ea.js +0 -1
- package/assets/esri/core/workers/chunks/9f2a8445a5848502c7e7.js +0 -1
- package/assets/esri/core/workers/chunks/a1b08aab73747f4e7e25.js +0 -1
- package/assets/esri/core/workers/chunks/ba59568e748f0ba53b78.js +0 -1
- package/assets/esri/core/workers/chunks/f21cb5b34d4d1e3af1a9.js +0 -1
- package/assets/esri/core/workers/chunks/f93f0586ce10cb5d98b3.js +0 -1
- package/layers/support/rasterDatasets/BaseRaster.js +0 -5
- package/layers/support/rasterDatasets/CovJSONRaster.js +0 -5
- package/layers/support/rasterDatasets/FunctionRaster.js +0 -5
- package/layers/support/rasterDatasets/ImageAuxRaster.js +0 -5
- package/layers/support/rasterDatasets/ImageServerRaster.js +0 -5
- package/layers/support/rasterDatasets/InMemoryRaster.js +0 -5
- package/layers/support/rasterDatasets/MRFRaster.js +0 -5
- package/layers/support/rasterDatasets/RawBlockCache.js +0 -5
- package/layers/support/rasterDatasets/TIFFRaster.js +0 -5
- package/layers/support/rasterDatasets/WCSRaster.js +0 -5
- package/layers/support/rasterDatasets/covJSONParser.js +0 -5
- package/layers/support/rasterDatasets/multidimensionalUtils.js +0 -5
- package/layers/support/rasterDatasets/pamParser.js +0 -5
- package/layers/support/rasterDatasets/pixelReader.js +0 -5
- package/layers/support/rasterDatasets/wcsCoverageParser.js +0 -5
- package/layers/support/rasterFormats/Lerc.js +0 -5
- package/layers/support/rasterFormats/Qb3.js +0 -5
- package/layers/support/rasterFormats/RasterCodec.js +0 -5
- package/layers/support/rasterFormats/TiffDecoder.js +0 -5
- package/layers/support/rasterFunctions/ArithmeticFunction.js +0 -5
- package/layers/support/rasterFunctions/BandArithmeticFunction.js +0 -5
- package/layers/support/rasterFunctions/BaseRasterFunction.js +0 -5
- package/layers/support/rasterFunctions/ColormapFunction.js +0 -5
- package/layers/support/rasterFunctions/ColormapToRGBFunction.js +0 -5
- package/layers/support/rasterFunctions/CompositeBandFunction.js +0 -5
- package/layers/support/rasterFunctions/CompositeBandFunctionArguments.js +0 -5
- package/layers/support/rasterFunctions/ComputeChangeFunction.js +0 -5
- package/layers/support/rasterFunctions/ConvolutionFunction.js +0 -5
- package/layers/support/rasterFunctions/ConvolutionFunctionArguments.js +0 -5
- package/layers/support/rasterFunctions/HillshadeFunction.js +0 -5
- package/layers/support/rasterFunctions/LocalFunction.js +0 -5
- package/layers/support/rasterFunctions/RemapFunction.js +0 -5
- package/layers/support/rasterFunctions/ShadedReliefFunction.js +0 -5
- package/layers/support/rasterFunctions/SlopeFunction.js +0 -5
- package/layers/support/rasterFunctions/StatisticsFunction.js +0 -5
- package/layers/support/rasterFunctions/StretchFunction.js +0 -5
- package/layers/support/rasterFunctions/bandIndexUtils.js +0 -5
- package/layers/support/rasterFunctions/changeDetectionUtils.js +0 -5
- package/layers/support/rasterFunctions/clipUtils.js +0 -5
- package/layers/support/rasterFunctions/conversionUtils.js +0 -5
- package/layers/support/rasterFunctions/convolutionUtils.js +0 -5
- package/layers/support/rasterFunctions/creators/createDataManagementFunctions.js +0 -5
- package/layers/support/rasterFunctions/creators/utils.js +0 -5
- package/layers/support/rasterFunctions/focalStatUtils.js +0 -5
- package/layers/support/rasterFunctions/localUtils.js +0 -5
- package/layers/support/rasterFunctions/pixelTransformUtils.js +0 -5
- package/layers/support/rasterFunctions/pixelUtils.js +0 -5
- package/layers/support/rasterFunctions/stretchUtils.js +0 -5
- package/layers/support/rasterFunctions/surfaceUtils.js +0 -5
- package/layers/support/rasterFunctions/vectorFieldUtils.js +0 -5
- package/layers/support/rasterTransforms/BaseRasterTransform.js +0 -5
- /package/assets/esri/layers/{support/rasterFormats → raster/formats}/lerc-wasm.wasm +0 -0
- /package/assets/esri/layers/{support/rasterFormats → raster/formats}/qb3-wasm.wasm +0 -0
- /package/layers/{support/rasterDatasets → raster/datasets}/DBFParser.js +0 -0
- /package/layers/{support/rasterDatasets → raster/datasets}/EphemeralBlockCache.js +0 -0
- /package/layers/{support/rasterDatasets → raster/datasets}/RasterFactory.js +0 -0
- /package/layers/{support/rasterDatasets → raster/datasets}/byteStreamUtils.js +0 -0
- /package/layers/{support/rasterDatasets → raster/datasets}/datasetUtils.js +0 -0
- /package/layers/{support/rasterDatasets → raster/datasets}/multipartParser.js +0 -0
- /package/layers/{support/rasterDatasets → raster/datasets}/wcsCapabilitiesParser.js +0 -0
- /package/layers/{support/rasterDatasets → raster/datasets}/xmlUtilities.js +0 -0
- /package/layers/{support/rasterFormats → raster/formats}/ImageCanvasDecoder.js +0 -0
- /package/layers/{support/rasterFormats → raster/formats}/JpgPlus.js +0 -0
- /package/layers/{support/rasterFormats → raster/formats}/Lzw.js +0 -0
- /package/layers/{support/rasterFormats → raster/formats}/Raw.js +0 -0
- /package/layers/{support/rasterFormats → raster/formats}/pixelRangeUtils.js +0 -0
- /package/layers/{support/rasterFormats → raster/formats}/tiffTag.js +0 -0
- /package/layers/{support/rasterFormats → raster/formats}/utils.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/colormaps.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/creators/createAppearenceFunctions.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/creators/createBandIndexFunctions.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/creators/createChangeFunctions.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/creators/createConversionFunctions.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/creators/createLocalFunctions.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/creators/createMultiRasterAnalysisFunctions.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/creators/createStatisticsFunctions.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/creators/createSurfaceFunctions.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/customBandIndexUtils.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/mirror.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/rasterFunctionHelper.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/rasterFunctionSchema.js +0 -0
- /package/layers/{support/rasterFunctions → raster/functions}/rasterProjectionHelper.js +0 -0
- /package/layers/{support/rasterTransforms → raster/transforms}/utils.js +0 -0
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{JSONSupport as s}from"../../../core/JSONSupport.js";import{property as e,cast as r,subclass as n}from"../../../core/accessorSupport/decorators.js";import i from"../PixelBlock.js";import o from"../RasterInfo.js";const a=new Set(["slope","aspect","curvature","hillshade","shadedrelief","statistics"]);let u=class extends s{constructor(){super(...arguments),this.functionArguments=null,this.readingBufferSize=0,this.id=-1,this.isNoopProcess=!1,this.rawInputBandIds=[],this.rawSourceRasterInfos=null,this.isInputBandIdsSwizzled=!1,this.swizzledBandSelection=[],this.isBranch=!1,this.isRoot=!1,this._bindingResult=null}get supportsGPU(){return this._bindingResult.supportsGPU}get flatWebGLFunctionChain(){const t=this.getWebGLProcessorDefinition();if(!t)return null;const s=[t],{parameters:e}=t;let r=e.rasters||e.raster&&[e.raster];for(;r?.length;){s.unshift(...r);const t=[];for(let s=0;s<r.length;s++){const{parameters:e}=r[s],n=e.rasters||e.raster&&[e.raster];n?.length&&t.push(...n)}r=t}for(let a=s.length-1;a>=0;a--)s[a].isNoopProcess&&s.splice(a,1);let n=!1;for(let a=0;a<s.length;a++){const t=s[a];t.id=s.length-a-1;const{rasters:e}=t.parameters;n=n||null!=e&&e.length>1}const i=s.some(({name:t})=>a.has(t.toLowerCase())),{rawSourceRasterInfos:o}=this;return{functions:s,hasBranches:n,hasFocalFunction:i,isSourceSingleBand:1===o?.[0]?.bandCount}}bind(t,s=!1,e=-1){this.id=e+1;const r=this._getRasterValues();let n=!0;for(let i=0;i<r.length;i++){const e=r[i];if(null!=e&&this._isRasterFunctionValue(e)){const r=e.bind(t,s,this.id+i);if(!r.success)return this._bindingResult=r,r;n=n&&r.supportsGPU}}if(!this.rasterInfo||s){if(this.sourceRasterInfos=this._getSourceRasterInfos(t),this._bindingResult=this._bindSourceRasters(),n&&=this._bindingResult.supportsGPU,this._bindingResult.success&&(this._patchRasterInfo(),n&&this.isRoot)){this.processInputBandIds();this.swizzleInputBandIds(this.rawInputBandIds)||(n=this.rawInputBandIds.length<=3)}return this._bindingResult.supportsGPU=n,this._bindingResult}return this._bindingResult={success:!0,supportsGPU:!0},this._bindingResult}process(t){const s=this._getRasterValues(),e=0===s.length?t.pixelBlocks??t.primaryPixelBlocks:s.map(s=>this._readRasterValue(s,t));return this._processPixels({...t,pixelBlocks:e})}processInputBandIds(){const t=this._getRasterValues().filter(this._isRasterFunctionValue);if(t.length>1){const s=t.map(t=>t.processInputBandIds());return this.rawInputBandIds=[...new Set(s.flat())],this.rawInputBandIds}const s=t[0];if(s)return this.rawInputBandIds=s.processInputBandIds(),this.rawInputBandIds;const{bandCount:e}=this.sourceRasterInfos[0],r=Array.from({length:e},(t,s)=>s);return this.rawInputBandIds=this._getInputBandIds(r),this.rawInputBandIds}swizzleInputBandIds(t){const s=this._getRasterValues().filter(this._isRasterFunctionValue);let e=!0;for(const r of s)e=r.swizzleInputBandIds(t)&&e;return!!e&&this._swizzleBandIds(t)}getPrimaryRasters(){const t=[],s=[];return this._getPrimaryRasters(this,t,s),{rasters:t,rasterIds:s}}getWebGLProcessorDefinition(){const t=this._getWebGLParameters(),{raster:s,rasters:e}=this.functionArguments;return e&&Array.isArray(e)&&e.length?(t.rasters=e.map(t=>this._isRasterFunctionValue(t)?t.getWebGLProcessorDefinition():"number"==typeof t?{name:"Constant",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1}:{name:"Identity",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1}),t.rasters.some(t=>null!=t)||(t.rasters=null)):this._isRasterFunctionValue(s)&&(t.raster=s.getWebGLProcessorDefinition()),{name:this.functionName,parameters:t,pixelType:this.outputPixelType,id:this.id,isNoopProcess:this.isNoopProcess}}getClippingGeometries(){const t=[];"Clip"===this.functionName&&t.push(this.functionArguments);const{raster:s,rasters:e}=this.functionArguments;if(e&&Array.isArray(e)&&e.length)e.forEach(s=>{if(this._isRasterFunctionValue(s)){const e=s.getClippingGeometries();t.push(...e)}});else if(this._isRasterFunctionValue(s)){const e=s.getClippingGeometries();t.push(...e)}return t}_getOutputPixelType(t){return"unknown"===this.outputPixelType?t:this.outputPixelType??t}_getWebGLParameters(){return{}}_getInputBandIds(t){return t}_swizzleBandIds(t){return!0}_isInputRasterPrimaryOrConstant(){return!this._getRasterValues().some(t=>t&&"object"==typeof t&&"rasterFunction"in t&&t.rasterFunction)}_removeStatsHistColormapVAT(t){t.statistics=null,t.histograms=null,t.colormap=null,t.attributeTable=null,t.multidimensionalInfo?.variables.forEach(t=>{t.statistics=void 0,t.histograms=void 0})}_getRasterValues(){const{rasterArgumentNames:t}=this;return"rasters"===t[0]?this.functionArguments.rasters??[]:t.flatMap(t=>this.functionArguments[t])}_getSourceRasterInfos(t){const s=this._getRasterValues(),{rasterInfos:e,rasterIds:r}=t;if(0===s.length)return e;const n=s.map(t=>t&&"object"==typeof t&&"bind"in t&&t.rasterInfo?t.rasterInfo:"string"==typeof t&&r.includes(t)?e[r.indexOf(t)]:"number"!=typeof t?e[0]:void 0),i=n.find(t=>t)??e[0];return n.forEach((t,s)=>{void 0===t&&(n[s]=i)}),n}_getPrimaryRasterId(t){return t?.rasterId}_getPrimaryRasters(t,s=[],e=[]){for(let r=0;r<t.sourceRasters.length;r++){const n=t.sourceRasters[r];if("number"!=typeof n)if("bind"in n)this._getPrimaryRasters(n,s,e);else{const t=n,r=this._getPrimaryRasterId(t);if(null==r)continue;e.includes(r)||(this.mainPrimaryRasterId===r?(s.unshift(t),e.unshift(r)):(s.push(t),e.push(r)))}}}_isRasterFunctionValue(t){return null!=t&&"object"==typeof t&&"getWebGLProcessorDefinition"in t}_readRasterValue(t,s){const{primaryPixelBlocks:e}=s;if(null==t||"$$"===t){const t=e[0];return null==t?null:t.clone()}if("string"==typeof t){const r=s.primaryRasterIds.indexOf(t);return-1===r?null:e[r]}if("number"==typeof t){const s=e[0];if(null==s)return null;const{width:r,height:n,pixelType:o}=s,a=new Float32Array(r*n);a.fill(t);const u=this.sourceRasterInfos[0].bandCount,l=new Array(u).fill(a);return new i({width:r,height:n,pixelType:o,pixels:l})}return t.process(s)}_patchRasterInfo(){const{rasterInfo:t}=this;if(!t?.keyProperties)return;const{bandCount:s,keyProperties:e,statistics:r,histograms:n}=t,i=e.BandProperties;i&&i.length!==s&&(t.keyProperties={...e,BandProperties:void 0}),r&&r.length!==s&&(t.statistics=r.length>s?r.slice(0,s):null),n&&n.length!==s&&(t.histograms=n.length>s?n.slice(0,s):null),e.BAND_COUNT&&Number(e.BAND_COUNT)!==s&&(t.keyProperties={...e,BAND_COUNT:"string"==typeof e.BAND_COUNT?String(s):s})}};t([e({json:{write:!0}})],u.prototype,"functionName",void 0),t([e({json:{write:!0}})],u.prototype,"functionArguments",void 0),t([e()],u.prototype,"rasterArgumentNames",void 0),t([e({json:{write:!0}}),r(t=>t?.toLowerCase())],u.prototype,"outputPixelType",void 0),t([e({json:{write:!0}})],u.prototype,"mainPrimaryRasterId",void 0),t([e()],u.prototype,"sourceRasters",void 0),t([e({type:[o],json:{write:!0}})],u.prototype,"sourceRasterInfos",void 0),t([e({json:{write:!0}})],u.prototype,"rasterInfo",void 0),t([e({json:{write:!0}})],u.prototype,"readingBufferSize",void 0),t([e({json:{write:!0}})],u.prototype,"id",void 0),t([e()],u.prototype,"isNoopProcess",void 0),t([e()],u.prototype,"supportsGPU",null),t([e({json:{write:!0}})],u.prototype,"rawInputBandIds",void 0),t([e()],u.prototype,"rawSourceRasterInfos",void 0),t([e({json:{write:!0}})],u.prototype,"isInputBandIdsSwizzled",void 0),t([e({json:{write:!0}})],u.prototype,"swizzledBandSelection",void 0),t([e()],u.prototype,"isBranch",void 0),t([e()],u.prototype,"isRoot",void 0),t([e({readOnly:!0})],u.prototype,"flatWebGLFunctionChain",null),t([e()],u.prototype,"_bindingResult",void 0),u=t([n("esri.layers.support.rasterFunctions.BaseRasterFunction")],u);const l=u;export{l as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as o}from"tslib";import{property as t,subclass as r}from"../../../core/accessorSupport/decorators.js";import{isIntegerPixelType as s}from"../rasterFormats/pixelRangeUtils.js";import e from"./BaseRasterFunction.js";import p from"./ColormapFunctionArguments.js";import{getColormapByName as i}from"./colormaps.js";import{convertColorRampToColormap as n,getColorRampJSON as a}from"../../../renderers/support/colorRampUtils.js";import{fromJSON as c}from"../../../rest/support/colorRamps.js";let m=class extends e{constructor(){super(...arguments),this.functionName="Colormap",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const o=this.sourceRasterInfos[0];if(o.bandCount>1)return{success:!1,supportsGPU:!1,error:"colormap-function: source data must be single band"};let{colormap:t,colormapName:r,colorRamp:s,colorRampName:e}=this.functionArguments;if(!t?.length)if(s)this.colorRamp=s,t=n(s,{interpolateAlpha:!0});else if(e){const o=a(e);o&&(t=n(o),this.colorRamp=c(o))}else r&&(t=i(r));if(!t?.length)return{success:!1,supportsGPU:!1,error:"colormap-function: missing colormap argument"};const p=this._getOutputPixelType(o.pixelType);this.outputPixelType=p.startsWith("f")?"s32":p;const m=o.clone();return m.pixelType=this.outputPixelType,m.colormap=t,m.bandCount=1,this.rasterInfo=m,{success:!0,supportsGPU:!0}}_processPixels(o){let t=o.pixelBlocks?.[0];return!t||s(t.pixelType)||(t=t.clone(),t.clamp(this.outputPixelType)),t}};o([t({json:{write:!0,name:"rasterFunction"}})],m.prototype,"functionName",void 0),o([t({type:p,json:{write:!0,name:"rasterFunctionArguments"}})],m.prototype,"functionArguments",void 0),o([t()],m.prototype,"rasterArgumentNames",void 0),o([t()],m.prototype,"isNoopProcess",void 0),o([t({json:{write:!0}})],m.prototype,"indexedColormap",void 0),o([t()],m.prototype,"colorRamp",void 0),m=o([r("esri.layers.support.rasterFunctions.ColormapFunction")],m);const u=m;export{u as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{property as o,subclass as e}from"../../../core/accessorSupport/decorators.js";import{SimpleBandStatistics as r}from"../SimpleBandStatistics.js";import s from"./BaseRasterFunction.js";import n from"./ColormapToRGBFunctionArguments.js";import{createColormapLUT as i}from"./pixelUtils.js";import{isColormapSupportedByWebGL as p}from"../../../renderers/support/rasterRendererChecks.js";let a=class extends s{constructor(){super(...arguments),this.functionName="ColormapToRGB",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1||!t.colormap?.length)return{success:!1,supportsGPU:!1,error:"colormap-to-rgb-function: source data must be single band with a colormap"};const o=t.clone();o.pixelType=this.outputPixelType=this._getOutputPixelType("u8"),this._removeStatsHistColormapVAT(o),o.bandCount=3,o.statistics=[{min:0,max:255,avg:100,stddev:20},{min:0,max:255,avg:100,stddev:20},{min:0,max:255,avg:100,stddev:20}],this.rasterInfo=o;const e=[...t.colormap].sort((t,o)=>t[0]-o[0]),{indexedColormap:r,offset:s}=i({colormap:e});return r?(this.lookup={indexedColormap:r,offset:s},{success:!0,supportsGPU:p(r)}):{success:!1,supportsGPU:!1,error:"colormap-to-rgb-function: the colormap is not supported"}}_processPixels(t){let o=t.pixelBlocks?.[0];if(!o||!this.lookup)return o;o=o.clone();const e=o.pixels[0],s=o.mask??new Uint8Array(e.length).fill(255),n=new Uint8Array(e.length),i=new Uint8Array(e.length),p=new Uint8Array(e.length),{indexedColormap:a,offset:u}=this.lookup,l=a.length;for(let r=0;r<e.length;r++)if(s[r]){let t=4*(e[r]-u);t<0||t>l-4?s[r]=0:(n[r]=a[t++],i[r]=a[t++],p[r]=a[t++])}return o.pixels=[n,i,p],o.statistics=[new r(0,255),new r(0,255),new r(0,255)],o.pixelType=this.outputPixelType,o}_getWebGLParameters(){return this.lookup}};t([o({json:{write:!0,name:"rasterFunction"}})],a.prototype,"functionName",void 0),t([o({type:n,json:{write:!0,name:"rasterFunctionArguments"}})],a.prototype,"functionArguments",void 0),t([o()],a.prototype,"rasterArgumentNames",void 0),t([o({json:{write:!0}})],a.prototype,"lookup",void 0),a=t([e("esri.layers.support.rasterFunctions.ColormapToRGBFunction")],a);const u=a;export{u as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{property as s,subclass as e}from"../../../core/accessorSupport/decorators.js";import n from"./BaseRasterFunction.js";import r from"./CompositeBandFunctionArguments.js";import{compositeBands as o}from"./pixelUtils.js";let i=class extends n{constructor(){super(...arguments),this.functionName="CompositeBand",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,s=t[0];this.outputPixelType=this._getOutputPixelType(s.pixelType);const e=s.clone();if(e.attributeTable=null,e.colormap=null,e.pixelType=this.outputPixelType,e.bandCount=t.map(({bandCount:t})=>t).reduce((t,s)=>t+s),t.every(({statistics:t})=>null!=t&&t.length)){const s=[];t.forEach(({statistics:t})=>null!=t&&s.push(...t)),e.statistics=s}if(t.every(({histograms:t})=>null!=t&&t.length)){const s=[];t.forEach(({histograms:t})=>null!=t&&s.push(...t)),e.histograms=s}e.multidimensionalInfo&&e.multidimensionalInfo.variables.forEach(s=>{const e=t.map(t=>t.multidimensionalInfo?.variables.find(({name:t})=>t===s.name)),n=e.map(t=>t?.statistics?.length?t.statistics:null),r=e.map(t=>t?.histograms?.length?t.histograms:null);s.statistics=n.every(t=>null!=t)?n.flat():null,s.histograms=r.every(t=>null!=t)?r.flat():null}),e.bandCount>1&&(e.colormap=null,e.attributeTable=null);const n=t.every(t=>t.keyProperties.BandProperties?.length)?t.flatMap(t=>t.keyProperties.BandProperties):void 0;e.keyProperties={...e.keyProperties,BandProperties:n},this.rasterInfo=e;return{success:!0,supportsGPU:e.bandCount<=3}}_processPixels(t){const{pixelBlocks:s}=t;if(!s)return null;const e=s?.[0];return null==e?null:o(s)}_getWebGLParameters(){return{bandCount:this.rasterInfo.bandCount}}};t([s({json:{write:!0,name:"rasterFunction"}})],i.prototype,"functionName",void 0),t([s({type:r,json:{write:!0,name:"rasterFunctionArguments"}})],i.prototype,"functionArguments",void 0),t([s()],i.prototype,"rasterArgumentNames",void 0),i=t([e("esri.layers.support.rasterFunctions.CompositeBandFunction")],i);const a=i;export{a as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as r}from"tslib";import{clone as t}from"../../../core/lang.js";import{property as s,subclass as o}from"../../../core/accessorSupport/decorators.js";import e from"./BaseFunctionArguments.js";import{writer as a}from"../../../core/accessorSupport/decorators/writer.js";var p;let n=p=class extends e{constructor(){super(...arguments),this.rasters=[]}writeRasters(r,t){t.rasters=r.map(r=>"number"==typeof r||"string"==typeof r?r:r.toJSON())}clone(){return new p({rasters:t(this.rasters)})}};r([s({json:{write:!0}})],n.prototype,"rasters",void 0),r([a("rasters")],n.prototype,"writeRasters",null),n=p=r([o("esri.layers.support.rasterFunctions.CompositeBandFunctionArguments")],n);const i=n;export{i as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as s}from"../../../core/accessorSupport/decorators.js";import n from"../Field.js";import{getPixelValueRange as r,isIntegerPixelType as a}from"../rasterFormats/pixelRangeUtils.js";import o from"./BaseRasterFunction.js";import{computeChange as i}from"./changeDetectionUtils.js";import u from"./ComputeChangeFunctionArguments.js";let l=class extends o{constructor(){super(...arguments),this.functionName="ComputeChange",this.functionArguments=null,this.rasterArgumentNames=["raster","raster2"]}_bindSourceRasters(){const{method:e}=this.functionArguments,t=this.sourceRasterInfos[0].clone();if(this.outputPixelType=this._getOutputPixelType(t.pixelType),t.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(t),"categorical"===e){const e=this.sourceRasterInfos.map(e=>e.attributeTable),s=this._getFieldNames(e,"value"),n=e.map(e=>this._getClassFieldName(e));if(null==s[0]||null==s[1]||null==n[0]||null==n[1])return{success:!1,supportsGPU:!1,error:"both inputs must have proper attribute table with value and class fields"};this._updateAttributeTable(t,s,n)}t.bandCount=1,this.rasterInfo=t;return{success:!0,supportsGPU:"difference"===e||"relative-difference"===e}}_processPixels(e){const{pixelBlocks:t}=e;if(null==t?.[0]||null==t?.[1])return null;const{method:s}=this.functionArguments;return i(t,s,this.outputPixelType,this._categoryConfig)}_getWebGLParameters(){const e=this.outputPixelType??"f32";let[t,s]=r(e);const n=a(e);return n&&(t-=1e-4,s+=1e-4),{method:this.functionArguments.method,domainRange:[t,s],isOutputRounded:n}}_updateAttributeTable(e,t,s){const r=this.sourceRasterInfos.map(e=>e.attributeTable),a=r.map((e,s)=>e.features.map(e=>e.attributes[t[s]])),o=r.map((e,t)=>e.features.map(e=>e.attributes[s[t]])),i=a.map(e=>{const t=[];return e.forEach((e,s)=>t[e]=s),t}),{keepMethod:u}=this.functionArguments;this._categoryConfig={categoryIndexLookups:i,classNames:o,keepMethod:u};const l=r[0].clone();l.fields=[new n({name:"OID",type:"oid"}),new n({name:"Value",type:"integer"}),new n({name:"ClassName",type:"string"}),new n({name:"Class_From",type:"string"}),new n({name:"Class_To",type:"string"})];const m=this._getFieldNames(r,"red"),p=this._getFieldNames(r,"green"),c=this._getFieldNames(r,"blue"),d=[],g=2===m.length&&2===p.length&&2===c.length;g&&(d.push(...r.map((e,t)=>e.features.map(e=>[e.attributes[m[t]],e.attributes[p[t]],e.attributes[c[t]]]))),l.fields.push(new n({name:"Red",type:"integer"}),new n({name:"Green",type:"integer"}),new n({name:"Blue",type:"integer"})));const h=l.features[0].clone();h.geometry=null;const f=[],[y,C]=a.map(e=>e.length);let b=1;for(let n=0;n<y;n++){const e=o[0][n];for(let t=0;t<C;t++){const s=o[1][t];if("changed"===u&&e===s||"unchanged"===u&&e!==s)continue;const r=h.clone();r.attributes={OID:b++,Value:n*C+t,ClassName:e===s?e:`${e} -> ${s}`,Class_From:e,Class_To:s},g&&(r.attributes.Red=d[0][n][0]+d[1][t][0]>>1,r.attributes.Green=d[0][n][1]+d[1][t][1]>>1,r.attributes.Blue=d[0][n][2]+d[1][t][2]>>1),f.push(r)}}if("changed"===u){const e=h.clone();e.attributes={OID:b++,Value:y*C+1,ClassName:"No Change",Class_From:"Same",Class_To:"Same"},f.push(e)}else if("unchanged"===u){const e=h.clone();e.attributes={OID:b++,Value:y*C+2,ClassName:"Changed",Class_From:"Any",Class_To:"Any"},f.push(e)}l.features=f,e.attributeTable=l}_getFieldNames(e,t){return e.map(({fields:e})=>e.find(e=>e.name.toLowerCase()===t)?.name).filter(e=>e)}_getClassFieldName(e){const t=e.fields.find(e=>"string"===e.type&&e.name.toLowerCase().startsWith("class"))??e.fields.find(e=>"string"===e.type&&e.name.toLowerCase().includes("class")||e.name.toLowerCase().includes("type")||e.name.toLowerCase().includes("name"))??e.fields.find(e=>"string"===e.type);return t?.name}};e([t({json:{write:!0,name:"rasterFunction"}})],l.prototype,"functionName",void 0),e([t({type:u,json:{write:!0,name:"rasterFunctionArguments"}})],l.prototype,"functionArguments",void 0),e([t()],l.prototype,"rasterArgumentNames",void 0),e([t({json:{write:!0}})],l.prototype,"_categoryConfig",void 0),l=e([s("esri.layers.support.rasterFunctions.ComputeChangeFunction")],l);const m=l;export{m as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{property as e,subclass as o}from"../../../core/accessorSupport/decorators.js";import{convolutionKernel as n}from"../rasterFunctionConstants.js";import{getPixelValueRange as s}from"../rasterFormats/pixelRangeUtils.js";import r from"./BaseRasterFunction.js";import i from"./ConvolutionFunctionArguments.js";import{convolute as u}from"./convolutionUtils.js";const l=25;let c=class extends r{constructor(){super(...arguments),this.functionName="Convolution",this.rasterArgumentNames=["raster"]}get _normalizedKernel(){const{kernel:t,convolutionType:e}=this.functionArguments,o=t.reduce((t,e)=>t+e);return-1===e||0===o||1===o?t:t.map(t=>t/o)}_bindSourceRasters(){const{convolutionType:t,rows:e,cols:o,kernel:s}=this.functionArguments;if(!Object.values(n).includes(t))return{success:!1,supportsGPU:!1,error:`convolution-function: the specified kernel type is not supported ${t}`};if(t!==n.none&&e*o!==s.length)return{success:!1,supportsGPU:!1,error:"convolution-function: the specified rows and cols do not match the length of the kernel"};const r=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType(r.pixelType);const i=r.clone();i.pixelType=this.outputPixelType;const u=[n.none,n.sharpen,n.sharpen2,n.sharpening3x3,n.sharpening5x5];(-1===t||"u8"!==this.outputPixelType&&!u.includes(t))&&(i.statistics=null,i.histograms=null),i.colormap=null,i.attributeTable=null,this.rasterInfo=i;return{success:!0,supportsGPU:s.length<=l}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e||this.functionArguments.convolutionType===n.none)return e;const{rows:o,cols:s}=this.functionArguments,{_normalizedKernel:r}=this;return u(e,{kernel:r,rows:o,cols:s,outputPixelType:this.outputPixelType})}_getWebGLParameters(){const t=new Float32Array(l),{rows:e,cols:o}=this.functionArguments,{_normalizedKernel:n}=this;for(let s=0;s<e;s++)for(let e=0;e<o;e++)t[5*s+e]=n[s*o+e];return{kernelRows:e,kernelCols:o,kernel:t,clampRange:s(this.outputPixelType)}}};t([e({json:{write:!0,name:"rasterFunction"}})],c.prototype,"functionName",void 0),t([e({type:i,json:{write:!0,name:"rasterFunctionArguments"}})],c.prototype,"functionArguments",void 0),t([e()],c.prototype,"rasterArgumentNames",void 0),t([e()],c.prototype,"_normalizedKernel",null),c=t([o("esri.layers.support.rasterFunctions.ConvolutionFunction")],c);const p=c;export{p as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{clone as o}from"../../../core/lang.js";import{property as e,subclass as s}from"../../../core/accessorSupport/decorators.js";import{convolutionKernel as r}from"../rasterFunctionConstants.js";import n from"./BaseFunctionArguments.js";import{convolutionKernels as i}from"./convolutionUtils.js";var p;let l=p=class extends n{constructor(){super(...arguments),this.rows=3,this.cols=3,this.kernel=[0,0,0,0,1,0,0,0,0]}set convolutionType(t){this._set("convolutionType",t);const o=i.get(t);if(!o||t===r.userDefined||t===r.none)return;const e=Math.sqrt(o.length);this._set("kernel",o),this._set("cols",e),this._set("rows",e)}clone(){return new p({cols:this.cols,rows:this.rows,kernel:[...this.kernel],convolutionType:this.convolutionType,raster:o(this.raster)})}};t([e({json:{type:Number,write:!0}})],l.prototype,"rows",void 0),t([e({json:{type:Number,write:!0}})],l.prototype,"cols",void 0),t([e({json:{name:"type",type:Number,write:!0}})],l.prototype,"convolutionType",null),t([e({json:{type:[Number],write:!0}})],l.prototype,"kernel",void 0),l=p=t([s("esri.layers.support.rasterFunctions.ConvolutionFunctionArguments")],l);const c=l;export{c as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{property as e,subclass as s}from"../../../core/accessorSupport/decorators.js";import{isIntegerPixelType as i}from"../rasterFormats/pixelRangeUtils.js";import r from"./BaseRasterFunction.js";import o from"./HillshadeFunctionArguments.js";import{getHillshadeOptions as n,hillshade as u,calculateHillshadeParams as a,gcsFactor as p}from"./surfaceUtils.js";let c=class extends r{constructor(){super(...arguments),this.functionName="Hillshade",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1)return{success:!1,supportsGPU:!1,error:"hillshade-function: source data must be single band"};this.outputPixelType=this._getOutputPixelType("u8");const e=t.clone();return this._removeStatsHistColormapVAT(e),e.pixelType=this.outputPixelType,e.bandCount=1,e.statistics=[{min:0,max:255,avg:60,stddev:10}],this.rasterInfo=e,this.isGCS=e.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(!e)return null;const{extent:s,primaryPixelSizes:i}=t,r=i?.[0],o=r??(s?{x:s.width/e.width,y:s.height/e.height}:{x:1,y:1}),a=n(this.functionArguments,o,this.isGCS),p=u(e,a);return p.pixelType=this.outputPixelType,p}_getWebGLParameters(){const t=n(this.functionArguments,{x:1,y:1},this.isGCS),e=a(t),{slopeType:s,zFactor:r,pixelSizeFactor:o,pixelSizePower:u}=this.functionArguments,c="scaled"===s,l=i(this.outputPixelType);return{...e,zFactor:r,gcsFactor:this.isGCS?p:1,pixelSizeFactor:c?o:0,pixelSizePower:c?u:0,isOutputRounded:l}}};t([e({json:{write:!0,name:"rasterFunction"}})],c.prototype,"functionName",void 0),t([e({type:o,json:{write:!0,name:"rasterFunctionArguments"}})],c.prototype,"functionArguments",void 0),t([e()],c.prototype,"rasterArgumentNames",void 0),t([e({json:{write:!0}})],c.prototype,"isGCS",void 0),c=t([s("esri.layers.support.rasterFunctions.HillshadeFunction")],c);const l=c;export{l as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{property as s,subclass as e}from"../../../core/accessorSupport/decorators.js";import{localOperators as n}from"../rasterFunctionConstants.js";import{getPixelValueRange as o,isIntegerPixelType as i,getIntegerPixelType as r}from"../rasterFormats/pixelRangeUtils.js";import u from"./BaseRasterFunction.js";import a from"./LocalFunctionArguments.js";import{operandsCount as c,local as l,getOutputDomain as p}from"./localUtils.js";let m=class extends u{constructor(){super(...arguments),this.functionName="Local",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,s=t[0],{bandCount:e}=s,{processAsMultiband:n}=this.functionArguments;if(t.some(t=>t.bandCount!==e))return{success:!1,supportsGPU:!1,error:"local-function: input rasters do not have same band count"};const{operation:o,rasters:i}=this.functionArguments,r=c[o];if(!(999===r||i.length===r||i.length<=1&&1===r))return{success:!1,supportsGPU:!1,error:`local-function: the length of functionArguments.rasters does not match operation's requirement: ${r}`};const u=s.clone();u.bandCount=999!==r||n?e:1,this._removeStatsHistColormapVAT(u),this._updateStatistics(u),this._updatePixelType(u),this.rasterInfo=u;return{success:!0,supportsGPU:1===u.bandCount&&r<=3}}_processPixels(t){const{pixelBlocks:s}=t;return null==s||s.some(t=>null==t)?null:l(s,this.functionArguments.operation,{processAsMultiband:this.functionArguments.processAsMultiband,outputPixelType:this.outputPixelType??void 0})}_getWebGLParameters(){const{operation:t}=this.functionArguments,s=c[t],e=Object.keys(n).find(s=>n[s]===t)?.toLowerCase()??"undefined",r=this.outputPixelType??"f32";let[u,a]=o(r);const l=i(r);return l&&(u-=1e-4,a+=1e-4),{imageCount:s,operationName:e,domainRange:[u,a],isOutputRounded:l}}_updateStatistics(t){const s=this.sourceRasterInfos[0],{operation:e}=this.functionArguments,n=p(e)?.domain;if(n){t.statistics=[];for(let s=0;s<t.bandCount;s++)t.statistics[s]={min:n[0],max:n[1],avg:(n[0]+n[1])/2,stddev:(n[0]+n[1])/10}}else 45===e&&s.statistics?.length&&(t.statistics=s.statistics.map(t=>({min:-t.max,max:-t.min,avg:null!=t.avg?-t.avg:void 0,stddev:null!=t.stddev?-t.stddev:void 0})))}_updatePixelType(t){const{statistics:s,pixelType:e}=this.sourceRasterInfos[0],{operation:n}=this.functionArguments,{domain:o,isInteger:u}=p(n)??{domain:null,isInteger:!1};let a="f32";if(o&&u)a=r(o[0],o[1]);else if(30===n){const t=s?.[0];a=t?r(t.min,t.max):i(e)?e:"s32"}else if(45===n&&i(e)){const t=s?.map(({max:t})=>-t),n=s?.map(({min:t})=>-t),o=t?.length?Math.min(...t):null,i=n?.length?Math.min(...n):null;a=null!=o&&null!=i?r(o,i):e.startsWith("s")?e.replace("s","u"):"u1"===e||"u2"===e||"u4"===e?"s8":"u8"===e?"s16":"s32"}t.pixelType=this.outputPixelType=this._getOutputPixelType(a)}};t([s({json:{write:!0,name:"rasterFunction"}})],m.prototype,"functionName",void 0),t([s({type:a,json:{write:!0,name:"rasterFunctionArguments"}})],m.prototype,"functionArguments",void 0),t([s()],m.prototype,"rasterArgumentNames",void 0),m=t([e("esri.layers.support.rasterFunctions.LocalFunction")],m);const d=m;export{d as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{numberMaxFloat32 as e}from"../../../core/mathUtils.js";import{property as s,subclass as n}from"../../../core/accessorSupport/decorators.js";import{getPixelValueRange as u}from"../rasterFormats/pixelRangeUtils.js";import a from"./BaseRasterFunction.js";import{createRemapLUT as o,maxMapSizeGpu as i,lookupPixels as l,lookupBandValues as r,remap as p,createRangeMaps as m}from"./pixelUtils.js";import c from"./RemapFunctionArguments.js";let f=class extends a{constructor(){super(...arguments),this.functionName="Remap",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone(),{pixelType:e}=t;t.bandCount=1;const{statistics:s}=t;this._removeStatsHistColormapVAT(t);const{allowUnmatched:n,replacementValue:a,outputValues:l,inputRanges:r,noDataRanges:p,isLastInputRangeInclusive:m}=this.functionArguments,c="unknown"===this.outputPixelType||null==this.outputPixelType;if(this.outputPixelType=this._getOutputPixelType(e),l?.length){const o=s?.[0];if(n&&null==a){let e=o?.min??l[0],s=o?.max??l[0];e=Math.min.apply(null,[...l,e]),s=Math.max.apply(null,[...l,s]),t.statistics=[{min:e,max:s,avg:o?.avg??0,stddev:o?.stddev??-1}]}else{let e=l[0],s=e;for(let t=0;t<l.length;t++)e=e>l[t]?l[t]:e,s=s>l[t]?s:l[t];n&&null!=a&&(e=Math.min(e,a),s=Math.max(s,a)),t.statistics=[{min:e,max:s,avg:o?.avg??0,stddev:o?.stddev??-1}]}if(c){const{min:s,max:o}=t.statistics[0],i=["u8","s8","u16","s16","u32","s32","f32"],r=i.find(t=>{const[e,n]=u(t);return s>=e&&o<=n})??"f64";l.some(t=>Math.floor(t)!==t)?this.outputPixelType="f64"===r?"f64":"f32":this.outputPixelType=n&&null==a&&i.indexOf(e)>i.indexOf(r)?e:r}}t.pixelType=this.outputPixelType,this.rasterInfo=t,this.lookup=n?null:o({srcPixelType:e,inputRanges:r,outputValues:l,noDataRanges:p,allowUnmatched:n,isLastInputRangeInclusive:m,outputPixelType:this.outputPixelType});return{success:!0,supportsGPU:(!l||l.length<=i)&&(!p||p.length<=i)}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{lookup:s,outputPixelType:n}=this;if(s){const t=l(e,{lut:[s.lut],offset:s.offset,outputPixelType:n});return null!=t&&s.mask&&(t.mask=r(e.pixels[0],e.mask,s.mask,s.offset,"u8")),t}const{inputRanges:u,outputValues:a,noDataRanges:o,allowUnmatched:i,isLastInputRangeInclusive:m,replacementValue:c}=this.functionArguments;return p(e,{inputRanges:u,outputValues:a,noDataRanges:o,outputPixelType:n,allowUnmatched:i,isLastInputRangeInclusive:m,replacementValue:c})}_getWebGLParameters(){const{allowUnmatched:t,noDataRanges:s,isLastInputRangeInclusive:n}=this.functionArguments,a=this.functionArguments.inputRanges??[],o=this.functionArguments.outputValues??[],l=m(a,o,n),r=new Float32Array(2*i);r.fill(e),s?.length&&r.set(s);return{allowUnmatched:t,rangeMaps:l,noDataRanges:r,clampRange:u(this.outputPixelType),replacementValue:this.functionArguments.replacementValue}}};t([s({json:{write:!0,name:"rasterFunction"}})],f.prototype,"functionName",void 0),t([s({type:c,json:{write:!0,name:"rasterFunctionArguments"}})],f.prototype,"functionArguments",void 0),t([s()],f.prototype,"rasterArgumentNames",void 0),t([s({json:{write:!0}})],f.prototype,"lookup",void 0),f=t([n("esri.layers.support.rasterFunctions.RemapFunction")],f);const g=f;export{g as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as s}from"../../../core/accessorSupport/decorators.js";import{isIntegerPixelType as r}from"../rasterFormats/pixelRangeUtils.js";import o from"./BaseRasterFunction.js";import{createColormapLUT as i}from"./pixelUtils.js";import n from"./ShadedReliefFunctionArguments.js";import{getHillshadeOptions as a,hillshade as p,tintHillshade as u,calculateHillshadeParams as c,gcsFactor as l}from"./surfaceUtils.js";import{convertColorRampToColormap as m,createHsvMap as d}from"../../../renderers/support/colorRampUtils.js";import{isColormapSupportedByWebGL as f}from"../../../renderers/support/rasterRendererChecks.js";let h=class extends o{constructor(){super(...arguments),this.functionName="ShadedRelief",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){const e=this.sourceRasterInfos[0];if(e.bandCount>1)return{success:!1,supportsGPU:!1,error:"shadedrelief-function: source data must be single band"};let{colorRamp:t,colormap:s}=this.functionArguments;if(!t&&!s?.length)return{success:!1,supportsGPU:!1,error:"shadedrelief-function: a color ramp argument must be specified"};this.outputPixelType=this._getOutputPixelType("u8");const r=e.clone();this._removeStatsHistColormapVAT(r),r.pixelType=this.outputPixelType,r.bandCount=3,r.statistics=[{min:0,max:255,avg:60,stddev:10},{min:0,max:255,avg:60,stddev:10},{min:0,max:255,avg:60,stddev:10}],this.rasterInfo=r,this.isGCS=r.spatialReference?.isGeographic??!1,s?.length||(s=m(t,{interpolateAlpha:!0}));const{indexedColormap:o,offset:n}=i({colormap:s});if(!o?.length)return{success:!1,supportsGPU:!1,error:"shadedrelief-function: a valid colorramp is required"};const a=d(o);return this.lookup={indexedColormap:o,offset:n,hsvMap:a},{success:!0,supportsGPU:f(o)}}_processPixels(e){const t=e.pixelBlocks?.[0];if(!t||!this.lookup)return null;let s=e.primaryPixelSizes?.[0];if(null==s){const{extent:r}=e;s=r?{x:r.width/t.width,y:r.height/t.height}:{x:1,y:1}}const r=a(this.functionArguments,s,this.isGCS),o=p(t,r),i=this.sourceRasterInfos[0].statistics?.[0]??{min:0,max:8e3};return u(o,t,this.lookup.hsvMap,i),o.pixelType=this.outputPixelType,o}_getWebGLParameters(){const e=a(this.functionArguments,{x:1,y:1},this.isGCS),t=c(e),{slopeType:s,zFactor:o,pixelSizeFactor:i,pixelSizePower:n}=this.functionArguments,p="scaled"===s,{indexedColormap:u,offset:m}=this.lookup,d=this.sourceRasterInfos[0].statistics?.[0],f=r(this.outputPixelType);return{...t,indexedColormap:u,offset:m,zFactor:o,gcsFactor:this.isGCS?l:1,pixelSizeFactor:p?i:0,pixelSizePower:p?n:0,minValue:d?.min??0,maxValue:d?.max??8e3,isOutputRounded:f}}};e([t({json:{write:!0,name:"rasterFunction"}})],h.prototype,"functionName",void 0),e([t({type:n,json:{write:!0,name:"rasterFunctionArguments"}})],h.prototype,"functionArguments",void 0),e([t()],h.prototype,"rasterArgumentNames",void 0),e([t({json:{write:!0}})],h.prototype,"isGCS",void 0),e([t({json:{write:!0}})],h.prototype,"lookup",void 0),h=e([s("esri.layers.support.rasterFunctions.ShadedReliefFunction")],h);const x=h;export{x as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{property as e,subclass as s}from"../../../core/accessorSupport/decorators.js";import{isIntegerPixelType as i}from"../rasterFormats/pixelRangeUtils.js";import r from"./BaseRasterFunction.js";import o from"./SlopeFunctionArguments.js";import{slope as n,gcsFactor as p}from"./surfaceUtils.js";let u=class extends r{constructor(){super(...arguments),this.functionName="Slope",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0].clone();return t.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(t),t.statistics="percent-rise"!==this.functionArguments.slopeType?[{min:0,max:90,avg:1,stddev:1}]:null,t.bandCount=1,this.rasterInfo=t,this.isGCS=t.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{zFactor:s,slopeType:i,pixelSizePower:r,pixelSizeFactor:o}=this.functionArguments,{isGCS:p}=this,{extent:u,primaryPixelSizes:a}=t,c=a?.[0],l=c??(u?{x:u.width/e.width,y:u.height/e.height}:{x:1,y:1});return n(e,{zFactor:s,slopeType:i,pixelSizePower:r,pixelSizeFactor:o,isGCS:p,resolution:l})}_getWebGLParameters(){const{zFactor:t,slopeType:e,pixelSizeFactor:s,pixelSizePower:r}=this.functionArguments;return{zFactor:this.isGCS&&t>=1?t*p:t,slopeType:e,pixelSizeFactor:s??0,pixelSizePower:r??0,isOutputRounded:i(this.outputPixelType)}}};t([e({json:{write:!0,name:"rasterFunction"}})],u.prototype,"functionName",void 0),t([e({type:o,json:{write:!0,name:"rasterFunctionArguments"}})],u.prototype,"functionArguments",void 0),t([e()],u.prototype,"rasterArgumentNames",void 0),t([e({json:{write:!0}})],u.prototype,"isGCS",void 0),u=t([s("esri.layers.support.rasterFunctions.SlopeFunction")],u);const a=u;export{a as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{property as s,subclass as e}from"../../../core/accessorSupport/decorators.js";import{getPixelValueRange as o}from"../rasterFormats/pixelRangeUtils.js";import r from"./BaseRasterFunction.js";import{computeFocalStatistics as i}from"./focalStatUtils.js";import n from"./StatisticsFunctionArguments.js";let u=class extends r{constructor(){super(...arguments),this.functionName="Statistics",this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{type:t}=this.functionArguments.toJSON();if(t<1||t>7)return{success:!1,supportsGPU:!1,error:`statistics-function: the given statistics type is not supported ${t}`};const s=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType(s.pixelType);const e=s.clone();e.pixelType=this.outputPixelType;const{statisticsType:o}=this.functionArguments;"stddev"===o&&this._removeStatsHistColormapVAT(e),this.rasterInfo=e;return{success:!0,supportsGPU:e.bandCount<=3&&t<5}}_processPixels(t){const s=t.pixelBlocks?.[0];if(null==s)return s;const{statisticsType:e,rows:o,cols:r,fillNoDataOnly:n}=this.functionArguments;return i(s,{kernelRows:o,kernelCols:r,fillNoDataOnly:n,outputPixelType:this.outputPixelType,statisticsType:e,mirrorEdges:!0})}_getWebGLParameters(){const{rows:t,cols:s,statisticsType:e,fillNoDataOnly:r}=this.functionArguments;return{fillNoDataOnly:r,kernelRows:t,kernelCols:s,statisticsType:e,clampRange:o(this.outputPixelType)}}};t([s({json:{write:!0,name:"rasterFunction"}})],u.prototype,"functionName",void 0),t([s({type:n,json:{write:!0,name:"rasterFunctionArguments"}})],u.prototype,"functionArguments",void 0),t([s()],u.prototype,"rasterArgumentNames",void 0),u=t([e("esri.layers.support.rasterFunctions.StatisticsFunction")],u);const a=u;export{a as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{property as s,subclass as e}from"../../../core/accessorSupport/decorators.js";import{isIntegerPixelType as o}from"../rasterFormats/pixelRangeUtils.js";import u from"./BaseRasterFunction.js";import{lookupPixels as r}from"./pixelUtils.js";import i from"./StretchFunctionArguments.js";import{getStretchCutoff as n,createStretchLUT as a,stretch as p,computeGammaCorrection as m}from"./stretchUtils.js";let c=class extends u{constructor(){super(...arguments),this.functionName="Stretch",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null,this.cutOffs=null}_bindSourceRasters(){this.lookup=null,this.cutOffs=null;const t=this.sourceRasterInfos[0],{pixelType:s}=t,{functionArguments:e}=this,{dynamicRangeAdjustment:u,gamma:r,useGamma:i}=e;if(!u&&["u8","u16","s8","s16"].includes(s)){const u=n(e.toJSON(),{rasterInfo:t}),p=o(this.outputPixelType)?"round":"float";this.lookup=a({pixelType:s,...u,gamma:i?r:null,rounding:p}),this.cutOffs=u}else u||(this.cutOffs=n(e.toJSON(),{rasterInfo:t}));this.outputPixelType=this._getOutputPixelType(s);const p=t.clone();p.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(p),"u8"===this.outputPixelType&&(p.keyProperties.DataType="processed");const{outputMin:m=0,outputMax:c=255}=this.functionArguments;p.statistics=[];for(let o=0;o<p.bandCount;o++)p.statistics[o]={min:m,max:c};this.rasterInfo=p;return{success:!0,supportsGPU:!u}}_processPixels(t){const s=t.pixelBlocks?.[0];if(null==s)return s;const{lookup:e}=this;if(e)return r(s,{...e,outputPixelType:this.rasterInfo.pixelType});const{functionArguments:o}=this,u=this.cutOffs||n(o.toJSON(),{rasterInfo:this.sourceRasterInfos[0],pixelBlock:s}),i=o.useGamma?o.gamma:null;return p(s,{...u,gamma:i,outputPixelType:this.outputPixelType})}_getWebGLParameters(){const{outputMin:t=0,outputMax:s=255,gamma:e,useGamma:u}=this.functionArguments,r=this.rasterInfo.bandCount>=2?3:1,i=u&&e?.length?m(r,e):[1,1,1],{minCutOff:n,maxCutOff:a}=this.cutOffs??{minCutOff:[0,0,0],maxCutOff:[255,255,255]};1===n.length&&(n[1]=n[2]=n[0],a[1]=a[2]=a[0]);const p=a.map((e,o)=>(s-t)/(a[o]-n[o])),c=o(this.outputPixelType),f=u&&e?[e[0],e[1]??e[0],e[2]??e[0]]:[1,1,1],l=u?[i[0],i[1]??i[0],i[2]??i[0]]:[1,1,1];return{bandCount:r,minOutput:t,maxOutput:s,minCutOff:n,maxCutOff:a,factor:p,useGamma:u,gamma:f,gammaCorrection:l,stretchType:this.functionArguments.stretchType,isOutputRounded:c,type:"stretch"}}};t([s({json:{write:!0,name:"rasterFunction"}})],c.prototype,"functionName",void 0),t([s({type:i,json:{write:!0,name:"rasterFunctionArguments"}})],c.prototype,"functionArguments",void 0),t([s()],c.prototype,"rasterArgumentNames",void 0),t([s({json:{write:!0}})],c.prototype,"lookup",void 0),t([s({json:{write:!0}})],c.prototype,"cutOffs",void 0),c=t([e("esri.layers.support.rasterFunctions.StretchFunction")],c);const f=c;export{f as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{JSONMap as t}from"../../../core/jsonMap.js";import n from"../PixelBlock.js";import{isIntegerPixelType as e,clipBandToPixelTypeRange as r}from"../rasterFormats/pixelRangeUtils.js";import{calculateCustomBandIndex as a}from"./customBandIndexUtils.js";import{isValidPixelBlock as o}from"./pixelUtils.js";const i=new t({0:"custom",1:"ndvi",2:"savi",3:"tsavi",4:"msavi",5:"gemi",6:"pvi",7:"gvitm",8:"sultan",9:"vari",10:"gndvi",11:"sr",12:"ndvi-re",13:"sr-re",14:"mtvi2",15:"rtvi-core",16:"ci-re",17:"ci-g",18:"ndwi",19:"evi",20:"iron-oxide",21:"ferrous-minerals",22:"clay-minerals",23:"wndwi",24:"bai",25:"nbr",26:"ndbi",27:"ndmi",28:"ndsi",29:"mndwi"},{useNumericKeys:!0});function s(t,i){if(!o(t))return t;const{equation:s,method:l}=i,c=i.bandIndexes.map(t=>t-1),{pixels:U,mask:q}=t;let M;switch(l){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":M=u(q,U[c[0]],U[c[1]]);break;case"ndwi":M=u(q,U[c[1]],U[c[0]]);break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":M=f(q,U[c[0]],U[c[1]]);break;case"ci-g":case"ci-re":M=h(q,U[c[0]],U[c[1]]);break;case"savi":M=w(q,U[c[0]],U[c[1]],c[2]+1);break;case"tsavi":M=m(q,U[c[0]],U[c[1]],c[2]+1,c[3]+1,c[4]+1);break;case"msavi":M=d(q,U[c[0]],U[c[1]]);break;case"gemi":M=g(q,U[c[0]],U[c[1]]);break;case"pvi":M=y(q,U[c[0]],U[c[1]],c[2]+1,c[3]+1);break;case"gvitm":M=p(q,[U[c[0]],U[c[1]],U[c[2]],U[c[3]],U[c[4]],U[c[5]]]);break;case"sultan":M=b(q,[U[c[0]],U[c[1]],U[c[2]],U[c[3]],U[c[4]]]);break;case"vari":M=v(q,[U[c[0]],U[c[1]],U[c[2]]]);break;case"mtvi2":M=k(q,[U[c[0]],U[c[1]],U[c[2]]]);break;case"rtvi-core":M=A(q,[U[c[0]],U[c[1]],U[c[2]]]);break;case"evi":M=F(q,[U[c[0]],U[c[1]],U[c[2]]]);break;case"wndwi":M=x(q,[U[c[0]],U[c[1]],U[c[2]]],c[3]?c[3]+1:.5);break;case"bai":M=j(q,U[c[0]],U[c[1]]);break;case"custom":M=a(q,U,s);break;default:return t}const{outputPixelType:B="f32"}=i,T=null!=B&&e(B);let I;q?(I=new Uint8Array(t.width*t.height),I.set(q)):T&&(I=new Uint8Array(t.width*t.height).fill(255)),T&&(M=M.map(t=>{const e=n.createEmptyBand(B,t.length);return r(t,I,B,e),e}));const P=new n({width:t.width,height:t.height,pixelType:B,pixels:M,mask:I});return P.updateStatistics(),P}function l(t,e,r,a){const{mask:o,pixels:i,width:s,height:l}=t,c=i[r],u=i[e],f=u.length,h=a?new Uint8Array(f):new Float32Array(f),w=a?100:1,m=a?100.5:0;for(let n=0;n<f;n++)if(null==o||o[n]){const t=c[n],e=u[n],r=t+e;r&&(h[n]=(t-e)/r*w+m)}const d=new n({width:s,height:l,mask:o,pixelType:a?"u8":"f32",pixels:[h]});return d.updateStatistics(),d}function c(t){const n=new Float32Array(9);return n[3*t[0]]=1,n[3*t[1]+1]=1,n[3*t[2]+2]=1,n}function u(t,n,e){const r=e.length,a=new Float32Array(r);for(let o=0;o<r;o++)if(null==t||t[o]){const t=n[o],r=e[o],i=t+r;i&&(a[o]=(t-r)/i)}return[a]}function f(t,n,e){const r=e.length,a=new Float32Array(r);for(let o=0;o<r;o++)if(null==t||t[o]){const t=n[o],r=e[o];r&&(a[o]=t/r)}return[a]}function h(t,n,e){const r=n.length,a=new Float32Array(r);for(let o=0;o<r;o++)if(null==t||t[o]){const t=n[o],r=e[o];r&&(a[o]=t/r-1)}return[a]}function w(t,n,e,r){const a=e.length,o=new Float32Array(a);for(let i=0;i<a;i++)if(null==t||t[i]){const t=e[i],a=n[i],s=a+t+r;s&&(o[i]=(a-t)/s*(1+r))}return[o]}function m(t,n,e,r,a,o){const i=e.length,s=new Float32Array(i),l=-a*r+o*(1+r*r);for(let c=0;c<i;c++)if(null==t||t[c]){const t=e[c],o=n[c],i=a*o+t+l;i&&(s[c]=r*(o-r*t-a)/i)}return[s]}function d(t,n,e){const r=e.length,a=new Float32Array(r);for(let o=0;o<r;o++)if(null==t||t[o]){const t=e[o],r=n[o],i=2*r+1;a[o]=.5*(i-Math.sqrt(i*i-8*(r-t)))}return[a]}function g(t,n,e){const r=e.length,a=new Float32Array(r);for(let o=0;o<r;o++)if(null==t||t[o]){const t=e[o],r=n[o];if(1!==t&&r+t+.5!==0){const n=(2*(r*r-t*t)+1.5*r+.5*t)/(r+t+.5);a[o]=n*(1-.25*n)-(t-.125)/(1-t)}}return[a]}function y(t,n,e,r,a){const o=e.length,i=new Float32Array(o),s=1/Math.sqrt(1+r*r);for(let l=0;l<o;l++)if(null==t||t[l]){const t=e[l],o=n[l];i[l]=(o-r*t-a)*s}return[i]}function p(t,n){const[e,r,a,o,i,s]=n,l=e.length,c=new Float32Array(l);for(let u=0;u<l;u++)(null==t||t[u])&&(c[u]=-.2848*e[u]-.2435*r[u]-.5436*a[u]+.7243*o[u]+.084*i[u]-.18*s[u]);return[c]}function b(t,n){const[e,r,a,o,i]=n,s=e.length,l=new Float32Array(s),c=new Float32Array(s),u=new Float32Array(s);for(let f=0;f<s;f++)(null==t||t[f])&&(l[f]=i[f]?o[f]/i[f]*100:0,c[f]=e[f]?o[f]/e[f]*100:0,u[f]=a[f]?r[f]/a[f]*(o[f]/a[f])*100:0);return[l,c,u]}function v(t,n){const[e,r,a]=n,o=e.length,i=new Float32Array(o);for(let s=0;s<o;s++)if(null==t||t[s])for(s=0;s<o;s++){const t=e[s],n=r[s],o=n+t-a[s];o&&(i[s]=(n-t)/o)}return[i]}function k(t,n){const[e,r,a]=n,o=e.length,i=new Float32Array(o);for(let s=0;s<o;s++)if(null==t||t[s])for(s=0;s<o;s++){const t=e[s],n=r[s],o=a[s],l=Math.sqrt((2*t+1)**2-(6*t-5*Math.sqrt(n))-.5);if(l){const e=1.5*(1.2*(t-o)-2.5*(n-o));i[s]=e/l}}return[i]}function A(t,n){const[e,r,a]=n,o=e.length,i=new Float32Array(o);for(let s=0;s<o;s++)if(null==t||t[s])for(s=0;s<o;s++){const t=e[s],n=r[s],o=a[s];i[s]=100*(t-n)-10*(t-o)}return[i]}function F(t,n){const[e,r,a]=n,o=e.length,i=new Float32Array(o);for(let s=0;s<o;s++)if(null==t||t[s])for(s=0;s<o;s++){const t=e[s],n=r[s],o=t+6*n-7.5*a[s]+1;o&&(i[s]=2.5*(t-n)/o)}return[i]}function x(t,n,e=.5){const[r,a,o]=n,i=a.length,s=new Float32Array(i);for(let l=0;l<i;l++)if(null==t||t[l])for(l=0;l<i;l++){const t=r[l],n=a[l],i=o[l],c=t+e*n+(1-e)*i;c&&(s[l]=(t-e*n-(1-e)*i)/c)}return[s]}function j(t,n,e){const r=e.length,a=new Float32Array(r);for(let o=0;o<r;o++)if(null==t||t[o])for(o=0;o<r;o++){const t=(.1-n[o])**2+(.06-e[o])**2;t&&(a[o]=1/t)}return[a]}export{i as bandIndexMethodMap,s as calculateBandIndex,l as calculateNDVI,c as getBandMatrix3};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import"../../../core/has.js";import{JSONMap as e}from"../../../core/jsonMap.js";import t from"../PixelBlock.js";import{isIntegerPixelType as a}from"../rasterFormats/pixelRangeUtils.js";const n=new e({0:"difference",1:"relative-difference",2:"categorical",3:"euclidean-distance",4:"angle-difference",5:"band-with-most-change"},{useNumericKeys:!0}),s=new e({0:"all",1:"changed",2:"unchanged"},{useNumericKeys:!0});function i(e,n,s,i){const[f,h]=e,m=a(s)&&!a(f.pixelType)&&!a(h.pixelType),p=[f.mask,h.mask].filter(e=>e),u=t.combineBandMasks(p),g=e.map(e=>e.pixels[0]),{width:k,height:x}=f,b=t.createEmptyBand(s,k*x);switch(n){case"difference":case"relative-difference":o({bands:g,mask:u,outBand:b,isRoundingNeeded:m,isRelative:"relative-difference"===n});break;case"categorical":c({bands:g,mask:u,outBand:b,...i});break;case"euclidean-distance":l({pixels:e.map(e=>e.pixels),mask:u,outBand:b});break;case"angle-difference":r({pixels:e.map(e=>e.pixels),mask:u,outBand:b});break;case"band-with-most-change":d({pixels:e.map(e=>e.pixels),mask:u,outBand:b})}const B=new t({width:k,height:x,pixels:[b],pixelType:s,mask:u});return B.updateStatistics(),B}function o(e){const{bands:[t,a],mask:n,isRelative:s,isRoundingNeeded:i,outBand:o}=e,c=t.length;for(let l=0;l<c;l++)if(!n||n[l]){let e=t[l]-a[l];if(s){const n=Math.max(Math.abs(t[l])-Math.abs(a[l]));e=n>0?e/n:0}o[l]=i?Math.round(e):e}}function c(e){const{bands:[t,a],categoryIndexLookups:[n,s],classNames:[i,o],mask:c,keepMethod:l,outBand:r}=e,d=t.length,f=i.length,h=o.length,m=f*h,p=m+1,u=m+2;for(let g=0;g<d;g++)if(!c||c[g]){const e=t[g],c=a[g],d=n[e],f=s[c],k=i[d],x=o[f];r[g]=null==d||null==f?m:"changed"===l&&k===x?p:"unchanged"===l&&k!==x?u:d*h+f}}function l(e){const{pixels:[t,a],mask:n,outBand:s}=e,i=t[0].length,o=t.length;for(let c=0;c<i;c++)if(!n||n[c]){let e=0;for(let n=0;n<o;n++){const s=t[n][c]-a[n][c];e+=s*s}s[c]=Math.sqrt(e)}}function r(e){const{pixels:[t,a],mask:n,outBand:s}=e,i=t[0].length,o=t.length;for(let c=0;c<i;c++)if(!n||n[c]){let e=0,n=0,i=0;for(let s=0;s<o;s++){const o=t[s][c],l=a[s][c];e+=o*l,n+=o*o,i+=l*l}const l=Math.sqrt(n*i);s[c]=l?Math.acos(e/l):1.5707963267948966}}function d(e){const{pixels:[t,a],mask:n,outBand:s}=e,i=t[0].length,o=t.length;for(let c=0;c<i;c++)if(!n||n[c]){let e=0,n=0;for(let s=0;s<o;s++){const i=Math.abs(t[s][c]-a[s][c]);i>e&&(e=i,n=s)}s[c]=n}}export{n as changeMethodMap,i as computeChange,s as keepMethodMap};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{getMetersPerUnitForSR as t}from"../../../core/units.js";import e from"../../../geometry/Extent.js";import n from"../../../geometry/Point.js";import i from"../PixelBlock.js";function a(e,n){if(e.spatialReference.equals(n))return e;const i=t(e.spatialReference),a=t(n);if(i===a)return e;const r=i/a;return{x:e.x*r,y:e.y*r}}async function r(t,e,n){if("extent"===n.type)return m(t,e,n);const{width:a,height:r}=t,h=new Uint8Array(a*r);if(!(await import("../../../geometry/operators/intersectsOperator.js")).execute(e,n))return new i({pixelType:t.pixelType,width:a,height:r,mask:h,maskIsAlpha:!1,pixels:[...t.pixels]});if("polyline"===n.type)return s(t,e,n);return(await import("../../../geometry/operators/containsOperator.js")).execute(n,e)?t:o(t,e,n)}function o(t,e,n){if(!t)return t;const{width:a,height:r}=t,o=h({geometry:n,size:[a,r],srcExtent:e,srcMask:t.mask});return new i({pixelType:t.pixelType,width:a,height:r,mask:o,maskIsAlpha:!1,pixels:[...t.pixels]})}function h(t){const{geometry:e,size:n,srcExtent:i,srcMask:a}=t,[r,o]=n;let h;const m=i.width/r,s=i.height/o,{xmin:l,ymax:p}=i;if("extent"===e.type){const t=(e.xmin-l)/m,n=(e.xmax-l)/m,i=(p-e.ymax)/s,a=(p-e.ymin)/s;h=[[[t,i],[t,a],[n,a],[n,i],[t,i]]]}else h=e.rings.map(t=>t.map(([t,e])=>[(t-l)/m,(p-e)/s]));return x(h,n,a)}function x(t,e,n){const[i,a]=e,r=new OffscreenCanvas(i,a).getContext("2d");r.fillStyle="#f00",r.beginPath(),t.forEach(t=>{r.moveTo(t[0][0],t[0][1]);for(let e=0;e<t.length;e++)r.lineTo(t[e][0],t[e][1]);r.closePath()}),r.fill();const o=r.getImageData(0,0,i,a).data,h=i*a,x=new Uint8Array(h);let m=!1;for(let s=0;s<h;s++)n&&!n[s]||(o[4*s+3]>127?x[s]=255:m=!0);return m||n?x:void 0}function m(t,e,n){const{width:a,height:r}=t,o=new Uint8Array(a*r),h=e.width/a,x=e.height/r;if(n.width/h<.5||n.height/x<.5)return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]});const{xmin:m,xmax:s,ymin:l,ymax:p}=e,{xmin:f,xmax:c,ymin:y,ymax:M}=n,u=Math.max(m,f),w=Math.min(s,c),d=Math.max(l,y),g=Math.min(p,M),T=.5*h,k=.5*x;if(w-u<T||g-d<k||w<m+T||u>s-T||d>p-k||g<l+k)return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]});const R=Math.max(0,(u-m)/h),j=Math.min(a,Math.max(0,(w-m)/h)),A=Math.max(0,(p-g)/x),z=Math.min(r,Math.max(0,(p-d)/x)),E=Math.round(R),P=Math.round(j)-1,S=Math.round(A),U=Math.round(z)-1;if(E===P&&R%1>.5&&j%1<.5||S===U&&A%1>.5&&z%1<.5)return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]});if(0===E&&0===S&&P===a&&U===r)return t;const v=t.mask;for(let i=S;i<=U;i++)for(let t=E;t<=P;t++){const e=i*a+t;o[e]=v?v[e]:255}return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]})}function s(t,e,n){const{width:a,height:r}=t,o=new Uint8Array(a*r),h=e.width/a,x=e.height/r,{xmin:m,ymax:s}=e,{paths:l}=n,p=t.mask;for(let i=0;i<l.length;i++){const t=l[i];for(let e=0;e<t.length-1;e++){const[n,i]=t[e],[l,f]=t[e+1],c=Math.min(i,f),y=Math.max(i,f),M=Math.max(0,Math.floor((s-y)/x)),u=Math.min(r-1,Math.floor((s-c)/x));if(!(u<M))if(M===u){const t=Math.min(n,l),e=Math.max(n,l),i=Math.max(0,Math.floor((t-m)/h)),r=Math.min(a-1,Math.floor((e-m)/h));if(r<i)continue;const x=M*a;for(let n=x+i;n<=x+r;n++)o[n]=p?p[n]:255}else{const t=(n-m)/h,e=(l-n)/(f-i)/h,r=x*e;for(let n=M;n<=u;n++){const h=e*(s-n*x-i)+t,m=Math.max(0,Math.floor(r>0?h-r:h)),l=Math.min(a-1,Math.floor(r>0?h:h-r));if(l<m)continue;const f=n*a;for(let t=f+m;t<=f+l;t++)o[t]=p?p[t]:255}}}}return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]})}function l(t,e){const{extent:i}=p(t,e,new n({x:t.pixelSize.x,y:t.pixelSize.y,spatialReference:t.spatialReference})),{extent:a}=t.extent;if(i.xmax=Math.min(i.xmax,a.xmax),i.ymax=Math.min(i.ymax,a.ymax),i.xmin<i.xmax&&i.ymin<i.ymax){const{x:e,y:n}=t.pixelSize,a=Math.round(i.width/e),r=Math.round(i.height/n);t.extent=i,t.width=a,t.height=r}}function p(t,n,i,r=!0){const{spatialReference:o}=t,{x:h,y:x}=a(i,o);let m,s,l;const p="extent"===n.type?n:n.extent;let{xmin:f,xmax:c,ymax:y,ymin:M}=p;const{xmin:u,ymax:w}=t.extent;return r?(f=u+(f>u?h*Math.round((f-u)/h):0),y=w-(y<w?x*Math.round((w-y)/x):0),c=u+(c>u?h*Math.round((c-u)/h):0),M=w-(M<w?x*Math.round((w-M)/x):0),m=new e({xmin:f,ymax:y,xmax:c,ymin:M,spatialReference:o}),s=Math.round(m.width/h),l=Math.round(m.height/x)):(s=Math.floor((c-f)/h+.8),l=Math.floor((y-M)/x+.8),f=u+(f>u?h*Math.floor((f-u)/h+.1):0),y=w-(y<w?x*Math.floor((w-y)/x+.1):0),c=f+s*h,M=y-l*x,m=new e({xmin:f,ymax:y,xmax:c,ymin:M,spatialReference:o})),{extent:m,width:s,height:l}}export{r as clip,l as clipRasterInfo,h as convertGeometryToMask,p as snapToRaster};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import t from"../PixelBlock.js";import{getPixelValueRange as e}from"../rasterFormats/pixelRangeUtils.js";function i(i,s,a){const{pixels:l,width:n,height:r,mask:o,bandMasks:h}=i,p=n*r,m=h?.length?t.combineBandMasks(h):o,f=Math.min(s.length,l.length),c=a.startsWith("f"),d=!c&&a!==i.pixelType,[x,g]=e(a),k=t.createEmptyBand(a,p);for(let t=0;t<r;t++){let e=t*n;for(let t=0;t<n;t++,e++)if(!m||m[e]){let t=0;for(let i=0;i<f;i++)t+=s[i]*l[i][e];c||(t=Math.round(t),d&&(t=t>g?g:t<x?x:t)),k[e]=t}}const u=new t({width:n,height:r,pixels:[k],pixelType:a,mask:m});return u.updateStatistics(),u}export{i as grayscale};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import e from"../PixelBlock.js";import{convolutionKernel as t}from"../rasterFunctionConstants.js";import{mirror as n}from"./mirror.js";const l=new Map;function o(e){const t=Math.sqrt(e.length),n=e.slice(0,t),l=[1];for(let o=1;o<t;o++){let n=null;for(let l=0;l<t;l++){const r=e[l+o*t],s=e[l];if(null==n)if(0===s){if(r)return{separable:!1,row:null,col:null}}else n=r/s;else if(r/s!==n)return{separable:!1,row:null,col:null}}if(null==n)return{separable:!1,row:null,col:null};l.push(n)}return{separable:!0,row:n,col:l}}function r(e,t,n,l,o,r,s){const i=new Float32Array(t*n),a=r.length,h=s?0:l,c=s?l:0,p=s?1:t;for(let u=h;u<n-h;u++){const n=u*t;for(let s=c;s<t-c;s++){if(o&&!o[n+s])continue;let t=0;for(let o=0;o<a;o++)t+=e[n+s+(o-l)*p]*r[o];i[n+s]=t}}return i}function s(e,t,n,l,o,r,s){const i=new Float32Array(t*n),a=Math.floor(l/2),h=Math.floor(o/2);for(let c=a;c<n-a;c++){const n=c*t;for(let c=h;c<t-h;c++){if(r&&!r[n+c])continue;let p=0;for(let r=0;r<l;r++)for(let l=0;l<o;l++)p+=e[n+c+(r-a)*t+l-h]*s[r*o+l];i[n+c]=p}}return i}function i(t,l,o=!0){const{pixels:r,width:i,height:a,pixelType:h,mask:c}=t,p=r.length,u=[],{kernel:f,rows:g,cols:m}=l;for(let e=0;e<p;e++){const t=s(r[e],i,a,g,m,c,f);o&&n(t,i,a,g,m),u.push(t)}return new e({width:i,height:a,pixelType:h,pixels:u,mask:c})}function a(t,l,o,s=!0){const{pixels:i,width:a,height:h,pixelType:c,mask:p}=t,u=i.length,f=[],g=l.length,m=o.length,x=Math.floor(g/2),w=Math.floor(m/2);for(let e=0;e<u;e++){let t=r(i[e],a,h,x,p,l,!0);t=r(t,a,h,w,p,o,!1),s&&n(t,a,h,g,m),f.push(t)}return new e({width:a,height:h,pixelType:c,pixels:f,mask:p})}function h(e,t){const n=o(t.kernel),l=!1!==t.mirrorEdges,r=n.separable?a(e,n.row,n.col,l):i(e,t,l),{outputPixelType:s}=t;return s&&r.clamp(s),r}l.set(t.none,[0,0,0,0,1,0,0,0,0]),l.set(t.lineDetectionHorizontal,[-1,-1,-1,2,2,2,-1,-1,-1]),l.set(t.lineDetectionVertical,[-1,2,-1,-1,2,-1,-1,2,-1]),l.set(t.lineDetectionLeftDiagonal,[2,-1,-1,-1,2,-1,-1,-1,2]),l.set(t.lineDetectionRightDiagonal,[-1,-1,2,-1,2,-1,2,-1,-1]),l.set(t.gradientNorth,[-1,-2,-1,0,0,0,1,2,1]),l.set(t.gradientWest,[-1,0,1,-2,0,2,-1,0,1]),l.set(t.gradientEast,[1,0,-1,2,0,-2,1,0,-1]),l.set(t.gradientSouth,[1,2,1,0,0,0,-1,-2,-1]),l.set(t.gradientNorthEast,[0,-1,-2,1,0,-1,2,1,0]),l.set(t.gradientNorthWest,[-2,-1,0,-1,0,1,0,1,2]),l.set(t.smoothArithmeticMean,[.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111]),l.set(t.smoothing3x3,[.0625,.125,.0625,.125,.25,.125,.0625,.125,.0625]),l.set(t.smoothing5x5,[1,1,1,1,1,1,4,4,4,1,1,4,12,4,1,1,4,4,4,1,1,1,1,1,1]),l.set(t.sharpening3x3,[-1,-1,-1,-1,9,-1,-1,-1,-1]),l.set(t.sharpening5x5,[-1,-3,-4,-3,-1,-3,0,6,0,-3,-4,6,21,6,-4,-3,0,6,0,-3,-1,-3,-4,-3,-1]),l.set(t.laplacian3x3,[0,-1,0,-1,4,-1,0,-1,0]),l.set(t.laplacian5x5,[0,0,-1,0,0,0,-1,-2,-1,0,-1,-2,17,-2,-1,0,-1,-2,-1,0,0,0,-1,0,0]),l.set(t.sobelHorizontal,[-1,-2,-1,0,0,0,1,2,1]),l.set(t.sobelVertical,[-1,0,1,-2,0,2,-1,0,1]),l.set(t.sharpen,[0,-.25,0,-.25,2,-.25,0,-.25,0]),l.set(t.sharpen2,[-.25,-.25,-.25,-.25,3,-.25,-.25,-.25,-.25]),l.set(t.pointSpread,[-.627,.352,-.627,.352,2.923,.352,-.627,.352,-.627]);export{h as convolute,a as convoluteSeparable,l as convolutionKernels,o as separateKernels};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{getNamedColor as t,hexToRgba as e}from"../../../../colorUtils.js";import{colormapName as n}from"../../rasterFunctionConstants.js";import{createRasterFunction as o}from"./utils.js";import{colorRampDict as r}from"../../../../renderers/support/colorRampUtils.js";function a(t){return"colormap"in t?s(t):"colorRamp"in t?i(t):u(t)}function s(n){const r=n.colormap.map(n=>{if("value"in n){const o="string"==typeof n.color?t(n.color)??e(n.color):n.color;(n=[n.value,...o])[4]&&n[4]<=1&&(n[4]=Math.round(255*n[4]))}return n}),{raster:a,outputPixelType:s}=n;return o("Colormap",{colormap:r,raster:a},s)}function i(t){const{raster:e,colorRamp:n,outputPixelType:r}=t,a={colorRamp:"toJSON"in n?n.toJSON():n,raster:e};return o("Colormap",a,r)}function u(t){const{colorRampName:e}=t,a=Object.values(n).find(t=>t.toLowerCase()===e?.toLowerCase()),s=r.toJSON(e),{raster:i,outputPixelType:u="unknown"}=t;return o("Colormap",a?{colormapName:a,raster:i}:{colorRampName:s,raster:i},u)}function l(t){const{raster:e,outputPixelType:n="u8"}=t;return o("ColormapToRGB",{raster:e},n)}function p(t){const{raster:e,histograms:n,outputPixelType:r}=t,a=t.statistics?.map(t=>({min:t.min,max:t.max,mean:t.avg,standardDeviation:t.stddev}));return o("StatisticsHistograms",{raster:e,statistics:a,histograms:n},r)}function c(t){const{raster:e,attributeTable:n,outputPixelType:r="unknown"}=t,a="toJSON"in n?n.toJSON():n;return o("Table",{raster:e,attributeTableAsRecordSet:a},r)}function m(t){const{raster:e,outputPixelType:n="unknown"}=t,r={raster:e,missingBandAction:"fail"===t.missingBandAction?1:0};return"bandIds"in t?r.bandIds=t.bandIds:"bandNames"in t?r.bandNames=t.bandNames:"bandWavelengths"in t&&(r.bandWavelengths=t.bandWavelengths),o("ExtractBand",r,n)}function d(t){const{redBand:e,greenBand:n,blueBand:r,raster:a,outputPixelType:s}=t,i="name"===t.method?0:2;return o("CreateColorComposite",{raster:a,method:i,bandIndexesR:e,bandIndexesG:n,bandIndexesB:r},s)}function f(t){const{rasters:e,outputPixelType:n}=t;return o("CompositeBand",{rasters:e},n)}function g(t){const{allowUnmatched:e,raster:n,rangeMaps:r,outputPixelType:a,replacementValue:s}=t,i=r?.filter(({output:t})=>null!=t),u=i?.flatMap(({range:t})=>t),l=i?.map(({output:t})=>t),p=r?.filter(t=>null==t.output)?.flatMap(({range:t})=>t);return o("Remap",{allowUnmatched:e,raster:n,inputRanges:u,outputValues:l,noDataRanges:p,replacementValue:s},a)}function b(t){const{inputBitPositions:e,raster:n,fillRaster:r,outputBitPositions:a,outputPixelType:s}=t,i={inputBitPositions:e,outputBitPositions:a,raster:n};return null!=r&&("number"==typeof r?(i.constantFillCheck=!0,i.constantFillValue=r):i.fillRaster=r),o("TransposeBits",i,s)}function x(t){const{raster:e,outputPixelType:n="unknown"}=t,r=t.includedRanges?.flat(),a=t.noDataValues?.map(t=>t.join(" ")),s="match-all"===t.noDataInterpretation?1:0;return o("Mask",{raster:e,includedRanges:r,noDataInterpretation:s,noDataValues:a},n)}function T(t){const{geometry:e,keepOutside:n,outputPixelType:r="unknown",raster:a}=t,s="declaredClass"in e?e.toJSON():e;return o("Clip",{clippingGeometry:s,clippingType:n?2:1,raster:a},r)}export{T as clip,a as colormap,l as colormapToRGB,f as compositeBand,d as createColorComposite,m as extractBand,x as mask,g as remap,p as statisticsHistogram,c as table,b as transposeBits};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import n from"../../RasterFunction.js";function e(e,t,o){return Object.keys(t).forEach(n=>{null==t[n]&&delete t[n]}),o||(o="unknown"),new n({functionName:e,functionArguments:t,outputPixelType:o})}export{e as createRasterFunction};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import"../../../core/has.js";import{JSONMap as t}from"../../../core/jsonMap.js";import e from"../PixelBlock.js";import{mirror as o}from"./mirror.js";const n=new t({1:"min",2:"max",3:"mean",4:"stddev",5:"median",6:"majority",7:"minority"},{useNumericKeys:!0});function s(t,e){const{fillNoDataOnly:o}=e,{band:n,width:s,height:r,mask:i,outBand:l}=t;if(o&&!i)return void l.set(n);const{statisticsType:a,kernelRows:c,kernelCols:f}=e,h="stddev"===a,m=s*r,u=new Float64Array(m),d=new Float64Array(m),y=new Uint32Array(m);for(let A=0;A<r;A++){const t=A*s;let e=0,o=0,r=0;for(let s=0;s<f;s++)i&&!i[t+s]||(e+=n[t+s],h&&(o+=n[t+s]**2),r++);u[t]=e,d[t]=o,y[t]=r;for(let l=1;l<=s-f;l++){const s=t+l-1,a=s+f;i?(i[s]&&(r--,e-=n[s],h&&(o-=n[s]**2)),i[a]&&(r++,e+=n[a],h&&(o+=n[a]**2))):(e-=n[s],e+=n[a],h&&(o-=n[s]**2,o+=n[a]**2)),u[t+l]=e,y[t+l]=r,h&&(d[t+l]=o)}}const k=new Float64Array(m),w=new Float64Array(m),p=new Uint32Array(m),M=c*s;for(let A=0;A<=s-f;A++){let t=0,e=0,o=0;for(let n=0;n<c;n++){const r=n*s+A;t+=u[r],o+=y[r],h&&(e+=d[r])}k[A]=t,w[A]=e,p[A]=o;for(let n=1;n<=r-c;n++){const r=(n-1)*s+A,i=r+M;t-=u[r],t+=u[i],o-=y[r],o+=y[i],h&&(e-=d[r],e+=d[i]),k[n*s+A]=t,w[n*s+A]=e,p[n*s+A]=o}}const g=Math.floor(c/2),b=Math.floor(f/2);for(let A=g;A<r-g;A++){const t=A*s;for(let e=b;e<s-b;e++){const n=(A-g)*s+e-b,r=p[n];if(0===r||o&&(!i||i[t+e]))continue;const a=k[n]/r,c=h?Math.sqrt((w[n]-k[n]*a)/r):a;l[t+e]=c,i&&(i[t+e]=255)}}}function r(t,e){const{fillNoDataOnly:o}=e,{band:n,width:s,height:r,mask:i,outBand:l}=t;if(o&&!i)return void l.set(n);const{kernelRows:a,kernelCols:c,statisticsType:f}=e,h=Math.floor(a/2),m=Math.floor(c/2),u="min"===f,d=l.slice(),y=new Uint32Array(s*r);for(let k=h;k<r-h;k++){const t=k*s;for(let e=m;e<s-m;e++){let o=u?Number.MAX_VALUE:-Number.MAX_VALUE,r=0;for(let l=0;l<a;l++)for(let a=0;a<c;a++){const c=t+e+(l-h)*s+a-m;i&&!i[c]||(o=u?Math.min(o,n[c]):Math.max(o,n[c]),r++)}i?(d[t+e]=0===r?0:o,y[t+e]=r):l[t+e]=0===r?0:o}}if(i)for(let k=h;k<r-h;k++){const t=k*s;for(let e=m;e<s-m;e++)if(y[t+e]){if(o&&i[t+e])continue;l[t+e]=d[t+e],i[t+e]=255}}}function i(t,e){const{fillNoDataOnly:o}=e,{band:n,width:s,height:r,mask:i,outBand:l}=t;if(o&&!i)return void l.set(n);const{kernelRows:a,kernelCols:c}=e,f=Math.floor(a/2),h=Math.floor(c/2),m=l.slice(),u=new Uint32Array(s*r);for(let d=f;d<r-f;d++){const t=d*s;for(let e=h;e<s-h;e++){if(o&&i?.[t+e])continue;const r=[];for(let o=0;o<a;o++)for(let l=0;l<c;l++){const a=t+e+(o-f)*s+l-h;i&&!i[a]||r.push(n[a])}r.length&&(r.sort((t,e)=>t-e),i?(m[t+e]=r[Math.floor((r.length-1)/2)],u[t+e]=r.length):l[t+e]=r[Math.floor((r.length-1)/2)])}}if(i)for(let d=f;d<r-f;d++){const t=d*s;for(let e=h;e<s-h;e++)if(u[t+e]){if(o&&i[t+e])continue;l[t+e]=m[t+e],i[t+e]=255}}}function l(t,e){const{fillNoDataOnly:o}=e,{band:n,width:s,height:r,mask:i,outBand:l}=t;if(o&&!i)return void l.set(n);const{kernelRows:a,kernelCols:c}=e,f=Math.floor(a/2),h=Math.floor(c/2),m="majority"===e.statisticsType,u=a*c,d=l.slice(),y=new Uint32Array(s*r);for(let k=f;k<r-f;k++){const t=k*s;for(let e=h;e<s-h;e++){if(o&&i?.[t+e])continue;const r=new Map;for(let o=0;o<a;o++)for(let l=0;l<c;l++){const a=t+e+(o-f)*s+l-h;if(i&&!i[a])continue;const c=n[a];r.set(c,r.has(c)?r.get(c)+1:1)}if(0===r.size)continue;let k=0,w=0,p=m?0:u+1;for(const t of r.keys())w=r.get(t),m===w>p&&(p=w,k=t);i?(d[t+e]=k,y[t+e]=r.size):l[t+e]=k}}if(i)for(let k=f;k<r-f;k++){const t=k*s;for(let e=h;e<s-h;e++)if(y[t+e]){if(o&&i[t+e])continue;l[t+e]=d[t+e],i[t+e]=255}}}function a(t,n){const{mask:a}=t,{fillNoDataOnly:c}=n;if(c&&!a)return t;const{pixels:f,width:h,height:m,bandMasks:u,pixelType:d}=t,y=f.length,k=h*m,w=[],{kernelRows:p,kernelCols:M,statisticsType:g,mirrorEdges:b}=n;if(c&&!a)return t;const A=n.outputPixelType??d,x=[];for(let N=0;N<y;N++){const t=f[N],d=e.createEmptyBand(A,k);c&&d.set(t);const y=u?.[N]??a,j=y?.slice()??null,B={band:t,width:h,height:m,mask:j,outBand:d};switch(g){case"min":case"max":r(B,n);break;case"mean":case"stddev":s(B,n);break;case"median":i(B,n);break;case"majority":case"minority":l(B,n)}b&&!c&&o(d,h,m,p,M),w.push(d),j&&x.push(j)}let j=x[0]??a;x.length!==y&&(x.length=0),y>1&&u?.length&&(j=e.combineBandMasks(u));const B=new e({pixelType:A,width:h,height:m,pixels:w,bandMasks:u&&x.length?x:null,mask:j});return B.updateStatistics(),B}export{a as computeFocalStatistics,n as statisticsTypeMap};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import t from"../PixelBlock.js";import{localConditionalOperation as e,localTrigonometricOperation as n,localLogicalOperation as r}from"../rasterFunctionConstants.js";import{fixNaN as o,clipBandToPixelTypeRange as s}from"../rasterFormats/pixelRangeUtils.js";const a=new Map([[n.acos,{domain:[0,Math.PI],isInteger:!1}],[n.asin,{domain:[-Math.PI/2,Math.PI/2],isInteger:!1}],[n.atan,{domain:[-Math.PI/2,Math.PI/2],isInteger:!1}],[n.cos,{domain:[-1,1],isInteger:!1}],[n.sin,{domain:[-1,1],isInteger:!1}],[r.booleanAnd,{domain:[0,1],isInteger:!0}],[r.booleanNot,{domain:[0,1],isInteger:!0}],[r.booleanOr,{domain:[0,1],isInteger:!0}],[r.booleanXOr,{domain:[0,1],isInteger:!0}],[r.equalTo,{domain:[0,1],isInteger:!0}],[r.notEqual,{domain:[0,1],isInteger:!0}],[r.greaterThan,{domain:[0,1],isInteger:!0}],[r.greaterThanEqual,{domain:[0,1],isInteger:!0}],[r.lessThan,{domain:[0,1],isInteger:!0}],[r.lessThanEqual,{domain:[0,1],isInteger:!0}],[r.isNull,{domain:[0,1],isInteger:!0}]]);function l(t){return a.get(t)}const c=[0,2,2,2,1,2,1,1,1,1,1,2,2,1,2,2,2,2,1,2,2,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,999,999,999,999,999,999,2,1,2,999,1,1,2,1,1,1,999,999,1,1,999,1,1,2,999,999,2,2,999,999,999,999,999,999,999,999,999,999,3,999,3];function f(t,e=!1){const n=t.map(t=>t.mask),r=n.filter(t=>null!=t),o=t[0].pixels[0].length;if(0===r.length||e&&r.length!==n.length)return new Uint8Array(o).fill(255);const s=r[0],a=new Uint8Array(s);if(1===r.length)return a;if(!e){for(let t=1;t<r.length;t++){const e=r[t];for(let t=0;t<a.length;t++)a[t]&&(a[t]=e[t]?255:0)}return a}for(let l=1;l<r.length;l++){const t=r[l];for(let e=0;e<a.length;e++)0===a[e]&&(a[e]=t[e]?255:0)}return a}function i(e,n,r){const[o,s]=e,a=o.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)n&&!n[t]||(l[t]=o[t]+s[t]);return l}function u(e,n,r){const[o]=e,s=o.length,a=t.createEmptyBand("f32",s);return a.set(o),a}function h(e,n,r){const[o]=e,s=o.length,a=t.createEmptyBand(r,s);for(let t=0;t<s;t++)n&&!n[t]||(a[t]=o[t]*o[t]);return a}function g(e,n,r){const[o,s]=e,a=o.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)n&&!n[t]||(l[t]=o[t]-s[t]);return l}function p(e,n,r){const[o,s]=e,a=o.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)n&&!n[t]||(l[t]=o[t]*s[t]);return l}function m(e,n,r){const[o]=e,s=o.length,a=t.createEmptyBand(r,s);for(let t=0;t<s;t++)n&&!n[t]||(a[t]=Math.sign(o[t])*Math.floor(Math.abs(o[t])));return a}function d(e,n,r){const[o,s]=e,a=o.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)n&&!n[t]||(l[t]=o[t]/s[t]);return l}function y(t,e,n){return d(t,e,"f32")}function E(e,n,r){const[o,s]=e,a=o.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)n&&!n[t]||(l[t]=Math.floor(o[t]/s[t]));return l}function M(e,r,o,s){const a=e[0],l=a.length,c=t.createEmptyBand(o,l);if(s===n.atanh){for(let t=0;t<l;t++)if(r[t]){const e=a[t];Math.abs(e)>=1?r[t]=0:c[t]=Math.atanh(e)}return c}const f=s===n.asin?Math.asin:Math.acos;for(let t=0;t<l;t++)if(r[t]){const e=a[t];Math.abs(e)>1?r[t]=0:c[t]=f(e)}return c}function B(e,n,r,o){const[s]=e,a=s.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)n&&!n[t]||(l[t]=o(s[t]));return l}function I(e,n,r,o){const[s,a]=e,l=s.length,c=t.createEmptyBand(r,l);for(let t=0;t<l;t++)n&&!n[t]||(c[t]=o(s[t],a[t]));return c}function w(e,n,r){const[o,s]=e,a=o.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)n&&!n[t]||(l[t]=o[t]&s[t]);return l}function x(e,n,r){const[o,s]=e,a=o.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)n&&!n[t]||(l[t]=o[t]<<s[t]);return l}function b(e,n,r){const[o]=e,s=o.length,a=t.createEmptyBand(r,s);for(let t=0;t<s;t++)n&&!n[t]||(a[t]=~o[t]);return a}function A(e,n,r){const[o,s]=e,a=o.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)n&&!n[t]||(l[t]=o[t]|s[t]);return l}function P(e,n,r){const[o,s]=e,a=o.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)n&&!n[t]||(l[t]=o[t]>>s[t]);return l}function T(e,n,r){const[o,s]=e,a=o.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)n&&!n[t]||(l[t]=o[t]^s[t]);return l}function k(e,n,r){const[o,s]=e,a=o.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)n&&!n[t]||(l[t]=o[t]&&s[t]?1:0);return l}function q(e,n,r){const[o]=e,s=o.length,a=t.createEmptyBand(r,s);for(let t=0;t<s;t++)n&&!n[t]||(a[t]=o[t]?0:1);return a}function N(e,n,r){const[o,s]=e,a=o.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)n&&!n[t]||(l[t]=o[t]||s[t]?1:0);return l}function U(e,n,r){const[o,s]=e,a=o.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)n&&!n[t]||(l[t]=(o[t]?1:0)^(s[t]?1:0));return l}function F(e,n,r){const[o,s]=e,a=o.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)n&&!n[t]||(l[t]=o[t]===s[t]?1:0);return l}function j(e,n,r,o){const[s]=e,a=s.length,l=t.createEmptyBand(r,a),c=o===Math.E;for(let t=0;t<a;t++)n&&!n[t]||(l[t]=c?Math.exp(s[t]):o**s[t]);return l}function z(t,e,n){return j(t,e,n,10)}function O(t,e,n){return j(t,e,n,2)}function C(t,e,n){return j(t,e,n,Math.E)}function R(e,n,r,o){const[s]=e,a=s.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)n&&!n[t]||(s[t]<=0?n[t]=0:l[t]=o(s[t]));return l}function S(t,e,n){return R(t,e,n,Math.log10)}function X(t,e,n){return R(t,e,n,Math.log2)}function v(t,e,n){return R(t,e,n,Math.log)}function D(e,n,r){const[o,s]=e,a=o.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)n&&!n[t]||(l[t]=o[t]>s[t]?1:0);return l}function G(e,n,r){const[o,s]=e,a=o.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)n&&!n[t]||(l[t]=o[t]>=s[t]?1:0);return l}function H(e,n,r){const[o,s]=e,a=o.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)n&&!n[t]||(l[t]=o[t]<s[t]?1:0);return l}function J(e,n,r){const[o,s]=e,a=o.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)n&&!n[t]||(l[t]=o[t]<=s[t]?1:0);return l}function K(e,n,r){const[o]=e,s=o.length,a=t.createEmptyBand(r,s);if(!n)return a;for(let t=0;t<s;t++)a[t]=n[t]?0:1;return a}function L(e,n,r){const[o,s]=e,a=o.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)n&&!n[t]||(l[t]=o[t]%s[t]);return l}function Q(e,n,r){const[o]=e,s=o.length,a=t.createEmptyBand(r,s);for(let t=0;t<s;t++)n&&!n[t]||(a[t]=-o[t]);return a}function V(e,n,r){const[o,s]=e,a=o.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)n&&!n[t]||(l[t]=o[t]===s[t]?0:1);return l}function W(e,n,r){const[o,s]=e,a=o.length,l=t.createEmptyBand(r,a),c=new Uint8Array(a);for(let t=0;t<a;t++)null!=n&&!n[t]||0!==o[t]||(l[t]=s[t],c[t]=255);return{band:l,mask:c}}function Y(e,n,r){const[o,s,a]=e,l=o.length,c=t.createEmptyBand(r,l);for(let t=0;t<l;t++)n&&!n[t]||(c[t]=o[t]?s[t]:a[t]);return c}function Z(e,n,r){const o=e.length;if(o<2)return e[0];const[s]=e,a=s.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)if(!n||n[t]){let n=s[t];for(let r=1;r<o;r++){const o=e[r][t];n<o&&(n=o)}l[t]=n}return l}function $(e,n,r){const o=e.length;if(o<2)return e[0];const[s]=e,a=s.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)if(!n||n[t]){let n=s[t];for(let r=1;r<o;r++){const o=e[r][t];n>o&&(n=o)}l[t]=n}return l}function _(e,n,r){const o=e.length;if(o<2)return e[0];const[s]=e,a=s.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)if(!n||n[t]){let n=s[t],r=n;for(let s=1;s<o;s++){const o=e[s][t];r<o?r=o:n>o&&(n=o)}l[t]=r-n}return l}function tt(e,n,r){const o=e.length;if(o<2)return e[0];const[s]=e,a=s.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)if(!n||n[t]){let n=0;for(let r=0;r<o;r++)n+=e[r][t];l[t]=n/o}return l}function et(e,n,r){const o=e.length;if(o<2)return e[0];const[s]=e,a=s.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)if(!n||n[t])for(let n=0;n<o;n++){const r=e[n];l[t]+=r[t]}return l}function nt(e,n,r){const o=e.length;if(o<2)return e[0];const[s]=e,a=s.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)if(!n||n[t]){const n=new Float32Array(o);let r=0;for(let a=0;a<o;a++){const o=e[a];r+=o[t],n[a]=o[t]}r/=o;let s=0;for(let t=0;t<o;t++)s+=(n[t]-r)**2;l[t]=Math.sqrt(s/o)}return l}function rt(e,n,r){const o=e.length;if(o<2)return e[0];const s=Math.floor(o/2),[a]=e,l=a.length,c=t.createEmptyBand(r,l),f=new Float32Array(o),i=o%2==1;for(let t=0;t<l;t++)if(!n||n[t]){for(let n=0;n<o;n++)f[n]=e[n][t];f.sort(),c[t]=i?f[s]:(f[s]+f[s-1])/2}return c}function ot(e,n,r){const[o,s]=e;if(null==s)return o;const a=o.length,l=t.createEmptyBand(r,a);for(let t=0;t<a;t++)n&&!n[t]||(l[t]=o[t]<s[t]?o[t]:s[t]);return l}function st(e,n,r){const o=e.length;if(o<=2)return ot(e,n,r);const s=e[0].length,a=t.createEmptyBand(r,s),l=new Map;for(let t=0;t<s;t++)if(!n||n[t]){l.clear();for(let a=0;a<o;a++){const n=e[a][t];l.set(n,l.has(n)?l.get(n)+1:1)}let n=0,r=0;const s=[];for(const t of l.keys())n=l.get(t),n>r?(r=n,s.length=0,s.push(t)):n===r&&s.push(t);s.length>1&&s.sort((t,e)=>t-e),a[t]=s[0]}return a}function at(e,n,r){const o=e.length;if(o<=2)return ot(e,n,r);const s=e[0].length,a=t.createEmptyBand(r,s),l=new Map;for(let t=0;t<s;t++)if(!n||n[t]){l.clear();for(let a=0;a<o;a++){const n=e[a][t];l.set(n,l.has(n)?l.get(n)+1:1)}let n=0,r=e.length;const s=[];for(const t of l.keys())n=l.get(t),n<r?(r=n,s.length=0,s.push(t)):n===r&&s.push(t);s.length>1&&s.sort((t,e)=>t-e),a[t]=s[0]}return a}function lt(e,n,r){const o=e.length;if(o<2)return e[0];const[s]=e,a=s.length,l=t.createEmptyBand(r,a),c=new Set;for(let t=0;t<a;t++)if(!n||n[t]){let n;c.clear();for(let r=0;r<o;r++)n=e[r][t],c.add(n);l[t]=c.size}return l}const ct=new Map,ft=new Map,it=new Map,ut=new Map;function ht(){ct.size||(ct.set(4,Math.sqrt),ct.set(6,Math.acos),ct.set(7,Math.asin),ct.set(8,Math.atan),ct.set(9,Math.atanh),ct.set(10,Math.abs),ct.set(21,Math.cos),ct.set(22,Math.cosh),ct.set(48,Math.floor),ct.set(49,Math.ceil),ct.set(51,Math.sin),ct.set(52,Math.sinh),ct.set(56,Math.tan),ct.set(57,Math.tanh),ct.set(59,Math.acosh),ct.set(60,Math.asinh),ct.set(65,Math.floor),ft.set(5,Math.pow),ft.set(61,Math.atan2),it.set(1,i),it.set(2,g),it.set(3,p),it.set(11,w),it.set(12,x),it.set(13,b),it.set(14,A),it.set(15,P),it.set(16,T),it.set(17,k),it.set(18,q),it.set(19,N),it.set(20,U),it.set(23,d),it.set(24,F),it.set(25,C),it.set(26,z),it.set(27,O),it.set(28,D),it.set(29,G),it.set(30,m),it.set(31,K),it.set(32,u),it.set(33,H),it.set(34,J),it.set(35,v),it.set(36,S),it.set(37,X),it.set(44,L),it.set(45,Q),it.set(46,V),it.set(53,h),it.set(64,y),it.set(65,E),it.set(76,Y),it.set(78,Y),ut.set(38,st),ut.set(39,Z),ut.set(40,tt),ut.set(41,rt),ut.set(42,$),ut.set(43,at),ut.set(47,_),ut.set(54,nt),ut.set(55,et),ut.set(58,lt),ut.set(66,st),ut.set(67,Z),ut.set(68,tt),ut.set(69,rt),ut.set(70,$),ut.set(71,at),ut.set(72,_),ut.set(73,nt),ut.set(74,et),ut.set(75,lt))}function gt(l,c,i={}){ht();let u=f(l,c>=66&&c<=75);const{outputPixelType:h="f32"}=i,g=!ut.has(c)||i.processAsMultiband,p=g?l[0].pixels.length:1,m=[];for(let f=0;f<p;f++){const i=ut.has(c)&&!g?l.flatMap(t=>t.pixels):l.map(t=>t.pixels[f]);let p,d=!0;if(c===e.setNull){const t=W(i,u,h);p=t.band,u=t.mask,d=!1}else if(it.has(c)){p=it.get(c)(i,u,"f64")}else if(ct.has(c))p=c===n.asin||c===n.acos||c===n.atanh?M(i,u,"f64",c):B(i,u,"f64",ct.get(c));else if(ft.has(c))p=I(i,u,"f64",ft.get(c));else if(ut.has(c)){p=ut.get(c)(i,u,"f64")}else p=i[0],d=!1;if(d&&c!==r.isNull&&!a.has(c)){const e=t.createEmptyBand(h,p.length);u||(u=new Uint8Array(p.length).fill(255)),o(p,u),s(p,u,h,e),p=e}m.push(p)}const d=l[0];return new t({width:d.width,height:d.height,pixelType:h,mask:c===r.isNull?null:u,pixels:m})}function pt(t,e,n){return gt(t,e=[null,1,2,3,23,5,44][e]??1,{outputPixelType:n})}export{pt as arithmetic,l as getOutputDomain,gt as local,c as operandsCount};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import"../../../core/has.js";import t from"../PixelBlock.js";import{getPixelValueRange as e}from"../rasterFormats/pixelRangeUtils.js";import{matchAnyMask as n}from"./pixelUtils.js";function r(e,n,r){const a=e.length,s=t.createEmptyBand(r,a);for(let t=0;t<a;t++)if(n[t]){const r=e[t];r<=0?n[t]=0:s[t]=Math.log(r)}return s}function a(n,r,a,s){const i=n.length,o=t.createEmptyBand(a,i),[l,c]=e(a),m=s?.lambda??0,f=s?.shift??0,h=0===m;for(let t=0;t<i;t++)if(r[t]){const e=n[t];if(e<=0)r[t]=0;else if(h)o[t]=Math.log(e+f);else{const n=((e+f)**m-1)/m;o[t]=Math.max(l,Math.min(n,c))}}return o}function s(e,n,r){const a=e.length,s=t.createEmptyBand(r,a);for(let t=0;t<a;t++)if(n[t]){const r=e[t];r<0?n[t]=0:s[t]=Math.sqrt(r)}return s}function i(n,r,a){const s=n.length,i=t.createEmptyBand(a,s),[o,l]=e(a);for(let t=0;t<s;t++)if(!r||r[t]){const e=1/n[t];i[t]=i[t]=Math.max(o,Math.min(e,l))}return i}function o(e,o,l){const{width:c,height:m,pixels:f}=e;let h=[];h=e.bandMasks?e.bandMasks.map(t=>new Uint8Array(t)):f.map(()=>e.mask?new Uint8Array(e.mask):new Uint8Array(c*m).fill(255));const p="f32",u=f.map((t,e)=>{switch(o){case"log":return r(t,h[e],p);case"sqrt":return s(t,h[e],p);case"inverse":return i(t,h[e],p);case"box-cox":return a(t,h[e],p,l);default:return t}}),d="inverse"===o,g=d?e.mask:1===h.length?h[0]:n(h),x=d?e.bandMasks:1===h.length?void 0:h;return new t({width:c,height:m,pixelType:p,bandMasks:x,mask:g,pixels:u})}export{o as transformPixels};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{numberMaxFloat32 as t}from"../../../core/mathUtils.js";import e from"../PixelBlock.js";import{getPixelValueRange as n}from"../rasterFormats/pixelRangeUtils.js";const l=9,i="PixelID";function o(t){return null!=t&&t.pixels?.length>0}function r(t,e){return e?.length&&o(t)?t.extractBands(e):t}function s(t){if(!t?.length||t.some(t=>!o(t)))return null;if(1===t.length)return t[0]?.clone()??null;const n=t,{width:l,height:i,pixelType:r}=n[0];if(n.some(t=>t.width!==l||t.height!==i))return null;const s=n.map(({mask:t})=>t).filter(t=>null!=t);let a=null;s.length&&(a=new Uint8Array(l*i),a.set(s[0]),s.length>1&&k(s.slice(1),a));const h=[];n.forEach(({pixels:t})=>h.push(...t));const f=null!=a&&h.length===n.length?n.map(({width:t,height:e,mask:n})=>n??new Uint8Array(t*e).fill(255)):null,c=n.map(({statistics:t})=>t).filter(t=>t?.length),u=[];return c.forEach(t=>u.push(...t)),new e({pixelType:r,width:l,height:i,mask:a,bandMasks:f,pixels:h,statistics:u.length?u:null})}function a(t){if(!t)return;const e=t.colormap;if(!e||0===e.length)return;const n=e.sort((t,e)=>t[0]-e[0]),l=n[0][0]<0?n[0][0]:0,i=Math.max(256,n[n.length-1][0]-l+1),o=new Uint8Array(4*i),r=[],s=5===n[0].length;if(i>65536)return n.forEach(t=>{r[t[0]-l]=s?t.slice(1):t.slice(1).concat([255])}),{indexed2DColormap:r,offset:l,alphaSpecified:s};if(t.fillUnspecified){let t=n[0];for(let e=t[0]-l,r=0;e<i;e++)o[4*e]=t[1],o[4*e+1]=t[2],o[4*e+2]=t[3],o[4*e+3]=s?t[4]:255,e===t[0]-l&&(t=r===n.length-1?t:n[++r])}else for(let a=0;a<n.length;a++){const t=n[a],e=4*(t[0]-l);o[e]=t[1],o[e+1]=t[2],o[e+2]=t[3],o[e+3]=s?t[4]:255}return{indexedColormap:o,offset:l,alphaSpecified:s}}function h(t,e){if(!o(t))return t;if(!e||!e.indexedColormap&&!e.indexed2DColormap)return t;const n=t.clone(),l=n.pixels;let i=n.mask;const r=n.width*n.height;if(1!==l.length)return t;const{indexedColormap:s,indexed2DColormap:a,offset:h,alphaSpecified:f}=e,c=l[0],u=new Uint8Array(c.length),p=new Uint8Array(c.length),d=new Uint8Array(c.length);let x,g=0;if(s){const t=s.length-1;if(null!=i)for(let e=0;e<r;e++)i[e]&&(g=4*(c[e]-h),g<h||g>t?i[e]=0:(u[e]=s[g],p[e]=s[g+1],d[e]=s[g+2],i[e]=s[g+3]));else{i=new Uint8Array(r);for(let e=0;e<r;e++)g=4*(c[e]-h),g<h||g>t?i[e]=0:(u[e]=s[g],p[e]=s[g+1],d[e]=s[g+2],i[e]=s[g+3]);n.mask=i}}else if(a)if(null!=i)for(let o=0;o<r;o++)i[o]&&(x=a[c[o]],u[o]=x[0],p[o]=x[1],d[o]=x[2],i[o]=x[3]);else{i=new Uint8Array(r);for(let t=0;t<r;t++)x=a[c[t]],u[t]=x[0],p[t]=x[1],d[t]=x[2],i[t]=x[3];n.mask=i}return n.pixels=[u,p,d],n.statistics=null,n.pixelType="u8",n.maskIsAlpha=f,n}function f(t,n){if(!o(t))return null;const{pixels:l,mask:i}=t,r=l.length;let s=n.lut;const{offset:a}=n;s&&1===s[0].length&&(s=l.map(()=>s));const h=[],f=n.outputPixelType||"u8";for(let e=0;e<r;e++){const t=c(l[e],i,s[e],a||0,f);h.push(t)}const u=new e({width:t.width,height:t.height,pixels:h,mask:i,pixelType:f});return u.updateStatistics(),u}function c(t,n,l,i,o){const r=t.length,s=e.createEmptyBand(o,r);if(n)for(let e=0;e<r;e++)n[e]&&(s[e]=l[t[e]-i]);else for(let e=0;e<r;e++)s[e]=l[t[e]-i];return s}function u(t,e,n,l){const{width:i,height:o,pixels:r,mask:s}=t,a=i*o,{bandId:h,ranges:f}=n,c=r[h];if(!c)return;const u=1===f.length,[p,d]=f[0];for(let x=0;x<a;x++)if(!s||s[x]){const t=c[x];if(u)t>=p&&t<=d&&(e[x]=l);else for(let n=0;n<f.length;n++){const[i,o]=f[n];if(t>=i&&t<=o){e[x]=l;break}}}}function p(t,e,n,l){const{width:i,height:o,xyMask:r,xBandId:s,yBandId:a,xBandRange:h,yBandRange:f}=n,{pixels:c,mask:u}=t,p=c[s],d=c[a],[x,g]=h,[m,y]=f,w=(g-x)/i,k=(y-m)/o;for(let M=0;M<p.length;M++)if(!u||u[M]){let t=p[M],n=d[M];if(t<x||t>g||n<m||n>y)continue;r?(t=(t-x)*w,t=t>i-1?i-1:t<0?0:255&t,n=(y-n)*k,n=n>o-1?o-1:n<0?0:255&n,r[n*i+t]&&(e[M]=l)):e[M]=l}}function d(t){const{pixelBlock:e,renderedPixelBlock:n,highlightOptions:l}=t;if(!o(e))return;const{width:i,height:r}=e,s=i*r,a=new Uint8Array(s);for(let o=1;o<=l.length;o++){const t=l[o-1];"bandId"in t?u(e,a,t,o):p(e,a,t,o)}const{pixels:h}=n;1===h.length&&(h[1]=h[0].slice(),h[2]=h[0].slice());const f=l.map(t=>t.color),[c,d,x]=h;if(n.mask){const t=n.mask;for(let e=0;e<s;e++)if(t[e]){t[e]=255;const n=a[e];if(n){const l=f[n-1];c[e]=l[0],d[e]=l[1],x[e]=l[2],t[e]=l[3]}}}else{const t=new Uint8Array(s).fill(255);for(let e=0;e<s;e++){const n=a[e];if(n){const l=f[n-1];c[e]=l[0],d[e]=l[1],x[e]=l[2],t[e]=l[3]}}n.mask=t}n.maskIsAlpha=!0}function x(t,e){if(!o(t))return null;const n=t.clone(),{pixels:l}=n,i=n.width*n.height,r=e.length,s=Math.floor(r/2),a=e[Math.floor(s)],h=l[0],f=new Uint8Array(i),c=new Uint8Array(i),u=new Uint8Array(i);let p=n.mask;const d=4===e[0].mappedColor.length;p||(p=new Uint8Array(i),p.fill(d?255:1),n.mask=p);for(let o=0;o<i;o++)if(p[o]){const t=h[o];let n=!1,l=s,i=a,d=0,x=r-1;for(;x-d>1;){if(t===i.value){n=!0;break}t>i.value?d=l:x=l,l=Math.floor((d+x)/2),i=e[Math.floor(l)]}n||(t===e[d].value?(i=e[d],n=!0):t===e[x].value?(i=e[x],n=!0):t<e[d].value?n=!1:t>e[d].value&&(t<e[x].value?(i=e[d],n=!0):x===r-1?n=!1:(i=e[x],n=!0))),n?(f[o]=i.mappedColor[0],c[o]=i.mappedColor[1],u[o]=i.mappedColor[2],p[o]=i.mappedColor[3]):f[o]=c[o]=u[o]=p[o]=0}return n.pixels=[f,c,u],n.mask=p,n.pixelType="u8",n.maskIsAlpha=d,n}function g(e,n,i=!1){const o=1e-5,r=new Float32Array(3*l),s=n.length;for(let a=0;a<l;a++)r[3*a]=e[2*a]??t-1,r[3*a+1]=e[2*a+1]??t,r[3*a+2]=n[a]??0,a<s&&(a>0&&(r[3*a]-=o),e[2*a+1]!==e[2*a]&&(a<s-1||!i)&&(r[3*a+1]-=o));return r}function m(t,l){if(!o(t))return null;const{width:i,height:r}=t,{inputRanges:s,outputValues:a,outputPixelType:h,noDataRanges:f,allowUnmatched:c,replacementValue:u,isLastInputRangeInclusive:p}=l,d=t.pixels[0],x=e.createEmptyBand(h,d.length),g=t.mask,m=new Uint8Array(i*r);g?m.set(g):m.fill(255);const y=t.pixelType.startsWith("f")?1e-6:0,w=s.map(t=>t-y);w[0]=s[0],w[w.length-1]=s[s.length-1]+(p?1e-6:0);const k=s.length/2,[M,A]=n(h);for(let e=0;e<r;e++)for(let t=0;t<i;t++){const n=e*i+t;if(m[n]){const t=d[n];let e=!1;for(let l=k-1;l>=0;l--)if(t===s[2*l]||t>w[2*l]&&t<w[2*l+1]){x[n]=a[l],e=!0;break}e||(c?x[n]=t>A?A:t<M?M:u??t:m[n]=0)}}const U=f?.length;if(U)for(let e=0;e<r;e++)for(let t=0;t<i;t++){const n=e*i+t;if(!g||g[n]){const t=d[n];for(let e=0;e<U;e+=2)if(t>=f[e]&&t<=f[e+1]){x[n]=0,m[n]=0;break}}}return new e({width:i,height:r,pixelType:h,pixels:[x],mask:m})}function y(t,e,n,l){const i=null!=n&&n.length>=2?new Set(n):null,o=1===n?.length?n[0]:null,r=!!e?.length;for(let s=0;s<t.length;s++)if(l[s]){const n=t[s];if(r){let t=!1;for(let l=0;l<e.length;l+=2)if(n>=e[l]&&n<=e[l+1]){t=!0;break}t||(l[s]=0)}l[s]&&(n===o||i?.has(n))&&(l[s]=0)}}function w(t,e){const n=t[0].length;e??=new Uint8Array(n).fill(255);for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(t[e][l]){n=!0;break}n||(e[l]=0)}return e}function k(t,e){const n=t[0].length;e??=new Uint8Array(n).fill(255);for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(0===t[e][l]){n=!0;break}n&&(e[l]=0)}return e}function M(t,n){if(!o(t))return null;const{width:l,height:i,pixels:r}=t,s=l*i,a=new Uint8Array(s);t.mask?a.set(t.mask):a.fill(255);const h=r.length,{includedRanges:f,noDataValues:u,outputPixelType:p,matchAll:d,lookups:x}=n;if(x){const t=[];for(let e=0;e<h;e++){const n=x[e],l=c(r[e],a,n.lut,n.offset||0,"u8");t.push(l)}1===t.length?a.set(t[0]):d?w(t,a):k(t,a)}else if(d){const t=[];for(let e=0;e<h;e++){const n=new Uint8Array(s);n.set(a),y(r[e],f?.slice(2*e,2*e+2),u?.[e],n),t.push(n)}1===t.length?a.set(t[0]):w(t,a)}else for(let e=0;e<h;e++)y(r[e],f?.slice(2*e,2*e+2),u?.[e],a);return new e({width:l,height:i,pixelType:p,pixels:r,mask:a})}function A(t){const{srcPixelType:l,inputRanges:i,outputValues:o,allowUnmatched:r,noDataRanges:s,isLastInputRangeInclusive:a,outputPixelType:h}=t;if("u8"!==l&&"s8"!==l&&"u16"!==l&&"s16"!==l)return null;const f=l.includes("16")?65536:256,c=l.includes("s")?-f/2:0,u=e.createEmptyBand(h,f),p=new Uint8Array(f);r&&p.fill(255);const[d,x]=n(h);if(i?.length&&o?.length){const t=1e-6,e=i.map(e=>e-t);e[0]=i[0],a&&(e[e.length-1]=i[i.length-1]);for(let n=0;n<e.length;n++){const t=o[n]>x?x:o[n]<d?d:o[n],l=Math.ceil(e[2*n]-c),r=i[2*n+1]===i[2*n]?l:Math.floor(e[2*n+1]-c);for(let e=l;e<=r;e++)u[e]=t,p[e]=255}}if(s?.length)for(let e=0;e<s.length;e++){const t=Math.ceil(s[2*e]-c),n=Math.floor(s[2*e+1]-c);for(let e=t;e<=n;e++)p[e]=0}return{lut:u,offset:c,mask:p}}function U(t,e,n){if("u8"!==t&&"s8"!==t&&"u16"!==t&&"s16"!==t)return null;const l=t.includes("16")?65536:256,i=t.includes("s")?-l/2:0,o=new Uint8Array(l);if(e)for(let r=0;r<e.length;r++){const t=Math.ceil(e[2*r]-i),n=Math.floor(e[2*r+1]-i);for(let e=t;e<=n;e++)o[e]=255}else o.fill(255);if(n)for(let r=0;r<n.length;r++)o[n[r]-i]=0;return{lut:o,offset:i}}function b(t,e,n,l,i,o,r,s){return{xmin:i<=n*t?0:i<n*t+t?i-n*t:t,ymin:o<=l*e?0:o<l*e+e?o-l*e:e,xmax:i+r<=n*t?0:i+r<n*t+t?i+r-n*t:t,ymax:o+s<=l*e?0:o+s<l*e+e?o+s-l*e:e}}function T(t,e){if(!t||0===t.length)return null;const n=t.find(t=>t.pixelBlock);if(null==n?.pixelBlock)return null;const l=(n.extent.xmax-n.extent.xmin)/n.pixelBlock.width,i=(n.extent.ymax-n.extent.ymin)/n.pixelBlock.height,o=.01*Math.min(l,i),r=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),s=Math.min.apply(null,r.map(t=>t.extent.xmin)),a=Math.min.apply(null,r.map(t=>t.extent.ymin)),h=Math.max.apply(null,r.map(t=>t.extent.xmax)),f=Math.max.apply(null,r.map(t=>t.extent.ymax)),c={x:Math.round((e.xmin-s)/l),y:Math.round((f-e.ymax)/i)},u={width:Math.round((h-s)/l),height:Math.round((f-a)/i)},p={width:Math.round((e.xmax-e.xmin)/l),height:Math.round((e.ymax-e.ymin)/i)};if(Math.round(u.width/n.pixelBlock.width)*Math.round(u.height/n.pixelBlock.height)!==r.length||c.x<0||c.y<0||u.width<p.width||u.height<p.height)return null;return{extent:e,pixelBlock:S(r.map(t=>t.pixelBlock),u,{clipOffset:c,clipSize:p})}}function B(t,e,n,l,i,o){const{width:r,height:s}=n.block,{x:a,y:h}=n.offset,{width:f,height:c}=n.mosaic,u=b(r,s,l,i,a,h,f,c);let p=0,d=0;if(o){const t=o.hasGCSSShiftTransform?360:o.halfWorldWidth??0,e=r*o.resolutionX,n=o.startX+l*e;n<t&&n+e>t?d=o.rightPadding:n>=t&&(p=o.leftMargin-o.rightPadding,d=0)}if(u.xmax-=d,"number"!=typeof e)for(let x=u.ymin;x<u.ymax;x++){const n=(i*s+x-h)*f+(l*r-a)+p,o=x*r;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e[o+l]}else for(let x=u.ymin;x<u.ymax;x++){const n=(i*s+x-h)*f+(l*r-a)+p;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e}}function S(t,n,l={}){const{clipOffset:i,clipSize:r,alignmentInfo:s,blockWidths:a}=l;if(a)return v(t,n,{blockWidths:a});const h=t.find(t=>o(t));if(null==h)return null;const f=r?r.width:n.width,c=r?r.height:n.height,u=h.width,p=h.height,d=n.width/u,x=n.height/p,g={offset:i||{x:0,y:0},mosaic:r||n,block:{width:u,height:p}},m=h.pixelType,y=e.getPixelArrayConstructor(m),w=h.pixels.length,k=[];let M,A;for(let e=0;e<w;e++){A=new y(f*c);for(let n=0;n<x;n++)for(let l=0;l<d;l++){const i=t[n*d+l];o(i)&&(M=i.pixels[e],B(A,M,g,l,n,s))}k.push(A)}const U=t.some(t=>null==t||null!=t.mask&&t.mask.length>0),b=t.some(t=>t?.bandMasks&&t.bandMasks.length>1),T=U?new Uint8Array(f*c):void 0,S=b?[]:void 0;if(T){for(let e=0;e<x;e++)for(let n=0;n<d;n++){const l=t[e*d+n],i=null!=l?l.mask:null;B(T,null!=i?i:l?255:0,g,n,e,s)}if(S)for(let e=0;e<w;e++){const n=new Uint8Array(f*c);for(let l=0;l<x;l++)for(let i=0;i<d;i++){const o=t[l*d+i],r=o?.bandMasks?.[e]??o?.mask;B(n,null!=r?r:o?255:0,g,i,l,s)}S.push(n)}}const C=new e({width:f,height:c,pixels:k,pixelType:m,bandMasks:S,mask:T});return C.updateStatistics(),C}function v(t,n,l){const i=t.find(t=>null!=t);if(null==i)return null;const r=t.some(t=>null==t||!!t.mask),{width:s,height:a}=n,h=r?new Uint8Array(s*a):null,{blockWidths:f}=l,c=[],u=i.getPlaneCount(),p=e.getPixelArrayConstructor(i.pixelType);if(r)for(let e=0,y=0;e<t.length;y+=f[e],e++){const n=t[e];if(!o(n))continue;const l=n.mask;for(let t=0;t<a;t++)for(let i=0;i<f[e];i++)h[t*s+i+y]=null==l?255:l[t*n.width+i]}const d=t.some(t=>t?.bandMasks&&t.bandMasks.length>1),x=d?[]:void 0,g=s*a;for(let e=0;e<u;e++){const n=new p(g),l=d?new Uint8Array(g):void 0;for(let i=0,r=0;i<t.length;r+=f[i],i++){const h=t[i];if(!o(h))continue;const c=h.pixels[e];if(null!=c){for(let t=0;t<a;t++)for(let e=0;e<f[i];e++)n[t*s+e+r]=c[t*h.width+e];if(l){const t=h.bandMasks?.[e]??h.mask;for(let e=0;e<a;e++)for(let n=0;n<f[i];n++)l[e*s+n+r]=t?t[e*h.width+n]:255}}}c.push(n),x&&l&&x.push(l)}const m=new e({width:s,height:a,mask:h,bandMasks:x,pixels:c,pixelType:i.pixelType});return m.updateStatistics(),m}function C(t,e,n){if(!o(t))return null;const{width:l,height:i}=t,r=e.x,s=e.y,a=n.width+r,h=n.height+s;if(r<0||s<0||a>l||h>i)return t;if(0===r&&0===s&&a===l&&h===i)return t;t.mask||(t.mask=new Uint8Array(l*i));const f=t.mask;for(let o=0;o<i;o++){const t=o*l;for(let e=0;e<l;e++)f[t+e]=o<s||o>=h||e<r||e>=a?0:1}return t.updateStatistics(),t}function I(t){if(!o(t))return null;const e=t.clone(),{width:n,height:l,pixels:i}=t,r=i[0],s=e.pixels[0],a=t.mask;for(let o=2;o<l-1;o++){const t=new Map;for(let l=o-2;l<o+2;l++)for(let e=0;e<4;e++){const i=l*n+e;F(t,r[i],a?a[i]:1)}s[o*n]=R(t),s[o*n+1]=s[o*n+2]=s[o*n];let e=3;for(;e<n-1;e++){let l=(o-2)*n+e+1;F(t,r[l],a?a[l]:1),l=(o-1)*n+e+1,F(t,r[l],a?a[l]:1),l=o*n+e+1,F(t,r[l],a?a[l]:1),l=(o+1)*n+e+1,F(t,r[l],a?a[l]:1),l=(o-2)*n+e-3,P(t,r[l],a?a[l]:1),l=(o-1)*n+e-3,P(t,r[l],a?a[l]:1),l=o*n+e-3,P(t,r[l],a?a[l]:1),l=(o+1)*n+e-3,P(t,r[l],a?a[l]:1),s[o*n+e]=R(t)}s[o*n+e+1]=s[o*n+e]}for(let o=0;o<n;o++)s[o]=s[n+o]=s[2*n+o],s[(l-1)*n+o]=s[(l-2)*n+o];return e.updateStatistics(),e}function R(t){if(0===t.size)return 0;let e=0,n=-1,l=0;const i=t.keys();let o=i.next();for(;!o.done;)l=t.get(o.value),l>e&&(n=o.value,e=l),o=i.next();return n}function P(t,e,n){if(0===n)return;const l=t.get(e);1===l?t.delete(e):t.set(e,l-1)}function F(t,e,n){0!==n&&t.set(e,t.has(e)?t.get(e)+1:1)}function _(t,n,l){let{x:i,y:r}=n;const{width:s,height:a}=l;if(0===i&&0===r&&a===t.height&&s===t.width)return t;const{width:h,height:f}=t,c=Math.max(0,r),u=Math.max(0,i),p=Math.min(i+s,h),d=Math.min(r+a,f);if(p<0||d<0||!o(t))return null;i=Math.max(0,-i),r=Math.max(0,-r);const{pixels:x}=t,g=s*a,m=x.length,y=[];for(let o=0;o<m;o++){const n=x[o],l=e.createEmptyBand(t.pixelType,g);for(let t=c;t<d;t++){const e=t*h;let o=(t+r-c)*s+i;for(let t=u;t<p;t++)l[o++]=n[e+t]}y.push(l)}const w=new Uint8Array(g),k=t.mask;for(let e=c;e<d;e++){const t=e*h;let n=(e+r-c)*s+i;for(let e=u;e<p;e++)w[n++]=k?k[t+e]:1}const M=new e({width:l.width,height:l.height,pixelType:t.pixelType,pixels:y,mask:w});return M.updateStatistics(),M}function W(t,n=!0){if(!o(t))return null;const{pixels:l,width:i,height:r,mask:s,pixelType:a}=t,h=[],f=Math.round(i/2),c=Math.round(r/2),u=r-1,p=i-1;for(let o=0;o<l.length;o++){const t=l[o],s=e.createEmptyBand(a,f*c);let d=0;for(let e=0;e<r;e+=2)for(let l=0;l<i;l+=2){const o=t[e*i+l];if(n){const n=l===p?o:t[e*i+l+1],r=e===u?o:t[e*i+l+i],a=l===p?r:e===u?n:t[e*i+l+i+1];s[d++]=(o+n+r+a)/4}else s[d++]=o}h.push(s)}let d=null;if(null!=s){d=new Uint8Array(f*c);let t=0;for(let e=0;e<r;e+=2)for(let l=0;l<i;l+=2){const o=s[e*i+l];if(n){const n=l===p?o:s[e*i+l+1],r=e===u?o:s[e*i+l+i],a=l===p?r:e===u?n:s[e*i+l+i+1];d[t++]=o*n*r*a?1:0}else d[t++]=o}}return new e({width:f,height:c,pixelType:a,pixels:h,mask:d})}function E(t,e,n=0,l=!0){if(!o(t))return null;const{width:i,height:r}=e;let{width:s,height:a}=t;const h=new Map,f={x:0,y:0},c=1+n;let u=t;for(let o=0;o<c;o++){const t=Math.ceil(s/i),n=Math.ceil(a/r);for(let l=0;l<n;l++){f.y=l*r;for(let n=0;n<t;n++){f.x=n*i;const t=_(u,f,e);h.set(`${o}/${l}/${n}`,t)}}o<c-1&&(u=W(u,l)),s=Math.round(s/2),a=Math.round(a/2)}return h}function D(t){const{pixelBlock:e,tileSize:n,level:l,row:i,col:r,useBilinear:s}=t;if(!o(e))return null;const{width:a,height:h}=n,f=2**l,c=f*a,u=f*h;let p=_(e,{y:i*u,x:r*c},{width:c,height:u});if(!p)return null;for(let o=l;o>0;o--)p=W(p,s);return p}function N(t,e,n,l,i=0){const{width:o,height:r}=t,{width:s,height:a}=e,h=l.cols,f=l.rows,c=Math.ceil(s/h-.1/h),u=Math.ceil(a/f-.1/f);let p,d,x,g,m,y,w;const k=c*h,M=k*u*f,A=new Float32Array(M),U=new Float32Array(M),b=new Uint32Array(M),T=new Uint32Array(M);let B,S,v=0;for(let C=0;C<u;C++)for(let t=0;t<c;t++){p=12*(C*c+t),d=n[p],x=n[p+1],g=n[p+2],m=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<f;e++){v=(C*f+e)*k+t*h,S=(e+.5)/f;for(let t=0;t<e;t++)B=(t+.5)/h,A[v+t]=(d*B+x*S+g)*o+i,U[v+t]=(m*B+y*S+w)*r+i,b[v+t]=Math.floor(A[v+t]),T[v+t]=Math.floor(U[v+t])}p+=6,d=n[p],x=n[p+1],g=n[p+2],m=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<f;e++){v=(C*f+e)*k+t*h,S=(e+.5)/f;for(let t=e;t<h;t++)B=(t+.5)/h,A[v+t]=(d*B+x*S+g)*o+i,U[v+t]=(m*B+y*S+w)*r+i,b[v+t]=Math.floor(A[v+t]),T[v+t]=Math.floor(U[v+t])}}return{offsets_x:A,offsets_y:U,offsets_xi:b,offsets_yi:T,gridWidth:k}}function j(t,e){const{coefficients:n,spacing:l}=e,{offsets_x:i,offsets_y:o,gridWidth:r}=N(t,t,n,{rows:l[0],cols:l[1]}),{width:s,height:a}=t,h=new Float32Array(s*a),f=180/Math.PI;for(let c=0;c<a;c++)for(let t=0;t<s;t++){const e=c*r+t,n=0===c?e:e-r,l=c===a-1?e:e+r,u=i[n]-i[l],p=o[l]-o[n];if(isNaN(u)||isNaN(p))h[c*s+t]=90;else{let e=Math.atan2(p,u)*f;e=(360+e)%360,h[c*s+t]=e}}return h}function O(t,n,l,i,r="nearest"){if(!o(t))return null;"majority"===r&&(t=I(t));const{pixels:s,mask:a,bandMasks:h,pixelType:f}=t,c=t.width,u=t.height,p=e.getPixelArrayConstructor(f),d=s.length,{width:x,height:g}=n;let m=!1;for(let e=0;e<l.length;e+=3)-1===l[e]&&-1===l[e+1]&&-1===l[e+2]&&(m=!0);const{offsets_x:y,offsets_y:w,offsets_xi:k,offsets_yi:M,gridWidth:A}=N({width:c,height:u},n,l,i,"majority"===r?.5:0);let U;const b=(t,e,n,l)=>{const i=t instanceof Float32Array||t instanceof Float64Array?0:.5;for(let o=0;o<g;o++){U=o*A;for(let r=0;r<x;r++){if(y[U]<0||w[U]<0)t[o*x+r]=0;else if(l)t[o*x+r]=e[k[U]+M[U]*c];else{const l=Math.floor(y[U]),s=Math.floor(w[U]),a=Math.ceil(y[U]),h=Math.ceil(w[U]),f=y[U]-l,u=w[U]-s;if(!n||n[l+s*c]&&n[a+s*c]&&n[l+h*c]&&n[a+h*c]){const n=(1-f)*e[l+s*c]+f*e[a+s*c],p=(1-f)*e[l+h*c]+f*e[a+h*c];t[o*x+r]=(1-u)*n+u*p+i}else t[o*x+r]=e[k[U]+M[U]*c]}U++}}},T=[];let B;const S=h?.length===d,v=[];for(let e=0;e<d;e++){if(S){const t=new Uint8Array(x*g);b(t,h[e],h[e],!0),v.push(t)}B=new p(x*g),b(B,s[e],S?h[e]:a,"nearest"===r||"majority"===r),T.push(B)}const C=new e({width:x,height:g,pixelType:f,pixels:T,bandMasks:S?v:void 0});if(null!=a)C.mask=new Uint8Array(x*g),b(C.mask,a,a,!0);else if(m){C.mask=new Uint8Array(x*g);for(let t=0;t<x*g;t++)C.mask[t]=y[t]<0||w[t]<0?0:1}return C.updateStatistics(),C}function z(t){const{pixelBlock:e,extent:n,fieldNames:l,skipFactor:o,skipSpatialReference:r=!1,pixelIdOffset:s=0}=t,a=[],{width:h,height:f,pixels:c,mask:u}=e,p=t.imageRowSize??h,d=n.width/h,x=n.height/f,g=c.length,m=Math.floor(o/2),{xmin:y,ymax:w}=n,k=r?void 0:n.spatialReference.toJSON();for(let M=m;M<f;M+=o)for(let t=m;t<h;t+=o){const e=M*h+t;if(!u||u[e]){const n={x:y+(t+.5)*d,y:w-(M+.5)*x,spatialReference:k},o={[i]:s+M*p+t};for(let t=0;t<g;t++)o[l[t+1]]=c[t][e];a.push({geometry:n,attributes:o})}}return a}function L(t,e){const{width:n,height:l,pixels:i,mask:o}=t,r=i[0];let s=0;for(let a=0;a<l;a++){let t=a*n;for(let l=0;l<n;l++,t++)o&&!o[t]||(e[r[t]]++,s++)}return s}function V(t,e){const{width:n,height:l,pixels:i,mask:o}=t,r=e.width/n,s=e.height/l,{xmin:a,ymax:h}=e,f=e.spatialReference.toJSON(),c=[];for(let u=0;u<l;u++)for(let t=0;t<n;t++){const e=u*n+t;if(!o||o[e]){const n={x:a+(t+.5)*r,y:h-(u+.5)*s,spatialReference:f},l=i.map(t=>t[e]);c.push({location:n,value:l})}}return c}function $(t,n,l){const{attributeTable:i}=n;if(!i)return t;const o=i.fields.find(t=>t.name.toLowerCase()===l.toLowerCase()),r=i.fields.find(t=>"value"===t.name.toLowerCase());if(!o||!r)return t;const[s]=t.pixels,a="single"===o.type?"f32":"double"===o.type||"big-integer"===o.type?"f64":"small-integer"===o.type?"s16":"s32",h=s.length,f=new("f32"===a?Float32Array:"f64"===a?Float64Array:"s16"===a?Int16Array:Int32Array)(h),c=new Map;for(const e of i.features){const t=e.attributes[r.name],n=e.attributes[o.name];c.set(t,n)}const u=t.mask??new Uint8Array(h).fill(255);for(let e=0;e<h;e++)if(u[e]){const t=c.get(s[e]);null==t?u[e]=0:f[e]=t}return new e({width:t.width,height:t.height,pixels:[f],mask:u,pixelType:a})}export{O as approximateTransform,_ as clip,D as clipTile,h as colorize,s as compositeBands,z as convertPixelBlockToFeatures,L as countCategoricalPixels,a as createColormapLUT,U as createMaskLUT,g as createRangeMaps,A as createRemapLUT,r as extractBands,b as getClipBounds,j as getLocalArithmeticNorthRotations,V as getValidPixels,d as highlightPixels,N as interpolateOffsets,o as isValidPixelBlock,c as lookupBandValues,f as lookupPixels,$ as mapPixelValueToAttribute,M as mask,k as matchAnyMask,l as maxMapSizeGpu,S as mosaic,T as mosaicPixelData,i as pixelIdFieldName,m as remap,x as remapColor,I as resampleByMajority,u as selectBySingleBandRange,p as selectByXYMask,C as setValidBoundary,E as split};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{assertIsSome as t}from"../../../core/maybe.js";import n from"../PixelBlock.js";import{getPixelValueRange as e}from"../rasterFormats/pixelRangeUtils.js";import{stretchTypeFunctionEnum as s}from"../../../renderers/support/stretchRendererUtils.js";const i=1,o=[.299,.587,.114];function a(t){if(null==t)return!1;const{max:n,min:e,size:s}=t;return(n-e)/s===1&&e>=-.5&&.5===Math.abs(e%1)&&n<=255.5}function r(t,n=256){const e=255;n=Math.min(n,e+1);const{size:s,counts:i}=t,o=new Float64Array(s);o[0]=i[0]/n;for(let a=1;a<s;a++)o[a]=o[a-1]+i[a]/n;const r=new Uint8Array(n),l=n/o[o.length-1];if(s<=n){const i=a(t)?Math.max(0,Math.round(t.min+.5)):0;for(let t=i;t<n;t++)r[t]=t>=s+i?e:Math.min(e,Math.trunc(o[t-i]*l))}else{const t=o.map(t=>Math.min(255,Math.trunc(t*l)));for(let e=0;e<n;e++)r[e]=t[Math.round(s/n)];r[n-1]=255}return r}function l(t){const{minCutOff:n,maxCutOff:e,gamma:s,pixelType:i,rounding:o}=t;if(!["u8","u16","s8","s16"].includes(i))return null;const a=n.length,r="s8"===i?-127:"s16"===i?-32767:0,l=["u16","s16"].includes(i)?65536:256,c=[],m=[],{minOutput:f=0,maxOutput:h=255}=t,d=h-f;for(let u=0;u<a;u++)m[u]=e[u]-n[u],c[u]=0===m[u]?0:d/m[u];const g=[];if(s&&s.length>=a){const t=w(a,s);for(let i=0;i<a;i++){const a=[];for(let u=0;u<l;u++){if(0===m[i]){a[u]=f;continue}const l=u+r,c=(l-n[i])/m[i];let g=1;if(s[i]>1&&(g-=(1/d)**(c*t[i])),l<e[i]&&l>n[i]){const t=g*d*c**(1/s[i])+f;a[u]="floor"===o?Math.floor(t):"round"===o?Math.round(t):t}else l>=e[i]?a[u]=h:a[u]=f}g[i]=a}}else for(let u=0;u<a;u++){const t=[];for(let s=0;s<l;s++){const i=s+r;if(i<=n[u])t[s]=f;else if(i>=e[u])t[s]=h;else{const e=(i-n[u])*c[u]+f;t[s]="floor"===o?Math.floor(e):"round"===o?Math.round(e):e}}g[u]=t}if(null!=t.contrastOffset){const n=u(t.contrastOffset,t.brightnessOffset);for(let t=0;t<a;t++){const e=g[t];for(let t=0;t<l;t++)e[t]=n[e[t]]}}return{lut:g,offset:r}}function u(t,n){const e=Math.min(Math.max(t,-100),100),s=Math.min(Math.max(n??0,-100),100),i=255,o=128,a=new Uint8Array(256);for(let r=0;r<256;r++){let t=0;e>0&&e<100?t=(200*r-100*i+2*i*s)/(2*(100-e))+o:e<=0&&e>-100?t=(200*r-100*i+2*i*s)*(100+e)/2e4+o:100===e?(t=200*r-100*i+(i+1)*(100-e)+2*i*s,t=t>0?i:0):-100===e&&(t=o),a[r]=t>i?i:t<0?0:t}return a}function c(t,n,e){const s=[];for(let i=0;i<n.length;i++){let a=0,r=0,l=0;"min"in n[i]?({min:a,max:r,avg:l}=n[i]):[a,r,l]=n[i];let u=l??0;"u8"!==t&&(u=255*(u-a)/(r-a)),e&&(u*=o[i]),s.push(m(u))}return s}function m(t){if(t<=0||t>=255)return i;const n=255,e=t+(150===t?0:t<150?45*Math.cos(.01047*t):17*Math.sin(.021*t)),s=Math.log(t/n),o=Math.log(e/n);if(0===o)return i;const a=s/o;return isNaN(a)?i:Math.min(9.9,Math.max(.01,a))}function f(t,n,e){let{min:s,max:i,count:o,avg:a,mode:r,median:l}=d(t,n,!0);if(0===o)return{statistics:{min:0,max:0,avg:0,stddev:0,count:o,mode:0,median:0},histogram:null};const u={min:s,max:i,avg:a,mode:r,count:o,median:l},c=M(t,n,a,!e.includeSkewnessKurtosis);c&&(u.stddev=c.stddev,e.includeSkewnessKurtosis&&(u.skewness=c.skewness,u.kurtosis=c.kurtosis));const m=e?.histogramSize??256,f=!!e?.pixelType&&["u8","s8","u4","u2","u1"].includes(e.pixelType),g=!e?.skipHistograms;if(null==l){const e=h({band:t,mask:n,min:s,max:i,size:1e4,use8BitHistogram:f});if(l=x(t,n,e,50),g&&f&&256===m)return{statistics:u,histogram:e}}if(!g)return{statistics:u,histogram:null};return{statistics:u,histogram:h({band:t,mask:n,min:s,max:i,size:m,use8BitHistogram:f&&256===m})}}function h(t){const{band:n,mask:e,min:s,max:i,use8BitHistogram:o}=t;if(o){const t=i-s+1,o=new Uint32Array(t);for(let i=0;i<n.length;i++)e&&!e[i]||o[n[i]-s]++;return{min:s-.5,max:i+.5,size:t,counts:o}}const a=t.size??256,r=new Uint32Array(a),l=(i-s)/a;if(0===l){const t=e?e.reduce((t,n)=>t+(n?1:0),0):n.length;return{min:s,max:i,size:1,counts:new Uint32Array(1).fill(t)}}const u=new Uint32Array(a+1),c=1/l;for(let m=0;m<n.length;m++)e&&!e[m]||u[Math.floor((n[m]-s)*c)]++;for(let m=0;m<a-1;m++)r[m]=u[m];return r[a-1]=u[a-1]+u[a],{min:s,max:i,size:a,counts:r}}function d(t,n,e=!1,s=!1){let i=1/0,o=-1/0,a=0,r=0,l=0,u=0;const c=t.length,m=new Map;for(let p=0;p<c;p++){const e=t[p];if(!n||n[p]){const t=(m.get(e)??0)+1;m.set(e,t),t>u&&(u=t,l=e),i=e<i?e:i,o=e>o?e:o,a+=e,r++}}const f=r>0?a/r:0;let h=i===o?i:void 0,d=i===o?i:void 0,g=i===o?i:void 0;if(e&&r>0&&r<2**24){let e=t.slice();if(n){let s=0;for(let i=0;i<c;i++){const o=t[i];n[i]&&(e[s++]=o)}}e=e.slice(0,r),e.sort((t,n)=>t-n);const i=r>>>1;h=r%2?e[Math.floor(i)]:(e[i-1]+e[i])/2,s&&(d=e[Math.floor(.25*r)],g=e[Math.floor(.75*r)])}return{min:i,max:o,count:r,avg:f,mode:l,median:h,quartile1:d,quartile3:g}}function g(t,n,e){let{min:s,max:i,avg:o,median:a,quartile1:r,quartile3:l}=d(t,n,!0,!0);if(null==a||null==r||null==l){const o=h({band:t,mask:n,min:s,max:i,size:1e4,use8BitHistogram:["u8","s8","u4","u2","u1"].includes(e)});a=x(t,n,o,50),r=x(t,n,o,25),l=x(t,n,o,75)}return{min:s,max:i,avg:o,median:a,quartile1:r,quartile3:l}}function p(t){const{pixels:n,mask:e,bandMasks:s,pixelType:i}=t;return n.map((t,n)=>g(t,s?.[n]??e,i))}function x(t,n,e,s=50){const{counts:i,min:o,max:a,size:r}=e,l=i.reduce((t,n)=>t+n)*(s/=100);let u=0,c=0;for(;c<i.length&&(u+=i[c],!(u>=l+1));c++);const m=(a-o)/r,f=o+m*c,h=o+m*(c+1);if(1===m&&.5===Math.abs(o%1))return f+.5;const d=t.slice(0,i[c]).fill(0);for(let p=0,x=0;p<t.length;p++)if(!n||n[p]){const n=t[p];n>=f&&n<h&&(d[x++]=n)}d.sort((t,n)=>t-n);const g=u-Math.floor(l)-1;return d[Math.max(0,d.length-1-g)]}function M(t,n,e,s=!1,i=!1){let o=0,a=0,r=0,l=0;for(let c=0;c<t.length;c++)if(!n||n[c]){const n=t[c]-e,i=n*n;if(o+=i,!s){const t=i*n;a+=t;r+=t*n}l++}if(l<2)return null;o/=l-1;const u=Math.sqrt(o);if(s)return{stddev:u};r/=l;return{stddev:u,skewness:i?a*(l/((l-1)*(l-2)))/o**1.5:a/l/o**1.5,kurtosis:r/(o*o)}}function k(t,n){const{pixels:e,mask:s,pixelType:i,bandMasks:o}=t,a=e.map((t,e)=>f(t,o?.[e]??s,{pixelType:i,...n}));return{statistics:a.map(({statistics:t})=>t),histograms:a.map(({histogram:t})=>t)}}function y(t){if(!t?.pixels?.length)return null;const{pixels:n,mask:e,bandMasks:s,pixelType:i}=t,o=t.width*t.height,a=n.length,r=[],l=[],u=256;let c,m;for(let f=0;f<a;f++){let a=new Uint32Array(u);const h=n[f],d=s?.[f]??e;if("u8"===i){if(c=255,m=0,d){for(let t=0;t<o;t++)if(d[t]){const n=h[t];c=n<c?n:c,m=n>m?n:m,a[n]++}}else for(let t=0;t<o;t++){const n=h[t];c=n<c?n:c,m=n>m?n:m,a[n]++}a=a.slice(c,m+1)}else{let n=!1;t.statistics||(t.updateStatistics(),n=!0);const e=t.statistics;c=e[f].minValue,m=e[f].maxValue;const s=(m-c)/u;if(0===s){!e||t.validPixelCount||n||t.updateStatistics();const s=(t.validPixelCount||t.width*t.height)/u;for(let t=0;t<u;t++)a[t]=Math.round(s*(t+1))-Math.round(s*t)}else{const t=new Uint32Array(u+1);for(let n=0;n<o;n++)d&&!d[n]||t[Math.floor((h[n]-c)/s)]++;for(let n=0;n<u-1;n++)a[n]=t[n];a[u-1]=t[u-1]+t[u]}}const g="u8"===i?c-.5:c,p="u8"===i?m+.5:m;r.push({min:g,max:p,size:a.length,counts:a});let x=0,M=0,k=0;for(let t=0;t<a.length;t++)x+=a[t],M+=t*a[t];const y=M/x;for(let t=0;t<a.length;t++)k+=a[t]*(t-y)**2;const v=Math.sqrt(k/(x-1)),b=(p-g)/a.length,O=(y+("u8"===i?0:.5))*b+c,w=v*b;l.push({min:c,max:m,avg:O,stddev:w})}return{statistics:l,histograms:r}}function v(t){const n=[];for(let e=0;e<t.length;e++){const{min:s,max:i,size:o,counts:a}=t[e];let r=0,l=0;for(let t=0;t<o;t++)r+=a[t],l+=t*a[t];const u=l/r;let c=0;for(let t=0;t<o;t++)c+=a[t]*(t-u)**2;const m=(i-s)/o,f=(u+.5)*m+s,h=Math.sqrt(c/(r-1))*m;n.push({min:s,max:i,avg:f,stddev:h})}return n}function b(n,i){const{pixelBlock:o,bandIds:a,returnHistogramLut:l,rasterInfo:u}=i;let c=null,m=null,f=n.stretchType;if("number"==typeof f&&(f=s[f]),n.dra)if("minMax"===f&&o?.statistics)c=o.statistics.map(t=>[t.minValue,t.maxValue,0,0]);else{const t=y(o);c=null!=t?t.statistics:null,m=null!=t?t.histograms:null}else c=n.statistics?.length?n.statistics:u.statistics,m="histograms"in n?n.histograms:void 0,m||(m=u.histograms);"percentClip"!==f&&"histogramEqualization"!==f||m?.length||(f="minMax");const h=c?.length||m?.length||u.bandCount,d=[],g=[];c&&!Array.isArray(c[0])&&(c=c.map(t=>[t.min,t.max,t.avg,t.stddev]));const[p,x]=e(u.pixelType);if(!c?.length){c=[];for(let t=0;t<h;t++)c.push([p,x,1,1]);"standardDeviation"===f&&(f="minMax")}switch(f){case"none":for(let t=0;t<h;t++)d[t]=p,g[t]=x;break;case"minMax":for(let t=0;t<h;t++){const n=c[t];d[t]=n[0],g[t]=n[1]}break;case"standardDeviation":{const{numberOfStandardDeviations:t=2}=n;for(let n=0;n<h;n++){const e=c[n];d[n]=e[2]-t*e[3],g[n]=e[2]+t*e[3],d[n]<e[0]&&(d[n]=e[0]),g[n]>e[1]&&(g[n]=e[1])}}break;case"histogramEqualization":t(m);for(let t=0;t<h;t++)d[t]=m[t].min,g[t]=m[t].max;break;case"percentClip":t(m);for(let t=0;t<m.length;t++){const e=m[t],s=new Uint32Array(e.size),i=[...e.counts];i.length>=20&&(i[0]=i[1]=i[2]=i[i.length-1]=i[i.length-2]=0);let o=0;const a=(e.max-e.min)/e.size,r=-.5===e.min&&1===a?.5:0;for(let t=0;t<e.size;t++)o+=i[t],s[t]=o;let l=(n.minPercent||0)*o/100;d[t]=e.min+r;for(let n=0;n<e.size;n++)if(s[n]>l){d[t]=e.min+a*(n+r);break}l=(1-(n.maxPercent||0)/100)*o,g[t]=e.max+r;for(let n=e.size-2;n>=0;n--)if(s[n]<l){g[t]=e.min+a*(n+2-r);break}if(g[t]<d[t]){const n=d[t];d[t]=g[t],g[t]=n}}break;default:for(let t=0;t<h;t++){const n=c[t];d[t]=n[0],g[t]=n[1]}}let M,k,v;"histogramEqualization"===f?(t(m),k=m[0].size||256,M=0,l&&(v=m.map(t=>r(t)))):(k=n.max||255,M=n.min||0);return O({minCutOff:d,maxCutOff:g,maxOutput:k,minOutput:M,histogramLut:v},a)}function O(t,n){if(null==n||0===n.length)return t;const e=Math.max.apply(null,n),{minCutOff:s,maxCutOff:i,minOutput:o,maxOutput:a,histogramLut:r}=t;return s.length===n.length||s.length<=e?t:{minCutOff:n.map(t=>s[t]),maxCutOff:n.map(t=>i[t]),histogramLut:r?n.map(t=>r[t]):null,minOutput:o,maxOutput:a}}function w(t,n){const e=new Float32Array(t);for(let s=0;s<t;s++)n[s]>1?n[s]>2?e[s]=6.5+(n[s]-2)**2.5:e[s]=6.5+100*(2-n[s])**4:e[s]=1;return e}function z(t,e){if(!t?.pixels?.length)return t;const{mask:s,bandMasks:i,width:o,height:a,pixels:r}=t,{minCutOff:l,maxCutOff:u,minOutput:c,maxOutput:m,gamma:f}=e,h=o*a,d=e.outputPixelType||"u8",g=t.pixels.map(()=>n.createEmptyBand(d,h)),p=g.length,x=m-c,M=[],k=[];for(let n=0;n<p;n++)k[n]=u[n]-l[n],M[n]=0===k[n]?0:x/k[n];const y=d.startsWith("u")||d.startsWith("s"),v=f&&f.length>=p,b=!!e.isRenderer;if(v){const t=w(p,f);for(let n=0;n<p;n++){const e=i?.[n]??s;for(let s=0;s<h;s++)if(null==e||e[s]){if(0===k[n]){g[n][s]=c;continue}const e=r[n][s],i=(e-l[n])/k[n];let o=1;if(f[n]>1&&(o-=(1/x)**(i*t[n])),e<u[n]&&e>l[n]){const t=o*x*i**(1/f[n])+c;g[n][s]=b?Math.floor(t):y?Math.round(t):t}else e>=u[n]?g[n][s]=m:g[n][s]=c}}}else for(let n=0;n<p;n++){const t=i?.[n]??s;for(let e=0;e<h;e++)if(null==t||t[e]){const t=r[n][e];if(t<u[n]&&t>l[n]){const s=(t-l[n])*M[n]+c;g[n][e]=b?Math.floor(s):y?Math.round(s):s}else t>=u[n]?g[n][e]=m:g[n][e]=c}}const O=new n({width:o,height:a,mask:s,bandMasks:i,pixels:g,pixelType:d});return O.updateStatistics(),O}export{p as computeBoxStatistics,w as computeGammaCorrection,c as computeGammaValues,k as computeStatisticsHistograms,u as createContrastBrightnessLUT,r as createHistogramEqualizationLUT,l as createStretchLUT,v as estimateStatisticsFromHistograms,y as estimateStatisticsHistograms,b as getStretchCutoff,a as isStandardU8Histogram,z as stretch};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import t from"../PixelBlock.js";import{SimpleBandStatistics as e}from"../SimpleBandStatistics.js";import{isValidPixelBlock as i}from"./pixelUtils.js";const s=1,n=1/111e3;function a(t){let{altitude:e,azimuth:i}=t;const{hillshadeType:s,pixelSizePower:a=1,pixelSizeFactor:o=1,scalingType:l,isGCS:r,resolution:c}=t,h="multi-directional"===s?2*t.zFactor:t.zFactor,{x:u,y:f}=c;let d=h/(8*u),p=h/(8*f);if(r&&h>.001&&(d/=n,p/=n),"adjusted"===l)if(r){const t=u*n,e=f*n;d=(h+t**a*o)/(8*t),p=(h+e**a*o)/(8*e)}else d=(h+u**a*o)/(8*u),p=(h+f**a*o)/(8*f);let x=(90-e)*Math.PI/180,w=Math.cos(x),y=(360-i+90)*Math.PI/180,m=Math.sin(x)*Math.cos(y),M=Math.sin(x)*Math.sin(y);const z=[315,270,225,360,180,0],A=[60,60,60,60,60,90],g=new Float32Array([3,5,3,2,1,4]),F=g.reduce((t,e)=>t+e),k=g.map(t=>t/F),P="multi-directional"===s?z.length:1,S=new Float32Array(6),C=new Float32Array(6),T=new Float32Array(6);if("multi-directional"===s)for(let n=0;n<P;n++)e=A[n],i=z[n],x=(90-e)*Math.PI/180,w=Math.cos(x),y=(360-i+90)*Math.PI/180,m=Math.sin(x)*Math.cos(y),M=Math.sin(x)*Math.sin(y),S[n]=w,C[n]=m,T[n]=M;else S.fill(w),C.fill(m),T.fill(M);return{resolution:c,factor:[d,p],sinZcosA:m,sinZsinA:M,cosZ:w,sinZcosAs:[...C],sinZsinAs:[...T],cosZs:[...S],weights:[...k],hillshadeType:["traditional","multi-directional"].indexOf(s)}}function o(t,e){const{width:i,height:n}=t,a=i*n,o=new Uint8Array(a),l=null!=t.mask;let r;if(l){r=new Uint8Array(t.mask);for(let t=0;t<r.length;t++)r[t]&&(o[t]=1,r[t]=1)}const c=t.pixels[0],h=new Float32Array(a),u=new Float32Array(a);let f,d=0;if(e){const{resolution:t}=e,i=t?(t.x+t.y)/2:1;d=200*e.zFactor/(i*i),f=new Float32Array(a)}const p=e?.curvatureType;let x,w,y,m,M,z,A,g;for(let F=s;F<n-s;F++){const t=F*i;for(let e=s;e<i-s;e++){const s=t+e;if(0!==r?.[s]){if(r){if(r[s-i-1]+r[s-i]+r[s-i+1]+r[s-1]+r[s+1]+r[s+i-1]+r[s+i]+r[s+i+1]<7){o[s]=0;continue}x=r[s-i-1]?c[s-i-1]:c[s],w=r[s-i]?c[s-i]:c[s],y=r[s-i+1]?c[s-i+1]:c[s],m=r[s-1]?c[s-1]:c[s],M=r[s+1]?c[s+1]:c[s],z=r[s+i-1]?c[s+i-1]:c[s],A=r[s+i]?c[s+i]:c[s],g=r[s+i+1]?c[s+i+1]:c[s]}else x=c[s-i-1],w=c[s-i],y=c[s-i+1],m=c[s-1],M=c[s+1],z=c[s+i-1],A=c[s+i],g=c[s+i+1];if(h[s]=y+M+M+g-(x+m+m+z),u[s]=z+A+A+g-(x+w+w+y),null!=f){const t=c[s],e=.5*(m+M)-t,i=.5*(w+A)-t;if("standard"===p)f[s]=-d*(e+i);else{const t=(-x+y+z-g)/4,n=(-m+M)/2,a=(w-A)/2,o=n*n,l=a*a,r=o+l;r&&(f[s]="profile"===p?d*(e*o+i*l+t*n*a)/r:-d*(e*l+i*o-t*n*a)/r)}}}}}return{outMask:l?o:null,dzxs:h,dzys:u,curvatures:f}}function l(t,e,i){for(let s=0;s<i;s++)t[s*e]=t[s*e+1],t[(s+1)*e-1]=t[(s+1)*e-2];for(let s=1;s<e-1;s++)t[s]=t[s+e],t[s+(i-1)*e]=t[s+(i-2)*e]}function r(n,r){if(!i(n))return n;const{factor:c,sinZcosA:h,sinZsinA:u,cosZ:f,sinZcosAs:d,sinZsinAs:p,cosZs:x,weights:w}=a(r),[y,m]=c,M="traditional"===r.hillshadeType,{width:z,height:A}=n,g=new Uint8Array(z*A),{dzxs:F,dzys:k,outMask:P}=o(n);for(let t=s;t<A-s;t++){const e=t*z;for(let t=s;t<z-s;t++){const i=e+t;if(!P||P[i]){const t=F[i]*y,e=k[i]*m,s=Math.sqrt(1+t*t+e*e);let n=0;if(M){let i=255*(f+u*e-h*t)/s;i<0&&(i=0),n=i}else{const i=p.length;for(let a=0;a<i;a++){let i=255*(x[a]+p[a]*e-d[a]*t)/s;i<0&&(i=0),n+=i*w[a]}}g[i]=255&n}}}l(g,z,A);return new t({width:z,height:A,pixels:[g],mask:P,pixelType:"u8",validPixelCount:n.validPixelCount,statistics:[new e(0,255)]})}function c(t,e,s,n){if(!i(t)||!i(e))return;const{min:a,max:o}=n,l=t.pixels[0],{pixels:r,mask:c}=e,h=r[0],u=255.00001/(o-a),f=new Uint8ClampedArray(h.length),d=new Uint8ClampedArray(h.length),p=new Uint8ClampedArray(h.length),x=s.length-1;for(let i=0;i<h.length;i++){if(0===c?.[i])continue;const t=Math.floor((h[i]-a)*u),[e,n]=s[t<0?0:t>x?x:t],o=l[i],r=o*n,w=r*(1-Math.abs(e%2-1)),y=o-r;switch(Math.floor(e)){case 0:f[i]=r+y,d[i]=w+y,p[i]=y;break;case 1:f[i]=w+y,d[i]=r+y,p[i]=y;break;case 2:f[i]=y,d[i]=r+y,p[i]=w+y;break;case 3:f[i]=y,d[i]=w+y,p[i]=r+y;break;case 4:f[i]=w+y,d[i]=y,p[i]=r+y;break;case 5:case 6:f[i]=r+y,d[i]=y,p[i]=w+y}}t.pixels=[f,d,p],t.updateStatistics()}function h(e,a){if(!i(e))return e;const r=a.zFactor,c=a.pixelSizePower??1,h=a.pixelSizeFactor??1,u=a.slopeType,f=a.isGCS,{x:d,y:p}=a.resolution;let x=r/(8*d),w=r/(8*p);f&&Math.abs(r-1)<1e-4&&(x/=n,w/=n),"adjusted"===u&&(x=(r+d**c*h)/(8*d),w=(r+p**c*h)/(8*p));const{dzxs:y,dzys:m,outMask:M}=o(e),{width:z,height:A}=e,g=new Float32Array(z*A);for(let t=s;t<A-s;t++){const e=t*z;for(let t=s;t<z-s;t++){const i=e+t;if(!M||M[i]){const s=y[i]*x,n=m[i]*w,a=Math.sqrt(s*s+n*n);g[e+t]="percent-rise"===u?100*a:57.2957795*Math.atan(a)}}}l(g,z,A);const F=new t({width:z,height:A,pixels:[g],mask:M,pixelType:"f32",validPixelCount:e.validPixelCount});return F.updateStatistics(),F}function u(n,a={}){if(!i(n))return n;const{resolution:r}=a,c=r?1/r.x:1,h=r?1/r.y:1,{dzxs:u,dzys:f,outMask:d}=o(n),{width:p,height:x}=n,w=new Float32Array(p*x);for(let t=s;t<x-s;t++){const e=t*p;for(let t=s;t<p-s;t++){const i=e+t;if(!d||d[i]){const s=u[i]*c,n=f[i]*h;let a=-1;0===s&&0===n||(a=90-57.29578*Math.atan2(n,-s),a<0&&(a+=360),360===a?a=0:a>360&&(a%=360)),w[e+t]=a}}}l(w,p,x);return new t({width:p,height:x,pixels:[w],mask:d,pixelType:"f32",validPixelCount:n.validPixelCount,statistics:[new e(-1,360)]})}function f(e,s){if(!i(e))return e;const{curvatures:n,outMask:a}=o(e,s),{width:r,height:c}=e;l(n,r,c);const h=new t({width:r,height:c,pixels:[n],mask:a,pixelType:"f32",validPixelCount:e.validPixelCount});return h.updateStatistics(),h}function d(t,e,i){const{hillshadeType:s,altitude:n,azimuth:a,zFactor:o,pixelSizeFactor:l,pixelSizePower:r,slopeType:c}=t;return{hillshadeType:s,altitude:n,azimuth:a,zFactor:o,pixelSizePower:r,pixelSizeFactor:l,scalingType:"scaled"===c?"adjusted":"none",resolution:e,isGCS:i}}export{u as aspect,a as calculateHillshadeParams,f as curvature,n as gcsFactor,d as getHillshadeOptions,r as hillshade,h as slope,c as tintHillshade};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{JSONMap as t}from"../../../core/jsonMap.js";import e from"../PixelBlock.js";import{isValidPixelBlock as n}from"./pixelUtils.js";const r=new Map;r.set("meter-per-second",1),r.set("kilometer-per-hour",.277778),r.set("knots",.514444),r.set("feet-per-second",.3048),r.set("mile-per-hour",.44704);const o=180/Math.PI,i=5,s=new t({esriMetersPerSecond:"meter-per-second",esriKilometersPerHour:"kilometer-per-hour",esriKnots:"knots",esriFeetPerSecond:"feet-per-second",esriMilesPerHour:"mile-per-hour"});function a(t,e){return r.get(t)/r.get(e)||1}function h(t){return(450-t)%360}function l(t,e="geographic"){const[n,r]=t,i=Math.sqrt(n*n+r*r);let s=Math.atan2(r,n)*o;return s=(360+s)%360,"geographic"===e&&(s=h(s)),[i,s]}function c(t,e="geographic"){let n=t[1];"geographic"===e&&(n=h(n)),n%=360;const r=t[0];return[r*Math.cos(n/o),r*Math.sin(n/o)]}function u(t,e,r,o="geographic"){if(!n(t)||null==r)return t;const i="vector-magdir"===e?t.clone():f(t,e),s=i.pixels[1];for(let n=0;n<s.length;n++)s[n]="geographic"===o?(s[n]+r[n]+270)%360:(s[n]+360-r[n])%360;return"vector-magdir"===e?i:f(i,"vector-magdir")}function f(t,r,o="geographic",i=1){if(!n(t))return t;const{pixels:s,width:a,height:h}=t,u=a*h,f=s[0],p=s[1],m=t.pixelType.startsWith("f")?t.pixelType:"f32",d=e.createEmptyBand(m,u),g=e.createEmptyBand(m,u);let x=0;for(let e=0;e<h;e++)for(let t=0;t<a;t++)"vector-uv"===r?([d[x],g[x]]=l([f[x],p[x]],o),d[x]*=i):([d[x],g[x]]=c([f[x],p[x]],o),d[x]*=i,g[x]*=i),x++;const M=new e({pixelType:m,width:t.width,height:t.height,mask:t.mask,validPixelCount:t.validPixelCount,maskIsAlpha:t.maskIsAlpha,pixels:[d,g]});return M.updateStatistics(),M}function p(t,e,r=1){if(1===r||!n(t))return t;const o=t.clone(),{pixels:i,width:s,height:a}=o,h=i[0],l=i[1];let c=0;for(let n=0;n<a;n++)for(let t=0;t<s;t++)"vector-uv"===e?(h[c]*=r,l[c]*=r):h[c]*=r,c++;return o.updateStatistics(),o}function m(t,e,n,r,o){if(null==o||!o.spatialReference.equals(t.spatialReference))return{extent:t,width:Math.round(e/r),height:Math.round(n/r),resolution:t.width/e};const i=o.xmin,s=o.ymax,a=(t.xmax-t.xmin)/e*r,h=(t.ymax-t.ymin)/n*r,l=(a+h)/2;return t.xmin=i+Math.floor((t.xmin-i)/a)*a,t.xmax=i+Math.ceil((t.xmax-i)/a)*a,t.ymin=s+Math.floor((t.ymin-s)/h)*h,t.ymax=s+Math.ceil((t.ymax-s)/h)*h,{extent:t,width:Math.round(t.width/a),height:Math.round(t.height/h),resolution:l}}const d=g(0,0,0);function g(t=0,e=0,n=Math.PI,r=!0){r&&(n=(2*Math.PI-n)%(2*Math.PI));const o=r?-1:1,i=13*o,s=-7*o,a=-2*o,h=-16*o,l=21.75,[c,u]=M(0,e+i,n,l),[f,p]=M(t-5.5,e+s,n,l),[m,d]=M(t+5.5,e+s,n,l),[g,x]=M(t-1.5,e+a,n,l),[k,w]=M(t+1.5,e+a,n,l),[y,P]=M(t-1.5,e+h,n,l),[b,v]=M(t+1.5,e+h,n,l);return[c,u,f,p,g,x,k,w,m,d,y,P,b,v]}function x(t=0,e=Math.PI,n=!0){n&&(e=(2*Math.PI-e)%(2*Math.PI));const r=10,o=n?-1:1,s=5*o,a=20*o,h=25*o,l=45,c=0,u=0,f=2,p=0,m=f*o,d=n?1:-1,g=r/2*d;let[x,k]=[c+g,u-a],[w,y]=[x+f*d,k],[P,b]=[w-p*d,y+m],[v,I]=[c-g,u-h],[A,_]=[v+p*d,I-m],U=Math.ceil(t/i),S=Math.floor(U/10);U-=8*S;const D=[],F=[];for(let i=0;i<U/2;i++,S--){S<=0&&U%2==1&&i===(U-1)/2&&(v=c,A=v+p*d,I=(I+k)/2,_=I-m);const[t,n]=M(v,I,e,l);if(S>0){const[r,o]=M(w,I,e,l),[i,s]=M(x,k,e,l);D.push(r),D.push(o),D.push(t),D.push(n),D.push(i),D.push(s)}else{const[r,o]=M(w,y,e,l),[i,s]=M(P,b,e,l),[a,h]=M(A,_,e,l);F.push(t),F.push(n),F.push(a),F.push(h),F.push(i),F.push(s),F.push(r),F.push(o)}I+=s,k+=s,y+=s,b+=s,_+=s}const[N,j]=M(c+g,u+a,e,l),J=(r/2+f)*d,[O,q]=M(c+J,u+a,e,l),[B,E]=M(c+g,u-h,e,l),[T,C]=M(c+J,u-h,e,l);return{pennants:D,barbs:F,shaft:[N,j,O,q,B,E,T,C]}}function M(t,e,n,r=1){const o=Math.sqrt(t*t+e*e)/r,i=(2*Math.PI+Math.atan2(e,t))%(2*Math.PI);return[o,(2*Math.PI+i-n)%(2*Math.PI)]}const k=[0,1,3,6,10,16,21,27,33,40,47,55,63],w=[0,.5,1,1.5,2],y=[0,.25,.5,1,1.5,2,2.5,3,3.5,4];function P(t,e,n,r){const o=a(r||"knots",n);let i;for(i=1;i<e.length;i++)if(i===e.length-1){if(t<e[i]*o)break}else if(t<=e[i]*o)break;return Math.min(i-1,e.length-2)}function b(t,e,n,r,o){let i=0;switch(e){case"beaufort_kn":i=P(t,k,"knots",n);break;case"beaufort_km":i=P(t,k,"kilometer-per-hour",n);break;case"beaufort_ft":i=P(t,k,"feet-per-second",n);break;case"beaufort_m":i=P(t,k,"meter-per-second",n);break;case"classified_arrow":i=P(t,o??[],r,n);break;case"ocean_current_m":i=P(t,w,"meter-per-second",n);break;case"ocean_current_kn":i=P(t,y,"knots",n)}return i}function v(t,e){const{style:n,inputUnit:r,outputUnit:o,breakValues:i}=e,a=s.fromJSON(r),h=s.fromJSON(o),l=7*6,c=15;let u=0,f=0;const{width:p,height:m,mask:x}=t,M=t.pixels[0],k=t.pixels[1],w=null!=x?x.filter(t=>t>0).length:p*m,y=new Float32Array(w*l),P=new Uint32Array(c*w),v=e.invertDirection?g(0,0,0,!1):d;for(let s=0;s<m;s++)for(let t=0;t<p;t++){const e=s*p+t;if(!x||x[s*p+t]){const r=(k[e]+360)%360/180*Math.PI,o=b(M[e],n,a,h,i);for(let n=0;n<v.length;n+=2)y[u++]=(t+.5)/p,y[u++]=(s+.5)/m,y[u++]=v[n],y[u++]=v[n+1]+r,y[u++]=o,y[u++]=M[e];const c=7*(u/l-1);P[f++]=c,P[f++]=c+1,P[f++]=c+2,P[f++]=c+0,P[f++]=c+4,P[f++]=c+3,P[f++]=c+0,P[f++]=c+2,P[f++]=c+3,P[f++]=c+2,P[f++]=c+5,P[f++]=c+3,P[f++]=c+5,P[f++]=c+6,P[f++]=c+3}}return{vertexData:y,indexData:P}}const I=[];function A(t,e){if(0===I.length)for(let i=0;i<30;i++)I.push(x(5*i,0,!e.invertDirection));const n=a(s.fromJSON(e.inputUnit),"knots"),{width:r,height:o,mask:h}=t,l=t.pixels[0],c=t.pixels[1],u=6,f=[],p=[];let m=0,d=0;for(let s=0;s<o;s++)for(let t=0;t<r;t++){const e=s*r+t,a=l[e]*n;if((!h||h[s*r+t])&&a>=i){const n=(c[e]+360)%360/180*Math.PI,{pennants:i,barbs:h,shaft:l}=I[Math.min(Math.floor(a/5),29)];if(i.length+h.length===0)continue;let g=f.length/u;const x=(t+.5)/r,M=(s+.5)/o;for(let t=0;t<i.length;t+=2)f[m++]=x,f[m++]=M,f[m++]=i[t],f[m++]=i[t+1]+n,f[m++]=0,f[m++]=a;for(let t=0;t<h.length;t+=2)f[m++]=x,f[m++]=M,f[m++]=h[t],f[m++]=h[t+1]+n,f[m++]=0,f[m++]=a;for(let t=0;t<l.length;t+=2)f[m++]=x,f[m++]=M,f[m++]=l[t],f[m++]=l[t+1]+n,f[m++]=0,f[m++]=a;for(let t=0;t<i.length/6;t++)p[d++]=g,p[d++]=g+1,p[d++]=g+2,g+=3;for(let t=0;t<h.length/8;t++)p[d++]=g,p[d++]=g+1,p[d++]=g+2,p[d++]=g+1,p[d++]=g+2,p[d++]=g+3,g+=4;p[d++]=g+0,p[d++]=g+1,p[d++]=g+2,p[d++]=g+1,p[d++]=g+3,p[d++]=g+2,g+=4}}return{vertexData:new Float32Array(f),indexData:new Uint32Array(p)}}function _(t,e){const n=4*6;let r=0,o=0;const{width:h,height:l,mask:c}=t,u=t.pixels[0],f=[],p=[],m=a(s.fromJSON(e.inputUnit),"knots"),d="wind_speed"===e.style?i:Number.MAX_VALUE;for(let i=0;i<l;i++)for(let t=0;t<h;t++){const e=u[i*h+t]*m;if((!c||c[i*h+t])&&e<d){for(let n=0;n<4;n++)f[r++]=(t+.5)/h,f[r++]=(i+.5)/l,f[r++]=n<2?-.5:.5,f[r++]=n%2==0?-.5:.5,f[r++]=0,f[r++]=e;const s=4*(r/n-1);p[o++]=s,p[o++]=s+1,p[o++]=s+2,p[o++]=s+1,p[o++]=s+2,p[o++]=s+3}}return{vertexData:new Float32Array(f),indexData:new Uint32Array(p)}}function U(t,e){return"simple_scalar"===e.style?_(t,e):"wind_speed"===e.style?A(t,e):v(t,e)}function S(t,n,r,o=[0,0],i=.5){const{width:s,height:a,mask:h}=t,[u,f]=t.pixels,[p,m]=o,d=Math.round((s-p)/r),g=Math.round((a-m)/r),x=d*g,M=new Float32Array(x),k=new Float32Array(x),w=new Uint8Array(x),y="vector-uv"===n;for(let e=0;e<g;e++)for(let t=0;t<d;t++){let n=0;const o=e*d+t,g=Math.max(0,e*r+m),x=Math.max(0,t*r+p),P=Math.min(a,g+r),b=Math.min(s,x+r);for(let t=g;t<P;t++)for(let e=x;e<b;e++){const r=t*s+e;if(!h||h[r]){n++;const t=y?[u[r],f[r]]:[u[r],(360+f[r])%360],[e,i]=y?t:c(t);M[o]+=e,k[o]+=i}}if(n>=(P-g)*(b-x)*(1-i)){w[o]=1;const[t,e]=l([M[o]/n,k[o]/n]);M[o]=t,k[o]=e}else w[o]=0,M[o]=0,k[o]=0}const P=new e({width:d,height:g,pixels:[M,k],mask:w});return P.updateStatistics(),P}export{u as convertToLocalDirections,f as convertVectorFieldData,p as convertVectorFieldUnit,U as createVFMesh,_ as createVFMeshScalar,a as getUnitConversionFactor,S as sampleVectorField,m as snapImageToSymbolTile,s as unitKebabDict,l as uvComponentToVector};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{__decorate as r}from"tslib";import{JSONSupport as e}from"../../../core/JSONSupport.js";import{property as o,subclass as s}from"../../../core/accessorSupport/decorators.js";let t=class extends e{get affectsPixelSize(){return!1}forwardTransform(r){return r}inverseTransform(r){return r}};r([o()],t.prototype,"affectsPixelSize",null),r([o({json:{write:!0}})],t.prototype,"spatialReference",void 0),t=r([s("esri.layers.support.rasterTransforms.BaseRasterTransform")],t);export{t as default};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/layers/{support/rasterFunctions → raster/functions}/creators/createAppearenceFunctions.js
RENAMED
|
File without changes
|
/package/layers/{support/rasterFunctions → raster/functions}/creators/createBandIndexFunctions.js
RENAMED
|
File without changes
|
/package/layers/{support/rasterFunctions → raster/functions}/creators/createChangeFunctions.js
RENAMED
|
File without changes
|
/package/layers/{support/rasterFunctions → raster/functions}/creators/createConversionFunctions.js
RENAMED
|
File without changes
|
/package/layers/{support/rasterFunctions → raster/functions}/creators/createLocalFunctions.js
RENAMED
|
File without changes
|
|
File without changes
|
/package/layers/{support/rasterFunctions → raster/functions}/creators/createStatisticsFunctions.js
RENAMED
|
File without changes
|
/package/layers/{support/rasterFunctions → raster/functions}/creators/createSurfaceFunctions.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|