Silverlight学习笔记十七BingMap(五)之中文地图系统
这一节是如何部署中文地图系统
步骤一、
public class ChinaTileSource
{
/// <summary>
/// 加载中国地图系统
/// http://r2.tiles.ditu.live.com/tiles/r{quadkey}.png?g=41中国地图系统
/// </summary>
/// <returns>TileSource</returns>
public TileSource GetChinaTileSource()
{
UriBuilder tileSourceUri = new UriBuilder("http://r2.tiles.ditu.live.com/tiles/r{quadkey}.png?g=41");
MapTileLayer tileLayer = new MapTileLayer();
LocationRectTileSource tileSource = new LocationRectTileSource(tileSourceUri.Uri.ToString()
, new LocationRect(new Location(60, 60), new Location(13, 140)), new Range<double>(1, 16));
return tileSource;
}
}
步骤二、
public ChinaMapControl()
{
InitializeComponent();
MapTileLayer tileLayer = new MapTileLayer();
ChinaTileSource gts = new ChinaTileSource();
tileLayer.TileSources.Add(gts.GetChinaTileSource());
MyMap.Children.Add(tileLayer);
this.MyMap.Mode = new MercatorMode();
}
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步