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();
        }

 

posted @ 2010-08-22 17:44  ForrestWoo  阅读(2305)  评论(1编辑  收藏  举报