Map control's Scale property always returns NaN if its MapResourceManager contains an ArcIMS ArcMapImage service.
上次发布: August 25, 2014No Product Found
漏洞 ID 编号
NIM010520
已提交
July 24, 2007
上次修改时间
June 5, 2024
适用范围
No Product Found
找到的版本
9.2
状态
Will Not Be Addressed
开发团队已考虑过该问题或请求,并决定不会解决该问题。 问题的“其他信息”部分可能包含进一步说明。
附加信息
No Public Explanation
解决办法
//Calculate the relative scale using the extent in map units and display units ...private double getMapScale() { int dpi = 96; //number of pixels per inch; default is 96 if ((_map.GetFunctionality(0).GetType()) == typeof(ESRI.ArcGIS.ADF.Web.DataSources.IMS.MapFunctionality)) { ESRI.ArcGIS.ADF.Web.DataSources.IMS.MapFunctionality funcMap = (ESRI.ArcGIS.ADF.Web.DataSources.IMS.MapFunctionality) _map.GetFunctionality(0); MapView viewMap = funcMap.MapView; dpi = viewMap.ImageDescriptor.Dpi; } //**Change the variable below to represent the current inches per map unit (meters, feet, degrees, etc.) int inchesPerMapUnit = 4371840; //number of inches in one degree latitude (or longitude at the equator) //* int inchesPerMapUnit = 12; //..feet //* int inchesPerMapUnit = 39.37; //..meters double mapW = _map.Extent.Width; //width of the map in decimal degrees int imgW = (int) _map.Width.Value; //width of the map image in pixels double inchesMap = mapW * inchesPerMapUnit; //width of the map in inches double inchesImg = imgW / dpi; //width of the map image in inches return (inchesMap / inchesImg); //number of ground inches per inch of the image }Or use MapView::Scale (to get the number of map units per pixel). For example: ESRI.ArcGIS.ADF.Web.DataSources.IMS.MapFunctionality funcMap = (ESRI.ArcGIS.ADF.Web.DataSources.IMS.MapFunctionality) Map1.GetFunctionality(0); MapView viewMap = funcMap.MapView; double scale = viewMap.Scale;