laptop and a wrench

漏洞

Rapidly panning a map causes the dynamic layer to be shifted relative to the cached layer if the 'useMapImage' property has been set to 'true' for the dynamic layer.

上次发布: November 11, 2014 ArcGIS API for JavaScript
漏洞 ID 编号 NIM050461
已提交October 30, 2009
上次修改时间June 5, 2024
适用范围ArcGIS API for JavaScript
找到的版本Other
编程语言JavaScript
操作系统Windows OS
操作系统版本2003
状态Non-Reproducible

附加信息

The useMapImage property is deprecated at version 2.0.

解决办法

1. Save the following code as a Javascript file and place it on the web server where the application is being hosted. /* * Patch (for v1.6) to fix the useMapImage bug in dynamic map service layer */ (function() { dojo.addOnLoad(function() { esri.layers.DynamicMapServiceLayer.prototype._onExtentChangeHandler = function(extent) { if(!this.visible){return;} var _m=this._map,_i=this._img,_istyle=_i&&_i.style,_do=this._img_dragOrigin;if(_i){_do.x=parseInt(_istyle.left);_do.y=parseInt(_istyle.top);} else{_do.x=(_do.y=0);} var loading=this._img_loading;if(loading){dojo.disconnect(loading._onload_connect);dojo.disconnect(loading._onerror_connect);dojo.disconnect(loading._onabort_connect);dojo.destroy(loading);this._img_loading=null;var request=this._jsonRequest;if(request){try{request.cancel();} catch(e){} this._jsonRequest=null;}} if(this.isPNG32){var div=(this._img_loading=dojo.create("div")),_d=this._div;div.id=_m.id+"_"+this.id+"_"+new Date().getTime();dojo.style(div,{position:"absolute",left:"0px",top:"0px",width:_m.width+"px",height:_m.height+"px"});var innerDiv=div.appendChild(dojo.create("div"));dojo.style(innerDiv,{opacity:0,width:_m.width+"px",height:_m.height+"px"});this.getImageUrl(extent,_m.width,_m.height,this._divAlphaImageFunc);div=null;} else{var img=(this._img_loading=dojo.create("img")),_d=this._div;img.id=_m.id+"_"+this.id+"_"+new Date().getTime();var styleAttr={position:"absolute",left:"0px",top:"0px",width:_m.width+"px",height:_m.height+"px"};var isIE=dojo.isIE;if(isIE&&isIE>7){styleAttr.opacity=this.opacity;} dojo.style(img,styleAttr);img._onload_connect=dojo.connect(img,"onload",this,"_onLoadHandler");img._onerror_connect=dojo.connect(img,"onerror",this,"_onErrorHandler");img._onabort_connect=dojo.connect(img,"onabort",this,"_onErrorHandler");this._startRect={left:_do.x,top:_do.y,width:_i?parseInt(_istyle.width):_m.width,height:_i?parseInt(_istyle.height):_m.height,zoom:(_istyle&&_istyle.zoom)?parseFloat(_istyle.zoom):1};this.getImageUrl(extent,_m.width,_m.height,this._imgSrcFunc);img=null;} }; esri.layers.ArcGISDynamicMapServiceLayer.prototype.getImageUrl = function(extent, width, height, callback) { var path=this._url.path+"/export?",_p=this._params,sr=extent.spatialReference.wkid,_errorHandler=this._errorHandler;delete _p._ts;dojo.mixin(_p,{bbox:dojo.toJson(extent.toJson()),bboxSR:sr,imageSR:sr,size:width+","+height},this.disableClientCaching?{_ts:new Date().getTime()}:{});if(_p.layerDefs){var defs=_p.layerDefs;delete _p.layerDefs;dojo.mixin(_p,{layerDefs:defs});} if(this.useMapImage){var _h=this._imageExportHandler;this._jsonRequest=esri.request({url:path,content:dojo.mixin(_p,{f:"json"}),callbackParamName:"callback",load:function(response,io){_h(response,io,callback);},error:_errorHandler});} else{callback(esri._getProxiedUrl(path+dojo.objectToQuery(dojo.mixin({},_p,{f:"image"}))));} }; }); }()); 2. In the Javascript application add this script tag right below the call to the Javascript API itself (patch.js is the file saved in step 1) <script type="text/javascript" src="./patch.js"></script>

重现步骤

漏洞 ID: NIM050461

软件:

  • ArcGIS API for JavaScript

当漏洞状态发生变化时获得通知

下载 Esri 支持应用程序

发现关于本主题的更多内容

获取来自 ArcGIS 专家的帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项