/*
 COPYRIGHT 2009 ESRI

 TRADE SECRETS: ESRI PROPRIETARY AND CONFIDENTIAL
 Unpublished material - all rights reserved under the
 Copyright Laws of the United States and applicable international
 laws, treaties, and conventions.

 For additional information, contact:
 Environmental Systems Research Institute, Inc.
 Attn: Contracts and Legal Services Department
 380 New York Street
 Redlands, California, 92373
 USA

 email: contracts@esri.com
 */

if(!dojo._hasResource["esri.tasks.geometry"]){dojo._hasResource["esri.tasks.geometry"]=true;dojo.provide("esri.tasks.geometry");dojo.require("esri.tasks._task");dojo.declare("esri.tasks.GeometryService",esri.tasks._Task,{constructor:function(_1){var _2=dojo.hitch;this._projectHandler=_2(this,this._projectHandler);this._simplifyHandler=_2(this,this._simplifyHandler);this._bufferHandler=_2(this,this._bufferHandler);this._areasAndLengthsHandler=_2(this,this._areasAndLengthsHandler);this._lengthsHandler=_2(this,this._lengthsHandler);this._labelPointsHandler=_2(this,this._labelPointsHandler);this._relationHandler=_2(this,this._relationHandler);this._convexHullHandler=_2(this,this._convexHullHandler);this._unionHandler=_2(this,this._unionHandler);this._autoCompleteHandler=_2(this,this._autoCompleteHandler);this._reshapeHandler=_2(this,this._reshapeHandler);this._cutHandler=_2(this,this._cutHandler);this._intersectHandler=_2(this,this._intersectHandler);this._differenceHandler=_2(this,this._differenceHandler);this._trimExtendHandler=_2(this,this._trimExtendHandler);this._densifyHandler=_2(this,this._densifyHandler);this._generalizeHandler=_2(this,this._densifyHandler);this._offsetHandler=_2(this,this._offsetHandler);this._distanceHandler=_2(this,this._distanceHandler);},_encodeGeometries:function(_3){var gs=[];for(var i=0,il=_3.length;i<il;i++){gs.push(_3[i].toJson());}return {geometryType:esri.geometry.getJsonType(_3[0]),geometries:gs};},_decodeGeometries:function(_4,_5,sr){var _6=esri.geometry.getGeometryType(_5),_7=_4.geometries,fs=[],_8={spatialReference:sr.toJson()},_9=dojo.mixin;dojo.forEach(_7,function(g,i){fs[i]=new _6(_9(g,_8));});return fs;},_toProjectGeometry:function(_a){var sr=_a.spatialReference.toJson();if(_a instanceof esri.geometry.Extent){return new esri.geometry.Polygon({rings:[[[_a.xmin,_a.ymin],[_a.xmin,_a.ymax],[_a.xmax,_a.ymax],[_a.xmax,_a.ymin],[_a.xmin,_a.ymin]]],spatialReference:sr});}else{return new esri.geometry.Polyline({paths:[[].concat(_a.points)],spatialReference:sr});}},_fromProjectedGeometry:function(_b,_c,_d){if(_c==="esriGeometryEnvelope"){var _e=_b.rings[0];return new esri.geometry.Extent(_e[0][0],_e[0][1],_e[2][0],_e[2][1],_d);}else{return new esri.geometry.Multipoint({points:_b.paths[0],spatialReference:_d.toJson()});}},project:function(_f,_10,_11,_12){var _13=_f[0];var _14=dojo.mixin({},this._url.query,{f:"json",outSR:_10.wkid?_10.wkid:dojo.toJson(_10.toJson()),inSR:_13.spatialReference.wkid?_13.spatialReference.wkid:dojo.toJson(_13.spatialReference.toJson()),geometries:dojo.toJson(this._encodeGeometries(_f))}),_15=esri.geometry.getJsonType(_f[0]),_16=this._projectHandler,_17=this._errorHandler,dfd=new dojo.Deferred(esri._dfdCanceller);dfd._pendingDfd=esri.request({url:this._url.path+"/project",content:_14,callbackParamName:"callback",load:(function(r,i){_16(r,i,_15,_10,_11,_12,dfd);}),error:(function(r){_17(r,_12,dfd);})});return dfd;},_projectHandler:function(_18,io,_19,_1a,_1b,_1c,dfd){try{var fs=this._decodeGeometries(_18,_19,_1a);this._successHandler([fs],"onProjectComplete",_1b,dfd);}catch(err){this._errorHandler(err,_1c,dfd);}},onProjectComplete:function(){},simplify:function(_1d,_1e,_1f){var _20=_1d[0].spatialReference;var _21=dojo.mixin({},this._url.query,{f:"json",sr:_20.wkid?_20.wkid:dojo.toJson(_20.toJson()),geometries:dojo.toJson(this._encodeGeometries(_1d))}),_22=esri.geometry.getJsonType(_1d[0]),_23=this._simplifyHandler,_24=this._errorHandler,dfd=new dojo.Deferred(esri._dfdCanceller);dfd._pendingDfd=esri.request({url:this._url.path+"/simplify",content:_21,callbackParamName:"callback",load:(function(r,i){_23(r,i,_22,_20,_1e,_1f,dfd);}),error:(function(r){_24(r,_1f,dfd);})});return dfd;},_simplifyHandler:function(_25,io,_26,sr,_27,_28,dfd){try{var fs=this._decodeGeometries(_25,_26,sr);this._successHandler([fs],"onSimplifyComplete",_27,dfd);}catch(err){this._errorHandler(err,_28,dfd);}},onSimplifyComplete:function(){},convexHull:function(_29,_2a,_2b){var _2c=_29[0].spatialReference;var _2d=dojo.mixin({},this._url.query,{f:"json",sr:dojo.toJson(_2c.toJson()),geometries:dojo.toJson(this._encodeGeometries(_29))}),_2e=this._convexHullHandler,_2f=this._errorHandler,dfd=new dojo.Deferred(esri._dfdCanceller);dfd._pendingDfd=esri.request({url:this._url.path+"/convexHull",content:_2d,callbackParamName:"callback",load:(function(r,i){_2e(r,i,_2c,_2a,_2b,dfd);}),error:(function(r){_2f(r,_2b,dfd);})});return dfd;},_convexHullHandler:function(_30,io,_31,_32,_33,dfd){try{var _34=esri.geometry.fromJson(_30.geometry).setSpatialReference(_31);this._successHandler([_34],"onConvexHullComplete",_32,dfd);}catch(err){this._errorHandler(err,_33,dfd);}},onConvexHullComplete:function(){},union:function(_35,_36,_37){var _38=_35[0].spatialReference;var _39=dojo.mixin({},this._url.query,{f:"json",sr:dojo.toJson(_38.toJson()),geometries:dojo.toJson(this._encodeGeometries(_35))}),_3a=this._unionHandler,_3b=this._errorHandler,dfd=new dojo.Deferred(esri._dfdCanceller);dfd._pendingDfd=esri.request({url:this._url.path+"/union",content:_39,callbackParamName:"callback",load:(function(r,i){_3a(r,i,_38,_36,_37,dfd);}),error:(function(r){_3b(r,_37,dfd);})});return dfd;},_unionHandler:function(_3c,io,_3d,_3e,_3f,dfd){try{var _40=esri.geometry.fromJson(_3c.geometry).setSpatialReference(_3d);this._successHandler([_40],"onUnionComplete",_3e,dfd);}catch(err){this._errorHandler(err,_3f,dfd);}},onUnionComplete:function(){},autoComplete:function(_41,_42,_43,_44){var _45=_41[0].spatialReference;var _46=dojo.mixin({},this._url.query,{f:"json",sr:dojo.toJson(_45.toJson()),polygons:dojo.toJson(this._encodeGeometries(_41).geometries),polylines:dojo.toJson(this._encodeGeometries(_42).geometries)}),_47=this._autoCompleteHandler,_48=this._errorHandler,dfd=new dojo.Deferred(esri._dfdCanceller);dfd._pendingDfd=esri.request({url:this._url.path+"/autoComplete",content:_46,callbackParamName:"callback",load:(function(r,i){_47(r,i,_45,_43,_44,dfd);}),error:(function(r){_48(r,_44,dfd);})});return dfd;},_autoCompleteHandler:function(_49,io,_4a,_4b,_4c,dfd){try{var _4d=esri.geometry.Polygon,_4e=_49.geometries,_4f=[];for(var i=0,il=_4e.length;i<il;i++){_4f[i]=new _4d({spatialReference:_4a,rings:_4e[i].rings});}this._successHandler([_4f],"onAutoCompleteComplete",_4b,dfd);}catch(err){this._errorHandler(err,_4c,dfd);}},onAutoCompleteComplete:function(){},reshape:function(_50,_51,_52,_53){var _54=_50.spatialReference;var _55=dojo.mixin({},this._url.query,{f:"json",sr:dojo.toJson(_54.toJson()),target:dojo.toJson({geometryType:esri.geometry.getJsonType(_50),geometry:_50.toJson()}),reshaper:dojo.toJson(_51.toJson())}),_56=this._reshapeHandler,_57=this._errorHandler,dfd=new dojo.Deferred(esri._dfdCanceller);dfd._pendingDfd=esri.request({url:this._url.path+"/reshape",content:_55,callbackParamName:"callback",load:(function(r,i){_56(r,i,_54,_52,_53,dfd);}),error:(function(r){_57(r,_53,dfd);})});return dfd;},_reshapeHandler:function(_58,io,_59,_5a,_5b,dfd){try{var _5c=esri.geometry.fromJson(_58.geometry).setSpatialReference(_59);this._successHandler([_5c],"onReshapeComplete",_5a,dfd);}catch(err){this._errorHandler(err,_5b,dfd);}},onReshapeComplete:function(){},cut:function(_5d,_5e,_5f,_60){var _61=_5d[0].spatialReference;var _62=dojo.map(_5d,function(_63){return _63.toJson();});var _64=dojo.mixin({},this._url.query,{f:"json",sr:dojo.toJson(_61.toJson()),target:dojo.toJson({geometryType:esri.geometry.getJsonType(_5d[0]),geometries:_62}),cutter:dojo.toJson(_5e.toJson())}),_65=this._cutHandler,_66=this._errorHandler,dfd=new dojo.Deferred(esri._dfdCanceller);dfd._pendingDfd=esri.request({url:this._url.path+"/cut",content:_64,callbackParamName:"callback",load:(function(r,i){_65(r,i,_61,_5f,_60,dfd);}),error:(function(r){_66(r,_60,dfd);})});return dfd;},_cutHandler:function(_67,io,_68,_69,_6a,dfd){try{var _6b=_67.geometries;var _6c={};_6c.cutIndexes=_67.cutIndexes;_6c.geometries=[];dojo.forEach(_6b,function(_6d){_6c.geometries.push(esri.geometry.fromJson(_6d).setSpatialReference(_68));});this._successHandler([_6c],"onCutComplete",_69,dfd);}catch(err){this._errorHandler(err,_6a,dfd);}},onCutComplete:function(){},intersect:function(_6e,_6f,_70,_71){var _72=_6e[0].spatialReference;var _73=dojo.mixin({},this._url.query,{f:"json",sr:dojo.toJson(_72.toJson()),geometries:dojo.toJson(this._encodeGeometries(_6e)),geometry:dojo.toJson({geometryType:esri.geometry.getJsonType(_6f),geometry:_6f.toJson()})}),_74=this._intersectHandler,_75=this._errorHandler,dfd=new dojo.Deferred(esri._dfdCanceller);dfd._pendingDfd=esri.request({url:this._url.path+"/intersect",content:_73,callbackParamName:"callback",load:(function(r,i){_74(r,i,_72,_70,_71,dfd);}),error:(function(r){_75(r,_71,dfd);})});return dfd;},_intersectHandler:function(_76,io,_77,_78,_79,dfd){try{var _7a=_76.geometries,_7b=[];dojo.forEach(_7a,function(_7c){_7b.push(esri.geometry.fromJson(_7c).setSpatialReference(_77));});this._successHandler([_7b],"onIntersectComplete",_78,dfd);}catch(err){this._errorHandler(err,_79,dfd);}},onIntersectComplete:function(){},difference:function(_7d,_7e,_7f,_80){var _81=_7d[0].spatialReference;var _82=dojo.mixin({},this._url.query,{f:"json",sr:dojo.toJson(_81.toJson()),geometries:dojo.toJson(this._encodeGeometries(_7d)),geometry:dojo.toJson({geometryType:esri.geometry.getJsonType(_7e),geometry:_7e.toJson()})}),_83=this._differenceHandler,_84=this._errorHandler,dfd=new dojo.Deferred(esri._dfdCanceller);dfd._pendingDfd=esri.request({url:this._url.path+"/difference",content:_82,callbackParamName:"callback",load:(function(r,i){_83(r,i,_81,_7f,_80,dfd);}),error:(function(r){_84(r,_80,dfd);})});return dfd;},_differenceHandler:function(_85,io,_86,_87,_88,dfd){try{var _89=_85.geometries,_8a=[];dojo.forEach(_89,function(_8b){_8a.push(esri.geometry.fromJson(_8b).setSpatialReference(_86));});this._successHandler([_8a],"onDifferenceComplete",_87,dfd);}catch(err){this._errorHandler(err,_88,dfd);}},onDifferenceComplete:function(){},buffer:function(_8c,_8d,_8e){var _8f=dojo.mixin({},this._url.query,{f:"json"},_8c.toJson()),sr=_8c.outSpatialReference||_8c.geometries[0].spatialReference,_90=this._bufferHandler,_91=this._errorHandler,dfd=new dojo.Deferred(esri._dfdCanceller);dfd._pendingDfd=esri.request({url:this._url.path+"/buffer",content:_8f,callbackParamName:"callback",load:(function(r,i){_90(r,i,sr,_8d,_8e,dfd);}),error:(function(r){_91(r,_8e,dfd);})});return dfd;},_bufferHandler:function(_92,io,sr,_93,_94,dfd){try{var _95=esri.geometry.Polygon,_96=_92.geometries,_97=[];for(var i=0,il=_96.length;i<il;i++){_97[i]=new _95({spatialReference:sr,rings:_96[i].rings});}this._successHandler([_97],"onBufferComplete",_93,dfd);}catch(err){this._errorHandler(err,_94,dfd);}},onBufferComplete:function(){},areasAndLengths:function(_98,_99,_9a){var _9b=dojo.mixin({},this._url.query,{f:"json"},_98.toJson()),_9c=this._areasAndLengthsHandler,_9d=this._errorHandler,dfd=new dojo.Deferred(esri._dfdCanceller);dfd._pendingDfd=esri.request({url:this._url.path+"/areasAndLengths",content:_9b,callbackParamName:"callback",load:(function(r,i){_9c(r,i,_99,_9a,dfd);}),error:(function(r){_9d(r,_9a,dfd);})});return dfd;},_areasAndLengthsHandler:function(_9e,io,_9f,_a0,dfd){try{this._successHandler([_9e],"onAreasAndLengthsComplete",_9f,dfd);}catch(err){this._errorHandler(err,_a0,dfd);}},onAreasAndLengthsComplete:function(){},lengths:function(_a1,_a2,_a3){var _a4=dojo.mixin({},this._url.query,{f:"json"},_a1.toJson()),_a5=this._lengthsHandler,_a6=this._errorHandler,dfd=new dojo.Deferred(esri._dfdCanceller);dfd._pendingDfd=esri.request({url:this._url.path+"/lengths",content:_a4,callbackParamName:"callback",load:(function(r,i){_a5(r,i,_a2,_a3,dfd);}),error:(function(r){_a6(r,_a3,dfd);})});return dfd;},_lengthsHandler:function(_a7,io,_a8,_a9,dfd){try{this._successHandler([_a7],"onLengthsComplete",_a8,dfd);}catch(err){this._errorHandler(err,_a9,dfd);}},onLengthsComplete:function(){},labelPoints:function(_aa,_ab,_ac){var _ad=dojo.map(_aa,function(_ae){return _ae.toJson();});var sr=_aa[0].spatialReference,_af=dojo.mixin({},this._url.query,{f:"json",sr:sr.wkid?sr.wkid:dojo.toJson(sr.toJson()),polygons:dojo.toJson(_ad)}),_b0=this._labelPointsHandler,_b1=this._errorHandler,dfd=new dojo.Deferred(esri._dfdCanceller);dfd._pendingDfd=esri.request({url:this._url.path+"/labelPoints",content:_af,callbackParamName:"callback",load:(function(r,i){_b0(r,i,_aa,sr,_ab,_ac,dfd);}),error:(function(r){_b1(r,_ac,dfd);})});return dfd;},_labelPointsHandler:function(_b2,io,_b3,sr,_b4,_b5,dfd){try{var _b6=_b2.labelPoints,_b7=[];dojo.forEach(_b6,function(_b8){_b7.push(esri.geometry.fromJson(_b8).setSpatialReference(sr));});this._successHandler([_b7],"onLabelPointsComplete",_b4,dfd);}catch(err){this._errorHandler(err,_b5,dfd);}},onLabelPointsComplete:function(){},relation:function(_b9,_ba,_bb){var _bc=dojo.mixin({},this._url.query,{f:"json"},_b9.toJson()),_bd=this._relationHandler,_be=this._errorHandler,dfd=new dojo.Deferred(esri._dfdCanceller);dfd._pendingDfd=esri.request({url:this._url.path+"/relation",content:_bc,callbackParamName:"callback",load:(function(r,i){_bd(r,i,_ba,_bb,dfd);}),error:(function(r){_be(r,_bb,dfd);})});return dfd;},_relationHandler:function(_bf,io,_c0,_c1,dfd){try{var _c2=_bf.relations;this._successHandler([_c2],"onRelationComplete",_c0,dfd);}catch(err){this._errorHandler(err,_c1,dfd);}},onRelationComplete:function(){},trimExtend:function(_c3,_c4,_c5){var _c6=dojo.mixin({},this._url.query,{f:"json"},_c3.toJson()),_c7=_c3.sr,_c8=this._trimExtendHandler,_c9=this._errorHandler,dfd=new dojo.Deferred(esri._dfdCanceller);dfd._pendingDfd=esri.request({url:this._url.path+"/trimExtend",content:_c6,callbackParamName:"callback",load:(function(r,i){_c8(r,i,_c7,_c4,_c5,dfd);}),error:(function(r){_c9(r,_c5,dfd);})});return dfd;},_trimExtendHandler:function(_ca,io,_cb,_cc,_cd,dfd){try{var _ce=esri.geometry.Polyline,_cf=_ca.geometries,_d0=[];for(var i=0,il=_cf.length;i<il;i++){_d0[i]=new _ce({spatialReference:_cb,paths:_cf[i].paths});}this._successHandler([_d0],"onTrimExtendComplete",_cc,dfd);}catch(err){this._errorHandler(err,_cd,dfd);}},onTrimExtendComplete:function(){},densify:function(_d1,_d2,_d3){var _d4=dojo.mixin({},this._url.query,{f:"json"},_d1.toJson()),_d5=_d1.geometries[0].spatialReference,_d6=this._densifyHandler,_d7=this._errorHandler,dfd=new dojo.Deferred(esri._dfdCanceller);dfd._pendingDfd=esri.request({url:this._url.path+"/densify",content:_d4,callbackParamName:"callback",load:(function(r,i){_d6(r,i,_d5,_d2,_d3,dfd);}),error:(function(r){_d7(r,_d3,dfd);})});return dfd;},_densifyHandler:function(_d8,io,_d9,_da,_db,dfd){try{var _dc=_d8.geometries,_dd=[];dojo.forEach(_dc,function(_de){_dd.push(esri.geometry.fromJson(_de).setSpatialReference(_d9));});this._successHandler([_dd],"onDensifyComplete",_da,dfd);}catch(err){this._errorHandler(err,_db,dfd);}},onDensifyComplete:function(){},generalize:function(_df,_e0,_e1){var _e2=dojo.mixin({},this._url.query,{f:"json"},_df.toJson()),_e3=_df.geometries[0].spatialReference,_e4=this._generalizeHandler,_e5=this._errorHandler,dfd=new dojo.Deferred(esri._dfdCanceller);dfd._pendingDfd=esri.request({url:this._url.path+"/generalize",content:_e2,callbackParamName:"callback",load:(function(r,i){_e4(r,i,_e3,_e0,_e1,dfd);}),error:(function(r){_e5(r,_e1,dfd);})});return dfd;},_generalizeHandler:function(_e6,io,_e7,_e8,_e9,dfd){try{var _ea=_e6.geometries,_eb=[];dojo.forEach(_ea,function(_ec){_eb.push(esri.geometry.fromJson(_ec).setSpatialReference(_e7));});this._successHandler([_eb],"onGeneralizeComplete",_e8,dfd);}catch(err){this._errorHandler(err,_e9,dfd);}},onGeneralizeComplete:function(){},offset:function(_ed,_ee,_ef){var _f0=dojo.mixin({},this._url.query,{f:"json"},_ed.toJson()),_f1=_ed.geometries[0].spatialReference,_f2=this._offsetHandler,_f3=this._errorHandler,dfd=new dojo.Deferred(esri._dfdCanceller);dfd._pendingDfd=esri.request({url:this._url.path+"/offset",content:_f0,callbackParamName:"callback",load:(function(r,i){_f2(r,i,_f1,_ee,_ef,dfd);}),error:(function(r){_f3(r,_ef,dfd);})});return dfd;},_offsetHandler:function(_f4,io,_f5,_f6,_f7,dfd){try{var _f8=_f4.geometries,_f9=[];dojo.forEach(_f8,function(_fa){_f9.push(esri.geometry.fromJson(_fa).setSpatialReference(_f5));});this._successHandler([_f9],"onOffsetComplete",_f6,dfd);}catch(err){this._errorHandler(err,_f7,dfd);}},onOffsetComplete:function(){},distance:function(_fb,_fc,_fd){var _fe=dojo.mixin({},this._url.query,{f:"json"},_fb.toJson()),_ff=_fb.geometry1.spatialReference,_100=this._distanceHandler,_101=this._errorHandler,dfd=new dojo.Deferred(esri._dfdCanceller);dfd._pendingDfd=esri.request({url:this._url.path+"/distance",content:_fe,callbackParamName:"callback",load:(function(r,i){_100(r,i,_ff,_fc,_fd,dfd);}),error:(function(r){_101(r,_fd,dfd);})});return dfd;},_distanceHandler:function(_102,io,_103,_104,_105,dfd){try{_102=_102&&_102.distance;this._successHandler([_102],"onDistanceComplete",_104,dfd);}catch(err){this._errorHandler(err,_105,dfd);}},onDistanceComplete:function(){}});dojo.declare("esri.tasks.TrimExtendParameters",null,{polylines:null,trimExtendTo:null,extendHow:null,toJson:function(){var _106=dojo.map(this.polylines,function(geom){return geom.toJson();});var json={};json.polylines=dojo.toJson(_106);json.trimExtendTo=dojo.toJson(this.trimExtendTo.toJson());json.sr=dojo.toJson(this.polylines[0].spatialReference.toJson());json.extendHow=this.extendHow||0;return json;}});dojo.mixin(esri.tasks.TrimExtendParameters,{DEFAULT_CURVE_EXTENSION:0,RELOCATE_ENDS:1,KEEP_END_ATTRIBUTES:2,NO_END_ATTRIBUTES:4,NO_EXTEND_AT_FROM:8,NO_EXTEND_AT_TO:16});dojo.declare("esri.tasks.BufferParameters",null,{geometries:null,outSpatialReference:null,bufferSpatialReference:null,distances:null,unit:null,unionResults:false,geodesic:false,toJson:function(){var json={unit:this.unit,unionResults:(""+this.unionResults),geodesic:(""+this.geodesic)},dt=this.distances,_107=this.outSpatialReference,_108=this.bufferSpatialReference;var _109=dojo.map(this.geometries,function(geom){geom=(geom.type==="extent")?this._extentToPolygon(geom):geom;return geom.toJson();},this);var _10a=this.geometries;if(_10a&&_10a.length>0){var _10b=_10a[0].type==="extent"?"esriGeometryPolygon":esri.geometry.getJsonType(_10a[0]);json.geometries=dojo.toJson({geometryType:_10b,geometries:_109});json.inSR=_10a[0].spatialReference.wkid?_10a[0].spatialReference.wkid:dojo.toJson(_10a[0].spatialReference.toJson());}if(dt){json.distances=dt.join(",");}if(_107){json.outSR=_107.wkid?_107.wkid:dojo.toJson(_107.toJson());}if(_108){json.bufferSR=_108.wkid?_108.wkid:dojo.toJson(_108.toJson());}return json;},_extentToPolygon:function(_10c){var xmin=_10c.xmin,ymin=_10c.ymin,xmax=_10c.xmax,ymax=_10c.ymax;return new esri.geometry.Polygon({"rings":[[[xmin,ymin],[xmin,ymax],[xmax,ymax],[xmax,ymin],[xmin,ymin]]],"spatialReference":_10c.spatialReference.toJson()});}});dojo.mixin(esri.tasks.GeometryService,{UNIT_METER:9001,UNIT_GERMAN_METER:9031,UNIT_FOOT:9002,UNIT_SURVEY_FOOT:9003,UNIT_CLARKE_FOOT:9005,UNIT_FATHOM:9014,UNIT_NAUTICAL_MILE:9030,UNIT_SURVEY_CHAIN:9033,UNIT_SURVEY_LINK:9034,UNIT_SURVEY_MILE:9035,UNIT_KILOMETER:9036,UNIT_CLARKE_YARD:9037,UNIT_CLARKE_CHAIN:9038,UNIT_CLARKE_LINK:9039,UNIT_SEARS_YARD:9040,UNIT_SEARS_FOOT:9041,UNIT_SEARS_CHAIN:9042,UNIT_SEARS_LINK:9043,UNIT_BENOIT_1895A_YARD:9050,UNIT_BENOIT_1895A_FOOT:9051,UNIT_BENOIT_1895A_CHAIN:9052,UNIT_BENOIT_1895A_LINK:9053,UNIT_BENOIT_1895B_YARD:9060,UNIT_BENOIT_1895B_FOOT:9061,UNIT_BENOIT_1895B_CHAIN:9062,UNIT_BENOIT_1895B_LINK:9063,UNIT_INDIAN_FOOT:9080,UNIT_INDIAN_1937_FOOT:9081,UNIT_INDIAN_1962_FOOT:9082,UNIT_INDIAN_1975_FOOT:9083,UNIT_INDIAN_YARD:9084,UNIT_INDIAN_1937_YARD:9085,UNIT_INDIAN_1962_YARD:9086,UNIT_INDIAN_1975_YARD:9087,UNIT_FOOT_1865:9070,UNIT_RADIAN:9101,UNIT_DEGREE:9102,UNIT_ARCMINUTE:9103,UNIT_ARCSECOND:9104,UNIT_GRAD:9105,UNIT_GON:9106,UNIT_MICRORADIAN:9109,UNIT_ARCMINUTE_CENTESIMAL:9112,UNIT_ARCSECOND_CENTESIMAL:9113,UNIT_MIL6400:9114,UNIT_BRITISH_1936_FOOT:9095,UNIT_GOLDCOAST_FOOT:9094,UNIT_INTERNATIONAL_CHAIN:109003,UNIT_INTERNATIONAL_LINK:109004,UNIT_INTERNATIONAL_YARD:109001,UNIT_STATUTE_MILE:9093,UNIT_SURVEY_YARD:109002,UNIT_50KILOMETER_LENGTH:109030,UNIT_150KILOMETER_LENGTH:109031,UNIT_DECIMETER:109005,UNIT_CENTIMETER:109006,UNIT_MILLIMETER:109007,UNIT_INTERNATIONAL_INCH:109008,UNIT_US_SURVEY_INCH:109009,UNIT_INTERNATIONAL_ROD:109010,UNIT_US_SURVEY_ROD:109011,UNIT_US_NAUTICAL_MILE:109012,UNIT_UK_NAUTICAL_MILE:109013,UNIT_SQUARE_INCHES:"esriSquareInches",UNIT_SQUARE_FEET:"esriSquareFeet",UNIT_SQUARE_YARDS:"esriSquareYards",UNIT_ACRES:"esriAcres",UNIT_SQUARE_MILES:"esriSquareMiles",UNIT_SQUARE_MILLIMETERS:"esriSquareMillimeters",UNIT_SQUARE_CENTIMETERS:"esriSquareCentimeters",UNIT_SQUARE_DECIMETERS:"esriSquareDecimeters",UNIT_SQUARE_METERS:"esriSquareMeters",UNIT_ARES:"esriAres",UNIT_HECTARES:"esriHectares",UNIT_SQUARE_KILOMETERS:"esriSquareKilometers"});dojo.declare("esri.tasks.AreasAndLengthsParameters",null,{polygons:null,lengthUnit:null,areaUnit:null,toJson:function(){var _10d=dojo.map(this.polygons,function(geom){return geom.toJson();});var json={};json.polygons=dojo.toJson(_10d);var _10e=this.polygons[0].spatialReference;json.sr=_10e.wkid?_10e.wkid:dojo.toJson(_10e.toJson());if(this.lengthUnit){json.lengthUnit=this.lengthUnit;}if(this.areaUnit){if(dojo.isString(this.areaUnit)){json.areaUnit=dojo.toJson({"areaUnit":this.areaUnit});}else{json.areaUnit=this.areaUnit;}}return json;}});dojo.declare("esri.tasks.LengthsParameters",null,{polylines:null,lengthUnit:null,geodesic:null,toJson:function(){var _10f=dojo.map(this.polylines,function(geom){return geom.toJson();});var json={};json.polylines=dojo.toJson(_10f);var _110=this.polylines[0].spatialReference;json.sr=_110.wkid?_110.wkid:dojo.toJson(_110.toJson());if(this.lengthUnit){json.lengthUnit=this.lengthUnit;}if(this.geodesic){json.geodesic=this.geodesic;}return json;}});dojo.declare("esri.tasks.RelationParameters",null,{geometries1:null,geometries2:null,relation:null,relationParam:null,toJson:function(){var _111=dojo.map(this.geometries1,function(geom){return geom.toJson();});var _112=dojo.map(this.geometries2,function(geom){return geom.toJson();});var json={};var _113=this.geometries1;if(_113&&_113.length>0){json.geometries1=dojo.toJson({geometryType:esri.geometry.getJsonType(_113[0]),geometries:_111});var _114=this.geometries1[0].spatialReference;json.sr=_114.wkid?_114.wkid:dojo.toJson(_114.toJson());}var _115=this.geometries2;if(_115&&_115.length>0){json.geometries2=dojo.toJson({geometryType:esri.geometry.getJsonType(_115[0]),geometries:_112});}if(this.relation){json.relation=this.relation;}if(this.relationParam){json.relationParam=dojo.toJson(this.relationParam);}return json;}});dojo.mixin(esri.tasks.RelationParameters,{SPATIAL_REL_CROSS:"esriGeometryRelationCross",SPATIAL_REL_DISJOINT:"esriGeometryRelationDisjoint",SPATIAL_REL_IN:"esriGeometryRelationIn",SPATIAL_REL_INTERIORINTERSECTION:"esriGeometryRelationInteriorIntersection",SPATIAL_REL_INTERSECTION:"esriGeometryRelationIntersection",SPATIAL_REL_COINCIDENCE:"esriGeometryRelationLineCoincidence",SPATIAL_REL_LINETOUCH:"esriGeometryRelationLineTouch",SPATIAL_REL_OVERLAP:"esriGeometryRelationOverlap",SPATIAL_REL_POINTTOUCH:"esriGeometryRelationPointTouch",SPATIAL_REL_TOUCH:"esriGeometryRelationTouch",SPATIAL_REL_WITHIN:"esriGeometryRelationWithin",SPATIAL_REL_RELATION:"esriGeometryRelationRelation"});dojo.declare("esri.tasks.DensifyParameters",null,{geometries:null,geodesic:null,lengthUnit:null,maxSegmentLength:null,toJson:function(){var _116=dojo.map(this.geometries,function(geom){return geom.toJson();});var json={};if(this.geometries&&this.geometries.length>0){json.geometries=dojo.toJson({geometryType:esri.geometry.getJsonType(this.geometries[0]),geometries:_116});json.sr=dojo.toJson(this.geometries[0].spatialReference.toJson());}if(this.geodesic){json.geodesic=this.geodesic;}if(this.lengthUnit){json.lengthUnit=this.lengthUnit;}if(this.maxSegmentLength){json.maxSegmentLength=this.maxSegmentLength;}return json;}});dojo.declare("esri.tasks.GeneralizeParameters",null,{geometries:null,deviationUnit:null,maxDeviation:null,toJson:function(){var _117=dojo.map(this.geometries,function(geom){return geom.toJson();});var json={};if(this.geometries&&this.geometries.length>0){json.geometries=dojo.toJson({geometryType:esri.geometry.getJsonType(this.geometries[0]),geometries:_117});json.sr=dojo.toJson(this.geometries[0].spatialReference.toJson());}if(this.deviationUnit){json.deviationUnit=this.deviationUnit;}if(this.maxDeviation){json.maxDeviation=this.maxDeviation;}return json;}});dojo.declare("esri.tasks.OffsetParameters",null,{geometries:null,bevelRatio:null,offsetDistance:null,offsetHow:null,offsetUnit:null,toJson:function(){var _118=dojo.map(this.geometries,function(geom){return geom.toJson();});var json={};if(this.geometries&&this.geometries.length>0){json.geometries=dojo.toJson({geometryType:esri.geometry.getJsonType(this.geometries[0]),geometries:_118});json.sr=dojo.toJson(this.geometries[0].spatialReference.toJson());}if(this.bevelRatio){json.bevelRatio=this.bevelRatio;}if(this.offsetDistance){json.offsetDistance=this.offsetDistance;}if(this.offsetHow){json.offsetHow=this.offsetHow;}if(this.offsetUnit){json.offsetUnit=this.offsetUnit;}return json;}});dojo.mixin(esri.tasks.OffsetParameters,{OFFSET_BEVELLED:"esriGeometryOffsetBevelled",OFFSET_MITERED:"esriGeometryOffsetMitered",OFFSET_ROUNDED:"esriGeometryOffsetRounded"});dojo.declare("esri.tasks.DistanceParameters",null,{geometry1:null,geometry2:null,distanceUnit:null,geodesic:null,toJson:function(){var json={};var _119=this.geometry1;if(_119){json.geometry1=dojo.toJson({geometryType:esri.geometry.getJsonType(_119),geometry:_119});}var _11a=this.geometry2;if(_11a){json.geometry2=dojo.toJson({geometryType:esri.geometry.getJsonType(_11a),geometry:_11a});}json.sr=dojo.toJson(this.geometry1.spatialReference.toJson());if(this.distanceUnit){json.distanceUnit=this.distanceUnit;}if(this.geodesic){json.geodesic=this.geodesic;}return json;}});}