// 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:{"esri/dijit/ImageServiceMeasure":function(){define("dojo/_base/declare dojo/_base/lang dojo/i18n!../nls/jsapi dojo/text!./templates/ImageServiceMeasure.html dojo/has dojo/on ../kernel dijit/_WidgetBase dijit/_TemplatedMixin dijit/_WidgetsInTemplateMixin ../toolbars/ImageServiceMeasureTool dijit/form/DropDownButton dijit/DropDownMenu dijit/MenuItem dijit/MenuSeparator dijit/PopupMenuItem dijit/RadioMenuItem dijit/CheckedMenuItem ../symbols/SimpleMarkerSymbol ../symbols/SimpleLineSymbol ../symbols/SimpleFillSymbol ../graphic ../InfoTemplate ../geometry/Point dojo/_base/Color dojo/dom-class dojo/_base/array ../tasks/ImageServiceMeasureParameters ../units dojo/dom-construct dijit/form/ToggleButton dojo/html dojo/number".split(" "),
function(k,e,r,m,p,q,l,g,C,u,x,y,v,D,n,G,c,f,F,E,I,O,P,Q,K,t,w,B,z,H,R,L,J){m=k([g,C,u],{declaredClass:"esri.dijit.ImageServiceMeasure",templateString:m,widgetsInTemplate:!0,layer:null,map:null,layout:"dropDown",displayOperations:null,markerSymbol:null,lineSymbol:null,fillSymbol:null,displayMeasureResultInPopup:null,angularUnit:null,linearUnit:null,areaUnit:null,_supportedMeasureOperations:[],_supportedUnits:{},_currentGraphic:null,_defaultUnits:{angularUnit:"DECIMAL_DEGREES",linearUnit:"METERS",
areaUnit:"SQUARE_METERS"},_desiredDropDownOrder:"OPERATION_POINT OPERATION_DISTANCE_ANGLE OPERATION_AREA_PERIMETER OPERATION_CENTROID OPERATION_BASE_TOP OPERATION_TOP_TOP_SHADOW OPERATION_BASE_TOP_SHADOW".split(" "),_map3DOperations:{OPERATION_POINT:"OPERATION_POINT_3D",OPERATION_DISTANCE_ANGLE:"OPERATION_DISTANCE_ANGLE_3D",OPERATION_AREA_PERIMETER:"OPERATION_AREA_PERIMETER_3D",OPERATION_CENTROID:"OPERATION_CENTROID_3D",OPERATION_BASE_TOP:"OPERATION_BASE_TOP",OPERATION_TOP_TOP_SHADOW:"OPERATION_TOP_TOP_SHADOW",
OPERATION_BASE_TOP_SHADOW:"OPERATION_BASE_TOP_SHADOW"},_menu:null,_dropDownButton:null,_currentOperation:null,_activeMeasureOpMenuItem:null,_has3DOperations:!1,_enabled3DCheckbox:!1,_dropDownMenuItemMap:{},_toggleButtonMenuItemMap:{},_decimalDegreesConstantValue:"esriDUDecimalDegrees",_decimalDegreesConstantKeyword:"DECIMAL_DEGREES",constructor:function(a){k.safeMixin(this,a);this._setDefaultSymbols();this._i18n=r},startup:function(){this.inherited(arguments)},postCreate:function(){this.map&&this.layer&&
(this.measureToolbar=new x({map:this.map,layer:this.layer}),this.measureToolbar.on("draw-end",e.hitch(this,this._addGraphic)),this.measureToolbar.on("draw-start",e.hitch(this,this._onDrawStart)),this.measureToolbar.on("measure-end",e.hitch(this,this._addInfoWindow)),this.measureToolbar.on("unit-change",e.hitch(this,this._onUnitChange)),q(this.layer,"spatial-reference-change",e.hitch(this,this._removeDraws)),this._supportedMeasureOperations=this._getSupportedMeasureOperations(),this._has3DOperations=
this._check3DSupported(),this._reorderMeasureOperations(),this._supportedUnits=this._getSupportedUnits(),this._setDefaultUnits());this._checkValidLayoutValue();0<this._supportedMeasureOperations.length?"dropDown"===this.layout?this._populateMeasureDropdown():"toolbar"===this.layout&&this._populateMeasureButtons():L.set(this.esriImageServiceMeasure,this._i18n.widgets.imageServiceMeasure.mensurationCapabilitiesAbsentText)},_checkValidLayoutValue:function(){"dropdown"===this.layout.toLowerCase()?this.layout=
"dropDown":"toolbar"===this.layout.toLowerCase()?this.layout="toolbar":(this.layout="dropDown",console.log("Invalid value for layout"))},_getUnitKeyword:function(a){var b=null,d;if(a===this._decimalDegreesConstantValue)b=this._decimalDegreesConstantKeyword;else for(d in z)z.hasOwnProperty(d)&&z[d]===a&&(b=d);return b||null},_setUnitKeyword:function(a,b){var d;this[a]?(d=this._getUnitKeyword(this[a]))?a=d:(a=this._defaultUnits[a],console.log("Incorrect "+b+" supplied. "+b+" set to default.")):a=this._defaultUnits[a];
return a},_setDefaultUnits:function(){this.linearUnit=this._setUnitKeyword("linearUnit","Linear Unit");this.areaUnit=this._setUnitKeyword("areaUnit","Area Unit");this.angularUnit=this._setUnitKeyword("angularUnit","Angular Unit");this.measureToolbar.setLinearUnit(z[this.linearUnit]);this.measureToolbar.setAreaUnit(z[this.areaUnit]);this.measureToolbar.setAngularUnit(z[this.angularUnit])},_getSupportedMeasureOperations:function(){var a=[],b=this.displayOperations||this.measureToolbar.getSupportedMeasureOperations(),
d=this.measureToolbar.getSupportedMeasureOperations(),h;w.forEach(b,function(A){for(h in B)B.hasOwnProperty(h)&&B[h]===A&&(-1<w.indexOf(d,A)?a.push(h):console.log(A+" is not supported by the service."))},this);return a},_getSupportedUnits:function(){var a={},b=[],d=[],h=this.measureToolbar.getSupportedUnits(),A;for(A in h)h.hasOwnProperty(A)&&(d=h[A],b=[],w.forEach(d,function(M){b.push(this._getUnitString(M))},this),a[A]=b);return a},_check3DSupported:function(){return this._isSupportedMeasureOperation("OPERATION_POINT_3D")||
this._isSupportedMeasureOperation("OPERATION_DISTANCE_ANGLE_3D")||this._isSupportedMeasureOperation("OPERATION_AREA_PERIMETER_3D")||this._isSupportedMeasureOperation("OPERATION_CENTROID_3D")},_isSupportedMeasureOperation:function(a){return-1<this._supportedMeasureOperations.indexOf(a)},_reorderMeasureOperations:function(){var a=[];w.forEach(this._desiredDropDownOrder,function(b){-1<this._supportedMeasureOperations.indexOf(b)&&a.push(b)},this);this._supportedMeasureOperations=a},_setDefaultSymbols:function(){this.markerSymbol||
(this.markerSymbol=new F,this.markerSymbol.setPath("M16,4.938c-7.732,0-14,4.701-14,10.5c0,1.981,0.741,3.833,2.016,5.414L2,25.272l5.613-1.44c2.339,1.316,5.237,2.106,8.387,2.106c7.732,0,14-4.701,14-10.5S23.732,4.938,16,4.938zM16.868,21.375h-1.969v-1.889h1.969V21.375zM16.772,18.094h-1.777l-0.176-8.083h2.113L16.772,18.094z"),this.markerSymbol.setColor(new K("#00FFFF")));this.lineSymbol||(this.lineSymbol=new E(E.STYLE_SOLID,new K([255,0,0]),1.5));this.fillSymbol||(this.fillSymbol=new I(I.STYLE_SOLID,new E(E.STYLE_DASHDOT,
new K([255,0,0]),2),new K([255,255,0,.25])))},_populateMeasureDropdown:function(){var a;this._menu=new v;w.forEach(this._supportedMeasureOperations,function(d){a=new D({label:this._i18n.widgets.imageServiceMeasure.operationLabel[d],iconClass:B[d]});a.on("click",e.hitch(this,this._onDropDownMenuItemClick,d,a));this._menu.addChild(a);this._dropDownMenuItemMap[d]=a},this);var b=new n;this._menu.addChild(b);this._has3DOperations&&(b=new f({label:this._i18n.widgets.imageServiceMeasure.measure3DLabel,checked:!1}),
b.on("change",e.hitch(this,this._on3DCheckBoxChange)),this._menu.addChild(b),b=new n,this._menu.addChild(b));this._addUnitsMenu();this._dropDownButton=new y({dropDown:this._menu,"class":"esriImageServiceMeasureDropdownContainer"},this.measureDropDownContainer);this._dropDownButton.startup();this._currentOperation=this._defaultOperation=this._supportedMeasureOperations[0];this._toggleButton=new y({label:this._i18n.widgets.imageServiceMeasure.operationLabel[this._defaultOperation],iconClass:B[this._defaultOperation],
"class":"esriImageServiceMeasureToggleButton",dropDown:new v({"class":"esriHiddenDropDownMenu"})},this.toggleButtonDiv);this._toggleButton._buttonNode.title=this._i18n.widgets.imageServiceMeasure.operationLabel[this._defaultOperation];this._toggleButton.startup();this._toggleButton.on("click",e.hitch(this,this._toggle))},_populateMeasureButtons:function(){var a;t.add(this.esriImageServiceMeasure,"esriImageServiceMeasureToolbarLayout");t.add(this.measureButtonContainer,"esriImageServiceMeasureButtonContainer");
this._menu=new v;w.forEach(this._supportedMeasureOperations,function(h){d=H.create("div",{innerHTML:this._i18n.widgets.imageServiceMeasure.operationLabel[h]},this.measureButtonContainer);a=new R({showLabel:!1,checked:!1,label:this._i18n.widgets.imageServiceMeasure.operationLabel[h],iconClass:B[h],baseClass:"esriMeasureButton"},d);a.on("click",e.hitch(this,this._onButtonMenuItemClick,h));this._toggleButtonMenuItemMap[h]=a},this);if(this._has3DOperations){var b=new f({label:this._i18n.widgets.imageServiceMeasure.measure3DLabel,
checked:!1});b.on("change",e.hitch(this,this._on3DCheckBoxToolbarLayoutChange));this._menu.addChild(b);b=new n;this._menu.addChild(b)}this._addUnitsMenu();b=H.create("span",{innerHTML:"|"},this.measureButtonContainer);var d=H.create("div",null,this.measureButtonContainer);this._dropDownButton=new y({dropDown:this._menu,label:this._i18n.widgets.imageServiceMeasure.settings,showLabel:!1,iconClass:"esriMensurationSettingsIcon","class":"esriMeasureSettingsButton"},d);this._dropDownButton.startup();"false"!==
this.displayMeasureResultInPopup&&!1!==this.displayMeasureResultInPopup&&this.displayMeasureResultInPopup||(this.measureResultContainer=H.create("div",{"class":"measureResultContainer"},this.esriImageServiceMeasure),this.esriMeasurementResultLabel=H.create("div",{innerHTML:this._i18n.widgets.imageServiceMeasure.infoWindowTitle,"class":"esriMeasurementResultLabel"},this.measureResultContainer),this.measureResultStringDiv=H.create("div",{"class":"esriMeasurementResultString"},this.measureResultContainer))},
_angularUnitsReqd:function(){if(w.some(this._supportedMeasureOperations,function(a){if("OPERATION_DISTANCE_ANGLE_3D"===a||"OPERATION_DISTANCE_ANGLE"===a)return!0}))return!0},_linearUnitsReqd:function(){if(w.some(this._supportedMeasureOperations,function(a){if(0>a.indexOf("OPERATION_POINT")&&0>a.indexOf("OPERATION_CENTROID"))return!0}))return!0},_areaUnitsReqd:function(){if(w.some(this._supportedMeasureOperations,function(a){if("OPERATION_AREA_PERIMETER_3D"===a||"OPERATION_AREA_PERIMETER"===a)return!0}))return!0},
_addUnitsMenu:function(){var a,b;if(this._angularUnitsReqd()){this.angularUnitMenu=new v;w.forEach(this._supportedUnits.angularUnits,function(h){b=this._isCurrentAngularUnit(h);a=new c({group:"angularUnit",checked:b,label:this._i18n.widgets.imageServiceMeasure.unitLabel[h],"class":b?"esriSelectedOption":""});b&&(this._currentAngularUnitMenuItem=a);a.on("click",e.hitch(this,this._onAngularUnitClick,h,a));this.angularUnitMenu.addChild(a)},this);var d=new G({label:this._i18n.widgets.imageServiceMeasure.angularUnits,
popup:this.angularUnitMenu});this._menu.addChild(d)}this._linearUnitsReqd()&&(this.linearUnitMenu=new v,w.forEach(this._supportedUnits.linearUnits,function(h){b=this._isCurrentLinearUnit(h);a=new c({group:"linearUnit",checked:b,label:this._i18n.widgets.imageServiceMeasure.unitLabel[h],"class":b?"esriSelectedOption":""});b&&(this._currentLinearUnitMenuItem=a);a.on("click",e.hitch(this,this._onLinearUnitClick,h,a));this.linearUnitMenu.addChild(a)},this),d=new G({label:this._i18n.widgets.imageServiceMeasure.linearUnits,
popup:this.linearUnitMenu}),this._menu.addChild(d));this._areaUnitsReqd()&&(this.areaUnitMenu=new v,w.forEach(this._supportedUnits.areaUnits,function(h){b=this._isCurrentAreaUnit(h);a=new c({group:"areaUnit",checked:b,label:this._i18n.widgets.imageServiceMeasure.unitLabel[h],"class":b?"esriSelectedOption":""});b&&(this._currentAreaUnitMenuItem=a);a.on("click",e.hitch(this,this._onAreaUnitClick,h,a));this.areaUnitMenu.addChild(a)},this),d=new G({label:this._i18n.widgets.imageServiceMeasure.areaUnits,
popup:this.areaUnitMenu}),this._menu.addChild(d))},_on3DCheckBoxChange:function(a){var b=this._currentOperation.replace("_3D","");this._enabled3DCheckbox=a;this._dropDownButton.openDropDown();this._activeMeasureOpMenuItem&&(this._activeMeasureOpMenuItem=null,this._onDropDownMenuItemClick(b,this._dropDownMenuItemMap[b]))},_on3DCheckBoxToolbarLayoutChange:function(a){this._enabled3DCheckbox=a;this._dropDownButton.openDropDown();this._enabled3DCheckbox||(this._currentOperation=this._currentOperation.replace("_3D",
""));this._currentOperation&&this._onButtonMenuItemClick(this._currentOperation)},_onDropDownMenuItemClick:function(a,b){var d=b.domNode;this._enabled3DCheckbox&&(a=this._map3DOperations[a]);this._disableMapNavigation();this._removeDraws();this._activeMeasureOpMenuItem?(t.remove(this._activeMeasureOpMenuItem.domNode,"esriSelectedOption"),t.add(d,"esriSelectedOption"),this._activeMeasureOpMenuItem=b,this._currentOperation=a,this._toggleButton.set({label:this._i18n.widgets.imageServiceMeasure.operationLabel[a],
iconClass:B[a.replace("_3D","")]})):(this._activeMeasureOpMenuItem=b,t.add(d,"esriSelectedOption"),this._currentOperation=a,this._toggleButton.set({label:this._i18n.widgets.imageServiceMeasure.operationLabel[a],iconClass:B[a.replace("_3D","")]}),t.add(this._toggleButton._buttonNode,"esriCheckedMeasureButton"));this._toggleButton._buttonNode.title=this._i18n.widgets.imageServiceMeasure.operationLabel[a];this.measureToolbar.activate(B[a]);this.measureToolbar.showDrawTooltip()},_uncheckOtherButtons:function(a){for(var b in this._toggleButtonMenuItemMap)this._toggleButtonMenuItemMap.hasOwnProperty(b)&&
b!==a&&(0<=w.indexOf(this._supportedMeasureOperations,b)?this._toggleButtonMenuItemMap[b].set("checked",!1):delete this._toggleButtonMenuItemMap[b])},_onButtonMenuItemClick:function(a){this._removeDraws();this._enabled3DCheckbox&&(a=this._map3DOperations[a]);this._uncheckOtherButtons(a.replace("_3D",""));this._currentOperation=a;this._toggleButtonMenuItemMap[a.replace("_3D","")].checked?(this._disableMapNavigation(),this.measureToolbar.activate(B[a]),this.measureToolbar.showDrawTooltip()):(this.measureToolbar.deactivate(),
this._enableMapNavigation());this.measureResultStringDiv&&L.set(this.measureResultStringDiv,"")},_isCurrentAngularUnit:function(a){return a===this.angularUnit?!0:!1},_isCurrentLinearUnit:function(a){return a===this.linearUnit?!0:!1},_isCurrentAreaUnit:function(a){return a===this.areaUnit?!0:!1},_onLinearUnitClick:function(a,b){t.remove(this._currentLinearUnitMenuItem.domNode,"esriSelectedOption");t.add(b.domNode,"esriSelectedOption");this._currentLinearUnitMenuItem=b;this.linearUnit=a;this.measureToolbar.setLinearUnit(z[a]);
this._dropDownButton.openDropDown()},_onAngularUnitClick:function(a,b){t.remove(this._currentAngularUnitMenuItem.domNode,"esriSelectedOption");t.add(b.domNode,"esriSelectedOption");this._currentAngularUnitMenuItem=b;this.angularUnit=a;this.measureToolbar.setAngularUnit(z[a]);this._dropDownButton.openDropDown()},_onAreaUnitClick:function(a,b){t.remove(this._currentAreaUnitMenuItem.domNode,"esriSelectedOption");t.add(b.domNode,"esriSelectedOption");this._currentAreaUnitMenuItem=b;this.areaUnit=a;this.measureToolbar.setAreaUnit(z[a]);
this._dropDownButton.openDropDown()},_onDrawStart:function(){this._removeDraws()},_addGraphic:function(a){var b=a.geometry;this.measureToolbar.hideDrawTooltip();a="point"===b.type?this.markerSymbol:"line"===b.type||"polyline"===b.type?this.lineSymbol:this.fillSymbol;this._removeDraws();this._currentGraphic=a=new O(b,a);this.map.graphics.add(a)},_addInfoWindow:function(a){a=this._measureResultString(a.measureResult,a.error);"dropDown"===this.layout||"toolbar"===this.layout&&("true"===this.displayMeasureResultInPopup||
!0===this.displayMeasureResultInPopup)?this._displayInfoWindowMeasureResult(a):"toolbar"===this.layout&&this._displayToolbarMeasureResult(a)},_measureResultString:function(a,b){b="";var d;if(a)for(d in a){if(a.hasOwnProperty(d)&&a[d]&&"name"!==d&&"sensorName"!==d){var h="point"===d&&0<=this._currentOperation.toLowerCase().indexOf("centroid")?this._i18n.widgets.imageServiceMeasure.measureDialog.Centroid:this._i18n.widgets.imageServiceMeasure.measureDialog[d.charAt(0).toUpperCase()+d.slice(1)];if("point"!=
d){var A=this._i18n.widgets.imageServiceMeasure.unitLabel[this._getUnitString(a[d].unit)];var M=Math.abs(a[d].uncertainty).toFixed(2);var N=this._getDisplayValue(a[d]);b+="\x3cstrong\x3e"+h+"\x3c/strong\x3e: "+J.format(N)+" (\x26plusmn"+J.format(M)+") "+A+"\x3cbr/\x3e"}else A=a[d].value.x.toFixed(2),N=a[d].value.y.toFixed(2),b+="\x3cstrong\x3e"+h+"\x3c/strong\x3e\x3cbr/\x3e"+this._i18n.widgets.imageServiceMeasure.measureDialog.X+" : "+J.format(A)+"\x3cbr/\x3e"+this._i18n.widgets.imageServiceMeasure.measureDialog.Y+
" : "+J.format(N)+"\x3cbr/\x3e",0<=this._currentOperation.toLowerCase().indexOf("3d")&&void 0!==a[d].value.z&&(h=a[d].value.z.toFixed(2),b+=this._i18n.widgets.imageServiceMeasure.measureDialog.Z+" : "+J.format(h)+"\x3cbr/\x3e")}}else b=this._i18n.widgets.imageServiceMeasure.measurementErrorGeneric;return b},_getDisplayValue:function(a){return this.layer.currentVersion&&10.3<=this.layer.currentVersion?0>a.uncertainty?a.value.toFixed(2):Number(a.displayValue).toString():a.value.toFixed(2)},_getUnitString:function(a){var b;
for(b in z)if(z.hasOwnProperty(b))if(z[b]===a)var d=b;else a===this._decimalDegreesConstantValue&&(d=this._decimalDegreesConstantKeyword);return d},_displayInfoWindowMeasureResult:function(a){if(this._currentGraphic){var b=this._currentGraphic.geometry,d=[this._currentGraphic];if(this._currentGraphic){if("point"===b.type)this._currentInfowindow=b;else if("polyline"===b.type){var h=(b.paths[0][0][0]+b.paths[0][1][0])/2;b=(b.paths[0][0][1]+b.paths[0][1][1])/2;this._currentInfowindow=new Q(h,b,this.map.spatialReference)}else"polygon"===
b.type&&(this._currentInfowindow=b.getCentroid());d[0].setInfoTemplate(new P({title:this._i18n.widgets.imageServiceMeasure.infoWindowTitle,content:a}));this.map.infoWindow.setFeatures(d);this.map.infoWindow.show(this._currentInfowindow)}}},_displayToolbarMeasureResult:function(a){L.set(this.measureResultStringDiv,a)},_removeAssociatedGeometry:function(){this._currentGraphic&&(this.map.graphics.remove(this._currentGraphic),this._currentGraphic=null)},_removeDraws:function(){this._removeAssociatedGeometry();
this._currentInfowindow&&(this.map.infoWindow.hide(this._currentInfowindow),this._currentInfowindow=null)},_onUnitChange:function(a){this._addInfoWindow(a)},_toggle:function(){this._activeMeasureOpMenuItem?(this._removeDraws(),t.remove(this._activeMeasureOpMenuItem.domNode,"esriSelectedOption"),this._activeMeasureOpMenuItem=null,this.measureToolbar.deactivate(),t.remove(this._toggleButton._buttonNode,"esriCheckedMeasureButton"),this._enableMapNavigation()):(this._menuItem=this._dropDownMenuItemMap[this._currentOperation.replace("_3D",
"")],this._onDropDownMenuItemClick(this._currentOperation.replace("_3D",""),this._menuItem))},deactivate:function(){this._removeDraws();this._activeMeasureOpMenuItem&&(t.remove(this._activeMeasureOpMenuItem.domNode,"esriSelectedOption"),this._activeMeasureOpMenuItem=null);this._toggleButton&&t.remove(this._toggleButton._buttonNode,"esriCheckedMeasureButton");this.measureResultStringDiv&&L.set(this.measureResultStringDiv,"");"toolbar"===this.layout&&this._currentOperation&&this._toggleButtonMenuItemMap[this._currentOperation.replace("_3D",
"")].set("checked",!1);this.measureToolbar&&this.measureToolbar.deactivate();this._enableMapNavigation()},_disableMapNavigation:function(){this.map.disableMapNavigation();this.map.setInfoWindowOnClick(!1)},_enableMapNavigation:function(){this.map.enableMapNavigation();this.map.setInfoWindowOnClick(!0)},destroy:function(){this.inherited(arguments)}});p("extend-esri")&&e.setObject("dijit.ImageServiceMeasure",m,l);return m})},"esri/toolbars/ImageServiceMeasureTool":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/Color dojo/has ../kernel ./_toolbar ../symbols/SimpleMarkerSymbol ../symbols/SimpleLineSymbol ../symbols/SimpleFillSymbol ./draw ../tasks/ImageServiceMeasureParameters ../tasks/ImageServiceMeasureTask ../geometry/Point dojo/_base/array ../units".split(" "),
function(k,e,r,m,p,q,l,g,C,u,x,y,v,D,n){var G=k("CustomDraw",[u],{returnCurrentPoint:function(){return this._points},hideTooltip:function(){this._options.showTooltips=!1},showTooltip:function(){this._options.showTooltips=!0}});q=k(q,{declaredClass:"esri.toolbars.imageServiceMeasure",_eventMap:{"draw-end":["geometry"],"draw-start":[],"measure-end":["measureResult","error","geometry"],"unit-change":["measureResult","error","geometry"]},_mensurationCapabilitiesMap:{Basic:["OPERATION_POINT","OPERATION_DISTANCE_ANGLE",
"OPERATION_AREA_PERIMETER","OPERATION_CENTROID"],"3D":["OPERATION_POINT_3D","OPERATION_DISTANCE_ANGLE_3D","OPERATION_AREA_PERIMETER_3D","OPERATION_CENTROID_3D"],"Base-Top Height":["OPERATION_BASE_TOP"],"Top-Top Shadow Height":["OPERATION_TOP_TOP_SHADOW"],"Base-Top Shadow Height":["OPERATION_BASE_TOP_SHADOW"]},_supportedMeasureOperations:[],_operationsMap:{OPERATION_POINT:{geometryType:"POINT"},OPERATION_DISTANCE_ANGLE:{geometryType:"LINE"},OPERATION_AREA_PERIMETER:{geometryType:"POLYGON"},OPERATION_BASE_TOP:{geometryType:"LINE"},
OPERATION_BASE_TOP_SHADOW:{geometryType:"LINE"},OPERATION_TOP_TOP_SHADOW:{geometryType:"LINE"},OPERATION_CENTROID:{geometryType:"POLYGON"},OPERATION_POINT_3D:{geometryType:"POINT"},OPERATION_DISTANCE_ANGLE_3D:{geometryType:"LINE"},OPERATION_AREA_PERIMETER_3D:{geometryType:"POLYGON"},OPERATION_CENTROID_3D:{geometryType:"POLYGON"}},_supportedUnits:{linearUnits:"INCHES FEET YARDS MILES NAUTICAL_MILES MILLIMETERS CENTIMETERS DECIMETERS METERS KILOMETERS".split(" "),angularUnits:["RADIANS","DECIMAL_DEGREES"],
areaUnits:"SQUARE_INCHES SQUARE_FEET SQUARE_YARDS ACRES SQUARE_MILES SQUARE_MILLIMETERS SQUARE_CENTIMETERS SQUARE_DECIMETERS SQUARE_METERS ARES HECTARES SQUARE_KILOMETERS".split(" ")},markerSymbol:null,lineSymbol:null,fillSymbol:null,_drawToolbar:null,_currentGeometry:null,_currentOperation:null,linearUnit:null,angularUnit:null,areaUnit:null,_decimalDegreesConstantValue:"esriDUDecimalDegrees",_decimalDegreesConstantKeyword:"DECIMAL_DEGREES",constructor:function(c){k.safeMixin(this,c);this._checkMensurationSupport();
this._setDefaultSymbols()},_checkMensurationSupport:function(){this.layer.mensurationCapabilities?this._setSupportedMeasureOperations():console.log("Mensuration Capabilities not supported.")},_setDefaultSymbols:function(){this.markerSymbol||(this.markerSymbol=new l,this.markerSymbol.setPath("M16,4.938c-7.732,0-14,4.701-14,10.5c0,1.981,0.741,3.833,2.016,5.414L2,25.272l5.613-1.44c2.339,1.316,5.237,2.106,8.387,2.106c7.732,0,14-4.701,14-10.5S23.732,4.938,16,4.938zM16.868,21.375h-1.969v-1.889h1.969V21.375zM16.772,18.094h-1.777l-0.176-8.083h2.113L16.772,18.094z"),
this.markerSymbol.setColor(new r("#00FFFF")));this.lineSymbol||(this.lineSymbol=new g(g.STYLE_SOLID,new r([255,0,0]),1.5));this.fillSymbol||(this.fillSymbol=new C(C.STYLE_SOLID,new g(g.STYLE_DASHDOT,new r([255,0,0]),2),new r([255,255,0,.25])))},_setSupportedMeasureOperations:function(){var c;this._supportedMeasureOperations=[];this.mensurationCapabilities=this.layer.mensurationCapabilities.split(",");D.forEach(this.mensurationCapabilities,function(f){c=this._mensurationCapabilitiesMap[f];D.forEach(c,
function(F){this._supportedMeasureOperations.push(F)},this)},this)},getSupportedMeasureOperations:function(){var c=[];D.forEach(this._supportedMeasureOperations,function(f){c.push(x[f])},this);return c},getSupportedUnits:function(){var c={},f=[],F=[],E;for(E in this._supportedUnits)this._supportedUnits.hasOwnProperty(E)&&(f=this._supportedUnits[E],F=[],D.forEach(f,function(I){I===this._decimalDegreesConstantKeyword?F.push(this._decimalDegreesConstantValue):F.push(n[I])},this),c[E]=F);return c},setLinearUnit:function(c){for(var f in n)n.hasOwnProperty(f)&&
n[f]===c&&(this.linearUnit=f);this._currentGeometry&&this._getUnitChangeResults(this._currentGeometry)},setAngularUnit:function(c){for(var f in n)n.hasOwnProperty(f)&&(n[f]===c?this.angularUnit=f:c===this._decimalDegreesConstantValue&&(this.angularUnit=this._decimalDegreesConstantKeyword));this._currentGeometry&&this._getUnitChangeResults(this._currentGeometry)},setAreaUnit:function(c){for(var f in n)n.hasOwnProperty(f)&&n[f]===c&&(this.areaUnit=f);this._currentGeometry&&this._getUnitChangeResults(this._currentGeometry)},
setMarkerSymbol:function(c){this.markerSymbol=c},setLineSymbol:function(c){this.lineSymbol=c},setFillSymbol:function(c){this.fillSymbol=c},activate:function(c){D.forEach(this._supportedMeasureOperations,function(f){x[f]===c&&(this._currentOperation=f)},this);this.map.setMapCursor("crosshair");this._mapClickHandle=this.map.on("click",e.hitch(this,this._onMapClick));this._mapMouseDownHandle=this.map.on("mouse-down",e.hitch(this,this._onMapMouseDown));this._drawToolbar||(this._drawToolbar=new G(this.map,
{fillSymbol:this.fillSymbol,markerSymbol:this.markerSymbol,lineSymbol:this.lineSymbol}),this._drawToolbar.on("draw-end",e.hitch(this,this._setGeometry)));this._drawToolbar.activate(u[this._operationsMap[this._currentOperation].geometryType])},_onMapClick:function(){if(0===this._drawToolbar.returnCurrentPoint().length)this.onDrawStart()},_onMapMouseDown:function(){if(0===this._drawToolbar.returnCurrentPoint().length)this.onDrawStart()},deactivate:function(){this._drawToolbar&&this._drawToolbar.deactivate();
this.map.setMapCursor("default");this._currentOperation=this._currentGeometry=null;this._mapClickHandle&&(this._mapClickHandle.remove(),this._mapClickHandle=null);this._mapMouseDownHandle&&(this._mapMouseDownHandle.remove(),this._mapMouseDownHandle=null)},hideDrawTooltip:function(){this._drawToolbar.deactivate();this._drawToolbar.hideTooltip();this._drawToolbar.activate(u[this._operationsMap[this._currentOperation].geometryType])},showDrawTooltip:function(){this._drawToolbar.deactivate();this._drawToolbar.showTooltip();
this._drawToolbar.activate(u[this._operationsMap[this._currentOperation].geometryType])},_setGeometry:function(c){c=c.geometry;this.onDrawEnd(c);this._getMensurationResults(c);this._currentGeometry=c},_getImageServiceMeasureParameters:function(c){var f=new x;f.operation=x[this._currentOperation];f.mosaicRule=this.layer.mosaicRule;f.linearUnit=n[this.linearUnit];f.angularUnit=this.angularUnit===this._decimalDegreesConstantKeyword?this._decimalDegreesConstantValue:n[this.angularUnit];f.areaUnit=n[this.areaUnit];
"line"===c.type||"polyline"===c.type?(f.fromGeometry=new v(c.paths[0][0][0],c.paths[0][0][1],this.map.spatialReference),f.toGeometry=new v(c.paths[0][1][0],c.paths[0][1][1],this.map.spatialReference)):f.fromGeometry=c;return f},_getMensurationResults:function(c){c=this._getImageServiceMeasureParameters(c);(new y(this.layer.url)).execute(c,e.hitch(this,this._measureTaskSuccess),e.hitch(this,this._measureTaskError))},_measureTaskSuccess:function(c){this.onMeasureEnd(c,null,this._currentGeometry)},_measureTaskError:function(c){this.onMeasureEnd(null,
c,this._currentGeometry)},_getUnitChangeResults:function(c){c=this._getImageServiceMeasureParameters(c);(new y(this.layer.url)).execute(c,e.hitch(this,this._unitChangeSuccess),e.hitch(this,this._unitChangeError))},_unitChangeSuccess:function(c){this.onUnitChange(c,null,this._currentGeometry)},_unitChangeError:function(c){this.onUnitChange(null,c,this._currentGeometry)},onDrawStart:function(){},onDrawEnd:function(){},onMeasureEnd:function(){},onUnitChange:function(){}});m("extend-esri")&&e.setObject("toolbars.imageServiceMeasure",
q,p);return q})},"esri/tasks/ImageServiceMeasureParameters":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/json dojo/has ../kernel ../geometry/jsonUtils".split(" "),function(k,e,r,m,p,q){k=k(null,{declaredClass:"esri.tasks.ImageServiceMeasureParameters",fromGeometry:null,toGeometry:null,operation:null,pixelSize:null,mosaicRule:!1,linearUnit:null,angularUnit:null,areaUnit:null,toJson:function(l){var g=l&&l.fromGeometry||this.fromGeometry;l={fromGeometry:g,toGeometry:l&&l.toGeometry||
this.toGeometry,measureOperation:this.operation,mosaicRule:this.mosaicRule?r.toJson(this.mosaicRule.toJson()):null,linearUnit:this.linearUnit,angularUnit:this.angularUnit,areaUnit:this.areaUnit};g&&(l.geometryType=q.getJsonType(g));this.pixelSize&&(l.pixelSize=this.pixelSize?r.toJson(this.pixelSize.toJson()):null);return l}});e.mixin(k,{OPERATION_POINT:"esriMensurationPoint",OPERATION_DISTANCE_ANGLE:"esriMensurationDistanceAndAngle",OPERATION_AREA_PERIMETER:"esriMensurationAreaAndPerimeter",OPERATION_BASE_TOP:"esriMensurationHeightFromBaseAndTop",
OPERATION_BASE_TOP_SHADOW:"esriMensurationHeightFromBaseAndTopShadow",OPERATION_TOP_TOP_SHADOW:"esriMensurationHeightFromTopAndTopShadow",OPERATION_CENTROID:"esriMensurationCentroid",OPERATION_POINT_3D:"esriMensurationPoint3D",OPERATION_DISTANCE_ANGLE_3D:"esriMensurationDistanceAndAngle3D",OPERATION_AREA_PERIMETER_3D:"esriMensurationAreaAndPerimeter3D",OPERATION_CENTROID_3D:"esriMensurationCentroid3D"});m("extend-esri")&&e.setObject("tasks.ImageServiceMeasureParameters",k,p);return k})},"esri/tasks/ImageServiceMeasureTask":function(){define("dojo/_base/declare dojo/_base/lang dojo/has ../kernel ../request ../geometry/normalizeUtils ./Task".split(" "),
function(k,e,r,m,p,q,l){k=k(l,{declaredClass:"esri.tasks.ImageServiceMeasureTask",constructor:function(g){this._url.path+="/measure";this._handler=e.hitch(this,this._handler)},__msigns:[{n:"execute",c:3,a:[{i:0,p:["fromGeometry","toGeometry"]}],e:2}],_handler:function(g,C,u,x,y){try{this._successHandler([g],"onComplete",u,y)}catch(v){this._errorHandler(v,x,y)}},execute:function(g,C,u,x){var y=x.assembly;g=this._encode(e.mixin({},this._url.query,{f:"json"},g.toJson(y&&y[0])));var v=this._handler,D=
this._errorHandler;return p({url:this._url.path,content:g,callbackParamName:"callback",load:function(n,G){v(n,G,C,u,x.dfd)},error:function(n){D(n,u,x.dfd)}})},onComplete:function(){}});q._createWrappers(k);r("extend-esri")&&e.setObject("tasks.ImageServiceMeasureTask",k,m);return k})},"dijit/PopupMenuItem":function(){define("dojo/_base/declare dojo/dom-style dojo/_base/lang dojo/query ./popup ./registry ./MenuItem ./hccss".split(" "),function(k,e,r,m,p,q,l){return k("dijit.PopupMenuItem",l,{baseClass:"dijitMenuItem dijitPopupMenuItem",
_fillContent:function(){if(this.srcNodeRef){var g=m("*",this.srcNodeRef);this.inherited(arguments,[g[0]]);this.dropDownContainer=this.srcNodeRef}},_openPopup:function(g,C){var u=this.popup;p.open(r.delegate(g,{popup:this.popup,around:this.domNode}));C&&u.focus&&u.focus()},_closePopup:function(){p.close(this.popup);this.popup.parentMenu=null},startup:function(){if(!this._started){this.inherited(arguments);if(!this.popup){var g=m("[widgetId]",this.dropDownContainer)[0];this.popup=q.byNode(g)}this.ownerDocumentBody.appendChild(this.popup.domNode);
this.popup.domNode.setAttribute("aria-labelledby",this.containerNode.id);this.popup.startup();this.popup.domNode.style.display="none";this.arrowWrapper&&e.set(this.arrowWrapper,"visibility","");this.focusNode.setAttribute("aria-haspopup","true")}},destroyDescendants:function(g){this.popup&&(this.popup._destroyed||this.popup.destroyRecursive(g),delete this.popup);this.inherited(arguments)}})})},"dijit/RadioMenuItem":function(){define("dojo/_base/array dojo/_base/declare dojo/dom-class dojo/query!css2 ./CheckedMenuItem ./registry".split(" "),
function(k,e,r,m,p,q){return e("dijit.RadioButtonMenuItem",p,{baseClass:"dijitMenuItem dijitRadioMenuItem",role:"menuitemradio",checkedChar:"*",group:"",_setGroupAttr:"domNode",_setCheckedAttr:function(l){this.inherited(arguments);this._created&&l&&this.group&&k.forEach(this._getRelatedWidgets(),function(g){g!=this&&g.checked&&g.set("checked",!1)},this)},_onClick:function(l){this.disabled||this.checked||(this.set("checked",!0),this.onChange(!0));this.onClick(l)},_getRelatedWidgets:function(){var l=
[];m("[group\x3d"+this.group+"][role\x3d"+this.role+"]").forEach(function(g){(g=q.getEnclosingWidget(g))&&l.push(g)});return l}})})},"widgets/ImageMeasurement/_build-generate_module":function(){define(["dojo/text!./Widget.html","dojo/text!./css/style.css","dojo/i18n!./nls/strings"],function(){})},"url:esri/dijit/templates/ImageServiceMeasure.html":'\x3cdiv data-dojo-attach-point\x3d"esriImageServiceMeasure" class\x3d"esriImageServiceMeasure"\x3e\r\n  \x3cdiv class\x3d"esriImageServiceMeasureToggleButton" data-dojo-attach-point\x3d"toggleButtonDiv"\x3e\r\n  \x3c/div\x3e\r\n  \x3cdiv class\x3d"esriImageServiceMeasureDropdownContainer" data-dojo-attach-point\x3d"measureDropDownContainer"\x3e\r\n  \x3c/div\x3e\r\n  \x3cdiv data-dojo-attach-point\x3d"measureButtonContainer"\x3e\r\n  \x3c/div\x3e\r\n\x3c/div\x3e\r\n',
"url:widgets/ImageMeasurement/Widget.html":'\x3cdiv\x3e\r\n  \x3cdiv data-dojo-attach-point\x3d"measureWidgetDiv"\x3e\x3c/div\x3e\r\n\x3c/div\x3e\r\n\r\n\r\n',"url:widgets/ImageMeasurement/css/style.css":".esriImageServiceMeasureToolbarLayout {border: none; box-shadow: none; border-radius: none;}","*now":function(k){k(['dojo/i18n!*preload*widgets/ImageMeasurement/nls/Widget*["ar","bs","ca","cs","da","de","en","el","es","et","fi","fr","he","hr","hu","id","it","ja","ko","lt","lv","nb","nl","pl","pt-br","pt-pt","ro","ru","sk","sl","sr","sv","th","tr","zh-cn","uk","vi","zh-hk","zh-tw","ROOT"]'])},
"*noref":1}});
define(["dojo/_base/declare","jimu/BaseWidget","esri/dijit/ImageServiceMeasure"],function(k,e,r){return k([e],{baseClass:"jimu-widget-ImageMeasurement",name:"ImageMeasurement",imageServiceMeasureWidget:null,startup:function(){this.inherited(arguments);var m=this.config.ImageMeasurement,p=this._getLayerId(this.config.ImageMeasurement.layerTitle);this.imageServiceMeasureWidget=new r({map:this.map,layer:this.map.getLayer(p),displayMeasureResultInPopup:m.displayMeasureResultInPopup,layout:"toolbar",linearUnit:m.linearUnit,
angularUnit:m.angularUnit,areaUnit:m.areaUnit,displayOperations:m.displayOperations},this.measureWidgetDiv);this.imageServiceMeasureWidget.startup()},onClose:function(){this.imageServiceMeasureWidget.deactivate()},_getLayerId:function(m){var p=this.map.itemInfo.itemData.operationalLayers,q;for(q in p)if(p.hasOwnProperty(q)&&p[q].title===m)var l=p[q].id;return l}})});