@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.96 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
*/
import{_ as t}from"../../../chunks/tslib.es6.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{getPixelValueRange as s,isIntegerPixelType as o}from"../rasterFormats/pixelRangeUtils.js";import i from"./ArithmeticFunctionArguments.js";import n from"./BaseRasterFunction.js";import{arithmetic as u}from"./localUtils.js";let p=class extends n{constructor(){super(...arguments),this.functionName="Arithmetic",this.functionArguments=null,this.rasterArgumentNames=["raster","raster2"]}_bindSourceRasters(){const{operation:t}=this.functionArguments;if(t<1||t>6)return{success:!1,supportsGPU:!1,error:"unsupported operation"};const e=this.sourceRasterInfos[0].clone();this.outputPixelType=this._getOutputPixelType(e.pixelType),e.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(e),this.rasterInfo=e;return{success:!0,supportsGPU:e.bandCount<=3}}_processPixels(t){const{pixelBlocks:e}=t;return null==e?.[0]||null==e?.[1]?null:u(e,this.functionArguments.operation,this.outputPixelType)}_getWebGLParameters(){const{operation:t}=this.functionArguments,e=["","plus","minus","times","divide","power","mod"][t],r=this.outputPixelType??"f32";let[i,n]=s(r);const u=o(r);return u&&(i-=1e-4,n+=1e-4),{imageCount:2,operationName:e,domainRange:[i,n],isOutputRounded:u}}};t([e({json:{write:!0,name:"rasterFunction"}})],p.prototype,"functionName",void 0),t([e({type:i,json:{write:!0,name:"rasterFunctionArguments"}})],p.prototype,"functionArguments",void 0),t([e()],p.prototype,"rasterArgumentNames",void 0),p=t([r("esri.layers.support.rasterFunctions.ArithmeticFunction")],p);const a=p;export{a as default};