/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{__decorate as t}from"tslib";import{property as e,subclass as s}from"../../../core/accessorSupport/decorators.js";import r from"./BaseRasterFunction.js";import o from"./ClipFunctionArguments.js";import{clipRasterInfo as i}from"./clipUtils.js";import{projectExtent as n,projectPolygon as p}from"./rasterProjectionHelper.js";let c=class extends r{constructor(){super(...arguments),this.functionName="Clip",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone();this.outputPixelType=this._getOutputPixelType(t.pixelType),t.pixelType=this.outputPixelType,this.rasterInfo=t;const{functionArguments:e}=this,{clippingGeometry:s,clippingType:r}=e;if(!s)return{success:!1,supportsGPU:!1,error:"missing clipping geometry"};if("outside"===r)try{const{spatialReference:e}=t,r="extent"===s.type?n(s,e):p(s,e).extent;r&&i(t,r)}catch{}return{success:!0,supportsGPU:!0}}_processPixels(t){return t.pixelBlocks?.[0]}_getWebGLParameters(){const{clippingGeometry:t,clippingType:e}=this.functionArguments;return{clippingGeometry:t.toJSON(),clippingType:e}}};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()],c.prototype,"isNoopProcess",void 0),c=t([s("esri.layers.raster.functions.ClipFunction")],c);const u=c;export{u as default};
