// 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
define("dojo/_base/declare dojo/_base/array dojo/_base/lang dojo/string dojo/number esri/geometry/geometryEngine esri/geometry/webMercatorUtils esri/geometry/Polyline".split(" "),function(g,k,l,d,a,e,f,h){return g(null,{Units:"meters feet kilometers miles nautical-miles yards".split(" "),getAngle:function(b){var c=null;c=void 0===this.angle?(180*Math.atan2(this.endPoint.x-this.startPoint.x,this.endPoint.y-this.startPoint.y)/Math.PI+360)%360:Number(this.angle);"mils"===b&&(c*=17.777777778);return c.toFixed(2)},
getLength:function(b){var c=this.Units[0];-1<this.Units.indexOf(b.toLowerCase())&&(c=b.toLowerCase());return e.geodesicLength(this.geographicGeometry,c)},getFormattedLength:function(b){return a.format(this.getLength(b),{places:4})},formatLength:function(b){return a.format(b,{places:4})},constructor:function(b){g.safeMixin(this,b);if("polygon"===this.geometry.type)if(this.geometry.hasOwnProperty("drawType")){if("ellipse"===this.geometry.drawType){var c=new h;k.forEach(this.geometry.geometry.rings,
l.hitch(this,function(m){c.paths.push(m)}));c.spatialReference=this.geometry.spatialReference;this.geographicGeometry=c=f.webMercatorToGeographic(c);this.geodesicGeometry=e.geodesicDensify(this.geometry.geometry,1E4);this.wmGeometry=this.geometry.geometry;this.angle=this.geometry.angle;this.startPoint=f.webMercatorToGeographic(this.geometry.center);this.formattedStartPoint=d.substitute("${xStr}, ${yStr}",{xStr:a.format(this.startPoint.y,{places:4}),yStr:a.format(this.startPoint.x,{places:4})})}}else b=
new h({paths:[[this.geometry.paths[0][0],this.geometry.paths[0][1]]],spatialReference:{wkid:this.geometry.spatialReference.wkid}}),this.geographicGeometry=b=f.webMercatorToGeographic(b),this.geodesicGeometry=e.geodesicDensify(b,1E4),this.wmGeometry=this.geometry,this.startPoint=this.geodesicGeometry.getPoint(0,0),this.endPoint=this.geodesicGeometry.getPoint(0,this.geodesicGeometry.paths[0].length-1),this.formattedStartPoint=d.substitute("${xStr}, ${yStr}",{xStr:a.format(this.startPoint.y,{places:4}),
yStr:a.format(this.startPoint.x,{places:4})}),this.formattedEndPoint=d.substitute("${xStr}, ${yStr}",{xStr:a.format(this.endPoint.y,{places:4}),yStr:a.format(this.endPoint.x,{places:4})});else"point"===this.geometry.type?(this.geodesicGeometry=e.geodesicBuffer(this.geometry,this.calculatedDistance,"meters"),this.geographicGeometry=null!==this.lineGeometry?this.lineGeometry:this.geometry,102100!==this.geodesicGeometry.spatialReference.wkid&&3857!==this.geodesicGeometry.spatialReference.wkid?(this.wgsGeometry=
this.geodesicGeometry,this.wmGeometry=f.geographicToWebMercator(this.geodesicGeometry)):(this.wgsGeometry=f.webMercatorToGeographic(this.geodesicGeometry),this.wmGeometry=this.geodesicGeometry),this.formattedStartPoint=d.substitute("${xStr}, ${yStr}",{xStr:a.format(this.wgsGeometry.getCentroid().y,{places:4}),yStr:a.format(this.wgsGeometry.getCentroid().x,{places:4})})):(this.geodesicGeometry=4326===this.geographicGeometry.spatialReference.wkid||3857===this.geographicGeometry.spatialReference.wkid?
e.geodesicDensify(this.geographicGeometry,1E4):this.geographicGeometry,this.startPoint=this.geodesicGeometry.getPoint(0,0),this.endPoint=this.geodesicGeometry.getPoint(0,this.geodesicGeometry.paths[0].length-1),this.formattedStartPoint=d.substitute("${xStr}, ${yStr}",{xStr:a.format(this.startPoint.y,{places:4}),yStr:a.format(this.startPoint.x,{places:4})}),this.formattedEndPoint=d.substitute("${xStr}, ${yStr}",{xStr:a.format(this.endPoint.y,{places:4}),yStr:a.format(this.endPoint.x,{places:4})}))}})});