/*
 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.GenerateRendererTask"]){dojo._hasResource["esri.tasks.GenerateRendererTask"]=true;dojo.provide("esri.tasks.GenerateRendererTask");dojo.require("esri.tasks._task");dojo.require("esri.symbol");dojo.declare("esri.tasks.GenerateRendererTask",esri.tasks._Task,{constructor:function(_1,_2){this.url=_1;var _3=_1.split("://")[1].split("/")[0].toLowerCase();if(_3.indexOf("arcgis.com")!==-1){this._url.path+="/generateRenderer";}else{this._url.path+="/generateDataClasses";}this._handler=dojo.hitch(this,this._handler);this.source=_2&&_2.source;this.gdbVersion=_2&&_2.gdbVersion;},_handler:function(_4,io,_5,_6,_7){try{var _8=esri.renderer.fromJson(_4);if(_4.type==="classBreaks"){_8._setMaxInclusiveness(true);}this._successHandler([_8],"onComplete",_5,_7);}catch(err){this._errorHandler(err,_6,_7);}},execute:function(_9,_a,_b){var _c=dojo.mixin(_9.toJson(),{f:"json"}),_d=this._handler,_e=this._errorHandler;if(this.source){var _f={source:this.source.toJson()};_c.layer=dojo.toJson(_f);}if(this.gdbVersion){_c.gdbVersion=this.gdbVersion;}var dfd=new dojo.Deferred(esri._dfdCanceller);dfd._pendingDfd=esri.request({url:this._url.path,content:_c,callbackParamName:"callback",load:function(r,i){_d(r,i,_a,_b,dfd);},error:function(r){_e(r,_b,dfd);}});return dfd;},onComplete:function(){}});dojo.declare("esri.tasks.GenerateRendererParameters",null,{classificationDefinition:null,where:null,toJson:function(){var _10={classificationDef:dojo.toJson(this.classificationDefinition.toJson()),where:this.where};return _10;}});dojo.declare("esri.tasks.ClassificationDefinition",null,{type:null,baseSymbol:null,colorRamp:null,toJson:function(){var _11={};if(this.baseSymbol){dojo.mixin(_11,{baseSymbol:this.baseSymbol.toJson()});}if(this.colorRamp){dojo.mixin(_11,{colorRamp:this.colorRamp.toJson()});}return _11;}});dojo.declare("esri.tasks.ClassBreaksDefinition",esri.tasks.ClassificationDefinition,{type:"classBreaksDef",classificationField:null,classificationMethod:null,breakCount:null,standardDeviationInterval:null,normalizationType:null,normalizationField:null,toJson:function(){var _12=this.inherited(arguments);var _13;switch(this.classificationMethod.toLowerCase()){case "natural-breaks":_13="esriClassifyNaturalBreaks";break;case "equal-interval":_13="esriClassifyEqualInterval";break;case "quantile":_13="esriClassifyQuantile";break;case "standard-deviation":_13="esriClassifyStandardDeviation";break;case "geometrical-interval":_13="esriClassifyGeometricalInterval";break;default:_13=this.classificationMethod;}dojo.mixin(_12,{type:this.type,classificationField:this.classificationField,classificationMethod:_13,breakCount:this.breakCount});if(this.normalizationType){var _14;switch(this.normalizationType.toLowerCase()){case "field":_14="esriNormalizeByField";break;case "log":_14="esriNormalizeByLog";break;case "percent-of-total":_14="esriNormalizeByPercentOfTotal";break;default:_14=this.normalizationType;}dojo.mixin(_12,{normalizationType:_14});}if(this.normalizationField){dojo.mixin(_12,{normalizationField:this.normalizationField});}if(this.standardDeviationInterval){dojo.mixin(_12,{standardDeviationInterval:this.standardDeviationInterval});}return _12;}});dojo.declare("esri.tasks.UniqueValueDefinition",esri.tasks.ClassificationDefinition,{type:"uniqueValueDef",attributeField:null,attributeField2:null,attributeField3:null,fieldDelimiter:null,toJson:function(){var _15=this.inherited(arguments);this.uniqueValueFields=[];if(this.attributeField){this.uniqueValueFields.push(this.attributeField);}if(this.attributeField2){this.uniqueValueFields.push(this.attributeField2);}if(this.attributeField3){this.uniqueValueFields.push(this.attributeField3);}dojo.mixin(_15,{type:this.type,uniqueValueFields:this.uniqueValueFields});if(this.fieldDelimiter){dojo.mixin(_15,{fieldDelimiter:this.fieldDelimiter});}return _15;}});dojo.declare("esri.tasks.ColorRamp",null,{type:null});dojo.declare("esri.tasks.AlgorithmicColorRamp",esri.tasks.ColorRamp,{type:"algorithmic",fromColor:null,toColor:null,algorithm:null,toJson:function(){var _16;switch(this.algorithm.toLowerCase()){case "cie-lab":_16="esriCIELabAlgorithm";break;case "hsv":_16="esriHSVAlgorithm";break;case "lab-lch":_16="esriLabLChAlgorithm";break;default:}var _17={type:"algorithmic",algorithm:_16};_17.fromColor=[];_17.fromColor.push(this.fromColor.r);_17.fromColor.push(this.fromColor.g);_17.fromColor.push(this.fromColor.b);_17.fromColor.push(this.fromColor.a);_17.toColor=[];_17.toColor.push(this.toColor.r);_17.toColor.push(this.toColor.g);_17.toColor.push(this.toColor.b);_17.toColor.push(this.toColor.a);return _17;}});dojo.declare("esri.tasks.MultipartColorRamp",esri.tasks.ColorRamp,{type:"multipart",colorRamps:[],toJson:function(){var _18=dojo.map(this.colorRamps,function(_19){return _19.toJson();});var _1a={type:"multipart",colorRamps:_18};return _1a;}});}