UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 2.21 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{_ as e}from"../../../chunks/tslib.es6.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{isIntegerPixelType as r}from"../rasterFormats/pixelRangeUtils.js";import o from"./BaseRasterFunction.js";import i from"./SlopeFunctionArguments.js";import{slope as p,gcsFactor as n}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:r,pixelSizePower:o,pixelSizeFactor:i}=this.functionArguments,{isGCS:n}=this,{extent:u,primaryPixelSizes:c}=e,a=c?.[0],l=a??(u?{x:u.width/t.width,y:u.height/t.height}:{x:1,y:1});return p(t,{zFactor:s,slopeType:r,pixelSizePower:o,pixelSizeFactor:i,isGCS:n,resolution:l})}_getWebGLParameters(){const{zFactor:e,slopeType:t,pixelSizeFactor:s,pixelSizePower:o}=this.functionArguments;return{zFactor:this.isGCS&&e>=1?e*n:e,slopeType:t,pixelSizeFactor:s??0,pixelSizePower:o??0,isOutputRounded:r(this.outputPixelType)}}};e([t({json:{write:!0,name:"rasterFunction"}})],u.prototype,"functionName",void 0),e([t({type:i,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.support.rasterFunctions.SlopeFunction")],u);const c=u;export{c as default};