// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
define("esri/renderers/StretchRenderer","dojo/_base/declare dojo/_base/array dojo/_base/lang dojo/has ../kernel ../lang ../layers/RasterFunction ./colorRampUtils".split(" "),function(e,n,f,l,m,g,k,h){var a={TYPE_NONE:"none",TYPE_STANDARDDEVIATION:"standardDeviation",TYPE_HISTOGRAMEQUALIZATION:"histogramEqualization",TYPE_MINMAX:"minMax",TYPE_PERCENTCLIP:"percentClip",TYPE_SIGMOID:"sigmoid"};e=e(null,{declaredClass:"esri.renderer.StretchRenderer",constructor:function(b){b=b||{};this.stretchType=a.TYPE_NONE;
this.dra=!0;this.statistics=[];this.gamma=[];this.computeGamma=this.useGamma=!1;this.sigmoidStrengthLevel=this.numberOfStandardDeviations=this.minPercent=this.maxPercent=this.min=this.max=null;f.mixin(this,b);this.colorRamp=h.fromJson(b.colorRamp)},toJson:function(){var b={type:"rasterStretch",stretchType:this.stretchType,colorRamp:this.colorRamp&&this.colorRamp.toJson(),min:this.min,max:this.max,numberOfStandardDeviations:this.numberOfStandardDeviations,statistics:f.clone(this.statistics),dra:this.dra,
minPercent:this.minPercent,maxPercent:this.maxPercent,useGamma:this.useGamma,gamma:f.clone(this.gamma),computeGamma:this.computeGamma,sigmoidStrengthLevel:this.sigmoidStrengthLevel};return g.fixJson(b)},toRenderingRule:function(b){b=b||{};var c=new k;c.functionName="Stretch";var a=this._convertStretchTypeEnumToIndex(this.stretchType),d={StretchType:a,Statistics:this.statistics,DRA:this.dra,UseGamma:this.useGamma,Gamma:this.gamma,ComputeGamma:this.computeGamma};g.isDefined(this.min)&&(d.Min=this.min);
g.isDefined(this.min)&&(d.Max=this.max);3===a?(d.NumberOfStandardDeviations=this.numberOfStandardDeviations,c.outputPixelType="U8"):6===a?(d.MinPercent=parseFloat(this.minPercent),d.MaxPercent=parseFloat(this.maxPercent),c.outputPixelType="U8"):5===a?c.outputPixelType="U8":9===a&&(d.SigmoidStrengthLevel=this.sigmoidStrengthLevel);c.functionArguments=d;c.variableName="Raster";return this.colorRamp?(a=new k,d=h.getColorRampName(this.colorRamp),a.functionArguments=d?{colorRamp:d}:b.convertToColormap?
{Colormap:h.convertColorRampToColormap(this.colorRamp,256)}:{colorRamp:this.colorRamp.toJson()},a.variableName="Raster",a.functionName="Colormap",a.functionArguments.Raster=c,a):c},_convertStretchTypeEnumToIndex:function(b){var c=0;b===a.TYPE_STANDARDDEVIATION?c=3:b===a.TYPE_HISTOGRAMEQUALIZATION?c=4:b===a.TYPE_MINMAX?c=5:b===a.TYPE_PERCENTCLIP?c=6:b===a.TYPE_SIGMOID&&(c=9);return c},_convertStretchTypeIndexToEnum:function(b){var c=0;3===b?c=a.TYPE_STANDARDDEVIATION:4===b?c=a.TYPE_HISTOGRAMEQUALIZATION:
5===b?c=a.TYPE_MINMAX:6===b?c=a.TYPE_PERCENTCLIP:9===b&&(c=a.TYPE_SIGMOID);return c}});f.mixin(e,a);l("extend-esri")&&f.setObject("renderer.StretchRenderer",e,m);return e});