// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://@sbaseurl@/jsapi/jsapi/esri/copyright.txt and http://www.arcgis.com/apps/webappbuilder/copyright.txt for details.

//>>built
require({cache:{"url:widgets/SuitabilityModeler/wro/templates/WeightedOverlayModelDesigner.html":'\x3cdiv\x3e\r\n  \x3cdiv class\x3d"header"\x3e\r\n    \x3cdiv class\x3d"model-colormap pull-right"\x3e\r\n      \x3cspan data-dojo-attach-point\x3d"colormapSelectorNode"\x3e\x3c/span\x3e\r\n    \x3c/div\x3e\r\n    \x3ch4\x3e\x3cspan class\x3d"bullet-number"\x3e2\x3c/span\x3e${i18n.wro.designModelCaption}\x3c/h4\x3e\r\n    \x3cdiv class\x3d"layer-visibility"\x3e\r\n      \x3clabel\x3e${i18n.wro.visible}:\r\n        \x3cinput type\x3d"checkbox" disabled\x3d"disabled"\r\n          data-dojo-attach-point\x3d"visibleModelNode"  /\x3e\r\n      \x3c/label\x3e\r\n      \x3clabel\x3e${i18n.wro.transparency}:\x3c/label\x3e\r\n      \x3cspan  class\x3d"modeler-transparency-slider" style\x3d"width:150px;"\r\n        data-dojo-attach-point\x3d"sliderNode"\r\n        data-dojo-type\x3d"dijit/form/HorizontalSlider"\r\n        data-dojo-props\x3d"minimum: 0, maximum:1, value: 0.0, intermediateChanges:true, showButtons:false" \x3e\r\n      \x3c/span\x3e\r\n    \x3c/div\x3e\r\n  \x3c/div\x3e\r\n  \x3cdiv class\x3d"body"\x3e\r\n    \x3cdiv class\x3d"weighted-overlay-layer-editors"\r\n      data-dojo-attach-point\x3d"containerNode" \x3e\r\n    \x3c/div\x3e\r\n    \x3cdiv class\x3d"weight-pct weight-pct-total"\x3e\r\n      \x3cdiv class\x3d"weight-pct-label"\x3e${i18n.wro.total}: \x3c/div\x3e\r\n      \x3cdiv class\x3d"weight-pct-total-wrapper"\r\n        data-dojo-attach-point\x3d"weightTotalWrapper" \x3e\r\n        \x3cspan data-dojo-attach-point\x3d"weightTotalNode"\x3e\x3c/span\x3e \x26#37;\r\n      \x3c/div\x3e\r\n    \x3c/div\x3e\r\n  \x3c/div\x3e\r\n\x3c/div\x3e\r\n'}});
define("dojo/_base/declare dojo/_base/array dojo/on dojo/Evented dojo/dom-class dojo/dom-attr dijit/_WidgetBase dijit/_TemplatedMixin dijit/_WidgetsInTemplateMixin dijit/_Container dijit/form/DropDownButton dijit/DropDownMenu dijit/MenuItem ./containerUtils ./WeightedOverlayLayerEditor ./Colormap dojo/text!./templates/WeightedOverlayModelDesigner.html dijit/form/HorizontalSlider".split(" "),function(m,h,e,n,f,k,p,q,r,t,u,v,w,x,y,l,z){return m([p,q,r,t,n],{i18n:null,templateString:z,baseClass:"weighted-overlay-model-designer",
_isValid:!1,buildRendering:function(){this.inherited(arguments);this.colormap=new l({context:this.context,i18n:this.i18n});this.ColormapSelector=new u({},this.colormapSelectorNode);this.ColormapSelector.containerNode.appendChild(this.colormap.domNode)},postCreate:function(){var b=this,a=this.sliderNode;e(a,"change",function(){b.weightedOverlayService&&b.weightedOverlayService.imageServiceLayer&&b.weightedOverlayService.imageServiceLayer.setOpacity(1-a.value)});var c=this.visibleModelNode;e(c,"change",
function(){b.weightedOverlayService&&b.weightedOverlayService.imageServiceLayer&&b.weightedOverlayService.imageServiceLayer.setVisibility(c.checked);a.disabled=!c.checked});a.set("value",0);c.checked=!1},_setModelAttr:function(b){this.setModel(b)},_setWeightedOverlayServiceAttr:function(b){this.setWeightedOverlayService(b)},startup:function(){this.inherited(arguments);this.validate()},setWeightedOverlayService:function(b){var a=this;this.weightedOverlayService=b;var c=new v({style:"display: none;"});
h.forEach(this.weightedOverlayService.colormapDefinitions,function(d){var g=new w;(new l({context:a.context,i18n:a.i18n,definition:d})).placeAt(g.containerNode);a.own(e(g,"Click",function(){a.colormap&&a.colormap.definition!==d&&a.colormap.set("definition",d);a.model.colormapDefinition=d;a.runModel()}));g.containerNode.title=d.label;c.addChild(g)});this.ColormapSelector.set("dropDown",c);this.own(e(c,"open",function(){var d=this.domNode.parentElement;d&&f.add(d,a.baseClass+"-popup")}));this.weightedOverlayService.imageServiceLayer&&
this._toggleModelLayer(this.weightedOverlayService.imageServiceLayer.visible)},clearModel:function(){this.setModel(this.weightedOverlayService.createNewModel());this.emit("model-clear",this.model)},setModel:function(b){var a=this;this.model=b;x.removeChildren(this);this.model.overlayLayers&&this.model.overlayLayers.length&&0<this.model.overlayLayers.length?h.forEach(this.model.overlayLayers,function(c){c=new y({context:a.context,i18n:a.i18n,overlayLayer:c});a.own(e(c,"WeightChange",function(){a.validate()}));
c.startup();a.addChild(c)}):(this.hideModelLayer(),k.set(this.visibleModelNode,"disabled","disabled"),this.weightedOverlayService&&this.weightedOverlayService.clearModel());this.validate();this.model.colormapDefinition&&this.colormap.set("definition",this.model.colormapDefinition)},validate:function(){var b=0;this.model&&this.model.overlayLayers&&h.forEach(this.model.overlayLayers,function(c){b+=c.weight});this.weightTotalNode.innerHTML=b;var a=this.weightTotalWrapper.parentNode;100===b?(this._isValid=
!0,f.remove(a,"alert-danger"),f.add(a,"alert-success")):(this._isValid=!1,f.remove(a,"alert-success"),f.add(a,"alert-danger"));this.emit("model-validated",this._isValid)},runModel:function(b){this.validate();this._isValid&&(this.weightedOverlayService.runModel(this.model),k.remove(this.visibleModelNode,"disabled"),this.showModelLayer(),this.emit("model-run",{options:b,model:this.model}))},showModelLayer:function(){this._toggleModelLayer(!0)},hideModelLayer:function(){this._toggleModelLayer(!1)},_toggleModelLayer:function(b){!!this.visibleModelNode.checked!==
b&&this.visibleModelNode.click()}})});