UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 2.33 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 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{isIntegerPixelType as r}from"../rasterFormats/pixelRangeUtils.js";import o from"./BaseRasterFunction.js";import i from"./HillshadeFunctionArguments.js";import{getHillshadeOptions as n,hillshade as u,calculateHillshadeParams as p,gcsFactor as a}from"./surfaceUtils.js";let c=class extends o{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 s=t.clone();return this._removeStatsHistColormapVAT(s),s.pixelType=this.outputPixelType,s.bandCount=1,s.statistics=[{min:0,max:255,avg:60,stddev:10}],this.rasterInfo=s,this.isGCS=s.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const s=t.pixelBlocks?.[0];if(!s)return null;const{extent:e,primaryPixelSizes:r}=t,o=r?.[0],i=o??(e?{x:e.width/s.width,y:e.height/s.height}:{x:1,y:1}),p=n(this.functionArguments,i,this.isGCS),a=u(s,p);return a.pixelType=this.outputPixelType,a}_getWebGLParameters(){const t=n(this.functionArguments,{x:1,y:1},this.isGCS),s=p(t),{slopeType:e,zFactor:o,pixelSizeFactor:i,pixelSizePower:u}=this.functionArguments,c="scaled"===e,l=r(this.outputPixelType);return{...s,zFactor:o,gcsFactor:this.isGCS?a:1,pixelSizeFactor:c?i:0,pixelSizePower:c?u:0,isOutputRounded:l}}};t([s({json:{write:!0,name:"rasterFunction"}})],c.prototype,"functionName",void 0),t([s({type:i,json:{write:!0,name:"rasterFunctionArguments"}})],c.prototype,"functionArguments",void 0),t([s()],c.prototype,"rasterArgumentNames",void 0),t([s({json:{write:!0}})],c.prototype,"isGCS",void 0),c=t([e("esri.layers.support.rasterFunctions.HillshadeFunction")],c);const l=c;export{l as default};