// 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/Measurement":function(){define("require dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/_base/connect dojo/_base/Color dojo/debounce dojo/sniff dojo/dom-style dojo/dom-construct dojox/gfx dijit/_Widget dijit/registry dijit/Menu dijit/MenuItem ../symbols/PictureMarkerSymbol ../symbols/SimpleLineSymbol ../symbols/SimpleFillSymbol ../symbols/jsonUtils ../geometry/geodesicUtils ../geometry/webMercatorUtils ../geometry/Point ../geometry/Polyline ../geometry/Polygon ../graphic ../tasks/AreasAndLengthsParameters ../tasks/LengthsParameters ../tasks/GeometryService ../kernel ../config ../domUtils ../numberUtils ../lang ../units ../WKIDUnitConversion ../SpatialReference dijit/_TemplatedMixin dijit/_WidgetsInTemplateMixin ./_EventedWidget dojo/text!./templates/Measurement.html dojo/i18n!../nls/jsapi dijit/form/ToggleButton dijit/form/DropDownButton dijit/layout/ContentPane".split(" "),
function(v,p,h,r,f,B,m,q,w,H,I,L,n,J,K,M,y,N,O,z,d,g,k,t,x,R,S,T,U,V,D,E,W,F,X,P,Y,Z,aa,ba,C){p=p([aa,L,Y,Z],{declaredClass:"esri.dijit.Measurement",widgetsInTemplate:!0,templateString:ba,_map:null,_geometryService:null,_interpolatedMap:null,_mouseImgURL:null,_defaultPinURL:null,_measureGraphics:[],_measureGraphic:null,_locationGraphic:null,_tempGraphic:null,_polylineGraphics:null,_polygonGraphic:null,_pointSymbol:null,_useDefaultPointSymbol:!0,_defaultLineSymbol:null,_lineSymbol:null,_areaLineSymbol:null,
_defaultFillSymbol:null,_fillSymbol:null,_borderlessFillSymbol:null,_defaultCustomPointSymbolHeight:25,_defaultCustomPointSymbolWidth:25,_userGeometry:null,_currentGeometry:null,_inputPoints:[],_unitDictionary:[],_densificationRatio:.07848050723825097,numberPattern:"#,###,###,##0.0",result:null,_defaultDistanceUnit:null,_defaultAreaUnit:null,_defaultLocationUnit:null,currentDistanceUnit:null,currentAreaUnit:null,currentLocationUnit:null,_unitStrings:{},_locationUnitStrings:[],_locationUnitStringsLong:[],
_distanceUnitStrings:[],_distanceUnitStringsLong:[],_areaUnitStrings:[],_areaUnitStringsLong:[],_calculatingMsg:null,_gsErrorMsg:null,_NLS_Lat:null,_NLS_Lon:null,_mouseMoveMapHandler:null,_mouseClickMapHandler:null,_doubleClickMapHandler:null,_mouseDragMapHandler:null,_clickMapHandler:null,_mapExtentChangeHandler:null,_geometryAreaHandler:null,_snappingCallback:null,_calcTimer:null,_buttonDijits:{},previousTool:null,activeTool:null,markerLongitude:null,markerLatitude:null,mouseLongitude:null,mouseLatitude:null,
_eventMap:{"measure-start":["toolName","unitName"],measure:["toolName","geometry","values","unitName","segmentLength"],"measure-end":["toolName","geometry","values","unitName"],"tool-change":["toolName","unitName","previousToolName"],"unit-change":["unitName","toolName"]},constructor:function(a,b){if(a&&a.map){this._map=a.map;if(this._map.loaded)this._map.cs=this._checkCS(this._map.spatialReference),this._interpolatedMap=!("Web Mercator"===this._map.cs||"PCS"===this._map.cs);else var c=f.connect(this._map,
"onLoad",this,function(){f.disconnect(c);c=null;this._map.cs=this._checkCS(this._map.spatialReference);this._interpolatedMap=!("Web Mercator"===this._map.cs||"PCS"===this._map.cs)});this._geometryService=V.defaults.geometryService;this._mouseImgURL=v.toUrl("./images/cursor16x24.png");this._defaultPinURL=v.toUrl("./images/esriGreenPin16x26.png");this._defaultLineSymbol=new y(y.STYLE_SOLID,new B([0,128,255]),3);this._defaultFillSymbol=new N(y.STYLE_SOLID,this._defaultLineSymbol,new B([0,0,0,.5]));a.pointSymbol?
(this._pointSymbol=a.pointSymbol,this._useDefaultPointSymbol=!1):(this._pointSymbol=new M(this._defaultPinURL,16,26),this._pointSymbol.setOffset(0,12));this._fillSymbol=b=a.fillSymbol||this._defaultFillSymbol;this._areaLineSymbol=b.outline||this._defaultLineSymbol;this._borderlessFillSymbol=O.fromJson(b.toJson());this._borderlessFillSymbol.setOutline(null);this._lineSymbol=a.lineSymbol?a.lineSymbol:this._defaultLineSymbol;this._defaultDistanceUnit=a.defaultLengthUnit?a.defaultLengthUnit:F.MILES;this._defaultAreaUnit=
a.defaultAreaUnit?a.defaultAreaUnit:F.ACRES;this._defaultLocationUnit=a.defaultLocationUnit?a.defaultLocationUnit:F.DECIMAL_DEGREES;this._snappingCallback=h.hitch(this,this._snappingCallback);a.geometry&&(this._userGeometry=a.geometry);this._calcTimer=null;this.advancedLocationUnits=a.advancedLocationUnits||!1;this._NLS_Lon=C.widgets.measurement.NLS_longitude;this._NLS_Lat=C.widgets.measurement.NLS_latitude;this._gsErrorMsg=C.widgets.measurement.NLS_geometry_service_error;this._calculatingMsg=C.widgets.measurement.NLS_calculating;
this._geometryServiceLength=m(this._geometryServiceLength,250)}else console.log("Unable to find the required 'map' property in widget parameters")},startup:function(){this._setupDictionaries();H.create("img",{src:this._mouseImgURL,style:"vertical-align: middle"},this.mouseCell);this._useDefaultPointSymbol?H.create("img",{src:this._defaultPinURL,style:"vertical-align: middle"},this.pinCell):this._drawPointGraphics(this.pinCell);if(this._userGeometry)if(this._map.loaded)this._measureCustomGeometry(this._userGeometry),
this._userGeometry=null;else var a=f.connect(this._map,"onLoad",this,function(){f.disconnect(a);a=null;this._measureCustomGeometry(this._userGeometry);this._userGeometry=null})},destroy:function(){this._resetToolState();this.clearResult();this.inherited(arguments);this._map=this._geometryService=this._measureGraphics=this._measureGraphic=this._tempGraphic=null},setTool:function(a,b){this.previousTool=this.activeTool||null;this._polylineGraphics=[];this._resetToolState();this._polygonGraphic&&(this._map.graphics.remove(this._polygonGraphic),
this._polygonGraphic=null);var c=n.byNode(this._buttonDijits[a].domNode).checked;w.set(this._unitDropDown.domNode,"visibility","visible");n.byNode(this._buttonDijits.area.domNode).set("checked",!1);n.byNode(this._buttonDijits.distance.domNode).set("checked",!1);n.byNode(this._buttonDijits.location.domNode).set("checked",!1);if(!0===b||!1===b)c=b;n.byNode(this._buttonDijits[a].domNode).set("checked",c);this._toggleLocationResultsTable(!1,!0);c?(this.activeTool=a,(this._dblClickZoom=this._map.isDoubleClickZoom)&&
this._map.disableDoubleClickZoom(),"area"===a?this._setupAreaTool():"distance"===a?this._setupDistanceTool():"location"===a&&this._setupLocationTool(),this._map.snappingManager&&(this._map.snappingManager._startSelectionLayerQuery(),this._map.snappingManager._setUpSnapping())):(this.activeTool=null,w.set(this._unitDropDown.domNode,"visibility","hidden"));if(this.activeTool!==this.previousTool)this.onToolChange(this.activeTool,this.getUnit(),this.previousTool)},measure:function(a){a&&this._measureCustomGeometry(a)},
clearResult:function(){var a=this._map,b;this.result=0;this.resultValue.setContent("\x26nbsp");for(b=0;b<this._measureGraphics.length;b++)a.graphics.remove(this._measureGraphics[b]);this._measureGraphic=this._locationGraphic=this._currentGeometry=null;this._measureGraphics=[];a.graphics.remove(this._tempGraphic);f.disconnect(this._mouseMoveMapHandler);this._mouseMoveMapHandler=null},show:function(){D.show(this.domNode)},hide:function(){D.hide(this.domNode)},showTool:function(a){w.set(this._buttonDijits[a].domNode,
"display","inline-block")},hideTool:function(a){w.set(this._buttonDijits[a].domNode,"display","none")},getTool:function(){if(this.activeTool)return{toolName:this.activeTool,unitName:this.getUnit()}},getUnit:function(){if("unit"!==this._unitDropDown.label)return this._unitDropDown.label},_setupLocationTool:function(){this._map.navigationManager.setImmediateClick(!0);this._measureGraphics=[];this._map.graphics.remove(this._locationGraphic);this._createLocationUnitList();"PCS"===this._map.cs&&(this._projectMapExtent(this._map.extent),
this._mapExtentChangeHandler=f.connect(this._map,"onExtentChange",h.hitch(this,this._projectMapExtent)));this._clickMapHandler=f.connect(this._map,"onClick",this,"_locationClickHandler");if("esriDegreeMinuteSeconds"===this.currentLocationUnit||"esriDecimalDegrees"===this.currentLocationUnit)this._mouseMoveMapHandler=f.connect(this._map,"onMouseMove",this,"_locationMoveHandler")},_locationButtonToggle:function(){this.clearResult();this.setTool("location")},_measureCustomPoint:function(a){this.setTool("location",
!0);"Web Mercator"===this._map.cs&&a.spatialReference!==this._map.spatialReference&&(a=d.geographicToWebMercator(a));this._measureGraphic=new x;this._measureGraphic.setSymbol(this._pointSymbol);this._measureGraphic.setGeometry(a);this._measureGraphics.push(this._measureGraphic);this._map.graphics.add(this._measureGraphic);this._currentGeometry=a;this._calculateLocation(a,!0)},_calculateLocation:function(a,b){var c=!("esriDegreeMinuteSeconds"===this.currentLocationUnit||"esriDecimalDegrees"===this.currentLocationUnit);
c&&this._mouseMoveMapHandler&&(f.disconnect(this._mouseMoveMapHandler),this._mouseMoveMapHandler=null);a=h.clone(a);if(b){if("Web Mercator"!==this.map.cs&&this.map.spatialReference&&4326!==this.map.spatialReference.wkid){this._projectLocation(a,c);return}this._updateMarkerLocation(a.x,a.y)}a=this._getGCSLocation(a);this._advancedLocationDisplayHandler(a,c,b)},_projectLocation:function(a,b){this._geometryService.project([a],new P({wkid:4326}),h.hitch(this,function(c){this._advancedLocationDisplayHandler(c[0],
b,!0)}),h.hitch(this,function(c){console.log(this._gsErrorMsg,c)}))},_advancedLocationDisplayHandler:function(a,b,c){b?this._updateGeocoordinateStringLocation({coordinates:[[a.x,a.y]],sr:{wkid:4326},conversionType:this._unitStrings[this.currentLocationUnit]},a):(b=this._calculateXY(a.x,a.y),c?(this._updateClickLocation(b[0],b[1]),this.onMeasureEnd(this.activeTool,a,[b[0],b[1]],this.getUnit())):this._updateMouseLocation(b[0],b[1]))},_updateMarkerLocation:function(a,b){this.markerLocationX=a;this.markerLocationY=
b},_updateMouseLocation:function(a,b){this.mouseLongitude.innerHTML=a;this.mouseLatitude.innerHTML=b},_updateClickLocation:function(a,b){this._updateMouseLocation(a,b);this.markerLongitude.innerHTML=a;this.markerLatitude.innerHTML=b},_updateGeocoordinateStringLocation:function(a,b){this.resultValue.setContent("\x26nbsp");this._geometryService.toGeoCoordinateString(a,h.hitch(this,function(c){clearTimeout(this._calcTimer);c?(this.resultValue.setContent(c[0]),this.onMeasureEnd(this.activeTool,b,c,this.getUnit())):
(this.resultValue.setContent(this._gsErrorMsg),this.onMeasureEnd(this.activeTool,null,null,this.getUnit()))}));clearTimeout(this._calcTimer);this._calcTimer=setTimeout(h.hitch(this,function(){this.resultValue.setContent(this._calculatingMsg)},1E3))},_switchLocationUnit:function(a){n.byNode(this._unitDropDown.domNode).set("label",this._unitStrings[a]);this.currentLocationUnit=a;f.disconnect(this._mouseMoveMapHandler);this._mouseMoveMapHandler=null;this.onUnitChange(this._unitStrings[a],this.activeTool);
if("esriDegreeMinuteSeconds"===a||"esriDecimalDegrees"===a)this._mouseMoveMapHandler=f.connect(this._map,"onMouseMove",this,"_locationMoveHandler"),this._toggleLocationResultsTable(!0,!1),this._locationGraphic&&this._calculateLocation(this._locationGraphic.geometry,!0);else if(this._toggleLocationResultsTable(!1,!1),null!==this.resultValue&&(null!==this.markerLocationX||null!==this.markerLocationY)&&this._locationGraphic){var b=this._getGCSLocation(this._locationGraphic.geometry);this._updateGeocoordinateStringLocation({coordinates:[[b.x,
b.y]],sr:{wkid:4326},conversionType:this._unitStrings[a]},this._locationGraphic.geometry)}},_toggleLocationResultsTable:function(a,b){b&&(this.resultValue.setContent("\x26nbsp"),this.markerLongitude.innerHTML="---",this.markerLatitude.innerHTML="---",this.mouseLongitude.innerHTML="---",this.mouseLatitude.innerHTML="---");a?(D.show(this.resultTable.domNode),D.hide(this.resultValueContainer.domNode)):(D.hide(this.resultTable.domNode),D.show(this.resultValueContainer.domNode),f.disconnect(this._mouseMoveMapHandler));
"PCS"===this._map.cs&&D.hide(this._mouseRow)},_setupDistanceTool:function(){this._map.navigationManager.setImmediateClick(!0);"PCS"===this._map.cs&&(this._projectMapExtent(this._map.extent),this._mapExtentChangeHandler=f.connect(this._map,"onExtentChange",this,"_projectMapExtent"));this._inputPoints=[];this._createDistanceUnitList();this._mouseClickMapHandler=f.connect(this._map,"onClick",this,"_measureDistanceMouseClickHandler");this._doubleClickMapHandler=f.connect(this._map,"onDblClick",this,"_measureDistanceDblClickHandler")},
_distanceButtonToggle:function(){this.clearResult();this.setTool("distance")},_measureCustomDistance:function(a){if(1<a.paths[0].length){this.setTool("distance",!0);this._inputPoints=[];r.forEach(a.paths[0],h.hitch(this,function(c,e){this._inputPoints.push(c);var l=new x(new g(c[0],c[1],a.spatialReference),this._pointSymbol);this._measureGraphics.push(l);this._map.graphics.add(l);0!==e&&(this.result+=this._geodesicDistance(c,a.paths[0][e-1]))}));this._measureGraphic=new x;this._measureGraphic.setSymbol(this._lineSymbol);
this._measureGraphics.push(this._measureGraphic);var b=this._densifyGeometry(a);this._measureGraphic.setGeometry(b);this._map.graphics.add(this._measureGraphic);this._inputPoints=[];b=this._outputResult(this.result,this.getUnit());this._currentGeometry=a;this.onMeasureEnd(this.activeTool,a,b,this.getUnit())}},_showDistance:function(a){a&&this._outputResult(a,n.byNode(this._unitDropDown.domNode).label)},_setupAreaTool:function(){this._map.navigationManager.setImmediateClick(!0);this._inputPoints=[];
this._createAreaUnitList();this._tempGraphic=new x;this._tempGraphic._isSnapTarget=!1;this._tempGraphic.setSymbol(this._areaLineSymbol);this._tempGraphic.setGeometry(new k(this._map.spatialReference));this._map.graphics.add(this._tempGraphic);"PCS"===this._map.cs&&(this._geometryAreaHandler=f.connect(this._geometryService,"onAreasAndLengthsComplete",this,"_outputArea"));this._mouseClickMapHandler=f.connect(this._map,"onClick",this,"_measureAreaMouseClickHandler");this._doubleClickMapHandler=f.connect(this._map,
"onDblClick",this,"_measureAreaDblClickHandler")},_areaButtonToggle:function(){this.clearResult();this.setTool("area")},_generatePolygonFromPaths:function(){var a=[];r.forEach(this._polylineGraphics,h.hitch(this,function(e){r.forEach(e.geometry.paths,h.hitch(this,function(l){r.forEach(l,h.hitch(this,function(u){a.push(u)}))}))}));a.push(a[0]);var b=new t(this._map.spatialReference);b.addRing(a);b=this._densifyGeometry(b);var c=new x;c.setGeometry(b);c.setSymbol(this._borderlessFillSymbol);this._measureGraphic=
c;this._measureGraphics.push(c);return c},_getArea:function(a){var b=[],c=new R;c.areaUnit=T.UNIT_SQUARE_METERS;c.calculationType="geodesic";t.prototype.isSelfIntersecting(a)?this._geometryService.simplify([a],h.hitch(this,function(e){r.forEach(e,h.hitch(this,function(u){"PCS"===this._map.cs?(c.polygons=e,this._geometryService.areasAndLengths(c)):("Web Mercator"===this._map.cs&&(u=d.webMercatorToGeographic(u)),b.push(u))}));var l=z.geodesicAreas(b,F.SQUARE_METERS);this._showArea(l[0])})):("Web Mercator"===
this._map.cs&&(a=d.webMercatorToGeographic(a)),b.push(a),"PCS"===this._map.cs?(c.polygons=b,this._geometryService.areasAndLengths(c)):(a=z.geodesicAreas(b,F.SQUARE_METERS),this._showArea(Math.abs(a[0]))))},_outputArea:function(a){this._showArea(Math.abs(a.areas[0]))},_showArea:function(a){if(a)if(this.result=a,a=n.byNode(this._unitDropDown.domNode).label,a=this._outputResult(this.result,a),this._mouseMoveMapHandler)this.onMeasure(this.activeTool,this._currentGeometry,a,this.getUnit(),null);else this.onMeasureEnd(this.activeTool,
this._currentGeometry,a,this.getUnit())},_measureCustomArea:function(a){this.setTool("area",!0);this._inputPoints=[];var b=this._densifyGeometry(a);this._currentGeometry=a;this._measureGraphic=new x;this._measureGraphic.setGeometry(b);this._measureGraphic.setSymbol(this._fillSymbol);this._measureGraphics.push(this._measureGraphic);this._map.graphics.add(this._measureGraphic);this._getArea(a);this._inputPoints=[]},_resetToolState:function(){var a=this._map;a.navigationManager.setImmediateClick(!1);
this._dblClickZoom&&a.enableDoubleClickZoom();this._inputPoints=[];f.disconnect(this._mouseClickMapHandler);f.disconnect(this._mouseMoveMapHandler);f.disconnect(this._doubleClickMapHandler);f.disconnect(this._mouseDragMapHandler);f.disconnect(this._clickMapHandler);f.disconnect(this._mapExtentChangeHandler);f.disconnect(this._geometryAreaHandler);this._mouseClickMapHandler=this._mouseMoveMapHandler=this._doubleClickMapHandler=this._mouseDragMapHandler=this._clickMapHandler=this._mapExtentChangeHandler=
this._geometryAreaHandler=null;a.snappingManager&&a.snappingManager._snappingGraphic&&a.graphics.remove(a.snappingManager._snappingGraphic);this._map.snappingManager&&(this._map.snappingManager._stopSelectionLayerQuery(),this._map.snappingManager._killOffSnapping());this._unitDropDown._opened&&this._unitDropDown.closeDropDown()},_measureCustomGeometry:function(a){this.clearResult();switch(a.type){case "point":this._measureCustomPoint(a);break;case "polyline":this._measureCustomDistance(a);break;case "polygon":this._measureCustomArea(a)}},
_densifyGeometry:function(a){var b=this._map.cs,c=z.getSpheroidInfo(a.spatialReference).radius*this._densificationRatio;"Web Mercator"===b?(a=d.webMercatorToGeographic(a),c=z.geodesicDensify(a,c),c=d.geographicToWebMercator(c)):c="PCS"===b?a:z.geodesicDensify(a,c);return c},_geodesicDistance:function(a,b){var c=new k(this._map.spatialReference);"PCS"===this._map.cs&&(a=this._getGCSLocation(a),b=this._getGCSLocation(b));c.addPath([a,b]);"Web Mercator"===this._map.cs&&(c=d.webMercatorToGeographic(c));
return z.geodesicLengths([c],F.METERS)[0]},_calculateXY:function(a,b){var c=C.widgets.measurement,e=this._map.getScale();if(this.getUnit()===c.NLS_decimal_degrees){var l=500<=e?6:500>e&&50<=e?7:50>e&&5<=e?8:9;var u=a.toFixed(l);this._map.spatialReference._isWrappable()||(u=this._roundX(u));u=E.format(u);l=E.format(this._roundY(b.toFixed(l)))}else if(this.getUnit()===c.NLS_deg_min_sec){var A=c=!1;l=9E4<=e?0:9E4>e&&9E3<=e?1:9E3>e&&900<=e?2:900>e&&90<e?3:4;0>a&&(c=!0,a=Math.abs(a));0>b&&(A=!0,b=Math.abs(b));
b=this._roundY(b);this._map.spatialReference._isWrappable()||(a=this._roundX(a));var G=Math.floor(b)+"\u00b0";u=Math.floor(a)+"\u00b0";var Q=Math.floor(this._getDegreeMinutes(b))+"'";e=Math.floor(this._getDegreeMinutes(a))+"'";b=E.format(this._getDegreeSeconds(b).toFixed(l))+'"';a=E.format(this._getDegreeSeconds(a).toFixed(l))+'"';l=G+Q+b;u=u+e+a;c&&(u="-"+u);A&&(l="-"+l)}return[u,l]},_getDegreeMinutes:function(a){return 60*(a-Math.floor(a))},_getDegreeSeconds:function(a){return 60*(60*(a-Math.floor(a))-
Math.floor(60*(a-Math.floor(a))))},_roundY:function(a){90<a?a=90:-90>a&&(a=-90);return a},_roundX:function(a){180<a?a=180:-180>a&&(a=-180);return a},_getGCSLocation:function(a){a=h.clone(a);var b=this._map,c=b.extent,e=b._newExtent;"Web Mercator"===b.cs?a=d.webMercatorToGeographic(a):"PCS"===b.cs?e&&(a=new g((a.x-c.xmin)*Math.abs((e.xmax-e.xmin)/(c.xmax-c.xmin))+e.xmin,(a.y-c.ymin)*Math.abs((e.ymax-e.ymin)/(c.ymax-c.ymin))+e.ymin,b.spatialReference)):a=a.normalize();return a},_projectMapExtent:function(a){a=
new x(a);var b=new P({wkid:4326});this._geometryService.project([a.geometry],b,h.hitch(this,function(c){if(!this._mouseMoveMapHandler&&"location"===this.activeTool){if("esriDegreeMinuteSeconds"===this.currentLocationUnit||"esriDecimalDegrees"===this.currentLocationUnit)this._mouseMoveMapHandler=f.connect(this._map,"onMouseMove",h.hitch(this,this._locationMoveHandler));this._mouseMoveMapHandler=f.connect(this._map,"onMouseMove",h.hitch(this,this._locationMoveHandler))}this._map._newExtent=c[0]}))},
_checkCS:function(a){if(a.wkid)return 3857===a.wkid||102100===a.wkid||102113===a.wkid?"Web Mercator":W.isDefined(X[a.wkid])?"PCS":"GCS";if(a.wkt)return-1!==a.wkt.indexOf("WGS_1984_Web_Mercator")?"Web Mercator":0===a.wkt.indexOf("PROJCS")?"PCS":"GCS"},_switchUnit:function(a){"distance"===this.activeTool?this.currentDistanceUnit=a:"area"===this.activeTool?this.currentAreaUnit=a:"location"===this.activeTool&&(this.currentLocationUnit=a);n.byNode(this._unitDropDown.domNode).set("label",this._unitStrings[a]);
if(null!==this.result){var b=this._outputResult(this.result,this._unitStrings[a]);this.onUnitChange(this._unitStrings[a],this.activeTool);if(null!==this._currentGeometry||null!==this._measureGraphic)if(a=this._currentGeometry||this._measureGraphic.geometry,this._mouseMoveMapHandler)this.onMeasure(this.activeTool,a,b,this.getUnit(),null);else this.onMeasureEnd(this.activeTool,a,b,this.getUnit())}},_setupDictionaries:function(){var a=C.widgets.measurement;this._unitDictionary[a.NLS_length_meters]=1;
this._unitDictionary[a.NLS_length_kilometers]=1E3;this._unitDictionary[a.NLS_length_feet]=.3048;this._unitDictionary[a.NLS_length_miles]=1609.344;this._unitDictionary[a.NLS_length_yards]=.9144;this._unitDictionary[a.NLS_length_nautical_miles]=1852;this._unitDictionary[a.NLS_length_miles_us]=1609.347218694438;this._unitDictionary[a.NLS_length_feet_us]=.3048006096012192;this._unitDictionary[a.NLS_length_yards_us]=.9144018288036576;this._unitDictionary[a.NLS_area_sq_meters]=1;this._unitDictionary[a.NLS_area_sq_kilometers]=
1E6;this._unitDictionary[a.NLS_area_sq_feet]=.09290304;this._unitDictionary[a.NLS_area_acres]=4046.8564224;this._unitDictionary[a.NLS_area_sq_miles]=2589988.110336;this._unitDictionary[a.NLS_area_hectares]=1E4;this._unitDictionary[a.NLS_area_sq_yards]=.83612736;this._unitDictionary[a.NLS_area_acres_us]=4046.872609874252;this._unitDictionary[a.NLS_area_sq_miles_us]=2589998.470319522;this._unitDictionary[a.NLS_area_sq_feet_us]=.09290341161327487;this._unitDictionary[a.NLS_area_sq_yards_us]=.8361307045194736;
this._unitStrings={esriMiles:a.NLS_length_miles,esriKilometers:a.NLS_length_kilometers,esriFeet:a.NLS_length_feet,esriFeetUS:a.NLS_length_feet_us,esriMeters:a.NLS_length_meters,esriYards:a.NLS_length_yards,esriNauticalMiles:a.NLS_length_nautical_miles,esriMilesUS:a.NLS_length_miles_us,esriYardsUS:a.NLS_length_yards_us,esriAcres:a.NLS_area_acres,esriSquareMiles:a.NLS_area_sq_miles,esriSquareKilometers:a.NLS_area_sq_kilometers,esriHectares:a.NLS_area_hectares,esriSquareYards:a.NLS_area_sq_yards,esriSquareFeet:a.NLS_area_sq_feet,
esriSquareFeetUS:a.NLS_area_sq_feet_us,esriSquareMeters:a.NLS_area_sq_meters,esriAcresUS:a.NLS_area_acres_us,esriSquareMilesUS:a.NLS_area_sq_miles_us,esriSquareYardsUS:a.NLS_area_sq_yards_us,esriDecimalDegrees:a.NLS_decimal_degrees,esriDegreeMinuteSeconds:a.NLS_deg_min_sec,esriMGRS:a.NLS_MGRS,esriUSNG:a.NLS_USNG,esriUTM:a.NLS_UTM,esriGARS:a.NLS_GARS,esriGeoRef:a.NLS_GeoRef,esriDDM:a.NLS_DDM,esriDD:a.NLS_DD};this._locationUnitStrings=[a.NLS_decimal_degrees,a.NLS_deg_min_sec,a.NLS_MGRS,a.NLS_USNG,a.NLS_UTM,
a.NLS_GeoRef,a.NLS_GARS];this._locationUnitStringsLong="esriDecimalDegrees esriDegreeMinuteSeconds esriMGRS esriUSNG esriUTM esriGeoRef esriGARS".split(" ");this._distanceUnitStrings=[a.NLS_length_miles,a.NLS_length_kilometers,a.NLS_length_feet,a.NLS_length_feet_us,a.NLS_length_meters,a.NLS_length_yards,a.NLS_length_nautical_miles];this._distanceUnitStringsLong="esriMiles esriKilometers esriFeet esriFeetUS esriMeters esriYards esriNauticalMiles".split(" ");this._areaUnitStrings=[a.NLS_area_acres,
a.NLS_area_sq_miles,a.NLS_area_sq_kilometers,a.NLS_area_hectares,a.NLS_area_sq_yards,a.NLS_area_sq_feet,a.NLS_area_sq_feet_us,a.NLS_area_sq_meters];this._areaUnitStringsLong="esriAcres esriSquareMiles esriSquareKilometers esriHectares esriSquareYards esriSquareFeet esriSquareFeetUS esriSquareMeters".split(" ");this._buttonDijits={area:this._areaButton,distance:this._distanceButton,location:this._locationButton};n.byNode(this._distanceButton.domNode).setLabel(a.NLS_distance);n.byNode(this._areaButton.domNode).setLabel(a.NLS_area);
n.byNode(this._locationButton.domNode).setLabel(a.NLS_location);n.byNode(this.resultLabel.domNode).setContent(a.NLS_resultLabel)},onToolChange:function(){},onUnitChange:function(){},onMeasureStart:function(){},onMeasure:function(){},onMeasureEnd:function(){},_measureAreaMouseClickHandler:function(a){if(this._map.snappingManager)var b=this._map.snappingManager._snappingPoint;b=b||a.mapPoint;this._inputPoints.push(b);this._currentStartPt=b;if(1===this._inputPoints.length){this._tempGraphic.setGeometry(new k(this._map.spatialReference));
for(a=0;a<this._measureGraphics.length;a++)this._map.graphics.remove(this._measureGraphics[a]);this._measureGraphics=[];this.result=0;this._outputResult(this.result,C.widgets.measurement.NLS_area_sq_meters);this._mouseMoveMapHandler=f.connect(this._map,"onMouseMove",this,"_measureAreaMouseMoveHandler");this.onMeasureStart(this.activeTool,this.getUnit())}this._measureGraphic=new x;this._measureGraphic.setSymbol(this._areaLineSymbol);this._measureGraphics.push(this._measureGraphic);if(1<this._inputPoints.length){a=
new k(this._map.spatialReference);a.addPath([this._inputPoints[this._inputPoints.length-2],b]);var c=new k(this._map.spatialReference);c.addPath([this._inputPoints[0],b]);b=this._densifyGeometry(a);c=this._densifyGeometry(c);this._tempGraphic.setGeometry(c);this._measureGraphic.setGeometry(b);this._map.graphics.add(this._measureGraphic);b=new x;b.setGeometry(a);this._polylineGraphics.push(b);if(2<this._inputPoints.length){b=new t(this._map.spatialReference);c=[];for(a=0;a<this._inputPoints.length;a++)c.push([this._inputPoints[a].x,
this._inputPoints[a].y]);c.push([this._inputPoints[0].x,this._inputPoints[0].y]);b.addRing(c);this._currentGeometry=b;this._polygonGraphic?(this._map.graphics.remove(this._polygonGraphic),this._polylineGraphics.push(this._tempGraphic),this._polygonGraphic=this._generatePolygonFromPaths(),this._map.graphics.add(this._polygonGraphic),this._measureGraphic=this._polygonGraphic,this._polylineGraphics.pop()):(this._polygonGraphic=this._generatePolygonFromPaths(),this._map.graphics.add(this._polygonGraphic));
this._getArea(b)}}else this._polygonGraphic&&(this._map.graphics.remove(this._polygonGraphic),this._polygonGraphic=null)},_measureAreaMouseMoveHandler:function(a){if(0<this._inputPoints.length){var b=new k(this._map.spatialReference);if(this._map.snappingManager)var c=this._map.snappingManager._snappingPoint;var e=c||a.mapPoint;b.addPath([this._currentStartPt,e]);a=this._densifyGeometry(b);this._tempGraphic.setGeometry(a)}1<this._inputPoints.length&&(a=new k(this._map.spatialReference),a.addPath([e,
this._inputPoints[0]]),e=this._densifyGeometry(a),this._tempGraphic.setGeometry(this._tempGraphic.geometry.addPath(e.paths[0])))},_measureAreaDblClickHandler:function(a){f.disconnect(this._mouseMoveMapHandler);this._mouseMoveMapHandler=null;"touch"===this._map.navigationManager.eventModel&&q("ios")&&this._measureAreaMouseClickHandler(a);a=new t(this._map.spatialReference);var b=[],c;for(c=0;c<this._inputPoints.length;c++)b.push([this._inputPoints[c].x,this._inputPoints[c].y]);b.push([this._inputPoints[0].x,
this._inputPoints[0].y]);a.addRing(b);this._inputPoints=[];this._currentGeometry=a;this._polygonGraphic&&(this._map.graphics.remove(this._polygonGraphic),this._polylineGraphics.push(this._tempGraphic),this._polygonGraphic=this._generatePolygonFromPaths(),this._map.graphics.add(this._polygonGraphic));this._getArea(a);this._polylineGraphics=[]},_measureDistanceMouseClickHandler:function(a){if(this._map.snappingManager)var b=this._map.snappingManager._snappingPoint;a=b||a.mapPoint;this._inputPoints.push(a);
this._currentStartPt=a;if(1===this._inputPoints.length){for(b=0;b<this._measureGraphics.length;b++)this._map.graphics.remove(this._measureGraphics[b]);this._map.graphics.remove(this._tempGraphic);this._measureGraphics=[];this.result=0;this._outputResult(this.result,C.widgets.measurement.NLS_length_meters);this._tempGraphic=new x;this._tempGraphic._isSnapTarget=!1;this._tempGraphic.setSymbol(this._lineSymbol);this._map.graphics.add(this._tempGraphic);this._mouseMoveMapHandler=f.connect(this._map,"onMouseMove",
this,"_measureDistanceMouseMoveHandler");this.onMeasureStart(this.activeTool,this.getUnit())}this._tempGraphic.setGeometry(new k(this._map.spatialReference));b=new x;b.setSymbol(this._pointSymbol);b.setGeometry(a);this._measureGraphics.push(b);this._map.graphics.add(b);if(1<this._inputPoints.length){this._measureGraphic=new x;this._measureGraphic.setSymbol(this._lineSymbol);this._measureGraphics.push(this._measureGraphic);b=new k(this._map.spatialReference);b.addPath([this._inputPoints[this._inputPoints.length-
2],a]);var c=this._densifyGeometry(b);this._measureGraphic.setGeometry(c);this._map.graphics.add(this._measureGraphic);"PCS"===this._map.cs?this._geometryServiceLength(b,!1):(c=this._geodesicDistance(this._inputPoints[this._inputPoints.length-2],a),b=this._outputResult(c,this.getUnit()),this.result+=c,this._showDistance(this.result),c=this._outputResult(this.result,this.getUnit()),this.onMeasure(this.activeTool,a,c,this.getUnit(),b))}else b.setSymbol(this._pointSymbol)},_measureDistanceMouseMoveHandler:function(a){if(0<
this._inputPoints.length){var b=new k(this._map.spatialReference);if(this._map.snappingManager)var c=this._map.snappingManager._snappingPoint;a=c||a.mapPoint;b.addPath([this._currentStartPt,a]);b=this._densifyGeometry(b);this._tempGraphic.setGeometry(b);"PCS"!==this._map.cs&&(c=this._geodesicDistance(this._currentStartPt,a),b=this._outputResult(c,this.getUnit()),c+=this.result,this._showDistance(c),c=this._outputResult(c,this.getUnit()),this.onMeasure(this.activeTool,a,c,this.getUnit(),b))}},_measureDistanceDblClickHandler:function(a){f.disconnect(this._mouseMoveMapHandler);
this._mouseMoveMapHandler=null;"touch"===this._map.navigationManager.eventModel&&q("ios")&&this._measureDistanceMouseClickHandler(a);a=new k(this._map.spatialReference);a.addPath(this._inputPoints);this._currentGeometry=a;var b=this._densifyGeometry(a);this._measureGraphic.geometry=b;"PCS"===this._map.cs?this._geometryServiceLength(a,!0):(this._inputPoints=[],this.onMeasureEnd(this.activeTool,a,this._outputResult(this.result,this.getUnit()),this.getUnit()))},_geometryServiceLength:function(a,b){var c=
new S;c.polylines=[a];c.lengthUnit=9001;c.calculationType="geodesic";this._geometryService.lengths(c,h.hitch(this,function(e){e=e.lengths[0];if(b)this.result=e,this._showDistance(this.result),this._inputPoints=[],this.onMeasureEnd(this.activeTool,a,this._outputResult(this.result,this.getUnit()),this.getUnit());else{var l=this._outputResult(e,this.getUnit());this.result+=e;this._showDistance(this.result);this.onMeasure(this.activeTool,a,this._outputResult(this.result,this.getUnit()),this.getUnit(),
l)}}))},_locationClickHandler:function(a){if(this._map.snappingManager)var b=this._map.snappingManager._snappingPoint;a=b||a.mapPoint;this._locationButtonToggle();this._locationGraphic=new x;this._locationGraphic.setGeometry(a);this._locationGraphic.setSymbol(this._pointSymbol);this._map.graphics.add(this._locationGraphic);this._measureGraphics.push(this._locationGraphic);this._calculateLocation(a,!0)},_locationMoveHandler:function(a){if(this._map.snappingManager)var b=this._map.snappingManager._snappingPoint;
this._calculateLocation(b||a.mapPoint,!1)},_outputResult:function(a,b){a/=this._unitDictionary[b];0===a?this.resultValue.setContent("\x26nbsp"):1E6<a?this.resultValue.setContent(E.format(a.toPrecision(9),{pattern:this.numberPattern})+" "+b):10>a?this.resultValue.setContent(E.format(a.toFixed(2),{pattern:this.numberPattern+"0"})+" "+b):this.resultValue.setContent(E.format(a.toFixed(2),{pattern:this.numberPattern})+" "+b);return a},_createDistanceUnitList:function(){var a=new J({style:"display: none;"});
r.forEach(this._distanceUnitStrings,h.hitch(this,function(c,e){c=new K({label:c,onClick:h.hitch(this,function(){this._switchUnit(this._distanceUnitStringsLong[e])})});c.set("class","unitDropDown");a.addChild(c)}));n.byNode(this._unitDropDown.domNode).set("dropDown",a);if(this.currentDistanceUnit){var b=this._unitStrings[this.currentDistanceUnit];n.byNode(this._unitDropDown.domNode).set("label",b)}else b=this._unitStrings[this._defaultDistanceUnit],n.byNode(this._unitDropDown.domNode).set("label",
b),this.currentDistanceUnit=this._defaultDistanceUnit},_createAreaUnitList:function(){var a=new J({style:"display: none;"});r.forEach(this._areaUnitStrings,h.hitch(this,function(c,e){c=new K({label:c,onClick:h.hitch(this,function(){this._switchUnit(this._areaUnitStringsLong[e])})});c.set("class","unitDropDown");a.addChild(c)}));n.byNode(this._unitDropDown.domNode).set("dropDown",a);if(this.currentAreaUnit){var b=this._unitStrings[this.currentAreaUnit];n.byNode(this._unitDropDown.domNode).set("label",
b)}else b=this._unitStrings[this._defaultAreaUnit],n.byNode(this._unitDropDown.domNode).set("label",b),this.currentAreaUnit=this._defaultAreaUnit},_createLocationUnitList:function(){var a=this._locationUnitStrings;var b=new J({style:"display: none;"});if(null===this._geometryService||!1===this.advancedLocationUnits)a=a.slice(0,2);r.forEach(a,h.hitch(this,function(c,e){c=new K({label:c,onClick:h.hitch(this,function(){this._switchLocationUnit(this._locationUnitStringsLong[e])})});c.set("class","unitDropDown");
b.addChild(c)}));n.byNode(this._unitDropDown.domNode).set("dropDown",b);this.currentLocationUnit||(this.currentLocationUnit=this._defaultLocationUnit);a=this._unitStrings[this.currentLocationUnit];n.byNode(this._unitDropDown.domNode).set("label",a);"esriDegreeMinuteSeconds"!==this.currentLocationUnit&&"esriDecimalDegrees"!==this.currentLocationUnit||this._toggleLocationResultsTable(!0,!1)},_drawPointGraphics:function(a){var b=this._pointSymbol,c=this._defaultCustomPointSymbolWidth,e=this._defaultCustomPointSymbolHeight;
a=H.create("div",{"class":"esriLocationResultSymbol"},a);a=I.createSurface(a,c,e);if(9>q("ie")){var l=a.getEventSource();w.set(l,"position","relative");w.set(l.parentNode,"position","relative")}b=b.getShapeDescriptors();try{var u=a.createShape(b.defaultShape).setFill(b.fill).setStroke(b.stroke)}catch(Q){a.clear();a.destroy();return}var A=u.getBoundingBox();b=A.width;l=A.height;var G=-(A.x+b/2);A=-(A.y+l/2);a=a.getDimensions();a={dx:G+a.width/2,dy:A+a.height/2};if(b>c||l>e)G=b/c>l/e,c=((G?c:e)-5)/
(G?b:l),h.mixin(a,{xx:c,yy:c});u.applyTransform(a)}});q("extend-esri")&&h.setObject("dijit.Measurement",p,U);return p})},"esri/tasks/AreasAndLengthsParameters":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/_base/json dojo/has ../kernel".split(" "),function(v,p,h,r,f,B){v=v(null,{declaredClass:"esri.tasks.AreasAndLengthsParameters",polygons:null,lengthUnit:null,areaUnit:null,calculationType:null,toJson:function(){var m=h.map(this.polygons,function(w){return w.toJson()}),
q={};q.polygons=r.toJson(m);m=this.polygons[0].spatialReference;q.sr=m.wkid?m.wkid:r.toJson(m.toJson());this.lengthUnit&&(q.lengthUnit=this.lengthUnit);this.areaUnit&&(p.isString(this.areaUnit)?q.areaUnit=r.toJson({areaUnit:this.areaUnit}):q.areaUnit=this.areaUnit);this.calculationType&&(q.calculationType=this.calculationType);return q}});f("extend-esri")&&p.setObject("tasks.AreasAndLengthsParameters",v,B);return v})},"esri/tasks/LengthsParameters":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/_base/json dojo/has ../kernel".split(" "),
function(v,p,h,r,f,B){v=v(null,{declaredClass:"esri.tasks.LengthsParameters",polylines:null,lengthUnit:null,geodesic:null,calculationType:null,toJson:function(){var m=h.map(this.polylines,function(w){return w.toJson()}),q={};q.polylines=r.toJson(m);m=this.polylines[0].spatialReference;q.sr=m.wkid?m.wkid:r.toJson(m.toJson());this.lengthUnit&&(q.lengthUnit=this.lengthUnit);this.geodesic&&(q.geodesic=this.geodesic);this.calculationType&&(q.calculationType=this.calculationType);return q}});f("extend-esri")&&
p.setObject("tasks.LengthsParameters",v,B);return v})},"widgets/Measurement/_build-generate_module":function(){define(["dojo/text!./Widget.html","dojo/text!./css/style.css","dojo/i18n!./nls/strings"],function(){})},"url:esri/dijit/templates/Measurement.html":"\x3cdiv class\x3d\"esriMeasurement\"\x3e\r\n  \x3cdiv dojoType\x3d'dijit.layout.ContentPane' class\x3d'esriMeasurementButtonContainer'\x3e\r\n    \x3cdiv dojoType\x3d'dijit.form.ToggleButton' baseClass\x3d'esriButton' dojoAttachPoint\x3d'_areaButton' iconClass\x3d'areaIcon' showLabel\x3d'false' dojoAttachEvent\x3d'onClick:_areaButtonToggle'\x3e\x3c/div\x3e\r\n    \x3cdiv dojoType\x3d'dijit.form.ToggleButton' baseClass\x3d'esriButton' dojoAttachPoint\x3d'_distanceButton' iconClass\x3d'distanceIcon' showLabel\x3d'false' dojoAttachEvent\x3d'onClick:_distanceButtonToggle'\x3e\x3c/div\x3e\r\n    \x3cdiv dojoType\x3d'dijit.form.ToggleButton' baseClass\x3d'esriButton' dojoAttachPoint\x3d'_locationButton' iconClass\x3d'locationIcon' showLabel\x3d'false' dojoAttachEvent\x3d'onClick:_locationButtonToggle'\x3e\x3c/div\x3e\r\n    \x3cdiv class\x3d\"esriMeasurementSeparator\"\x3e|\x3c/div\x3e\r\n    \x3cbutton dojoType\x3d'dijit.form.DropDownButton' baseClass\x3d'esriToggleButton' dojoAttachPoint\x3d'_unitDropDown' label\x3d'unit' value\x3d'unit' style\x3d'visibility:hidden;'\x3e\x3c/button\x3e\r\n  \x3c/div\x3e\r\n  \x3cdiv dojoType\x3d'dijit.layout.ContentPane' dojoAttachPoint\x3d'resultLabel' class\x3d'resultLabel esriMeasurementResultLabel'\x3e\x3c/div\x3e\r\n  \x3cdiv dojoType\x3d'dijit.layout.ContentPane' dojoAttachPoint\x3d'resultValueContainer' align\x3d'leading' class\x3d\"esriMeasurementResultValue\"\x3e\r\n    \x3cdiv dojoType\x3d'dijit.layout.ContentPane' dojoAttachPoint\x3d'resultValue' class\x3d'result'\x3e\x26nbsp;\x3c/div\x3e\r\n  \x3c/div\x3e\r\n  \x3cdiv dojoType\x3d'dijit.layout.ContentPane' dojoAttachPoint\x3d'resultTable' align\x3d'leading' class\x3d\"resultTable esriMeasurementTableContainer\" style\x3d\"display:none;\"\x3e\r\n    \x3ctable class\x3d\"esriMeasurementResultTable\"\x3e\r\n      \x3ctr\x3e\r\n        \x3ctd class\x3d\"esriMeasurementTableHeader\" colspan\x3d\"2\"\x3e${_NLS_Lat}\x3c/td\x3e\x3ctd class\x3d\"esriMeasurementTableHeader\"\x3e${_NLS_Lon}\x3c/td\x3e\r\n      \x3c/tr\x3e\r\n      \x3ctr class\x3d\"esriMeasurementTableRow\" dojoAttachPoint\x3d\"_mouseRow\"\x3e\r\n        \x3ctd dojoAttachPoint\x3d\"mouseCell\"\x3e\x3c/td\x3e\r\n        \x3ctd class\x3d\"esriMeasurementTableCell\"\x3e\r\n          \x3cspan dojoAttachPoint\x3d\"mouseLatitude\" dir\x3d'ltr'\x3e\x3c/span\x3e\r\n        \x3c/td\x3e\r\n        \x3ctd class\x3d\"esriMeasurementTableCell\"\x3e\r\n          \x3cspan dojoAttachPoint\x3d\"mouseLongitude\" dir\x3d'ltr'\x3e\x3c/span\x3e\r\n        \x3c/td\x3e\r\n      \x3c/tr\x3e\r\n      \x3ctr class\x3d\"esriMeasurementTableRow\"\x3e\r\n        \x3ctd dojoAttachPoint\x3d\"pinCell\"\x3e\x3c/td\x3e\r\n        \x3ctd class\x3d\"esriMeasurementTableCell\"\x3e\r\n          \x3cspan dojoAttachPoint\x3d\"markerLatitude\" dir\x3d'ltr'\x3e\x3c/span\x3e\r\n        \x3c/td\x3e\r\n        \x3ctd class\x3d\"esriMeasurementTableCell\"\x3e\r\n          \x3cspan dojoAttachPoint\x3d\"markerLongitude\" dir\x3d'ltr'\x3e\x3c/span\x3e\r\n        \x3c/td\x3e\r\n      \x3c/tr\x3e\r\n    \x3c/table\x3e\r\n  \x3c/div\x3e\r\n\x3c/div\x3e",
"url:widgets/Measurement/Widget.html":'\x3cdiv\x3e\r\n\t\x3cdiv data-dojo-attach-point\x3d"measurementDiv"\x3e\x3c/div\x3e\r\n\t\x3cdiv class\x3d"operations" onselectstart\x3d"return false;"\x3e\r\n\t  \x3cdiv role\x3d"button" class\x3d"jimu-btn jimu-state-disabled lastFocusNode"  data-dojo-attach-point\x3d"clearGraphicsBtn" data-dojo-attach-event\x3d"onclick:clearGraphics, onkeydown:clearGraphicsKeydown" tabindex\x3d"0"\x3e${jimuNls.common.clear}\x3c/div\x3e\r\n\t\x3c/div\x3e\r\n\x3c/div\x3e\r\n\r\n',
"url:widgets/Measurement/css/style.css":".jimu-widget-Measurement .operations{margin-top: 10px; text-align: center;}.jimu-widget-Measurement .operations .jimu-btn{padding: 0 18px; height: 32px; line-height: 33px; margin-right: 10px; margin-bottom: 10px; min-width: 10px;}.jimu-widget-frame.jimu-container .snapingLabel{position: absolute; left: 0; bottom: 0; font-size: smaller; padding: 5px 5px;}.jimu-rtl .jimu-widget-frame.jimu-container .snapingLabel{left: inherit; right: 0;}","*now":function(v){v(['dojo/i18n!*preload*widgets/Measurement/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 dojo/_base/lang dojo/aspect dojo/on dojo/keys dojo/Deferred dojo/_base/html jimu/LayerInfos/LayerInfos esri/layers/GraphicsLayer esri/layers/FeatureLayer esri/graphic jimu/dijit/LoadingIndicator dijit/_WidgetsInTemplateMixin jimu/BaseWidget jimu/portalUtils jimu/dijit/Message esri/units esri/dijit/Measurement jimu/utils esri/symbols/jsonUtils".split(" "),function(v,p,h,r,f,B,m,q,w,H,I,L,n,J,K,M,y,N,O,z){return v([J,n],{name:"Measurement",baseClass:"jimu-widget-Measurement",measurement:null,
_pcDef:null,toolName:null,currentFeatureLayer:null,linePicGraphicsLayer:null,linePicGraphics:[],isClose:!1,_objectIdName:"OBJECTID",_objectIdType:"esriFieldTypeOID",postMixInProperties:function(){this.inherited(arguments);this.jimuNls=window.jimuNls},startup:function(){if(!this.measurement&&!this._pcDef){this.inherited(arguments);this._isPCS="Web Mercator"!==this.map.cs&&this.map.spatialReference&&4326!==this.map.spatialReference.wkid;this._clearAbledLabel=this.clearGraphicsBtn.innerHTML;this._clearDisabledLabel=
this._clearAbledLabel+" "+window.jimuNls.common.disabled;var d=this.config.measurement;d.map=this.map;d.lineSymbol&&(d.lineSymbol=z.fromJson(d.lineSymbol));d.pointSymbol&&(d.pointSymbol=z.fromJson(d.pointSymbol));this._addSnappingTips();this._processConfig(d).then(p.hitch(this,function(g){this.measurement=new N(g,this.measurementDiv);this.own(h.after(this.measurement,"setTool",p.hitch(this,function(){this.measurement.activeTool?this.disableWebMapPopup():this.enableWebMapPopup()})));this.own(r(this.measurement,
"tool-change",p.hitch(this,this._toolChange)));this.own(r(this.measurement,"measure-start",p.hitch(this,this._onMeasureStart)));this.own(r(this.measurement,"measure-end",p.hitch(this,this._onMeasureEnd)));this.measurement.startup();this._initGraphicsLayers();this._hideToolsByConfig();this._initFirstFocusNode()}),p.hitch(this,function(g){new M({message:g.message||g})}))}},_addSnappingTips:function(){if(this.map.snappingManager){var d=document.createElement("div");d.className="snapingLabel";d.innerHTML=
this.jimuNls.snapping.pressStr+"\x3cb\x3e"+this.jimuNls.snapping.ctrlStr+"\x3c/b\x3e "+this.jimuNls.snapping.snapStr;this.domNode.parentNode.appendChild(d)}},_initGraphicsLayers:function(){this.config.isOperationalLayer||(this.currentFeatureLayer=new w,this.map.addLayer(this.currentFeatureLayer),this._setCurrentFeatureLayerVisible());this.linePicGraphicsLayer=new w;this.map.addLayer(this.linePicGraphicsLayer)},_clearAllGraphics:function(){this.currentFeatureLayer&&(this.currentFeatureLayer.clear(),
this.linePicGraphicsLayer&&(this.linePicGraphicsLayer.clear(),this.linePicGraphics=[]),m.addClass(this.clearGraphicsBtn,"jimu-state-disabled"),m.attr(this.clearGraphicsBtn,"aria-label",this._clearDisabledLabel))},_clearMapGraphics:function(d){var g=this.map.graphics;if("distance"===d){d=g.graphics;this.linePicGraphics=[];for(var k=0;k<d.length;k++){var t=d[k];"picturemarkersymbol"===(t.symbol&&t.symbol.type?t.symbol.type:null)&&(t=new I(t.geometry,t.symbol,null,null),this.linePicGraphics.push(t))}}g.clear()},
_onMeasureStart:function(){this._isPCS&&(this._isMeasureEnd=!1);this._clearAllGraphics();m.addClass(this.clearGraphicsBtn,"jimu-state-disabled");m.attr(this.clearGraphicsBtn,"aria-label",this._clearDisabledLabel)},_onMeasureEnd:function(d){if(this._isPCS&&"location"!==d.toolName){if(this._isMeasureEnd)return;this._isMeasureEnd=!0}if("location"!==d.toolName||!this._isPCS){this._clearMapGraphics(d.toolName);if("location"===d.toolName){this._clearAllGraphics();var g=this.measurement._pointSymbol}else if("distance"===
d.toolName){g=this.measurement._lineSymbol;for(var k=0;k<this.linePicGraphics.length;k++)this.linePicGraphicsLayer.add(this.linePicGraphics[k])}else g=this.measurement._fillSymbol;d=new I(d.geometry,g,{OBJECTID:1},null);this.currentFeatureLayer.add(d)}m.removeClass(this.clearGraphicsBtn,"jimu-state-disabled");m.attr(this.clearGraphicsBtn,"aria-label",this._clearAbledLabel)},_toolChange:function(d){this.toolName=d.toolName;this.isClose||(m.addClass(this.clearGraphicsBtn,"jimu-state-disabled"),m.attr(this.clearGraphicsBtn,
"aria-label",this._clearDisabledLabel),this._clearAllGraphics());this.isClose=!1;this.config.isOperationalLayer&&this.toolName&&this._checkOperateLayers(this.toolName)},_checkOperateLayers:function(d){this.currentFeatureLayer&&(this.map.removeLayer(this.currentFeatureLayer),this.currentFeatureLayer=null);var g={name:this.nls._widgetLabel,geometryType:"",fields:[{name:this._objectIdName,type:this._objectIdType,alias:this._objectIdName}]};"location"===d?g.geometryType="esriGeometryPoint":"distance"!==
d||this._polylineLayer?"area"!==d||this._polygonLayer||(g.geometryType="esriGeometryPolygon"):g.geometryType="esriGeometryPolyline";this.currentFeatureLayer=d=this._getFeatureLayer(g);this.linePicGraphicsLayer.setVisibility(!0);this._setCurrentFeatureLayerVisible();this._addLayerFromLayerInfos(d)},_getFeatureLayer:function(d){return new H({layerDefinition:d,featureSet:null})},_setCurrentFeatureLayerVisible:function(){this.own(r(this.currentFeatureLayer,"visibility-change",p.hitch(this,function(){this.linePicGraphicsLayer&&
this.linePicGraphicsLayer.setVisibility(this.currentFeatureLayer.visible)})))},_addLayerFromLayerInfos:function(d){var g=new L;g.placeAt(this.domNode);q.getInstance(this.map,this.map.itemInfo).then(p.hitch(this,function(k){this.domNode&&(g.destroy(),k.addFeatureCollection([d],this.label+"_"+d.name))}),p.hitch(this,function(k){g.destroy();console.error("Can not get LayerInfos instance",k)}))},_processConfig:function(d){this._pcDef=new B;d.defaultLengthUnit&&d.defaultAreaUnit?this._pcDef.resolve(d):
K.getUnits(this.appConfig.portalUrl).then(p.hitch(this,function(g){d.defaultAreaUnit="english"===g?y.SQUARE_MILES:y.SQUARE_KILOMETERS;d.defaultLengthUnit="english"===g?y.MILES:y.KILOMETERS;this._pcDef.resolve(d)}),p.hitch(this,function(g){console.error(g);d.defaultAreaUnit=y.SQUARE_MILES;d.defaultLengthUnit=y.MILES;this._pcDef.resolve(d)}));return this._pcDef.promise},_hideToolsByConfig:function(){!1===this.config.showArea&&this.measurement.hideTool("area");!1===this.config.showDistance&&this.measurement.hideTool("distance");
!1===this.config.showLocation&&this.measurement.hideTool("location")},_initFirstFocusNode:function(){var d=null;this.config.showArea?d=this.measurement._areaButton:this.config.showDistance?d=this.measurement._distanceButton:this.config.showLocation&&(d=this.measurement._locationButton);O.initFirstFocusNode(this.domNode,d.focusNode)},disableWebMapPopup:function(){this.map.setInfoWindowOnClick(!1)},enableWebMapPopup:function(){this.map.setInfoWindowOnClick(!0)},onDeActive:function(){if("location"===
this.toolName&&this._isPCS)for(var d=this.map.graphics,g=d.graphics,k=0;k<g.length;k++){var t=g[k];if("picturemarkersymbol"===(t.symbol&&t.symbol.type?t.symbol.type:null)&&this.measurement._pointSymbol===t.symbol){g=new I(t.geometry,t.symbol,{OBJECTID:1},null);this.currentFeatureLayer.add(g);d.remove(t);break}}this.onClose()},onOpen:function(){},onClose:function(){this.measurement&&this.measurement.activeTool&&(this.isClose=!0,this.measurement.setTool(this.measurement.activeTool,!1));this.keepGraphics()},
keepGraphics:function(){this.config.isOperationalLayer&&this.currentFeatureLayer&&0===this.currentFeatureLayer.graphics.length&&(this.map.removeLayer(this.currentFeatureLayer),this.currentFeatureLayer=null)},clearGraphics:function(){this.measurement.clearResult();this.currentFeatureLayer&&(this.currentFeatureLayer.clear(),this.linePicGraphicsLayer&&this.linePicGraphicsLayer.clear());m.addClass(this.clearGraphicsBtn,"jimu-state-disabled");m.attr(this.clearGraphicsBtn,"aria-label",this._clearDisabledLabel)},
clearGraphicsKeydown:function(d){d.keyCode!==f.ENTER&&d.keyCode!==f.SPACE||m.hasClass(this.clearGraphicsBtn,"jimu-state-disabled")||this.clearGraphics()},destroy:function(){this.measurement&&(this.measurement.destroy(),this.currentFeatureLayer&&(this.currentFeatureLayer.clear(),this.map.removeLayer(this.currentFeatureLayer),this.currentFeatureLayer=null),this.linePicGraphicsLayer&&(this.linePicGraphicsLayer.clear(),this.map.removeLayer(this.linePicGraphicsLayer),this.linePicGraphicsLayer=null));this.inherited(arguments)}})});