@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 2.04 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/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 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.raster.functions.HillshadeFunction")],c);const l=c;export{l as default};