代码改变世界

Google卫片下载(转)

2010-03-26 09:08  smat  阅读(308)  评论(0编辑  收藏  举报

//创建GoogleMap地图 浏览器,并加载GoogleMap地图
GoogleMapWebBrowser browser = new GoogleMapWebBrowser();
browser.LoadGoogleMap(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "GoogleMap.htm"));

//设置经纬度与像素坐标转换回调函数
DownloadManager.Instance.LatLngToPixelCallBack = browser.LatLngToPixel;
DownloadManager.Instance.PixelToLatLngCallBack = browser.PixelToLatLng;

//设置下载器任务列表保存引擎
DownloadManager.Instance.DataStore = new DatabaseStore(new AccessData("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "data\\AccessDB.mdb")));


//设置下载默认保存路径
DownloadManager.Instance.DefaultLocation = "d:\\google map_download";

//设置拨号信息
DownloadManager.Instance.ADSLInfo.Name = "bh";
DownloadManager.Instance.ADSLInfo.UserName = "zxb1245";
DownloadManager.Instance.ADSLInfo.Password = "123456";

//创建下载器,并启动下载
Downloader dl=DownloadManager.Instance.Create("陕西10级地图",new Envelope(new Coordinate(38.5, 108.5), new Coordinate(40, 110)),10);

//注册事件监听下载进程
//dl.StateChanged += new EventHandler(dl_StateChanged);

//同步下载
DownloadManager.Instance.Start(dl);