@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 2.11 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import{_ as t}from"../../../chunks/tslib.es6.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.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 c=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"}})],c.prototype,"functionName",void 0),t([s({type:n,json:{write:!0,name:"rasterFunctionArguments"}})],c.prototype,"functionArguments",void 0),t([s()],c.prototype,"rasterArgumentNames",void 0),c=t([e("esri.layers.support.rasterFunctions.StatisticsFunction")],c);const p=c;export{p as default};