扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者: 陶刚编译 来源:天极开发 2007年11月21日
关键字: MapPoint Smartphone C# 开发
public static void GetAddress(Address address, string DataSourceName, out indResults Location, out ViewByHeightWidth[] Views) { try { FindServiceSoap locationService = new FindServiceSoap(); locationService.Credentials = new System.Net.NetworkCredential(_mapPointUserName,_mapPointPassword); locationService.PreAuthenticate = true; FindAddressSpecification locationData = new FindAddressSpecification(); locationData.DataSourceName = DataSourceName; locationData.InputAddress = address; Location = locationService.FindAddress(locationData); Views = new ViewByHeightWidth[1]; Views[0] = Location.Results[0].FoundLocation.BestMapView.ByHeightWidth; } catch(Exception ex) { throw new Exception(ex.Message,ex); } } |
public static Bitmap GetMap(FindResults Location, ViewByHeightWidth[] Views,string DataSourceName, Point MapDimensions) { try { RenderServiceSoap renderService = new RenderServiceSoap(); Pushpin[] pushpins = new Pushpin[1]; MapSpecification mapSpec = new MapSpecification(); renderService.Credentials = new System.Net.NetworkCredential(_mapPointUserName, _mapPointPassword); renderService.PreAuthenticate = true; pushpins[0] = new Pushpin(); pushpins[0].IconDataSource = "MapPoint.Icons"; pushpins[0].IconName = "0"; pushpins[0].Label = Location.Results[0].FoundLocation.Entity.Name; pushpins[0].LatLong = Views[0].CenterPoint; pushpins[0].ReturnsHotArea = true; mapSpec.DataSourceName = DataSourceName; mapSpec.Views = Views; mapSpec.Pushpins = pushpins; mapSpec.Options = new MapOptions(); mapSpec.Options.Format = new ImageFormat(); mapSpec.Options.Format.Width = MapDimensions.X; mapSpec.Options.Format.Height = MapDimensions.Y; MapImage[] mapImages = renderService.GetMap(mapSpec); System.IO.Stream streamImage = new System.IO.MemoryStream(mapImages[0].MimeData.Bits); Bitmap bitmap = new Bitmap(streamImage); return bitmap; } catch(Exception ex) { throw new Exception(ex.Message,ex); } } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者