/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{__decorate as t}from"tslib";import{property as e,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 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:o,pixelSizeFactor:r}=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:o,pixelSizeFactor:r,isGCS:p,resolution:l})}_getWebGLParameters(){const{zFactor:t,slopeType:e,pixelSizeFactor:s,pixelSizePower:o}=this.functionArguments;return{zFactor:this.isGCS&&t>=1?t*p:t,slopeType:e,pixelSizeFactor:s??0,pixelSizePower:o??0,isOutputRounded:i(this.outputPixelType)}}};t([e({json:{write:!0,name:"rasterFunction"}})],u.prototype,"functionName",void 0),t([e({type:r,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.raster.functions.SlopeFunction")],u);const a=u;export{a as default};
