UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 2.43 kB
/* 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 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 r from"./BaseRasterFunction.js";import o from"./CompositeBandFunctionArguments.js";import{compositeBands as n}from"./pixelUtils.js";let i=class extends r{constructor(){super(...arguments),this.functionName="CompositeBand",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,s=t[0];this.outputPixelType=this._getOutputPixelType(s.pixelType);const e=s.clone();if(e.attributeTable=null,e.colormap=null,e.pixelType=this.outputPixelType,e.bandCount=t.map((({bandCount:t})=>t)).reduce(((t,s)=>t+s)),t.every((({statistics:t})=>null!=t&&t.length))){const s=[];t.forEach((({statistics:t})=>null!=t&&s.push(...t))),e.statistics=s}if(t.every((({histograms:t})=>null!=t&&t.length))){const s=[];t.forEach((({histograms:t})=>null!=t&&s.push(...t))),e.histograms=s}e.multidimensionalInfo&&e.multidimensionalInfo.variables.forEach((s=>{const e=t.map((t=>t.multidimensionalInfo?.variables.find((({name:t})=>t===s.name)))),r=e.map((t=>t?.statistics?.length?t.statistics:null)),o=e.map((t=>t?.histograms?.length?t.histograms:null));s.statistics=r.every((t=>null!=t))?r.flat():null,s.histograms=o.every((t=>null!=t))?o.flat():null})),e.bandCount>1&&(e.colormap=null,e.attributeTable=null);const r=t.every((t=>t.keyProperties.BandProperties?.length))?t.flatMap((t=>t.keyProperties.BandProperties)):void 0;e.keyProperties={...e.keyProperties,BandProperties:r},this.rasterInfo=e;return{success:!0,supportsGPU:e.bandCount<=3}}_processPixels(t){const{pixelBlocks:s}=t;if(!s)return null;const e=s?.[0];return null==e?null:n(s)}_getWebGLParameters(){return{bandCount:this.rasterInfo.bandCount}}};t([s({json:{write:!0,name:"rasterFunction"}})],i.prototype,"functionName",void 0),t([s({type:o,json:{write:!0,name:"rasterFunctionArguments"}})],i.prototype,"functionArguments",void 0),t([s()],i.prototype,"rasterArgumentNames",void 0),i=t([e("esri.layers.support.rasterFunctions.CompositeBandFunction")],i);const a=i;export{a as default};