// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
require({cache:{"url:esri/dijit/RasterFunctionEditor/templates/RFxBandCombinationEditor.html":'\x3cdiv class\x3d"esriRFxBandCombinationEditor"\x3e\r\n  \x3ctable class\x3d"esriRFxArgsEditor__table"\x3e\r\n    \x3ctr class\x3d"esriRFxArgsEditor__tr--arg-name esriRFxBandCombinationEditor--method"\x3e\r\n      \x3ctd\x3e${_i18n.methodLabel}\x3c/td\x3e\r\n    \x3c/tr\x3e\r\n    \x3ctr class\x3d"esriRFxArgsEditor__tr--arg-widget esriRFxBandCombinationEditor--method" \x3e\r\n      \x3ctd\x3e\r\n        \x3cdiv data-dojo-type\x3d"dijit/form/Select" data-dojo-attach-point\x3d"methodSelect" data-dojo-attach-event\x3d"onChange: onBandComboMethodChange"\x3e\x3c/div\x3e\r\n      \x3c/td\x3e\r\n    \x3c/tr\x3e\r\n    \x3ctr class\x3d"esriRFxArgsEditor__tr--arg-name esriRFxBandCombinationEditor--band"\x3e\r\n      \x3ctd\x3e${_i18n.bandLabel}\x3c/td\x3e\r\n    \x3c/tr\x3e\r\n    \x3ctr class\x3d"esriRFxArgsEditor__tr--arg-widget esriRFxBandCombinationEditor--band"\x3e\r\n      \x3ctd\x3e\r\n        \x3cdiv data-dojo-type\x3d"dijit/form/Select" data-dojo-attach-point\x3d"bandNameSelect" data-dojo-attach-event\x3d"onChange: onBandChange"\r\n          data-dojo-attach-props\x3d"labelAttr: \'label\'"\x3e\x3c/div\x3e\r\n        \x3cdiv data-dojo-type\x3d"dijit/form/Select" data-dojo-attach-point\x3d"bandIdSelect" data-dojo-attach-event\x3d"onChange: onBandChange"\r\n          data-dojo-attach-props\x3d"labelAttr: \'label\'"\x3e\x3c/div\x3e\r\n        \x3cdiv data-dojo-type\x3d"dijit/form/Select" data-dojo-attach-point\x3d"bandWavelengthSelect" data-dojo-attach-event\x3d"onChange: onBandChange"\r\n          data-dojo-attach-props\x3d"labelAttr: \'label\'"\x3e\x3c/div\x3e\r\n      \x3c/td\x3e\r\n    \x3c/tr\x3e\r\n    \x3ctr class\x3d"esriRFxArgsEditor__tr--arg-name esriRFxBandCombinationEditor--combination"\x3e\r\n      \x3ctd\x3e${_i18n.combinationLabel}\x3c/td\x3e\r\n    \x3c/tr\x3e\r\n    \x3ctr class\x3d"esriRFxArgsEditor__tr--arg-widget esriRFxBandCombinationEditor--combination"\x3e\r\n      \x3ctd\x3e\r\n        \x3cdiv data-dojo-type\x3d"dijit/form/TextBox" data-dojo-attach-point\x3d"bandCombinationTextbox" data-dojo-attach-event\x3d"onChange: onBandCombinationChange"\x3e\x3c/div\x3e\r\n      \x3c/td\x3e\r\n    \x3c/tr\x3e\r\n  \x3c/table\x3e\r\n\x3c/div\x3e'}});
define("esri/dijit/RasterFunctionEditor/RFxBandCombinationEditor","dojo/_base/declare dojo/_base/lang dojo/has dojo/query dojo/_base/array dojo/store/Memory dojo/data/ObjectStore dojo/dom-style dijit/form/Select dijit/form/TextBox dijit/_WidgetBase dijit/_TemplatedMixin dijit/_WidgetsInTemplateMixin ../../kernel dojo/text!./templates/RFxBandCombinationEditor.html dojo/i18n!../../nls/jsapi".split(" "),function(m,e,n,f,c,g,h,d,k,w,p,q,r,t,u,v){k=m("RFxBandCombinationEditor",[p,q,r],{baseClass:"esriRFxBandCombinationEditor",
templateString:u,schemaArgDefinitions:{},inputArgs:{},rasterArgs:{},rasterFunctionSchema:null,rasterFunctionEnums:null,rasterSelect:null,constructor:function(a){this.inherited(arguments);m.safeMixin(this,a);this._i18n=v.widgets.rasterFunctionEditor.rfxBandCombinationEditor},postCreate:function(){this.inherited(arguments);this._processRasterArgs();this._bandControls=[this.bandNameSelect,this.bandWavelengthSelect,this.bandIdSelect];this._setupBandComboStore();this._setArgVisibilities();this._setupValues()},
_setupValues:function(){var a=this.inputArgs;a&&a.Method&&void 0!==a.Method.value?this.methodSelect.set("value",a.Method.value.toString()):(!a.BandIds||a.BandNames||a.BandWavelengths?!a.BandNames||a.BandIds||a.BandWavelengths?!a.bandWavelengths||a.BandIds||a.BandNames||this.methodSelect.set("value","1"):this.methodSelect.set("value","0"):this.methodSelect.set("value","2"),this.methodSelect.set("disabled",!0));0===this.method&&a.BandNames&&a.BandNames.value&&a.BandNames.value.length?this.bandCombinationTextbox.set("value",
a.BandNames.value.join(" ")):1===this.method&&a.BandWavelengths&&a.BandWavelengths.value&&a.BandWavelengths.value.length?this.bandCombinationTextbox.set("value",a.BandWavelengths.value.join(" ")):2===this.method&&a.BandIds&&a.BandIds.value&&a.BandIds.value.length&&this.bandCombinationTextbox.set("value",a.BandIds.value.join(" "))},_setArgVisibilities:function(){var a=this.inputArgs,b;this._show(a.Method)||(b=f("."+this.baseClass+"--method"),c.forEach(b,function(a){d.set(a,"display","none")}));this._show(a.BandIds)||
this._show(a.BandNames)||this._show(a.BandWavelengths)||(b=f("."+this.baseClass+"--band"),b=b.concat(f("."+this.baseClass+"--combination")),c.forEach(b,function(a){d.set(a,"display","none")}))},_show:function(a){return!a||a.hasOwnProperty("isPublic")&&!a.isPublic?!1:!0},_processRasterArgs:function(){if(this.rasterArgs){var a=(this.rasterArg=this.rasterArgs.Raster)&&this.rasterArg.input;a&&(this._updateRasterArg(a.value),a.on("change",e.hitch(this,this._updateRasterArg)))}},_updateRasterArg:function(a){var b=
this.rasterArg&&this.rasterArg.input;b&&b.store&&(this.layer=b.store.get(a),this._updateBands())},_updateBands:function(){if(this.layer){var a=[],b=[];this.layer.getKeyProperties({renderingRule:this.layer.renderingRule}).then(e.hitch(this,function(l){c.forEach(l.BandProperties,function(c,l){a.push({label:String(l+1)});c.BandName&&b.push({label:c.BandName})});this.bandNameSelect.set("store",new h(new g({data:b,idProperty:"label"})));this.bandIdSelect.set("store",new h(new g({data:a,idProperty:"label"})))}))}},
_setupBandComboStore:function(){if(this.rasterFunctionEnums){var a=[];c.forEach(this.rasterFunctionEnums.bandComboMethods,function(b){a.push({key:b.key+"",label:b.label})});this.methodSelect.set("labelAttr","label");this.methodSelect.set("store",new h(new g({idProperty:"key",data:a})));this.onBandComboMethodChange(this.methodSelect.value)}},onBandComboMethodChange:function(a){this.method=parseInt(a,10);this.inputArgs&&this.inputArgs.Method&&(this.inputArgs.Method.value=this.method);c.forEach(this._bandControls,
function(a,c){if(c===this.method)return d.set(a.domNode,"display","");d.set(a.domNode,"display","none")},this)},onBandChange:function(a){var b=this.bandCombinationTextbox.value;b.length?this.bandCombinationTextbox.set("value",b+" "+a):this.bandCombinationTextbox.set("value",a)},onBandCombinationChange:function(){var a=this.bandCombinationTextbox.value,b=0<c.indexOf(a,",")?a.split(","):a.split(" ");c.forEach(b,function(a,c){b[c]=1===this.method?parseFloat(a):2===this.method?parseInt(a,10)-1:a.trim()},
this);this.inputArgs&&(0===this.method&&this.inputArgs.BandNames?this.inputArgs.BandNames.value=b:1===this.method&&this.inputArgs.BandWavelengths?this.inputArgs.BandWavelengths.value=b:2===this.method&&this.inputArgs.BandIds&&(this.inputArgs.BandIds.value=b))}});n("extend-esri")&&e.setObject("dijit.RasterFunctionEditor.RFxBandCombinationEditor",k,t);return k});