/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{__decorate as e}from"tslib";import{property as t,subclass as s}from"../../../core/accessorSupport/decorators.js";import{isIntegerPixelType as i}from"../formats/pixelRangeUtils.js";import o from"./BaseRasterFunction.js";import r from"./SlopeFunctionArguments.js";import{slope as n,gcsFactor as p}from"./surfaceUtils.js";let u=class extends o{constructor(){super(...arguments),this.functionName="Slope",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const e=this.sourceRasterInfos[0].clone();return e.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(e),e.statistics="percent-rise"!==this.functionArguments.slopeType?[{min:0,max:90,avg:1,stddev:1}]:null,e.bandCount=1,this.rasterInfo=e,this.isGCS=e.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(e){const t=e.pixelBlocks?.[0];if(null==t)return null;const{zFactor:s,slopeType:i,pixelSizePower:o,pixelSizeFactor:r}=this.functionArguments,{isGCS:p}=this,{extent:u,primaryPixelSizes:a}=e,c=a?.[0],l=c??(u?{x:u.width/t.width,y:u.height/t.height}:{x:1,y:1});return n(t,{zFactor:s,slopeType:i,pixelSizePower:o,pixelSizeFactor:r,isGCS:p,resolution:l})}_getWebGLParameters(){const{zFactor:e,slopeType:t,pixelSizeFactor:s,pixelSizePower:o}=this.functionArguments;return{zFactor:this.isGCS&&e>=1?e*p:e,slopeType:t,pixelSizeFactor:s??0,pixelSizePower:o??0,isOutputRounded:i(this.outputPixelType)}}_getNeighborhoodSize(){return{rows:3,cols:3}}};e([t({json:{write:!0,name:"rasterFunction"}})],u.prototype,"functionName",void 0),e([t({type:r,json:{write:!0,name:"rasterFunctionArguments"}})],u.prototype,"functionArguments",void 0),e([t()],u.prototype,"rasterArgumentNames",void 0),e([t({json:{write:!0}})],u.prototype,"isGCS",void 0),u=e([s("esri.layers.raster.functions.SlopeFunction")],u);const a=u;export{a as default};
