/*
 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
 */
//>>built
define("esri/tasks/ClosestFacilityParameters",["dojo/_base/declare","dojo/_base/lang","dojo/_base/json","dojo/has","esri/kernel","esri/lang","esri/graphicsUtils","esri/tasks/NATypes"],function(_1,_2,_3,_4,_5,_6,_7,_8){var _9=_1(null,{declaredClass:"esri.tasks.ClosestFacilityParameters",accumulateAttributes:null,attributeParameterValues:null,defaultCutoff:null,defaultTargetFacilityCount:null,directionsLanguage:null,directionsLengthUnits:null,directionsOutputType:null,directionsStyleName:null,directionsTimeAttribute:null,doNotLocateOnRestrictedElements:true,facilities:null,impedanceAttribute:null,incidents:null,outputGeometryPrecision:null,outputGeometryPrecisionUnits:null,outputLines:null,outSpatialReference:null,pointBarriers:null,polygonBarriers:null,polylineBarriers:null,restrictionAttributes:null,restrictUTurns:null,returnDirections:false,returnFacilities:false,returnIncidents:false,returnPointBarriers:false,returnPolylgonBarriers:false,returnPolylineBarriers:false,returnRoutes:true,travelDirection:null,useHierarchy:false,timeOfDay:null,timeOfDayUsage:null,toJson:function(_a){var _b={returnDirections:this.returnDirections,returnFacilities:this.returnFacilities,returnIncidents:this.returnIncidents,returnBarriers:this.returnPointBarriers,returnPolygonBarriers:this.returnPolygonBarriers,returnPolylineBarriers:this.returnPolylineBarriers,returnCFRoutes:this.returnRoutes,useHierarchy:this.useHierarchy,attributeParameterValues:this.attributeParameterValues&&_3.toJson(this.attributeParameterValues),defaultCutoff:this.defaultCutoff,defaultTargetFacilityCount:this.defaultTargetFacilityCount,directionsLanguage:this.directionsLanguage,directionsLengthUnits:_8.LengthUnit[this.directionsLengthUnits],directionsTimeAttributeName:this.directionsTimeAttribute,impedanceAttributeName:this.impedanceAttribute,outputGeometryPrecision:this.outputGeometryPrecision,outputGeometryPrecisionUnits:this.outputGeometryPrecisionUnits,outputLines:this.outputLines,outSR:this.outSpatialReference?(this.outSpatialReference.wkid||_3.toJson(this.outSpatialReference.toJson())):null,restrictionAttributeNames:this.restrictionAttributes?this.restrictionAttributes.join(","):null,restrictUTurns:this.restrictUTurns,accumulateAttributeNames:this.accumulateAttributes?this.accumulateAttributes.join(","):null,travelDirection:this.travelDirection,timeOfDay:this.timeOfDay&&this.timeOfDay.getTime(),directionsStyleName:this.directionsStyleName};if(this.directionsOutputType){switch(this.directionsOutputType.toLowerCase()){case "complete":_b.directionsOutputType="esriDOTComplete";break;case "complete-no-events":_b.directionsOutputType="esriDOTCompleteNoEvents";break;case "instructions-only":_b.directionsOutputType="esriDOTInstructionsOnly";break;case "standard":_b.directionsOutputType="esriDOTStandard";break;case "summary-only":_b.directionsOutputType="esriDOTSummaryOnly";break;default:_b.directionsOutputType=this.directionsOutputType;}}if(this.timeOfDayUsage){var _c;switch(this.timeOfDayUsage.toLowerCase()){case "start":_c="esriNATimeOfDayUseAsStartTime";break;case "end":_c="esriNATimeOfDayUseAsEndTime";break;default:_c=this.timeOfDayUsage;}_b.timeOfDayUsage=_c;}var _d=this.incidents;if(_d.declaredClass==="esri.tasks.FeatureSet"&&_d.features.length>0){_b.incidents=_3.toJson({type:"features",features:_7._encodeGraphics(_d.features,_a&&_a["incidents.features"]),doNotLocateOnRestrictedElements:this.doNotLocateOnRestrictedElements});}else{if(_d.declaredClass==="esri.tasks.DataLayer"){_b.incidents=_d;}else{if(_d.declaredClass==="esri.tasks.DataFile"){_b.incidents=_3.toJson({type:"features",url:_d.url,doNotLocateOnRestrictedElements:this.doNotLocateOnRestrictedElements});}}}var _e=this.facilities;if(_e.declaredClass==="esri.tasks.FeatureSet"&&_e.features.length>0){_b.facilities=_3.toJson({type:"features",features:_7._encodeGraphics(_e.features,_a&&_a["facilities.features"]),doNotLocateOnRestrictedElements:this.doNotLocateOnRestrictedElements});}else{if(_e.declaredClass==="esri.tasks.DataLayer"){_b.facilities=_e;}else{if(_e.declaredClass==="esri.tasks.DataFile"){_b.facilities=_3.toJson({type:"features",url:_e.url,doNotLocateOnRestrictedElements:this.doNotLocateOnRestrictedElements});}}}var _f=function(_10,_11){if(!_10){return null;}if(_10.declaredClass==="esri.tasks.FeatureSet"){if(_10.features.length>0){return _3.toJson({type:"features",features:_7._encodeGraphics(_10.features,_a&&_a[_11])});}else{return null;}}else{if(_10.declaredClass==="esri.tasks.DataLayer"){return _10;}else{if(_10.declaredClass==="esri.tasks.DataFile"){return _3.toJson({type:"features",url:_10.url});}}}return _3.toJson(_10);};if(this.pointBarriers){_b.barriers=_f(this.pointBarriers,"pointBarriers.features");}if(this.polygonBarriers){_b.polygonBarriers=_f(this.polygonBarriers,"polygonBarriers.features");}if(this.polylineBarriers){_b.polylineBarriers=_f(this.polylineBarriers,"polylineBarriers.features");}return _6.filter(_b,function(_12){if(_12!==null){return true;}});}});if(_4("extend-esri")){_2.setObject("tasks.ClosestFacilityParameters",_9,_5);}return _9;});