/*
 COPYRIGHT 2009 ESRI

 TRADE SECRETS: ESRI PROPRIETARY AND CONFIDENTIAL
 Unpublished material - all rights reserved under the
 Copyright Laws of the United States and applicable international
 laws, treaties, and conventions.

 For additional information, contact:
 Environmental Systems Research Institute, Inc.
 Attn: Contracts and Legal Services Department
 380 New York Street
 Redlands, California, 92373
 USA

 email: contracts@esri.com
 */
//>>built
require({cache:{"url:esri/dijit/templates/RenderingRule.html":"<div data-dojo-attach-point=\"_renderingRuleContainer\" class=\"esriRenderingRuleContainer\">\r\n  <table class=\"esriRenderingRuleTable\">\r\n    <tbody>\r\n      <col class=\"esriRenderingRuleCol1\"/>\r\n      <col class=\"esriRenderingRuleCol2\"/>\r\n      <col class=\"esriRenderingRuleCol3\"/>\r\n      <tr>\r\n        <td colspan=\"3\">\r\n          <label class=\"esriRenderingRuleHeadingLabel\" data-dojo-attach-point=\"rendererLabel\">${_i18n.widgets.renderingRule.rendererLabelTitle}</label>\r\n        </td>\r\n      </tr>\r\n      <tr>\r\n        <td colspan=\"3\" data-dojo-attach-point=\"rasterFunctionRow\">\r\n          <div data-dojo-attach-point=\"rasterFunctionList\" data-dojo-type=\"dijit/form/FilteringSelect\"\r\n            class=\"esriRenderingRuleRasterFunctionList\">\r\n          </div>\r\n        </td>\r\n      </tr>\r\n      <tr data-dojo-attach-point=\"bandIdsLabelBlock\">\r\n        <td colspan=\"3\">\r\n          <label class=\"esriRenderingRuleHeadingLabel\" data-dojo-attach-point=\"bandIdsLabel\">${_i18n.widgets.renderingRule.bandCombinationLabelTitle}</label>\r\n        </td>\r\n      </tr>\r\n      <tr data-dojo-attach-point=\"bandIdsBlock\">\r\n        <td>\r\n          <div data-dojo-attach-point=\"bandIdsRedList\" data-dojo-type=\"dijit/form/FilteringSelect\"\r\n            class=\"esriRenderingRuleBandIdsRedList\">\r\n          </div>\r\n        </td>\r\n        <td>\r\n          <div data-dojo-attach-point=\"bandIdsGreenList\" data-dojo-type=\"dijit/form/FilteringSelect\"\r\n            class=\"esriRenderingRuleBandIdsGreenList\">\r\n          </div>\r\n        </td>\r\n        <td>\r\n          <div data-dojo-attach-point=\"bandIdsBlueList\" data-dojo-type=\"dijit/form/FilteringSelect\"\r\n            class=\"esriRenderingRuleBandIdsBlueList\">\r\n          </div>\r\n        </td>\r\n      </tr>\r\n      <tr data-dojo-attach-point=\"bandIdsMsgBlock\">\r\n        <td/>\r\n        <td colspan=\"2\">\r\n          <div data-dojo-attach-point=\"msgLabel\" class=\"esriRenderingRuleMsgLabel\">\r\n          </div>\r\n        </td>\r\n      </tr>      \r\n      <tr>\r\n        <td colspan=\"3\">\r\n          <label class=\"esriRenderingRuleEnhancementHeadingLabel\" data-dojo-attach-point=\"imageEnhancementLabel\">${_i18n.widgets.renderingRule.imageEnhancementLabelTitle}</label>\r\n        </td>\r\n      </tr>\r\n      <tr>\r\n        <td colspan=\"3\">\r\n          <label data-dojo-attach-point=\"stretchDescLabel\">${_i18n.widgets.renderingRule.stretchDescLabel}</label>\r\n        </td>\r\n      </tr>\r\n      <tr>\r\n        <td colspan=\"3\">\r\n          <label data-dojo-attach-point=\"stretchMethodLabel\">${_i18n.widgets.renderingRule.stretchMethodLabel}</label>\r\n        </td>\r\n      </tr>      \r\n      <tr>\r\n        <td colspan=\"3\">\r\n          <select data-dojo-attach-point=\"stretchMethodList\" style=\"width:100%;\" data-dojo-type=\"dijit/form/Select\" class=\"esriRenderingRuleStretchMethodList\">\r\n          </select>\r\n        </td>\r\n      </tr>\r\n      <tr data-dojo-attach-point=\"stretchMethodNoneDescBlock\">\r\n        <td colspan=\"3\">\r\n          <label data-dojo-attach-point=\"stretchMethodNoneDesc\">${_i18n.widgets.renderingRule.stretchMethodNoneDesc}</label>\r\n        </td>\r\n      </tr> \r\n      <tr data-dojo-attach-point=\"stretchMethodMinMaxDescBlock\">\r\n        <td colspan=\"3\">\r\n          <label data-dojo-attach-point=\"stretchMethodMinMaxDesc\">${_i18n.widgets.renderingRule.stretchMethodMinMaxDesc}</label>\r\n        </td>\r\n      </tr>       \r\n      <tr data-dojo-attach-point=\"numStdDevBlock\">\r\n        <td colspan=\"3\">\r\n          <label data-dojo-attach-point=\"numStdDevLabel\">${_i18n.widgets.renderingRule.numStdDevLabelTitle}</label>\r\n          <input type=\"text\" value=\"2.0\" data-dojo-attach-point=\"numStdDevText\" class=\"esriRenderingRuleFixedInput\">\r\n          </input>\r\n          <label data-dojo-attach-point=\"numStdDevLabel\">${_i18n.widgets.renderingRule.numStdDevEndLabelTitle}</label>\r\n        </td>\r\n        <td/>\r\n        <td/>\r\n      </tr>\r\n      <tr data-dojo-attach-point=\"minMaxPercentDescBlock\">\r\n        <td colspan=\"3\">\r\n          <label data-dojo-attach-point=\"numStdDescLabel\">${_i18n.widgets.renderingRule.minMaxDescLabelTitle}</label>\r\n        </td>\r\n      </tr>      \r\n      <tr data-dojo-attach-point=\"maxPercentBlock\">\r\n        <td>\r\n          <label data-dojo-attach-point=\"maxPercentLabel\">${_i18n.widgets.renderingRule.maxPercentLabelTitle}</label>\r\n        </td>\r\n        <td colspan=\"2\">\r\n          <input type=\"text\" value=\"2.0\" data-dojo-attach-point=\"maxPercentText\" class=\"esriRenderingRuleFixedInput\">\r\n          </input>\r\n          <label data-dojo-attach-point=\"percentLabel\">${_i18n.widgets.renderingRule.percentLabelTitle}</label>\r\n        </td>\r\n        </td>\r\n      </tr>      \r\n      <tr data-dojo-attach-point=\"minPercentBlock\">\r\n        <td>\r\n          <label data-dojo-attach-point=\"minPercentLabel\">${_i18n.widgets.renderingRule.minPercentLabelTitle}</label>\r\n        </td>\r\n        <td colspan=\"2\">\r\n          <input type=\"text\" value=\"2.0\" data-dojo-attach-point=\"minPercentText\" class=\"esriRenderingRuleFixedInput\">\r\n          </input>\r\n          <label data-dojo-attach-point=\"percentLabel\">${_i18n.widgets.renderingRule.percentLabelTitle}</label>\r\n        </td>\r\n      </tr>\r\n      <tr data-dojo-attach-point=\"draBlock\">\r\n        <td colspan=\"3\">\r\n          <input type=\"checkbox\" value=\"true\" data-dojo-attach-point=\"draCheckbox\" class=\"esriRenderingRuleDraCheckbox\">\r\n          </input>\r\n          <label class=\"esriRenderingRuleDraLabel\" data-dojo-attach-point=\"draLabel\">${_i18n.widgets.renderingRule.draLabelTitle}</label>\r\n        <td/>\r\n      </tr>\r\n      <tr data-dojo-attach-point=\"gammaBlock\">\r\n        <td>\r\n          <label data-dojo-attach-point=\"gammaLabel\">${_i18n.widgets.renderingRule.gammaLabelTitle}</label>\r\n        </td>\r\n        <td colspan=\"2\">\r\n          <div id=\"gammaSliderID\" data-dojo-attach-point=\"gammaSlider\" class=\"esriRenderingRuleGammaSlider\" data-dojo-type=\"dijit.form.HorizontalSlider\" showbuttons=\"true\" value=\"0.0\" minimum=\"-1\" maximum=\"1\" intermediatechanges=\"true\">\r\n            <div data-dojo-type=\"dijit.form.HorizontalRuleLabels\" container=\"bottomDecoration\" labels=\"${_i18n.widgets.renderingRule.minGammaLabel}, ${_i18n.widgets.renderingRule.maxGammaLabel}\" style=\"height: 1.5em; font-size: 0.8em; color: #666\">\r\n            </div>        \r\n          </div> \r\n        </td>\r\n      </tr>    \r\n      <tr>\r\n        <td colspan=\"3\">\r\n          <center><input type=\"button\" data-dojo-attach-point=\"_apply\" value=\"APPLY\" size=\"15\" class=\"esriRenderingRuleApplyButton\" /></center>\r\n        </td>\r\n      </tr>      \r\n    </tbody>\r\n  </table>\r\n</div>\r\n"}});define("esri/dijit/RenderingRule",["dojo/_base/declare","dojo/_base/lang","dojo/_base/connect","dojo/_base/array","dojo/i18n!esri/nls/jsapi","dojo/text!esri/dijit/templates/RenderingRule.html","dojo/store/Memory","dojo/has","esri/kernel","esri/layers/RasterFunction","esri/geometry/Extent","dijit/_WidgetBase","dijit/_TemplatedMixin","dijit/_WidgetsInTemplateMixin","dijit/Tooltip","dijit/form/HorizontalSlider","dijit/form/HorizontalRuleLabels","dijit/form/FilteringSelect"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c,_d,_e,_f){var _10=_1([_c,_d,_e],{declaredClass:"esri.dijit.RenderingRule",templateString:_6,widgetsInTemplate:true,layer:null,map:null,hideApplyButton:false,_renderingRuleObject:null,_rasterFunctionData:[],_rasterFunctionStore:null,_cachedFunctionList:[],_cachedkeyProperties:{},_pendingDfds:{},_redBandIdStore:null,_greenBandIdStore:null,_blueBandIdStore:null,_donotSaveChanges:false,_resetBandCombination:false,_serviceBandCount:3,_defaultBandCombinationFncName:"User Defined Renderer",_firstFncInRenderingRuleList:null,_gammaSliderTooltip:null,constructor:function(_11){_1.safeMixin(this,_11);this._i18n=_5;_defaultBandCombinationFncName=this._i18n.widgets.renderingRule.userDefinedRendererTitle;this._renderingRuleObject=new _a();},startup:function(){this.inherited(arguments);_3.connect(this.rasterFunctionList,"onChange",_2.hitch(this,"_onRasterFunctionChange"));_3.connect(this.stretchMethodList,"onChange",_2.hitch(this,"_onStretchMethodChange"));_3.connect(this.gammaSlider,"onChange",_2.hitch(this,"_onGammaChange"));_3.connect(this.gammaSlider,"onMouseLeave",_2.hitch(this,"_onGammaMouseLeave"));_3.connect(this._apply,"onclick",_2.hitch(this,"_onClickApplyRenderingRule"));_3.subscribe("onRenderingRuleApply",_2.hitch(this,"_onClickApplyRenderingRule"));_3.subscribe("onRenderingRuleReset",_2.hitch(this,"_onClickResetRenderingRule"));if(this.hideApplyButton){this._apply.style.display="none";}},destroy:function(){this._pendingDfds=null;if(this._gammaSliderTooltip){this._gammaSliderTooltip.destroy();this._gammaSliderTooltip=null;}this.inherited(arguments);},_setLayerAttr:function(_12){if(!_12){return;}this.inherited(arguments);this.layer=_12;this._donotSaveChanges=true;this._firstFncInRenderingRuleList=null;this._fillStretchMehodList();this._hideStretch();var _13=_2.hitch(this,"_setupDefaults");if(this.layer.loaded){this._setupDefaults();}else{_3.connect(this.layer,"onLoad",_13);}this._donotSaveChanges=false;},_setupDefaults:function(){this._setupBandIdDefaults();this._setupStretchDefaults();this._setupRenderingRuleDefaults();},_setupRenderingRuleDefaults:function(){if(!this.layer){return;}this._rasterFunctionData=[];var i;for(i=0;i<this._cachedFunctionList.length;i++){var _14=this._cachedFunctionList[i];if(_14&&this.layer===_14.layer){this._rasterFunctionData=_14.data;this._setupFunctionStore();return;}}this._fillRasterFunctionList(this.layer);},_setupFunctionStore:function(){if(!this.layer){console.log("Could not populate renderers as the layer does not exists");return;}this._rasterFunctionStore=new _7({data:this._rasterFunctionData,idProperty:"name"});this.rasterFunctionList.set("store",this._rasterFunctionStore);this.rasterFunctionList.set("labelAttr","label");this.rasterFunctionList.set("labelType","html");var _15="";if(this.layer.renderingRule&&this.layer.renderingRule.functionName){if(this.layer.renderingRule.functionName.toLowerCase()!=="stretch"){_15=this.layer.renderingRule.functionName;}else{_15=this._defaultBandCombinationFncName;}}else{if(this._firstFncInRenderingRuleList&&this._firstFncInRenderingRuleList.toLowerCase()!=="none"){_15=this._firstFncInRenderingRuleList;}else{_15=this._defaultBandCombinationFncName;}}if(_15&&this._rasterFunctionStore.get(_15)){this.rasterFunctionList.set("value",_15);this._onRasterFunctionChange();}return;},_fillRasterFunctionList:function(_16){if(!this.layer){return;}this._rasterFunctionData=[];if(_16===null||_16.extent===null){return;}var _17=new _b(_16.extent.xmin,_16.extent.ymin,_16.extent.xmax,_16.extent.ymax,_16.extent.spatialReference);var _18=_17.getWidth();var _19=_17.getHeight();if((_18/_19>=2)||(_19/_18>=2)){var _1a=(Math.min(_18,_19))/2;var _1b=_17.getCenter();_17.update(_1b.x-_1a,_1b.y-_1a,_1b.x+_1a,_1b.y+_1a,_16.extent.spatialReference);}var _1c=_17.xmin+","+_17.ymin+","+_17.xmax+","+_17.ymax;var _1d=_16._getToken();var _1e="";if(_1d){_1e="&token="+_1d;}var _1f=this.layer.url+"/exportImage?bbox="+_1c+_1e+"&imageSize=400,400&f=image&renderingRule=";var _20=this.layer.bandIds;var _21=_1f;if(_20&&_20.length>=3){_21=_1f+"&bandIds="+_20[0]+","+_20[1]+","+_20[2];}this._addFunctionItemToList(this._defaultBandCombinationFncName,this._defaultBandCombinationFncName,this._i18n.widgets.renderingRule.userDefinedRendererDesc,_21,"");if(_16.rasterFunctionInfos&&_16.rasterFunctionInfos.length>0){_4.forEach(_16.rasterFunctionInfos,_2.hitch(this,function(_22){if(this._firstFncInRenderingRuleList===null){this._firstFncInRenderingRuleList=_22.name;}if(_22.name.toLowerCase()!=="none"){var _23="{\"rasterFunction\":\""+_22.name+"\"}";this._addFunctionItemToList(_22.name,_22.name,_22.description,_1f,_23);}}));}var _24={};_24.layer=this.layer;_24.data=this._rasterFunctionData;this._cachedFunctionList.push(_24);this._setupFunctionStore();return;},_addFunctionItemToList:function(_25,id,_26,_27,_28){var _29={};_29.name=_25;_29.id=id;var _2a=_26;if(_2a.length>200){_2a=_2a.substring(0,200)+"...";}_29.description=_2a;_29.label="<html><body><section><h4>"+_25+":</h4><table cellspacing='5'><tr><td><img src='"+_27+_28+"' height='100' width='100'></td><td><p style='white-space:pre-wrap;width:40ex'><i>"+_2a+"</i></p></td></tr></table></section></body></html>";this._rasterFunctionData.push(_29);},_setupBandIdDefaults:function(){if(!this.layer){return;}var _2b=3;_2b=this.layer.bandCount;var _2c=this.layer.id;var _2d=this._cachedkeyProperties[_2c];if(!_2d&&_2b>1){this.msgLabel.style.display="";this.msgLabel.innerHTML="<i>"+this._i18n.widgets.renderingRule.bandNamesRequestMsg+"</i>";var dfd=this.layer.getKeyProperties();this._pendingDfds[_2c]=1;dfd.addBoth(_2.partial(this._fillBandIdList,this,this.layer));}else{this._fillBandIdList(this,this.layer,_2d);}if(_2b<3){this._hideBandIds();}else{this._showBandIds();}},_fillBandIdList:function(_2e,_2f,_30){if(!_2e.layer||_2e.layer!==_2f){return;}var _31=_2e._pendingDfds,_32=_2e.layer.id;if(_31&&_31[_32]){delete _31[_32];}_2e.msgLabel.style.display="none";_2e.msgLabel.innerHTML="";var _33=3;_33=_2e.layer.bandCount;var _34;if(_30&&_30.BandProperties&&_30.BandProperties.length>0){_34=_30.BandProperties;}var _35=_2e._getBandIdList(_33,_34,"");_2e._redBandIdStore=new _7({data:_35,idProperty:"name"});_2e.bandIdsRedList.set("store",_2e._redBandIdStore);_2e.bandIdsRedList.set("labelAttr","label");_2e.bandIdsRedList.set("labelType","html");var _36=_2e._getBandIdList(_33,_34,"");_2e._greenBandIdStore=new _7({data:_36,idProperty:"name"});_2e.bandIdsGreenList.set("store",_2e._greenBandIdStore);_2e.bandIdsGreenList.set("labelAttr","label");_2e.bandIdsGreenList.set("labelType","html");var _37=_2e._getBandIdList(_33,_34,"");_2e._blueBandIdStore=new _7({data:_37,idProperty:"name"});_2e.bandIdsBlueList.set("store",_2e._blueBandIdStore);_2e.bandIdsBlueList.set("labelAttr","label");_2e.bandIdsBlueList.set("labelType","html");var _38=_2e.layer.bandIds;if(_38&&_38.length>2){_2e.bandIdsRedList.set("value",_2e._getBandName(_2e._redBandIdStore,_38[0]));_2e.bandIdsGreenList.set("value",_2e._getBandName(_2e._greenBandIdStore,_38[1]));_2e.bandIdsBlueList.set("value",_2e._getBandName(_2e._blueBandIdStore,_38[2]));}else{if(_2e._redBandIdStore.data.length>0&&_2e._greenBandIdStore.data.length>1&&_2e._blueBandIdStore.data.length>2){var _39=_2e._getRedBandIndex(_34);var _3a=_2e._getGreenBandIndex(_34);var _3b=_2e._getBlueBandIndex(_34);_2e.bandIdsRedList.set("value",_2e._redBandIdStore.data[_39].name);_2e.bandIdsGreenList.set("value",_2e._greenBandIdStore.data[_3a].name);_2e.bandIdsBlueList.set("value",_2e._blueBandIdStore.data[_3b].name);}}_2e._cachedkeyProperties[_32]=_30;var _3c=_2e.rasterFunctionList.get("value");if(_3c===_2e._defaultBandCombinationFncName){_2e._enableBandIds();}return;},_getRedBandIndex:function(_3d){if(!this.layer||!_3d){return 0;}var i;for(i=0;i<_3d.length;i++){if(_3d[i]&&_3d[i].hasOwnProperty("BandName")&&_3d[i].BandName.toLowerCase()==="red"){return i;}}return 0;},_getGreenBandIndex:function(_3e){if(!this.layer||!_3e){return 1;}var i;for(i=0;i<_3e.length;i++){if(_3e[i]&&_3e[i].hasOwnProperty("BandName")&&_3e[i].BandName.toLowerCase()==="green"){return i;}}return 1;},_getBlueBandIndex:function(_3f){if(!this.layer||!_3f){return 2;}var i;for(i=0;i<_3f.length;i++){if(_3f[i]&&_3f[i].hasOwnProperty("BandName")&&_3f[i].BandName.toLowerCase()==="blue"){return i;}}return 2;},_getBandIdList:function(_40,_41,_42){if(!this.layer){return;}var _43=[];if(!_42){_42="Black";}var _44=false;if(_41&&_40===_41.length){_44=true;}var i;for(i=0;i<_40;i++){var _45=i;var _46=i;if(_44&&_41[i]&&_41[i].BandName){_45=_41[i].BandName;}else{_45++;}var _47={};_47.name=_45;_47.index=_46;_47.label="<html><body><span value="+_46+"><font color="+_42+">"+_45+"</font></span></body></html>";_43.push(_47);}return _43;},_getBandName:function(_48,_49){if(!_48||!_48.data){return;}var i;for(i=0;i<_48.data.length;i++){var _4a=_48.data[i];if(_4a.index===_49){return _4a.name;}}return "";},_setupStretchDefaults:function(){if(!this.layer){return;}if(this.layer.renderingRule&&this.layer.renderingRule.functionName&&this.layer.renderingRule.functionName.toLowerCase()==="stretch"){this._loadStretchFunction();}else{this.stretchMethodList.set("value","0");this._onStretchMethodChange();this.numStdDevText.value=2;this.minPercentText.value=2;this.maxPercentText.value=2;this.gammaSlider.setValue(0);if(this.layer.minValues&&this.layer.minValues.length>0&&this.layer.maxValues&&this.layer.maxValues.length>0){this.draCheckbox.checked=false;this.draCheckbox.disabled=false;this.draLabel.style.color="Black";}else{this.draCheckbox.checked=true;this.draCheckbox.disabled=true;this.draLabel.style.color="Gray";}}if(!this._gammaSliderTooltip){this._gammaSliderTooltip=new _f({connectId:["gammaSliderID"],position:["below","above"],id:"gammaSliderTooltipID"});}},_loadStretchFunction:function(){var _4b=this.layer.renderingRule;if(!_4b||!_4b.functionName||_4b.functionName.toLowerCase()!=="stretch"){return;}var _4c=_4b.functionArguments;var _4d=_4c.StretchType;this.stretchMethodList.set("value",_4d.toString());this._onStretchMethodChange();if(_4c.NumberOfStandardDeviations){this.numStdDevText.value=_4c.NumberOfStandardDeviations;}this.draCheckbox.checked=_4c.DRA?true:false;if(_4c.UseGamma){var _4e=_4c.Gamma;if(_4c.Gamma.length>0){_4e=_4c.Gamma[0];}var _4f=Math.log(_4e)/Math.log(10);if(_4f){this.gammaSlider.setValue(_4f);}}if(_4c.MinPercent){this.minPercentText.value=_4c.MinPercent;}if(_4c.MaxPercent){this.maxPercentText.value=_4c.MaxPercent;}},_fillStretchMehodList:function(){this.stretchMethodList.removeOption(this.stretchMethodList.getOptions());this.stretchMethodList.addOption([{value:"0",label:this._i18n.widgets.renderingRule.noneStretchAlias},{value:"5",label:this._i18n.widgets.renderingRule.minMaxStretchAlias},{value:"3",label:this._i18n.widgets.renderingRule.stdDevStretchAlias},{value:"6",label:this._i18n.widgets.renderingRule.percentClipStretchAlias}]);this.stretchMethodList.set("value","0");this._onStretchMethodChange();},_onRasterFunctionChange:function(){var _50=this.rasterFunctionList.get("value");if(_50){var _51=this._rasterFunctionStore.get(_50).description;this.rasterFunctionList.set("title",_51);var _52=this.layer.id;if(_50===this._defaultBandCombinationFncName){this.rasterFunctionRow.width="";if(this.layer.bandCount>1){this._showBandIds();if(!this._pendingDfds[_52]){this._enableBandIds();}else{this._disableBandIds();}}else{this._hideBandIds();}}else{if(this.domNode.clientWidth>0){this.rasterFunctionRow.width=this.domNode.clientWidth;}this._hideBandIds();}if(_50===this._defaultBandCombinationFncName){this.imageEnhancementLabel.style.display="";this.stretchMethodLabel.style.display="";this.stretchDescLabel.style.display="";this.stretchMethodList.domNode.style.display="";this._onStretchMethodChange();}else{this._hideStretch();}}},_onStretchMethodChange:function(){if(this.stretchMethodList.getOptions.length<1){return;}var _53=this.stretchMethodList.get("value");if(_53==="0"){this._hideStretchOptions(true);}else{this._hideStretchOptions(false);}switch(_53){case "0":this.stretchMethodNoneDescBlock.style.display="";break;case "3":this.numStdDevBlock.style.display="";break;case "5":this.stretchMethodMinMaxDescBlock.style.display="";break;case "6":this.minMaxPercentDescBlock.style.display="";this.minPercentBlock.style.display="";this.maxPercentBlock.style.display="";break;}},_onClickApplyRenderingRule:function(){var _54=this.rasterFunctionList.get("value");if(_54!==this._defaultBandCombinationFncName){this._onRasterFunctionApply();}else{this._onBandIdsApply();}},_onClickResetRenderingRule:function(){if(!this.layer){return;}this.layer.renderingRule=null;this.layer.bandIds=null;this._setupDefaults();this._onClickApplyRenderingRule();},_onRasterFunctionApply:function(){if(this._donotSaveChanges){return;}if(!this.layer){return;}var _55=this.rasterFunctionList.get("value");var _56=new _a();_56.functionName=_55;var _57=[];this.layer.setBandIds(_57,true);this.layer.setRenderingRule(_56);},_onBandIdsApply:function(){if(this._donotSaveChanges){return;}if(!this.layer){return;}if(!this._redBandIdStore||!this.bandIdsGreenList||!this.bandIdsBlueList){this._onStretchApply(false);return;}var _58=[];var _59=this._redBandIdStore.get(this.bandIdsRedList.value);var _5a=this._greenBandIdStore.get(this.bandIdsGreenList.value);var _5b=this._blueBandIdStore.get(this.bandIdsBlueList.value);if(_59&&_5a&&_5b){_58.push(_59.index);_58.push(_5a.index);_58.push(_5b.index);}this._onStretchApply(true);this.layer.setBandIds(_58);},_onStretchApply:function(_5c){if(this._donotSaveChanges){return;}if(!this.layer){return;}var _5d=this.stretchMethodList.get("value");var _5e=null;if(_5d!=="0"){_5e=new _a();_5e.functionName="Stretch";this._buildStretchFunction(_5e);}this.layer.setRenderingRule(_5e,_5c);},_buildStretchFunction:function(_5f){_5f.functionName="Stretch";var _60=this.stretchMethodList.get("value");var _61={};_61.StretchType=parseInt(_60,10);_61.DRA=this.draCheckbox.checked?true:false;var _62=Math.exp(this.gammaSlider.value*Math.log(10));_62=parseFloat(_62).toFixed(2);if(this.layer.bandCount===1){_61.Gamma=_62;}else{var _63=[];_63.push(_62);_63.push(_62);_63.push(_62);_61.Gamma=_63;}_61.UseGamma=true;if(_60==="3"){_61.NumberOfStandardDeviations=this.numStdDevText.value;_5f.outputPixelType="U8";}else{if(_60==="6"){_61.MinPercent=parseFloat(this.minPercentText.value);_61.MaxPercent=parseFloat(this.maxPercentText.value);_5f.outputPixelType="U8";}else{if(_60==="5"){_5f.outputPixelType="U8";}}}_5f.functionArguments=_61;},_onGammaChange:function(_64){var _65=this._gammaSliderTooltip;if(_65){var _66=Math.exp(_64*Math.log(10));if(_66){_65.label=parseFloat(_66).toFixed(2);}else{_65.label=_64;}_65.open("gammaSliderID");}},_onGammaMouseLeave:function(){this.gammaTooltipClose();},_disableBandIds:function(){this.bandIdsRedList.set("disabled",true);this.bandIdsGreenList.set("disabled",true);this.bandIdsBlueList.set("disabled",true);this.bandIdsLabel.style.color="Gray";},_enableBandIds:function(){this.bandIdsRedList.set("disabled",false);this.bandIdsGreenList.set("disabled",false);this.bandIdsBlueList.set("disabled",false);if(this.bandIdsRedList.value===""){this.bandIdsRedList.set("value","1");}if(this.bandIdsGreenList.value===""){this.bandIdsGreenList.set("value","2");}if(this.bandIdsBlueList.value===""){this.bandIdsBlueList.set("value","3");}this.bandIdsLabel.style.color="Black";},_showBandIds:function(){this.bandIdsLabelBlock.style.display="";this.bandIdsBlock.style.display="";this.bandIdsMsgBlock.style.display="";},_hideBandIds:function(){this.bandIdsLabelBlock.style.display="none";this.bandIdsBlock.style.display="none";this.bandIdsMsgBlock.style.display="none";},_hideStretch:function(){this.imageEnhancementLabel.style.display="none";this.stretchDescLabel.style.display="none";this.stretchMethodLabel.style.display="none";this.stretchMethodList.domNode.style.display="none";this._hideStretchOptions(true);},_hideStretchOptions:function(all){var _67="";if(all){_67="none";}this.gammaBlock.style.display=_67;this.draBlock.style.display=_67;this.stretchMethodNoneDescBlock.style.display="none";this.stretchMethodMinMaxDescBlock.style.display="none";this.numStdDevBlock.style.display="none";this.minMaxPercentDescBlock.style.display="none";this.minPercentBlock.style.display="none";this.maxPercentBlock.style.display="none";},_getDefaultRedBandIndex:function(){var _68;if(this._redBandIdStore){_68=this._redBandIdStore.get("Red");}if(!_68){_68=1;}return _68;},gammaTooltipClose:function(){if(this._gammaSliderTooltip){this._gammaSliderTooltip.close();}}});if(_8("extend-esri")){_2.setObject("dijit.RenderingRule",_10,_9);}return _10;});