/*
 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
 */

window[esri._dojoScopeName||"dojo"]._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","esri.layers.agsimageservice"],["require","esri.layers.dynamic"],["require","esri.layers.agscommon"],["require","esri.utils"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["esri.layers.agsimageservice"]){_4._hasResource["esri.layers.agsimageservice"]=true;_4.provide("esri.layers.agsimageservice");_4.require("esri.layers.dynamic");_4.require("esri.layers.agscommon");_4.require("esri.utils");_4.declare("esri.layers.ArcGISImageServiceLayer",esri.layers.DynamicMapServiceLayer,{constructor:function(_7,_8){this._url=esri.urlToObject(_7);var _9=_8&&_8.imageServiceParameters;this.format=_9&&_9.format;this.interpolation=_9?_9.interpolation:null;this.compressionQuality=_9?_9.compressionQuality:null;this.bandIds=_9?_9.bandIds:null;this.mosaicRule=_9?_9.mosaicRule:null;this.renderingRule=_9?_9.renderingRule:null;this._params=_4.mixin({},this._url.query,{f:"image",interpolation:this.interpolation,format:this.format,compressionQuality:this.compressionQuality,bandIds:this.bandIds?this.bandIds.join(","):null},_9?_9.toJson():{});this._initLayer=_4.hitch(this,this._initLayer);this.useMapImage=(_8&&_8.useMapImage)||false;this._loadCallback=_8&&_8.loadCallback;var _a=_8&&_8.resourceInfo;if(_a){this._initLayer(_a);}else{esri.request({url:this._url.path,content:_4.mixin({f:"json"},this._url.query),callbackParamName:"callback",load:this._initLayer,error:this._errorHandler});}},disableClientCaching:false,_initLayer:function(_b,io){this._findCredential();_4.mixin(this,_b);this.initialExtent=(this.fullExtent=this.extent=(new esri.geometry.Extent(_b.extent)));this.spatialReference=this.initialExtent.spatialReference;this.pixelSizeX=parseFloat(this.pixelSizeX);this.pixelSizeY=parseFloat(this.pixelSizeY);var i,il,_c=this.minValues,_d=this.maxValues,_e=this.meanValues,_f=this.stdvValues,bs=(this.bands=[]);for(i=0,il=this.bandCount;i<il;i++){bs[i]={min:_c[i],max:_d[i],mean:_e[i],stddev:_f[i]};}var _10=this.timeInfo;this.timeInfo=(_10&&_10.timeExtent)?new esri.layers.TimeInfo(_10):null;var _11=this.fields=[];var _12=_b.fields;if(_12){for(i=0;i<_12.length;i++){_11.push(new esri.layers.Field(_12[i]));}}this.version=_b.currentVersion;if(!this.version){var ver;if("fields" in _b||"objectIdField" in _b||"timeInfo" in _b){ver=10;}else{ver=9.3;}this.version=ver;}this.loaded=true;this.onLoad(this);var _13=this._loadCallback;if(_13){delete this._loadCallback;_13(this);}},getImageUrl:function(_14,_15,_16,_17){var sr=_14.spatialReference.wkid||_4.toJson(_14.spatialReference.toJson());delete this._params._ts;var _18=this._url.path+"/exportImage?";_4.mixin(this._params,{bbox:_14.xmin+","+_14.ymin+","+_14.xmax+","+_14.ymax,imageSR:sr,bboxSR:sr,size:_15+","+_16},this.disableClientCaching?{_ts:new Date().getTime()}:{});var _19=(this._params.token=this._getToken()),_1a=esri._getProxiedUrl(_18+_4.objectToQuery(_4.mixin(this._params,{f:"image"})));if((_1a.length>esri.config.defaults.io.postLength)||this.useMapImage){this._jsonRequest=esri.request({url:_18,content:_4.mixin(this._params,{f:"json"}),callbackParamName:"callback",load:function(_1b,io){var _1c=_1b.href;if(_19){_1c+=(_1c.indexOf("?")===-1?("?token="+_19):("&token="+_19));}_17(esri._getProxiedUrl(_1c));},error:this._errorHandler});}else{_17(_1a);}},setInterpolation:function(_1d,_1e){this.interpolation=(this._params.interpolation=_1d);if(!_1e){this.refresh(true);}},setCompressionQuality:function(_1f,_20){this.compressionQuality=(this._params.compressionQuality=_1f);if(!_20){this.refresh(true);}},setBandIds:function(ids,_21){this.bandIds=ids;this._params.bandIds=ids.join(",");if(!_21){this.refresh(true);}},setDefaultBandIds:function(_22){this.bandIds=(this._params.bandIds=null);if(!_22){this.refresh(true);}},setDisableClientCaching:function(_23){this.disableClientCaching=_23;},setMosaicRule:function(_24,_25){this.mosaicRule=_24;this._params.mosaicRule=_4.toJson(_24.toJson());if(!_25){this.refresh(true);}},setRenderingRule:function(_26,_27){this.renderingRule=_26;this._params.renderingRule=_4.toJson(_26.toJson());if(!_27){this.refresh(true);}},setImageFormat:function(_28,_29){this.format=(this._params.format=_28);if(!_29){this.refresh(true);}},refresh:function(_2a){if(_2a){this.inherited(arguments);}else{var dc=this.disableClientCaching;this.disableClientCaching=true;this.inherited(arguments);this.disableClientCaching=dc;}},exportMapImage:function(_2b,_2c){var m=esri.config.defaults.map,p=_4.mixin({size:m.width+","+m.height},this._params,_2b?_2b.toJson(this.normalization):{},{f:"json"});delete p._ts;this._exportMapImage(this._url.path+"/exportImage",p,_2c);}});_4.declare("esri.layers.ImageServiceParameters",null,{extent:null,width:null,height:null,imageSpatialReference:null,format:null,interpolation:null,compressionQuality:null,bandIds:null,timeExtent:null,mosaicRule:null,renderingRule:null,noData:null,toJson:function(_2d){var ext=this.bbox||this.extent;ext=ext&&_2d&&ext._normalize(true);var _2e=ext?(ext.spatialReference.wkid||_4.toJson(ext.spatialReference.toJson())):null,_2f=this.imageSpatialReference,_30={bbox:ext?(ext.xmin+","+ext.ymin+","+ext.xmax+","+ext.ymax):null,bboxSR:_2e,size:(this.width!==null&&this.height!==null?this.width+","+this.height:null),imageSR:(_2f?(_2f.wkid||_4.toJson(_2f.toJson())):_2e),format:this.format,interpolation:this.interpolation,compressionQuality:this.compressionQuality,bandIds:this.bandIds?this.bandIds.join(","):null,mosaicRule:this.mosaicRule?_4.toJson(this.mosaicRule.toJson()):null,renderingRule:this.renderingRule?_4.toJson(this.renderingRule.toJson()):null,noData:this.noData};var _31=this.timeExtent;_30.time=_31?_31.toJson().join(","):null;return esri.filter(_30,function(_32){if(_32!==null){return true;}});}});_4.mixin(esri.layers.ImageServiceParameters,{INTERPOLATION_BILINEAR:"RSP_BilinearInterpolation",INTERPOLATION_CUBICCONVOLUTION:"RSP_CubicConvolution",INTERPOLATION_MAJORITY:"RSP_Majority",INTERPOLATION_NEARESTNEIGHBOR:"RSP_NearestNeighbor"});_4.declare("esri.layers.MosaicRule",null,{method:null,where:null,sortField:null,sortValue:null,ascending:false,lockRasterIds:null,viewpoint:null,objectIds:null,operation:null,toJson:function(){var _33={mosaicMethod:this.method,where:this.where,sortField:this.sortField,sortValue:this.sortValue?_4.toJson(this.sortValue):null,ascending:this.ascending,lockRasterIds:this.lockRasterIds,viewpoint:this.viewpoint?this.viewpoint.toJson():null,fids:this.objectIds,mosaicOperation:this.operation};return esri.filter(_33,function(_34){if(_34!==null){return true;}});}});_4.mixin(esri.layers.MosaicRule,{METHOD_NONE:"esriMosaicNone",METHOD_CENTER:"esriMosaicCenter",METHOD_NADIR:"esriMosaicNadir",METHOD_VIEWPOINT:"esriMosaicViewpoint",METHOD_ATTRIBUTE:"esriMosaicAttribute",METHOD_LOCKRASTER:"esriMosaicLockRaster",METHOD_NORTHWEST:"esriMosaicNorthwest",METHOD_SEAMLINE:"esriMosaicSeamline",OPERATION_FIRST:"MT_FIRST",OPERATION_LAST:"MT_LAST",OPERATION_MIN:"MT_MIN",OPERATION_MAX:"MT_MAX",OPERATION_MEAN:"MT_MEAN",OPERATION_BLEND:"MT_BLEND"});_4.declare("esri.layers.RasterFunction",null,{functionName:null,"arguments":null,variableName:null,toJson:function(){var _35={rasterFunction:this.functionName,rasterFunctionArguments:this["arguments"],variableName:this.variableName};return esri.filter(_35,function(_36){if(_36!==null){return true;}});}});}}};});