Repository: sherlockchou86/BMap.NET Branch: master Commit: a85128edd0c4 Files: 159 Total size: 1.1 MB Directory structure: gitextract_d4njwb7z/ ├── .gitattributes ├── .gitignore ├── Asserts/ │ ├── ico.psd │ ├── ico1.psd │ ├── points.psd │ ├── strange_point.psd │ ├── 未标题-2.psd │ └── 未标题-3.psd ├── BMap.NET/ │ ├── BMap.NET.csproj │ ├── BMapConfiguration.cs │ ├── HTTPService/ │ │ ├── AKSNCaculater.cs │ │ ├── CoordinateTransService.cs │ │ ├── DirectionService.cs │ │ ├── GeocodingService.cs │ │ ├── IPService.cs │ │ ├── MapService.cs │ │ ├── PlaceService.cs │ │ ├── PlaceSuggestionService.cs │ │ └── ServiceBase.cs │ ├── LoadMapMode.cs │ ├── MapMode.cs │ ├── Properties/ │ │ ├── AssemblyInfo.cs │ │ ├── BMap.Designer.cs │ │ └── BMap.settings │ ├── VerificationMode.cs │ └── app.config ├── BMap.NET.DownloadDemo/ │ ├── BMap.NET.DownloadDemo.csproj │ ├── MainForm.Designer.cs │ ├── MainForm.cs │ ├── MainForm.resx │ ├── Program.cs │ ├── Properties/ │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ └── app.config ├── BMap.NET.WindowsForm/ │ ├── BCityControl.Designer.cs │ ├── BCityControl.cs │ ├── BCityControl.resx │ ├── BDirectionBoard.Designer.cs │ ├── BDirectionBoard.cs │ ├── BDirectionBoard.resx │ ├── BDrivingRouteItem.Designer.cs │ ├── BDrivingRouteItem.cs │ ├── BDrivingRouteItem.resx │ ├── BDrivingStepItem.Designer.cs │ ├── BDrivingStepItem.cs │ ├── BDrivingStepItem.resx │ ├── BLoadMapModeControl.Designer.cs │ ├── BLoadMapModeControl.cs │ ├── BLoadMapModeControl.resx │ ├── BMap.NET.WindowsForm.csproj │ ├── BMapControl.Designer.cs │ ├── BMapControl.cs │ ├── BMapControl.resx │ ├── BMapElements/ │ │ ├── BBound.cs │ │ ├── BDistance.cs │ │ ├── BMapElement.cs │ │ ├── BMarker.cs │ │ ├── BNearBy.cs │ │ ├── BPOI.cs │ │ ├── BPoint.cs │ │ ├── BRoute.cs │ │ └── BTile.cs │ ├── BMarkerEditorControl.Designer.cs │ ├── BMarkerEditorControl.cs │ ├── BMarkerEditorControl.resx │ ├── BMarkerTipControl.Designer.cs │ ├── BMarkerTipControl.cs │ ├── BMarkerTipControl.resx │ ├── BPOITipControl.Designer.cs │ ├── BPOITipControl.cs │ ├── BPOITipControl.resx │ ├── BPlaceBox.Designer.cs │ ├── BPlaceBox.cs │ ├── BPlaceBox.resx │ ├── BPlaceItem.Designer.cs │ ├── BPlaceItem.cs │ ├── BPlaceItem.resx │ ├── BPlacesBoard.Designer.cs │ ├── BPlacesBoard.cs │ ├── BPlacesBoard.resx │ ├── BPlacesSuggestionControl.Designer.cs │ ├── BPlacesSuggestionControl.cs │ ├── BPlacesSuggestionControl.resx │ ├── BPlacesSuggestionItem.Designer.cs │ ├── BPlacesSuggestionItem.cs │ ├── BPlacesSuggestionItem.resx │ ├── BPointTipControl.Designer.cs │ ├── BPointTipControl.cs │ ├── BPointTipControl.resx │ ├── BQuickSearchBoardcs.Designer.cs │ ├── BQuickSearchBoardcs.cs │ ├── BQuickSearchBoardcs.resx │ ├── BQuickSearchControl.Designer.cs │ ├── BQuickSearchControl.cs │ ├── BQuickSearchControl.resx │ ├── BScreenshotMenu.Designer.cs │ ├── BScreenshotMenu.cs │ ├── BScreenshotMenu.resx │ ├── BStepStartAndEndItem.Designer.cs │ ├── BStepStartAndEndItem.cs │ ├── BStepStartAndEndItem.resx │ ├── BTaxiTipControl.Designer.cs │ ├── BTaxiTipControl.cs │ ├── BTaxiTipControl.resx │ ├── BTransitRouteItem.Designer.cs │ ├── BTransitRouteItem.cs │ ├── BTransitRouteItem.resx │ ├── BTransitStepItem.Designer.cs │ ├── BTransitStepItem.cs │ ├── BTransitStepItem.resx │ ├── BWalkingRouteItem.Designer.cs │ ├── BWalkingRouteItem.cs │ ├── BWalkingRouteItem.resx │ ├── BWalkingStepItem.Designer.cs │ ├── BWalkingStepItem.cs │ ├── BWalkingStepItem.resx │ ├── BaiduJSAPI_cracker.js │ ├── DrawingObjects/ │ │ ├── BCircle.cs │ │ ├── BDownloadRectangle.cs │ │ ├── BLine.cs │ │ ├── BPolygon.cs │ │ ├── BRectangle.cs │ │ ├── BScreenShotRectangle.cs │ │ └── DrawingObject.cs │ ├── FunctionalControls/ │ │ ├── BTabControl.cs │ │ ├── CityList.Designer.cs │ │ ├── CityList.cs │ │ └── CityList.resx │ ├── LatLngPoint.cs │ ├── MapDownloadDialog.Designer.cs │ ├── MapDownloadDialog.cs │ ├── MapDownloadDialog.resx │ ├── MapDownloaderControl.Designer.cs │ ├── MapDownloaderControl.cs │ ├── PointType.cs │ ├── Properties/ │ │ ├── AssemblyInfo.cs │ │ ├── BMap.Designer.cs │ │ ├── BMap.resx │ │ ├── Resources.Designer.cs │ │ └── Resources.resx │ ├── Resources/ │ │ └── baidu_citys.txt │ └── RouteType.cs ├── BMap.NET.WinformDemo/ │ ├── BMap.NET.WinformDemo.csproj │ ├── MainForm.Designer.cs │ ├── MainForm.cs │ ├── MainForm.resx │ ├── Program.cs │ ├── Properties/ │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ └── app.config ├── BMap.NET.sln ├── README.md └── licences.txt ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitattributes ================================================ # Auto detect text files and perform LF normalization * text=auto # Custom for Visual Studio *.cs diff=csharp # Standard to msysgit *.doc diff=astextplain *.DOC diff=astextplain *.docx diff=astextplain *.DOCX diff=astextplain *.dot diff=astextplain *.DOT diff=astextplain *.pdf diff=astextplain *.PDF diff=astextplain *.rtf diff=astextplain *.RTF diff=astextplain ================================================ FILE: .gitignore ================================================ ################# ## Eclipse ################# *.pydevproject .project .metadata bin/ tmp/ *.tmp *.bak *.swp *~.nib local.properties .classpath .settings/ .loadpath # External tool builders .externalToolBuilders/ # Locally stored "Eclipse launch configurations" *.launch # CDT-specific .cproject # PDT-specific .buildpath ################# ## Visual Studio ################# ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. # User-specific files *.suo *.user *.sln.docstates # Build results [Dd]ebug/ [Rr]elease/ x64/ build/ [Bb]in/ [Oo]bj/ # MSTest test Results [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* *_i.c *_p.c *.ilk *.meta *.obj *.pch *.pdb *.pgc *.pgd *.rsp *.sbr *.tlb *.tli *.tlh *.tmp *.tmp_proj *.log *.vspscc *.vssscc .builds *.pidb *.log *.scc # Visual C++ cache files ipch/ *.aps *.ncb *.opensdf *.sdf *.cachefile # Visual Studio profiler *.psess *.vsp *.vspx # Guidance Automation Toolkit *.gpState # ReSharper is a .NET coding add-in _ReSharper*/ *.[Rr]e[Ss]harper # TeamCity is a build add-in _TeamCity* # DotCover is a Code Coverage Tool *.dotCover # NCrunch *.ncrunch* .*crunch*.local.xml # Installshield output folder [Ee]xpress/ # DocProject is a documentation generator add-in DocProject/buildhelp/ DocProject/Help/*.HxT DocProject/Help/*.HxC DocProject/Help/*.hhc DocProject/Help/*.hhk DocProject/Help/*.hhp DocProject/Help/Html2 DocProject/Help/html # Click-Once directory publish/ # Publish Web Output *.Publish.xml *.pubxml *.publishproj # NuGet Packages Directory ## TODO: If you have NuGet Package Restore enabled, uncomment the next line #packages/ # Windows Azure Build Output csx *.build.csdef # Windows Store app package directory AppPackages/ # Others sql/ *.Cache ClientBin/ [Ss]tyle[Cc]op.* ~$* *~ *.dbmdl *.[Pp]ublish.xml *.pfx *.publishsettings # RIA/Silverlight projects Generated_Code/ # Backup & report files from converting an old project file to a newer # Visual Studio version. Backup files are not needed, because we have git ;-) _UpgradeReport_Files/ Backup*/ UpgradeLog*.XML UpgradeLog*.htm # SQL Server files App_Data/*.mdf App_Data/*.ldf ############# ## Windows detritus ############# # Windows image file caches Thumbs.db ehthumbs.db # Folder config file Desktop.ini # Recycle Bin used on file shares $RECYCLE.BIN/ # Mac crap .DS_Store ############# ## Python ############# *.py[cod] # Packages *.egg *.egg-info dist/ build/ eggs/ parts/ var/ sdist/ develop-eggs/ .installed.cfg # Installer logs pip-log.txt # Unit test / coverage reports .coverage .tox #Translations *.mo #Mr Developer .mr.developer.cfg ================================================ FILE: BMap.NET/BMap.NET.csproj ================================================  Debug AnyCPU 8.0.30703 2.0 {AFFEB71C-54B6-4A9B-A445-BB287EDBAC19} Library Properties BMap.NET BMap.NET v4.0 512 true full false bin\Debug\ DEBUG;TRACE prompt 4 pdbonly true bin\Release\ TRACE prompt 4 False libs\Newtonsoft.Json.dll True True BMap.settings SettingsSingleFileGenerator BMap.Designer.cs ================================================ FILE: BMap.NET/BMapConfiguration.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BMap.NET { /// /// 负责读/写配置 /// public class BMapConfiguration { /// /// 访问WebAPI的AK /// public static string AK { get { return Properties.BMap.Default.ServiceAK; } set { Properties.BMap.Default.ServiceAK = value; Properties.BMap.Default.Save(); } } /// /// 访问WebAPI的SK /// public static string SK { get { return Properties.BMap.Default.ServiceSK; } set { Properties.BMap.Default.ServiceSK = value; Properties.BMap.Default.Save(); } } /// /// Web API校验方式 /// public static VerificationMode VerificationMode { get { return (VerificationMode)Properties.BMap.Default.VerificationMode; } set { Properties.BMap.Default.VerificationMode = (int)value; Properties.BMap.Default.Save(); } } /// /// 地图加载方式 /// public static LoadMapMode LoadMapMode { get { return (LoadMapMode)Properties.BMap.Default.LoadMapMode; } set { Properties.BMap.Default.LoadMapMode = (int)value; Properties.BMap.Default.Save(); } } /// /// 地图缓存路径 /// public static string MapCachePath { get { return Properties.BMap.Default.MapCachePath; } set { Properties.BMap.Default.MapCachePath = value; Properties.BMap.Default.Save(); } } } } ================================================ FILE: BMap.NET/HTTPService/AKSNCaculater.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; public class AKSNCaculater { /// /// 计算SN /// /// /// private static string MD5(string password) { byte[] textBytes = System.Text.Encoding.UTF8.GetBytes(password); try { System.Security.Cryptography.MD5CryptoServiceProvider cryptHandler; cryptHandler = new System.Security.Cryptography.MD5CryptoServiceProvider(); byte[] hash = cryptHandler.ComputeHash(textBytes); string ret = ""; foreach (byte a in hash) { ret += a.ToString("x"); } return ret; } catch { throw; } } private static string UrlEncode(string str) { str = System.Web.HttpUtility.UrlEncode(str, Encoding.UTF8); byte[] buf = Encoding.ASCII.GetBytes(str);//等同于Encoding.ASCII.GetBytes(str) for (int i = 0; i < buf.Length; i++) if (buf[i] == '%') { if (buf[i + 1] >= 'a') buf[i + 1] -= 32; if (buf[i + 2] >= 'a') buf[i + 2] -= 32; i += 2; } return Encoding.ASCII.GetString(buf);//同上,等同于Encoding.ASCII.GetString(buf) } private static string HttpBuildQuery(IDictionary querystring_arrays) { StringBuilder sb = new StringBuilder(); foreach (var item in querystring_arrays) { sb.Append(UrlEncode(item.Key)); sb.Append("="); sb.Append(UrlEncode(item.Value)); sb.Append("&"); } sb.Remove(sb.Length - 1, 1); return sb.ToString(); } public static string CaculateAKSN(string ak, string sk, string url, IDictionary querystring_arrays) { var queryString = HttpBuildQuery(querystring_arrays); var str = UrlEncode(url + "?" + queryString + sk); return MD5(str); } } ================================================ FILE: BMap.NET/HTTPService/CoordinateTransService.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using Newtonsoft.Json.Linq; using Newtonsoft.Json; namespace BMap.NET.HTTPService { /// /// 提供坐标转换相关服务 /// public class CoordinateTransService:ServiceBase { private static string _coordinate_url = "http://api.map.baidu.com/geoconv/v1/?"; /// /// 将指定坐标转换成另一种指定坐标 /// 1:GPS设备获取的角度坐标 /// 2:GPS获取的米制坐标、sogou地图所用坐标 /// 3:google地图、soso地图、aliyun地图、mapabc地图和amap地图所用坐标 /// 4:3中列表地图坐标对应的米制坐标 /// 5:百度地图采用的经纬度坐标 /// 6:百度地图采用的米制坐标 /// 7:mapbar地图坐标; /// 8:51地图坐标 /// /// 原坐标1(经度、X值) /// 原坐标2(纬度、Y值) /// 原坐标类型 /// 转换类型 /// public JObject CoordinateTransform(string source1, string source2, int from, int to) { try { if (_vm == VerificationMode.IPWhiteList) //IP 白名单校验 { string url = _coordinate_url + "coords=" + source1 + "," + source2 + "&from=" + from + "&to=" + to + "&output=json&ak=" + _ak; string json = DownloadString(url); return JsonConvert.DeserializeObject(json) as JObject; } else //SN校验 { string url = _coordinate_url + "coords=" + source1 + "," + source2 + "&from=" + from + "&to=" + to + "&output=json&ak=" + _ak; IDictionary param = new Dictionary { { "coords", source1+","+source2 }, { "from", from.ToString() }, { "to", to.ToString() }, { "output", "json" }, { "ak", _ak } }; string sn = AKSNCaculater.CaculateAKSN(_ak, _sk, _coordinate_url.Split(new string[] { ".com" }, StringSplitOptions.None)[1], param); //计算sn string json = DownloadString(url + "&sn=" + sn); return JsonConvert.DeserializeObject(json) as JObject; } } catch { return null; } } } } ================================================ FILE: BMap.NET/HTTPService/DirectionService.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace BMap.NET.HTTPService { /// /// 提供导航相关服务 /// public class DirectionService:ServiceBase { private static string _direction_url = "http://api.map.baidu.com/direction/v1"; //导航相关 /// /// 驾车导航 /// /// 起点 /// 终点 /// 起点城市 /// 终点城市 /// 方案 10:不走高速 11:最短时间 12:最短路径 /// public JObject DirectionByDriving(string origin, string destination, string origin_region, string destination_region, int tactics = 11) { try { if (_vm == VerificationMode.IPWhiteList) //IP 白名单校验 { string url = _direction_url + "?origin=" + origin + "&destination=" + destination + "&origin_region=" + origin_region + "&destination_region=" + destination_region + "&tactics=" + tactics + "&output=json&mode=driving&ak=" + _ak; string json = DownloadString(url); return JsonConvert.DeserializeObject(json) as JObject; } else //SN校验 { string url = _direction_url + "?origin=" + origin + "&destination=" + destination + "&origin_region=" + origin_region + "&destination_region=" + destination_region + "&tactics=" + tactics + "&output=json&mode=driving&ak=" + _ak; IDictionary param = new Dictionary { { "origin", origin }, { "destination", destination }, { "origin_region", origin_region }, { "destination_region", destination_region }, { "tactics", tactics.ToString() }, {"output","json"}, {"mode","driving"}, { "ak", _ak } }; string sn = AKSNCaculater.CaculateAKSN(_ak, _sk, _direction_url.Split(new string[] { ".com" }, StringSplitOptions.None)[1], param); //计算sn string json = DownloadString(url + "&sn=" + sn); return JsonConvert.DeserializeObject(json) as JObject; } } catch { return null; } } /// /// 步行导航 /// /// 起点 /// 终点 /// 所在城市 /// public JObject DirectionByWalking(string origin, string destination, string region) { try { if (_vm == VerificationMode.IPWhiteList) //IP 白名单校验 { string url = _direction_url + "?origin=" + origin + "&destination=" + destination + "®ion=" + region + "&output=json&mode=walking&ak=" + _ak; string json = DownloadString(url); return JsonConvert.DeserializeObject(json) as JObject; } else //SN校验 { string url = _direction_url + "?origin=" + origin + "&destination=" + destination + "®ion=" + region + "&output=json&mode=walking&ak=" + _ak; IDictionary param = new Dictionary { { "origin", origin }, { "destination", destination }, { "region", region }, {"output","json"}, {"mode","walking"}, { "ak", _ak } }; string sn = AKSNCaculater.CaculateAKSN(_ak, _sk, _direction_url.Split(new string[] { ".com" }, StringSplitOptions.None)[1], param); //计算sn string json = DownloadString(url + "&sn=" + sn); return JsonConvert.DeserializeObject(json) as JObject; } } catch { return null; } } /// /// 公交导航 /// /// 起点 /// 终点 /// 所在城市 /// public JObject DirectionByTransit(string origin, string destination, string region) { try { if (_vm == VerificationMode.IPWhiteList) //IP 白名单校验 { string url = _direction_url + "?origin=" + origin + "&destination=" + destination + "®ion=" + region + "&output=json&mode=transit&ak=" + _ak; string json = DownloadString(url); return JsonConvert.DeserializeObject(json) as JObject; } else //SN校验 { string url = _direction_url + "?origin=" + origin + "&destination=" + destination + "®ion=" + region + "&output=json&mode=transit&ak=" + _ak; IDictionary param = new Dictionary { { "origin", origin }, { "destination", destination }, { "region", region }, { "output", "json" }, {"mode","transit"}, { "ak", _ak } }; string sn = AKSNCaculater.CaculateAKSN(_ak, _sk, _direction_url.Split(new string[] { ".com" }, StringSplitOptions.None)[1], param); //计算sn string json = DownloadString(url + "&sn=" + sn); return JsonConvert.DeserializeObject(json) as JObject; } } catch { return null; } } } } ================================================ FILE: BMap.NET/HTTPService/GeocodingService.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace BMap.NET.HTTPService { /// /// 提供地址解析相关服务 /// public class GeocodingService:ServiceBase { private static string _geocoding_url = "http://api.map.baidu.com/geocoder/v2/"; //地理编码 /// /// 地址编码 地址转坐标 /// /// 地址 /// public JObject Geocoding(string address) { try { if (_vm == VerificationMode.IPWhiteList) //IP 白名单校验 { string url = _geocoding_url + "?address=" + address + "&output=json&ak=" + _ak; string json = DownloadString(url); return JsonConvert.DeserializeObject(json) as JObject; } else //SN校验 { string url = _geocoding_url + "?address=" + address + "&output=json&ak=" + _ak; IDictionary param = new Dictionary { { "address", address }, { "output", "json" }, { "ak", _ak } }; string sn = AKSNCaculater.CaculateAKSN(_ak, _sk, _geocoding_url.Split(new string[] { ".com" }, StringSplitOptions.None)[1], param); //计算sn string json = DownloadString(url + "&sn=" + sn); return JsonConvert.DeserializeObject(json) as JObject; } } catch { return null; } } /// /// 逆地址编码 坐标转地址 /// /// 坐标 维度,经度 /// public JObject DeGeocoding(string location) { try { if (_vm == VerificationMode.IPWhiteList) //IP 白名单校验 { string url = _geocoding_url + "?location=" + location + "&pois=1&output=json&ak=" + _ak; string json = DownloadString(url); return JsonConvert.DeserializeObject(json) as JObject; } else //SN校验 { string url = _geocoding_url + "?location=" + location + "&pois=1&output=json&ak=" + _ak; IDictionary param = new Dictionary { { "location", location }, { "pois", "1" }, { "output", "json" }, { "ak", _ak } }; string sn = AKSNCaculater.CaculateAKSN(_ak, _sk, _geocoding_url.Split(new string[] { ".com" }, StringSplitOptions.None)[1], param); //计算sn string json = DownloadString(url + "&sn=" + sn); return JsonConvert.DeserializeObject(json) as JObject; } } catch { return null; } } } } ================================================ FILE: BMap.NET/HTTPService/IPService.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using Newtonsoft.Json.Linq; using Newtonsoft.Json; namespace BMap.NET.HTTPService { /// /// 提供IP定位相关服务 /// public class IPService:ServiceBase { private static string _ip_url = "http://api.map.baidu.com/location/ip"; /// /// 根据IP获取对应位置 /// /// IP地址 为空表示访问者IP /// public JObject LocationByIP(string ip = null) { try { if (_vm == VerificationMode.IPWhiteList) //IP 白名单校验 { string url = _ip_url + "?ip=" + (ip == null ? "" : ip) + "&coor=bd09ll&output=json&ak=" + _ak; string json = DownloadString(url); return JsonConvert.DeserializeObject(json) as JObject; } else //SN校验 { string url = _ip_url + "?ip=" + (ip == null ? "" : ip) + "&coor=bd09ll&output=json&ak=" + _ak; IDictionary param = new Dictionary { { "ip", ip == null ? "" : ip }, { "coor", "bd09ll" }, { "output", "json" }, { "ak", _ak } }; string sn = AKSNCaculater.CaculateAKSN(_ak, _sk, _ip_url.Split(new string[] { ".com" }, StringSplitOptions.None)[1], param); //计算sn string json = DownloadString(url + "&sn=" + sn); return JsonConvert.DeserializeObject(json) as JObject; } } catch { return null; } } } } ================================================ FILE: BMap.NET/HTTPService/MapService.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; using System.IO; namespace BMap.NET.HTTPService { /// /// 提供地图相关服务 /// public class MapService:ServiceBase { private static string _road_url = "http://online{0}.map.bdimg.com/onlinelabel/"; //地图切片URL private static string _sate_url = "http://shangetu{0}.map.bdimg.com/it/"; //卫星图切片URL /* http://online9.map.bdimg.com/onlinelabel/?qt=tile&x=796&y=287&z=12&styles=pl */ /* http://shangetu9.map.bdimg.com/it/u=x=796;y=287;z=13;v=009;type=sate&fm=46 */ /// /// 下载地图瓦片 /// /// 瓦片方块横坐标 /// 瓦片方块纵坐标 /// 当前地图缩放级别(1-18) /// 地图模式 /// 加载瓦片方式 /// public Bitmap LoadMapTile(int x, int y, int zoom, MapMode map_mode, LoadMapMode load_mode) { if (load_mode == LoadMapMode.Server) //直接从服务器下载图片 { return TileFromServer(zoom, x, y, map_mode); } else if (load_mode == LoadMapMode.Cache) //从本地缓存中下载图片 { return TileFromCache(zoom, x, y, map_mode); } else if (load_mode == LoadMapMode.CacheServer) //先从本地缓存中找,如果没有则从服务器上下载 { Bitmap bitmap = TileFromCache(zoom, x, y, map_mode); if (bitmap == null) { bitmap = TileFromServer(zoom, x, y, map_mode); } return bitmap; } else { return null; } } /// /// 清空瓦片缓存 /// public void ClearTileCache() { try { string cache_path = Properties.BMap.Default.MapCachePath; DirectoryInfo dir = new DirectoryInfo(cache_path); foreach (DirectoryInfo d in dir.GetDirectories()) { if (d.Name == MapMode.Normal.ToString() || d.Name == MapMode.RoadNet.ToString() || d.Name == MapMode.Satellite.ToString()) { d.Delete(true); } } } catch { } } /// /// 从缓存中加载瓦片 /// /// /// /// /// /// private Bitmap TileFromCache(int zoom, int x, int y, MapMode map_mode) { try { string cache_path = Properties.BMap.Default.MapCachePath; if (Directory.Exists(cache_path + "\\" + map_mode.ToString())) { string cache_name = cache_path + "\\" + map_mode.ToString() + "\\" + zoom + "_" + x + "_" + y + ".bmp"; if (File.Exists(cache_name)) { return new Bitmap(cache_name); } else { return null; } } else { return null; } } catch { return null; } } /// /// 从服务器上加载瓦片 /// /// /// /// /// /// private Bitmap TileFromServer(int zoom, int x, int y, MapMode map_mode) { try { Random r = new Random(DateTime.Now.Millisecond); int server_index = r.Next(0, 10); //随即产生0~9之间的整数 string url = ""; if (map_mode == MapMode.Normal) //地图 { url = String.Format(_road_url, server_index) + "?qt=tile&x=" + x + "&y=" + y + "&z=" + zoom + "&styles=pl"; } if (map_mode == MapMode.Satellite) //卫星图 { url = String.Format(_sate_url, server_index) + "u=x=" + x + ";y=" + y + ";z=" + zoom + ";v=009;type=sate&fm=46"; } if (map_mode == MapMode.RoadNet) //道路网 { url = String.Format(_road_url, server_index) + "?qt=tile&x=" + x + "&y=" + y + "&z=" + zoom + "&styles=sl"; } byte[] bytes = DownloadData(url); Bitmap bitmap = Image.FromStream(new MemoryStream(bytes)) as Bitmap; SaveTile2Cache(zoom, x, y, map_mode, bitmap); return bitmap; } catch { return null; } } /// /// 将从服务器上下载的瓦片保存到缓存 /// /// /// /// /// /// private void SaveTile2Cache(int zoom, int x, int y, MapMode map_mode, Bitmap tile) { try { string cache_path = Properties.BMap.Default.MapCachePath; if (!Directory.Exists(cache_path + "\\" + map_mode.ToString())) { Directory.CreateDirectory(cache_path + "\\" + map_mode.ToString()); } tile.Save(cache_path + "\\" + map_mode.ToString() + "\\" + zoom + "_" + x + "_" + y + ".bmp"); } catch { } } } } ================================================ FILE: BMap.NET/HTTPService/PlaceService.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using Newtonsoft.Json.Linq; using Newtonsoft.Json; namespace BMap.NET.HTTPService { /// /// 提供位置相关服务 /// public class PlaceService : ServiceBase { private static string _search_url = "http://api.map.baidu.com/place/v2/search"; //v2 place区域检索POI服务 private static string _detail_url = "http://api.map.baidu.com/place/v2/detail"; //v2 POI详情服务 private static string _eventsearch_url = "http://api.map.baidu.com/place/v2/eventsearch"; //v2 团购信息检索服务 private static string _eventdetail_url = "http://api.map.baidu.com/place/v2/eventdetail"; //v2 商家团购信息查询 /// /// 城市内检索POI /// /// 检索关键字 /// 城市名、代码 /// public JObject SearchInCity(string query, string region) { try { if (_vm == VerificationMode.IPWhiteList) //IP 白名单校验 { string url = _search_url + "?query=" + query + "®ion=" + region + "&output=json&page_size=20&scope=2&ak=" + _ak; string json = DownloadString(url); return JsonConvert.DeserializeObject(json) as JObject; } else //SN校验 { string url = _search_url + "?query=" + query + "®ion=" + region + "&output=json&page_size=20&scope=2&ak=" + _ak; IDictionary param = new Dictionary { { "query", query }, { "region", region }, { "output", "json" }, {"page_size","20"}, { "scope", "2" }, { "ak", _ak } }; string sn = AKSNCaculater.CaculateAKSN(_ak, _sk, _search_url.Split(new string[] { ".com" }, StringSplitOptions.None)[1], param); //计算sn string json = DownloadString(url + "&sn=" + sn); return JsonConvert.DeserializeObject(json) as JObject; } } catch { return null; } } /// /// 矩形区域内检索POI /// /// 检索关键字 /// 矩形区域,左下角纬度,经度,右上角纬度,经度 /// public JObject SearchInBound(string query,string bounds) { try { if (_vm == VerificationMode.IPWhiteList) //IP 白名单校验 { string url = _search_url + "?query=" + query + "&bounds=" + bounds + "&output=json&page_size=20&scope=2&ak=" + _ak; string json = DownloadString(url); return JsonConvert.DeserializeObject(json) as JObject; } else //SN校验 { string url = _search_url + "?query=" + query + "&bounds=" + bounds + "&output=json&page_size=20&scope=2&ak=" + _ak; IDictionary param = new Dictionary { { "query", query }, { "bounds", bounds }, { "output", "json" }, {"page_size","20"}, { "scope", "2" }, { "ak", _ak } }; string sn = AKSNCaculater.CaculateAKSN(_ak, _sk, _search_url.Split(new string[] { ".com" }, StringSplitOptions.None)[1], param); //计算sn string json = DownloadString(url + "&sn=" + sn); return JsonConvert.DeserializeObject(json) as JObject; } } catch { return null; } } /// /// 圆形区域内检索POI /// /// 检索关键字 /// 中心点纬度,经度 /// 半径,单位为m /// public JObject SearchInCircle(string query, string location, int radius) { try { if (_vm == VerificationMode.IPWhiteList) //IP 白名单校验 { string url = _search_url + "?query=" + query + "&location=" + location + "&radius=" + radius + "&output=json&page_size=20&scope=2&ak=" + _ak; string json = DownloadString(url); return JsonConvert.DeserializeObject(json) as JObject; } else //SN校验 { string url = _search_url + "?query=" + query + "&location=" + location + "&radius=" + radius + "&output=json&page_size=20&scope=2&ak=" + _ak; IDictionary param = new Dictionary { { "query", query }, { "location",location }, {"radius",radius.ToString()}, { "output", "json" }, {"page_size","20"},{ "scope", "2" }, { "ak", _ak } }; string sn = AKSNCaculater.CaculateAKSN(_ak, _sk, _search_url.Split(new string[] { ".com" }, StringSplitOptions.None)[1], param); //计算sn string json = DownloadString(url + "&sn=" + sn); return JsonConvert.DeserializeObject(json) as JObject; } } catch { return null; } } /// /// 查询POI详细信息 /// /// POI的唯一标识 /// public JObject Detail(string uid) { try { if (_vm == VerificationMode.IPWhiteList) //IP 白名单校验 { string url = _detail_url + "?uid=" + uid + "&output=json&scope=2&ak=" + _ak; string json = DownloadString(url); return JsonConvert.DeserializeObject(json) as JObject; } else //SN校验 { string url = _detail_url + "?uid=" + uid + "&output=json&scope=2&ak=" + _ak; IDictionary param = new Dictionary { { "uid", uid }, { "output", "json" }, { "scope", "2" }, { "ak", _ak } }; string sn = AKSNCaculater.CaculateAKSN(_ak, _sk, _detail_url.Split(new string[] { ".com" }, StringSplitOptions.None)[1], param); //计算sn string json = DownloadString(url + "&sn=" + sn); return JsonConvert.DeserializeObject(json) as JObject; } } catch { return null; } } /// /// 矩形区域内检索商业活动POI /// /// 检索关键字 /// 事件名称,可以是团购、打折,全部(groupon、discount、all) 目前只支持团购 /// 城市名、代码 /// 矩形区域,左下角纬度,经度,右上角纬度,经度 /// public JObject EventSearchInBound(string query, string events, string region, string bounds) { try { if (_vm == VerificationMode.IPWhiteList) //IP 白名单校验 { string url = _eventsearch_url + "?query=" + query + "&event=" + events + "®ion=" + region + "&bounds=" + bounds + "&output=json&page_size=20&scope=2&ak=" + _ak; string json = DownloadString(url); return JsonConvert.DeserializeObject(json) as JObject; } else //SN校验 { string url = _eventsearch_url + "?query=" + query + "&event=" + events + "®ion=" + region + "&bounds=" + bounds + "&output=json&page_size=20&scope=2&ak=" + _ak; IDictionary param = new Dictionary { { "query", query }, { "event", events }, { "region", region }, { "bounds", bounds }, { "output", "json" }, {"page_size","20"}, { "scope", "2" }, { "ak", _ak } }; string sn = AKSNCaculater.CaculateAKSN(_ak, _sk, _eventsearch_url.Split(new string[] { ".com" }, StringSplitOptions.None)[1], param); //计算sn string json = DownloadString(url + "&sn=" + sn); return JsonConvert.DeserializeObject(json) as JObject; } } catch { return null; } } /// /// 圆形区域内检索商业活动POI /// /// 检索关键字 /// 事件名称,可以是团购、打折,全部(groupon、discount、all) 目前只支持团购 /// 城市名、代码 /// 中心点,纬度,经度 /// 半径,单位为m /// public JObject EventSearchInCircle(string query, string events, string region, string location, int radius) { try { if (_vm == VerificationMode.IPWhiteList) //IP 白名单校验 { string url = _eventsearch_url + "?query=" + query + "&event=" + events + "®ion=" + region + "&location=" + location + "&radius=" + radius + "&output=json&page_size=20&scope=2&ak=" + _ak; string json = DownloadString(url); return JsonConvert.DeserializeObject(json) as JObject; } else //SN校验 { string url = _eventsearch_url + "?query=" + query + "&event=" + events + "®ion=" + region + "&location=" + location + "&radius=" + radius + "&output=json&page_size=20&scope=2&ak=" + _ak; IDictionary param = new Dictionary { { "query", query }, { "event", events }, { "region", region }, { "location", location }, {"radius",radius.ToString()}, { "output", "json" }, {"page_size","20"}, { "scope", "2" }, { "ak", _ak } }; string sn = AKSNCaculater.CaculateAKSN(_ak, _sk, _eventsearch_url.Split(new string[] { ".com" }, StringSplitOptions.None)[1], param); //计算sn string json = DownloadString(url + "&sn=" + sn); return JsonConvert.DeserializeObject(json) as JObject; } } catch { return null; } } /// /// 查询商业活动POI详细信息 /// /// /// public JObject EventDetail(string uid) { try { if (_vm == VerificationMode.IPWhiteList) //IP 白名单校验 { string url = _eventdetail_url + "?uid=" + uid + "&output=json&scope=2&ak=" + _ak; string json = DownloadString(url); return JsonConvert.DeserializeObject(json) as JObject; } else //SN校验 { string url = _eventdetail_url + "?uid=" + uid + "&output=json&scope=2&ak=" + _ak; IDictionary param = new Dictionary { { "uid", uid }, { "output", "json" }, { "scope", "2" }, { "ak", _ak } }; string sn = AKSNCaculater.CaculateAKSN(_ak, _sk, _eventdetail_url.Split(new string[] { ".com" }, StringSplitOptions.None)[1], param); //计算sn string json = DownloadString(url + "&sn=" + sn); return JsonConvert.DeserializeObject(json) as JObject; } } catch { return null; } } } } ================================================ FILE: BMap.NET/HTTPService/PlaceSuggestionService.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace BMap.NET.HTTPService { /// /// 提供位置建议相关服务 /// public class PlaceSuggestionService : ServiceBase { private static string _suggestion_url = "http://api.map.baidu.com/place/v2/suggestion"; //位置建议服务 /// /// 检索相似位置 /// /// 检索关键字 /// 所在城市 /// public JObject Suggestion(string query, string region) { try { if (_vm == VerificationMode.IPWhiteList) //IP 白名单校验 { string url = _suggestion_url + "?query=" + query + "®ion=" + region + "&output=json&ak=" + _ak; string json = DownloadString(url); return JsonConvert.DeserializeObject(json) as JObject; } else //SN校验 { string url = _suggestion_url + "?query=" + query + "®ion=" + region + "&output=json&ak=" + _ak; IDictionary param = new Dictionary { { "query", query }, { "region", region }, { "output", "json" }, { "ak", _ak } }; string sn = AKSNCaculater.CaculateAKSN(_ak, _sk, _suggestion_url.Split(new string[] { ".com" }, StringSplitOptions.None)[1], param); //计算sn string json = DownloadString(url + "&sn=" + sn); return JsonConvert.DeserializeObject(json) as JObject; } } catch { return null; } } } } ================================================ FILE: BMap.NET/HTTPService/ServiceBase.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; namespace BMap.NET.HTTPService { /// /// 服务基类 /// public class ServiceBase { protected static string _ak = Properties.BMap.Default.ServiceAK; //AK protected static string _sk = Properties.BMap.Default.ServiceSK; //SK protected static VerificationMode _vm = (VerificationMode)Properties.BMap.Default.VerificationMode; //校验方式 0表示IP白名单校验(忽略SK) 1表示SN校验(需要SK) /// /// 从服务器上下载字符串 /// /// /// protected string DownloadString(string url) { try { WebClient client = new WebClient(); client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); client.Encoding = Encoding.UTF8; return client.DownloadString(url); } catch { return null; } } /// /// 从服务器上下载字节流 /// /// /// protected byte[] DownloadData(string url) { try { WebClient client = new WebClient(); client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); return client.DownloadData(url); } catch { return null; } } } } ================================================ FILE: BMap.NET/LoadMapMode.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BMap.NET { /// /// 加载地图的方式 /// public enum LoadMapMode { Server, Cache, CacheServer } } ================================================ FILE: BMap.NET/MapMode.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BMap.NET { /// /// 地图模式 /// public enum MapMode { Normal, //地图 Satellite, //卫星图 RoadNet, //路网 Sate_RoadNet //卫星图+路网 } } ================================================ FILE: BMap.NET/Properties/AssemblyInfo.cs ================================================ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("BMap.NET")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BMap.NET")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("1db6c54d-5163-49ea-a7e2-4631f63e7435")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] ================================================ FILE: BMap.NET/Properties/BMap.Designer.cs ================================================ //------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.18444 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace BMap.NET.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] internal sealed partial class BMap : global::System.Configuration.ApplicationSettingsBase { private static BMap defaultInstance = ((BMap)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new BMap()))); public static BMap Default { get { return defaultInstance; } } [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("TMzlZXetCzK9t9fSdKO7v35T")] public string ServiceAK { get { return ((string)(this["ServiceAK"])); } set { this["ServiceAK"] = value; } } [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("")] public string ServiceSK { get { return ((string)(this["ServiceSK"])); } set { this["ServiceSK"] = value; } } [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("0")] public int VerificationMode { get { return ((int)(this["VerificationMode"])); } set { this["VerificationMode"] = value; } } [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("0")] public int LoadMapMode { get { return ((int)(this["LoadMapMode"])); } set { this["LoadMapMode"] = value; } } [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("C:\\maps\\")] public string MapCachePath { get { return ((string)(this["MapCachePath"])); } set { this["MapCachePath"] = value; } } } } ================================================ FILE: BMap.NET/Properties/BMap.settings ================================================  TMzlZXetCzK9t9fSdKO7v35T 0 0 E:\ ================================================ FILE: BMap.NET/VerificationMode.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BMap.NET { /// /// Web API校验方式 /// public enum VerificationMode { IPWhiteList, SN } } ================================================ FILE: BMap.NET/app.config ================================================ 
TMzlZXetCzK9t9fSdKO7v35T 0 0 C:\maps\ E4805d16520de693a3fe707cdc962045 E4805d16520de693a3fe707cdc962045 ================================================ FILE: BMap.NET.DownloadDemo/BMap.NET.DownloadDemo.csproj ================================================  Debug x86 8.0.30703 2.0 {7341A85E-0A31-479A-B79E-A8A166DFD649} WinExe Properties BMap.NET.DownloadDemo BMap.NET.DownloadDemo v4.0 512 x86 true full false bin\Debug\ DEBUG;TRACE prompt 4 x86 pdbonly true bin\Release\ TRACE prompt 4 ..\BMap.NET.WindowsForm\libs\Newtonsoft.Json.dll Form MainForm.cs MainForm.cs ResXFileCodeGenerator Resources.Designer.cs Designer True Resources.resx True SettingsSingleFileGenerator Settings.Designer.cs True Settings.settings True {1B32D6FD-3C74-40DC-9D43-102B19D40785} BMap.NET.WindowsForm {AFFEB71C-54B6-4A9B-A445-BB287EDBAC19} BMap.NET ================================================ FILE: BMap.NET.DownloadDemo/MainForm.Designer.cs ================================================ namespace BMap.NET.DownloadDemo { partial class MainForm { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.mapDownloaderControl1 = new BMap.NET.WindowsForm.MapDownloaderControl(); this.label1 = new System.Windows.Forms.Label(); this.button1 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // mapDownloaderControl1 // this.mapDownloaderControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.mapDownloaderControl1.LoadMode = BMap.NET.LoadMapMode.CacheServer; this.mapDownloaderControl1.Location = new System.Drawing.Point(1, 42); this.mapDownloaderControl1.Mode = BMap.NET.MapMode.Normal; this.mapDownloaderControl1.Name = "mapDownloaderControl1"; this.mapDownloaderControl1.Size = new System.Drawing.Size(596, 361); this.mapDownloaderControl1.TabIndex = 0; this.mapDownloaderControl1.Zoom = 12; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(7, 15); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(431, 12); this.label1.TabIndex = 1; this.label1.Text = "鼠标右键选择区域,下载地图瓦片。瓦片保存格式:缩放级别/缩放级别_X_Y.jpg"; // // button1 // this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.button1.Location = new System.Drawing.Point(512, 10); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 2; this.button1.Text = "清空缓存"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(599, 405); this.Controls.Add(this.button1); this.Controls.Add(this.label1); this.Controls.Add(this.mapDownloaderControl1); this.Name = "MainForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "MainForm"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.ResumeLayout(false); this.PerformLayout(); } #endregion private BMap.NET.WindowsForm.MapDownloaderControl mapDownloaderControl1; private System.Windows.Forms.Label label1; private System.Windows.Forms.Button button1; } } ================================================ FILE: BMap.NET.DownloadDemo/MainForm.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace BMap.NET.DownloadDemo { public partial class MainForm : Form { public MainForm() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { mapDownloaderControl1.RefreshTitles(); } } } ================================================ FILE: BMap.NET.DownloadDemo/MainForm.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ================================================ FILE: BMap.NET.DownloadDemo/Program.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; namespace BMap.NET.DownloadDemo { static class Program { /// /// 应用程序的主入口点。 /// [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); } } } ================================================ FILE: BMap.NET.DownloadDemo/Properties/AssemblyInfo.cs ================================================ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 有关程序集的常规信息通过以下 // 特性集控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("BMap.NET.DownloadDemo")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BMap.NET.DownloadDemo")] [assembly: AssemblyCopyright("Copyright © 2018")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 将 ComVisible 设置为 false 使此程序集中的类型 // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, // 则将该类型上的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("7bba903d-19aa-45e2-8f66-6177d69376a7")] // 程序集的版本信息由下面四个值组成: // // 主版本 // 次版本 // 内部版本号 // 修订号 // // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] ================================================ FILE: BMap.NET.DownloadDemo/Properties/Resources.Designer.cs ================================================ //------------------------------------------------------------------------------ // // 此代码由工具生成。 // 运行时版本:4.0.30319.42000 // // 对此文件的更改可能会导致不正确的行为,并且如果 // 重新生成代码,这些更改将会丢失。 // //------------------------------------------------------------------------------ namespace BMap.NET.DownloadDemo.Properties { using System; /// /// 一个强类型的资源类,用于查找本地化的字符串等。 /// // 此类是由 StronglyTypedResourceBuilder // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen // (以 /str 作为命令选项),或重新生成 VS 项目。 [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// /// 返回此类使用的缓存的 ResourceManager 实例。 /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BMap.NET.DownloadDemo.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// /// 使用此强类型资源类,为所有资源查找 /// 重写当前线程的 CurrentUICulture 属性。 /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } } ================================================ FILE: BMap.NET.DownloadDemo/Properties/Resources.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ================================================ FILE: BMap.NET.DownloadDemo/Properties/Settings.Designer.cs ================================================ //------------------------------------------------------------------------------ // // 此代码由工具生成。 // 运行时版本:4.0.30319.42000 // // 对此文件的更改可能会导致不正确的行为,并且如果 // 重新生成代码,这些更改将会丢失。 // //------------------------------------------------------------------------------ namespace BMap.NET.DownloadDemo.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); public static Settings Default { get { return defaultInstance; } } } } ================================================ FILE: BMap.NET.DownloadDemo/Properties/Settings.settings ================================================  ================================================ FILE: BMap.NET.DownloadDemo/app.config ================================================ ================================================ FILE: BMap.NET.WindowsForm/BCityControl.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class BCityControl { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BCityControl)); this.lbl_current_city = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.flp_hot_cities = new System.Windows.Forms.FlowLayoutPanel(); this.rdo_by_province = new System.Windows.Forms.RadioButton(); this.rdo_by_pinyin = new System.Windows.Forms.RadioButton(); this.cityList1 = new BMap.NET.WindowsForm.FunctionalControls.CityList(); this.pic_close = new System.Windows.Forms.PictureBox(); ((System.ComponentModel.ISupportInitialize)(this.pic_close)).BeginInit(); this.SuspendLayout(); // // lbl_current_city // this.lbl_current_city.AutoSize = true; this.lbl_current_city.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lbl_current_city.Location = new System.Drawing.Point(7, 17); this.lbl_current_city.Name = "lbl_current_city"; this.lbl_current_city.Size = new System.Drawing.Size(59, 17); this.lbl_current_city.TabIndex = 1; this.lbl_current_city.Text = "当前城市:"; // // label2 // this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.label2.BackColor = System.Drawing.Color.LightGray; this.label2.Location = new System.Drawing.Point(11, 37); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(244, 1); this.label2.TabIndex = 2; // // flp_hot_cities // this.flp_hot_cities.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.flp_hot_cities.Location = new System.Drawing.Point(11, 48); this.flp_hot_cities.Name = "flp_hot_cities"; this.flp_hot_cities.Size = new System.Drawing.Size(244, 36); this.flp_hot_cities.TabIndex = 3; // // rdo_by_province // this.rdo_by_province.AutoSize = true; this.rdo_by_province.Checked = true; this.rdo_by_province.Location = new System.Drawing.Point(11, 96); this.rdo_by_province.Name = "rdo_by_province"; this.rdo_by_province.Size = new System.Drawing.Size(59, 16); this.rdo_by_province.TabIndex = 4; this.rdo_by_province.TabStop = true; this.rdo_by_province.Text = "按省份"; this.rdo_by_province.UseVisualStyleBackColor = true; this.rdo_by_province.Click += new System.EventHandler(this.rdo_CheckedChanged); // // rdo_by_pinyin // this.rdo_by_pinyin.AutoSize = true; this.rdo_by_pinyin.Location = new System.Drawing.Point(76, 96); this.rdo_by_pinyin.Name = "rdo_by_pinyin"; this.rdo_by_pinyin.Size = new System.Drawing.Size(59, 16); this.rdo_by_pinyin.TabIndex = 5; this.rdo_by_pinyin.Text = "按拼音"; this.rdo_by_pinyin.UseVisualStyleBackColor = true; this.rdo_by_pinyin.Click += new System.EventHandler(this.rdo_CheckedChanged); // // cityList1 // this.cityList1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.cityList1.DataByOrganization = null; this.cityList1.DataByPinyin = null; this.cityList1.Location = new System.Drawing.Point(13, 118); this.cityList1.Mode = BMap.NET.WindowsForm.FunctionalControls.CityListMode.Pinyin; this.cityList1.Name = "cityList1"; this.cityList1.Size = new System.Drawing.Size(242, 271); this.cityList1.TabIndex = 0; this.cityList1.SelectedCityChanged += new BMap.NET.WindowsForm.FunctionalControls.SelectedCityChangedEventHandler(this.cityList1_SelectedCityChanged); // // pic_close // this.pic_close.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.pic_close.Cursor = System.Windows.Forms.Cursors.Hand; this.pic_close.Image = ((System.Drawing.Image)(resources.GetObject("pic_close.Image"))); this.pic_close.Location = new System.Drawing.Point(244, 9); this.pic_close.Name = "pic_close"; this.pic_close.Size = new System.Drawing.Size(13, 14); this.pic_close.TabIndex = 6; this.pic_close.TabStop = false; this.pic_close.Click += new System.EventHandler(this.pic_close_Click); // // BCityControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.pic_close); this.Controls.Add(this.rdo_by_pinyin); this.Controls.Add(this.rdo_by_province); this.Controls.Add(this.flp_hot_cities); this.Controls.Add(this.label2); this.Controls.Add(this.lbl_current_city); this.Controls.Add(this.cityList1); this.Name = "BCityControl"; this.Size = new System.Drawing.Size(264, 396); this.Load += new System.EventHandler(this.BCityControl_Load); ((System.ComponentModel.ISupportInitialize)(this.pic_close)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private FunctionalControls.CityList cityList1; private System.Windows.Forms.Label lbl_current_city; private System.Windows.Forms.Label label2; private System.Windows.Forms.FlowLayoutPanel flp_hot_cities; private System.Windows.Forms.RadioButton rdo_by_province; private System.Windows.Forms.RadioButton rdo_by_pinyin; private System.Windows.Forms.PictureBox pic_close; } } ================================================ FILE: BMap.NET.WindowsForm/BCityControl.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using BMap.NET.WindowsForm.FunctionalControls; namespace BMap.NET.WindowsForm { /// /// 城市切换控件 /// partial class BCityControl : UserControl { public event SelectedCityChangedEventHandler SelectedCityChanged; private string _currentCity = ""; /// /// 当前城市 /// public string CurrentCity { get { return _currentCity; } set { _currentCity = value; lbl_current_city.Text = "当前城市:" + _currentCity; } } /// /// 构造方法 /// public BCityControl() { InitializeComponent(); } /// /// 控件加载 /// /// /// private void BCityControl_Load(object sender, EventArgs e) { LoadCities(); Init(); } /// /// 初始化城市列表 /// private void LoadCities() { Dictionary> data_pinyin = new Dictionary>(); //拼音数据源 CityNode root = new CityNode("中国", "1", null, "0"); //组织结构数据源 ((Action)delegate() { string areas = Properties.BMap.baidu_citys; string[] cities = areas.Split(new string[] { "\r\n" }, StringSplitOptions.None); foreach (string city in cities) { string[] items = city.Split('|'); if (items.Length == 4) { if (items[3] != "0" && items[3] != "1") //忽略国家 省份 { string pinyin = GetSpellCodeAt(items[0][0].ToString()); //首汉字拼音 if (!data_pinyin.ContainsKey(pinyin)) { data_pinyin.Add(pinyin, new List { items[0] }); } data_pinyin[pinyin].Add(items[0]); } if (items[3] != "0") //忽略国家 { if (items[2] == root.CityCode) //省份、直辖市 { if (root.Nexts == null) { root.Nexts = new List(); } root.Nexts.Add(new CityNode(items[0], items[1], items[2], items[3])); } else //地级市 直辖市中的县区 { foreach (CityNode province in root.Nexts) { if (province.CityCode == items[2]) { if (province.Nexts == null) { province.Nexts = new List(); } province.Nexts.Add(new CityNode(items[0], items[1], items[2], items[3])); break; } } } } } } this.Invoke((Action)delegate() { cityList1.DataByOrganization = root; cityList1.DataByPinyin = data_pinyin; cityList1.Mode = CityListMode.Pinyin; cityList1.RefreshList(); }); }).BeginInvoke(null, null); } /// /// 获取汉字拼音开头字母 /// /// /// private static string GetSpellCodeAt(string s) { long iCnChar; byte[] ZW = System.Text.Encoding.Default.GetBytes(s); if (ZW.Length == 1) { return s.ToUpper(); } int i1 = (short)ZW[0]; int i2 = (short)ZW[1]; iCnChar = i1 * 256 + i2; if ((iCnChar >= 45217) && (iCnChar <= 45252)) { return "A"; } else if ((iCnChar >= 45253) && (iCnChar <= 45760)) { return "B"; } else if ((iCnChar >= 45761) && (iCnChar <= 46317)) { return "C"; } else if ((iCnChar >= 46318) && (iCnChar <= 46825)) { return "D"; } else if ((iCnChar >= 46826) && (iCnChar <= 47009)) { return "E"; } else if ((iCnChar >= 47010) && (iCnChar <= 47296)) { return "F"; } else if ((iCnChar >= 47297) && (iCnChar <= 47613)) { return "G"; } else if ((iCnChar >= 47614) && (iCnChar <= 48118)) { return "H"; } else if ((iCnChar >= 48119) && (iCnChar <= 49061)) { return "J"; } else if ((iCnChar >= 49062) && (iCnChar <= 49323)) { return "K"; } else if ((iCnChar >= 49324) && (iCnChar <= 49895)) { return "L"; } else if ((iCnChar >= 49896) && (iCnChar <= 50370)) { return "M"; } else if ((iCnChar >= 50371) && (iCnChar <= 50613)) { return "N"; } else if ((iCnChar >= 50614) && (iCnChar <= 50621)) { return "O"; } else if ((iCnChar >= 50622) && (iCnChar <= 50905)) { return "P"; } else if ((iCnChar >= 50906) && (iCnChar <= 51386)) { return "Q"; } else if ((iCnChar >= 51387) && (iCnChar <= 51445)) { return "R"; } else if ((iCnChar >= 51446) && (iCnChar <= 52217)) { return "S"; } else if ((iCnChar >= 52218) && (iCnChar <= 52697)) { return "T"; } else if ((iCnChar >= 52698) && (iCnChar <= 52979)) { return "W"; } else if ((iCnChar >= 52980) && (iCnChar <= 53640)) { return "X"; } else if ((iCnChar >= 53689) && (iCnChar <= 54480)) { return "Y"; } else if ((iCnChar >= 54481) && (iCnChar <= 55289)) { return "Z"; } else return ("?"); } /// /// 初始化工作 /// private void Init() { string[] hot_cities = new string[] { "北京", "天津", "上海", "重庆", "广州", "武汉", "成都", "南京", "深圳", "合肥", "厦门" }; foreach (string city in hot_cities) { LinkLabel lkb = new LinkLabel(); lkb.Text = city; lkb.AutoSize = true; lkb.VisitedLinkColor = Color.Blue; lkb.Click += new EventHandler(lkb_Click); flp_hot_cities.Controls.Add(lkb); } } /// /// 点击热门城市 /// /// /// void lkb_Click(object sender, EventArgs e) { CurrentCity = (sender as LinkLabel).Text; if (SelectedCityChanged != null) { SelectedCityChanged((sender as LinkLabel).Text); } } /// /// 排列方式 /// /// /// private void rdo_CheckedChanged(object sender, EventArgs e) { if (rdo_by_pinyin.Checked) { cityList1.Mode = CityListMode.Pinyin; } else { cityList1.Mode = CityListMode.Organization; } rdo_by_pinyin.Enabled = false; rdo_by_province.Enabled = false; cityList1.RefreshList(); rdo_by_province.Enabled = true; rdo_by_pinyin.Enabled = true; } /// /// 选择城市变化 /// /// private void cityList1_SelectedCityChanged(string cityName) { CurrentCity = cityName; if (SelectedCityChanged != null) { SelectedCityChanged(cityName); } } /// /// 关闭 /// /// /// private void pic_close_Click(object sender, EventArgs e) { Visible = false; } } } ================================================ FILE: BMap.NET.WindowsForm/BCityControl.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 R0lGODlhDQANAIEBAAkkPP///wAAAAAAACH/C05FVFNDQVBFMi4wAwEBAAAh+QQBAAABACwAAAAADQAN AAAIMQADBABAsGBBgQMNKgSQcKFDhg0FLkQIsaFBhBIfUtSI0SHFjRcjWnx4kSRBkBMDBAQAOw== ================================================ FILE: BMap.NET.WindowsForm/BDirectionBoard.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class BDirectionBoard { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BDirectionBoard)); this.picExchange = new System.Windows.Forms.PictureBox(); this.lblSearch = new System.Windows.Forms.Label(); this.pictureBox2 = new System.Windows.Forms.PictureBox(); this.pictureBox3 = new System.Windows.Forms.PictureBox(); this.label2 = new System.Windows.Forms.Label(); this.flpRoutes = new System.Windows.Forms.FlowLayoutPanel(); this.bPlaceBoxDestination = new BMap.NET.WindowsForm.BPlaceBox(); this.bPlaceBoxSource = new BMap.NET.WindowsForm.BPlaceBox(); ((System.ComponentModel.ISupportInitialize)(this.picExchange)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit(); this.SuspendLayout(); // // picExchange // this.picExchange.BackColor = System.Drawing.Color.White; this.picExchange.Cursor = System.Windows.Forms.Cursors.Hand; this.picExchange.Image = ((System.Drawing.Image)(resources.GetObject("picExchange.Image"))); this.picExchange.Location = new System.Drawing.Point(1, 47); this.picExchange.Name = "picExchange"; this.picExchange.Size = new System.Drawing.Size(33, 58); this.picExchange.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; this.picExchange.TabIndex = 2; this.picExchange.TabStop = false; this.picExchange.Click += new System.EventHandler(this.picExchange_Click); // // lblSearch // this.lblSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.lblSearch.BackColor = System.Drawing.Color.WhiteSmoke; this.lblSearch.Cursor = System.Windows.Forms.Cursors.Hand; this.lblSearch.Font = new System.Drawing.Font("Microsoft YaHei", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblSearch.ForeColor = System.Drawing.Color.DarkGray; this.lblSearch.Location = new System.Drawing.Point(266, 46); this.lblSearch.Name = "lblSearch"; this.lblSearch.Size = new System.Drawing.Size(46, 59); this.lblSearch.TabIndex = 3; this.lblSearch.Text = "搜索"; this.lblSearch.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lblSearch.Click += new System.EventHandler(this.lblSearch_Click); this.lblSearch.MouseEnter += new System.EventHandler(this.label1_MouseEnter); this.lblSearch.MouseLeave += new System.EventHandler(this.label1_MouseLeave); // // pictureBox2 // this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image"))); this.pictureBox2.Location = new System.Drawing.Point(33, 50); this.pictureBox2.Name = "pictureBox2"; this.pictureBox2.Size = new System.Drawing.Size(17, 17); this.pictureBox2.TabIndex = 4; this.pictureBox2.TabStop = false; // // pictureBox3 // this.pictureBox3.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox3.Image"))); this.pictureBox3.Location = new System.Drawing.Point(33, 85); this.pictureBox3.Name = "pictureBox3"; this.pictureBox3.Size = new System.Drawing.Size(17, 17); this.pictureBox3.TabIndex = 5; this.pictureBox3.TabStop = false; // // label2 // this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.label2.BackColor = System.Drawing.Color.LightGray; this.label2.Location = new System.Drawing.Point(2, 120); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(310, 1); this.label2.TabIndex = 6; this.label2.Text = "label2"; // // flpRoutes // this.flpRoutes.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.flpRoutes.AutoScroll = true; this.flpRoutes.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.flpRoutes.Location = new System.Drawing.Point(0, 171); this.flpRoutes.Name = "flpRoutes"; this.flpRoutes.Size = new System.Drawing.Size(313, 286); this.flpRoutes.TabIndex = 7; this.flpRoutes.WrapContents = false; // // bPlaceBoxDestination // this.bPlaceBoxDestination.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.bPlaceBoxDestination.BPlacesBoard = null; this.bPlaceBoxDestination.CurrentCity = null; this.bPlaceBoxDestination.Enter2Search = false; this.bPlaceBoxDestination.InputFont = new System.Drawing.Font("Microsoft YaHei", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.bPlaceBoxDestination.Location = new System.Drawing.Point(51, 83); this.bPlaceBoxDestination.Name = "bPlaceBoxDestination"; this.bPlaceBoxDestination.QueryText = ""; this.bPlaceBoxDestination.Size = new System.Drawing.Size(212, 21); this.bPlaceBoxDestination.TabIndex = 1; // // bPlaceBoxSource // this.bPlaceBoxSource.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.bPlaceBoxSource.BPlacesBoard = null; this.bPlaceBoxSource.CurrentCity = null; this.bPlaceBoxSource.Enter2Search = false; this.bPlaceBoxSource.InputFont = new System.Drawing.Font("Microsoft YaHei", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.bPlaceBoxSource.Location = new System.Drawing.Point(51, 46); this.bPlaceBoxSource.Name = "bPlaceBoxSource"; this.bPlaceBoxSource.QueryText = ""; this.bPlaceBoxSource.Size = new System.Drawing.Size(212, 21); this.bPlaceBoxSource.TabIndex = 0; // // BDirectionBoard // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.flpRoutes); this.Controls.Add(this.label2); this.Controls.Add(this.pictureBox3); this.Controls.Add(this.pictureBox2); this.Controls.Add(this.lblSearch); this.Controls.Add(this.picExchange); this.Controls.Add(this.bPlaceBoxDestination); this.Controls.Add(this.bPlaceBoxSource); this.Name = "BDirectionBoard"; this.Size = new System.Drawing.Size(313, 457); this.Click += new System.EventHandler(this.BDirectionBoard_Click); this.Paint += new System.Windows.Forms.PaintEventHandler(this.BDirectionBoard_Paint); this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.BDirectionBoard_MouseMove); ((System.ComponentModel.ISupportInitialize)(this.picExchange)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit(); this.ResumeLayout(false); } #endregion private BPlaceBox bPlaceBoxSource; private BPlaceBox bPlaceBoxDestination; private System.Windows.Forms.PictureBox picExchange; private System.Windows.Forms.Label lblSearch; private System.Windows.Forms.PictureBox pictureBox2; private System.Windows.Forms.PictureBox pictureBox3; private System.Windows.Forms.Label label2; private System.Windows.Forms.FlowLayoutPanel flpRoutes; } } ================================================ FILE: BMap.NET.WindowsForm/BDirectionBoard.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using Newtonsoft.Json.Linq; using BMap.NET.HTTPService; using BMap.NET.WindowsForm.BMapElements; namespace BMap.NET.WindowsForm { /// /// 导航控件 /// public partial class BDirectionBoard : UserControl { private string _currentCity; /// /// 当前建议搜索城市 /// [Description("当前建议搜索城市"),Category("BMap.NET")] public string CurrentCity { get { return _currentCity; } set { _currentCity = value; bPlaceBoxSource.CurrentCity = _currentCity; bPlaceBoxDestination.CurrentCity = _currentCity; } } /// /// 与之关联的地图控件 /// [Description("与之关联的地图控件"),Category("BMap.NET")] public BMapControl BMapControl { get; set; } /// /// 与之关联的位置列表控件 /// [Description("与之关联的位置列表控件"),Category("BMap.NET")] public BPlacesBoard BPlacesBoard { get; set; } /// /// 导航起始位置 /// [Description("导航起始位置"),Category("BMap.NET")] internal string SourcePlace { get { return bPlaceBoxSource.QueryText; } set { bPlaceBoxSource.DontSearchNextTime(); bPlaceBoxSource.QueryText = value; if (bPlaceBoxSource.QueryText != "" && bPlaceBoxDestination.QueryText != "") //导航起点、终点不为空 { StartSearch(); } if (Parent != null && Parent is TabPage) //如果父控件是tabpage 则选中 { ((Parent as TabPage).Parent as TabControl).SelectedTab = (Parent as TabPage); } } } /// /// 导航结束位置 /// [Description("导航结束位置"),Category("BMap.NET")] internal string DestinationPlace { get { return bPlaceBoxDestination.QueryText; } set { bPlaceBoxDestination.DontSearchNextTime(); bPlaceBoxDestination.QueryText = value; if (bPlaceBoxDestination.QueryText != "" && bPlaceBoxSource.QueryText != "") //导航起点、终点不为空 { StartSearch(); } if (Parent != null && Parent is TabPage) //如果父控件是tabpage 则选中 { ((Parent as TabPage).Parent as TabControl).SelectedTab = (Parent as TabPage); } } } /// /// 当前方案 0公交 1驾车 2步行 /// private int _current_method = 0; /// /// 方案类型 0时间短 1少换乘 2少步行 3最短路程 4最短时间 5不走高速 /// private int _method_filter = 0; private Label _wait = new Label(); //等待框 /// /// 构造方法 /// public BDirectionBoard() { InitializeComponent(); SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); UpdateStyles(); _wait.AutoSize = false; _wait.Font = new System.Drawing.Font("微软雅黑", 10); _wait.Width = Width; _wait.Height = Height; _wait.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; _wait.BackColor = Color.FromArgb(200, Color.White); _wait.TextAlign = ContentAlignment.MiddleCenter; _wait.Text = "正在搜索,请稍候..."; _wait.Visible = false; _wait.Location = new Point(0, 0); Controls.Add(_wait); _wait.BringToFront(); } #region 事件处理 /// /// 重绘 /// /// /// private void BDirectionBoard_Paint(object sender, PaintEventArgs e) { //顶部 方案选择 if (_current_method == 0) //公交 { e.Graphics.DrawImage(Properties.BMap.ico_transit_blue, new Point(Width / 3 / 2 - 30, 3)); e.Graphics.DrawImage(Properties.BMap.ico_driving_gray, new Point(Width / 3 + Width / 3 / 2 - 30, 3)); e.Graphics.DrawImage(Properties.BMap.ico_walking_gray, new Point(Width * 2 / 3 + Width / 3 / 2 - 30, 3)); e.Graphics.DrawLine(Pens.LightBlue, new Point(0, 33), new Point(Width / 3 / 2 - 3, 33)); e.Graphics.DrawLine(Pens.LightBlue, new Point(Width / 3 / 2 + 3, 33), new Point(Width, 33)); e.Graphics.DrawLine(Pens.LightBlue, new Point(Width / 3 / 2 - 3, 33), new Point(Width / 3 / 2, 30)); e.Graphics.DrawLine(Pens.LightBlue, new Point(Width / 3 / 2 + 3, 33), new Point(Width / 3 / 2, 30)); } else if (_current_method == 1) //驾车 { e.Graphics.DrawImage(Properties.BMap.ico_transit_gray, new Point(Width / 3 / 2 - 30, 3)); e.Graphics.DrawImage(Properties.BMap.ico_driving_blue, new Point(Width / 3 + Width / 3 / 2 - 30, 3)); e.Graphics.DrawImage(Properties.BMap.ico_walking_gray, new Point(Width * 2 / 3 + Width / 3 / 2 - 30, 3)); e.Graphics.DrawLine(Pens.LightBlue, new Point(0, 33), new Point(Width / 3 + Width / 3 / 2 - 3, 33)); e.Graphics.DrawLine(Pens.LightBlue, new Point(Width / 3 + Width / 3 / 2 + 3, 33), new Point(Width, 33)); e.Graphics.DrawLine(Pens.LightBlue, new Point(Width / 3 + Width / 3 / 2 - 3, 33), new Point(Width / 3 + Width / 3 / 2, 30)); e.Graphics.DrawLine(Pens.LightBlue, new Point(Width / 3 + Width / 3 / 2 + 3, 33), new Point(Width / 3 + Width / 3 / 2, 30)); } else //步行 { e.Graphics.DrawImage(Properties.BMap.ico_transit_gray, new Point(Width / 3 / 2 - 30, 3)); e.Graphics.DrawImage(Properties.BMap.ico_driving_gray, new Point(Width / 3 + Width / 3 / 2 - 30, 3)); e.Graphics.DrawImage(Properties.BMap.ico_walking_blue, new Point(Width * 2 / 3 + Width / 3 / 2 - 30, 3)); e.Graphics.DrawLine(Pens.LightBlue, new Point(0, 33), new Point(Width * 2 / 3 + Width / 3 / 2 - 3, 33)); e.Graphics.DrawLine(Pens.LightBlue, new Point(Width * 2 / 3 + Width / 3 / 2 + 3, 33), new Point(Width, 33)); e.Graphics.DrawLine(Pens.LightBlue, new Point(Width * 2 / 3 + Width / 3 / 2 - 3, 33), new Point(Width * 2 / 3 + Width / 3 / 2, 30)); e.Graphics.DrawLine(Pens.LightBlue, new Point(Width * 2 / 3 + Width / 3 / 2 + 3, 33), new Point(Width * 2 / 3 + Width / 3 / 2, 30)); } //中部 方案类型 if (_current_method == 0) //公交 { if (_method_filter == 0) //时间短 { e.Graphics.FillRectangle(Brushes.WhiteSmoke, new Rectangle(3, 135, (Width - 25) / 3, 25)); e.Graphics.DrawImage(Properties.BMap.ico_select, new Point(3 + 3, 135 + 5)); } else if (_method_filter == 1) //少换乘 { e.Graphics.FillRectangle(Brushes.WhiteSmoke, new Rectangle(3 + (Width - 25) / 3, 135, (Width - 25) / 3, 25)); e.Graphics.DrawImage(Properties.BMap.ico_select, new Point(3 + (Width - 25) / 3 + 3, 135 + 5)); } else if (_method_filter == 2) //少步行 { e.Graphics.FillRectangle(Brushes.WhiteSmoke, new Rectangle(3 + 2 * (Width - 25) / 3, 135, (Width - 25) / 3, 25)); e.Graphics.DrawImage(Properties.BMap.ico_select, new Point(3 + 2 * (Width - 25) / 3 + 3, 135 + 5)); } e.Graphics.DrawRectangle(Pens.LightGray, new Rectangle(3, 135, (Width - 25) / 3, 25)); e.Graphics.DrawRectangle(Pens.LightGray, new Rectangle(3 + (Width - 25) / 3, 135, (Width - 25) / 3, 25)); e.Graphics.DrawRectangle(Pens.LightGray, new Rectangle(3 + 2 * (Width - 25) / 3, 135, (Width - 25) / 3, 25)); e.Graphics.DrawString("时间短", new Font("微软雅黑", 10), Brushes.Gray, new PointF(3 + 21, 135 + 3)); e.Graphics.DrawString("少换乘", new Font("微软雅黑", 10), Brushes.Gray, new PointF(3 + (Width - 25) / 3 + 21, 135 + 3)); e.Graphics.DrawString("少步行", new Font("微软雅黑", 10), Brushes.Gray, new PointF(3 + 2 * (Width - 25) / 3 + 21, 135 + 3)); } else if (_current_method == 1) //驾车 { if (_method_filter == 3) //最短路程 { e.Graphics.FillRectangle(Brushes.WhiteSmoke, new Rectangle(3, 135, (Width - 25) / 3, 25)); e.Graphics.DrawImage(Properties.BMap.ico_select, new Point(3 + 3, 135 + 5)); } else if (_method_filter == 4) //最短距离 { e.Graphics.FillRectangle(Brushes.WhiteSmoke, new Rectangle(3 + (Width - 25) / 3, 135, (Width - 25) / 3, 25)); e.Graphics.DrawImage(Properties.BMap.ico_select, new Point(3 + (Width - 25) / 3 + 3, 135 + 5)); } else if (_method_filter == 5) //不走高速 { e.Graphics.FillRectangle(Brushes.WhiteSmoke, new Rectangle(3 + 2 * (Width - 25) / 3, 135, (Width - 25) / 3, 25)); e.Graphics.DrawImage(Properties.BMap.ico_select, new Point(3 + 2 * (Width - 25) / 3 + 3, 135 + 5)); } e.Graphics.DrawRectangle(Pens.LightGray, new Rectangle(3, 135, (Width - 25) / 3, 25)); e.Graphics.DrawRectangle(Pens.LightGray, new Rectangle(3 + (Width - 25) / 3, 135, (Width - 25) / 3, 25)); e.Graphics.DrawRectangle(Pens.LightGray, new Rectangle(3 + 2 * (Width - 25) / 3, 135, (Width - 25) / 3, 25)); e.Graphics.DrawString("最短时间", new Font("微软雅黑", 10), Brushes.Gray, new PointF(3 + 20, 135 + 3)); e.Graphics.DrawString("最短路程", new Font("微软雅黑", 10), Brushes.Gray, new PointF(3 + (Width - 25) / 3 + 20, 135 + 3)); e.Graphics.DrawString("不走高速", new Font("微软雅黑", 10), Brushes.Gray, new PointF(3 + 2 * (Width - 25) / 3 + 20, 135 + 3)); } //步行没有方案类型 } /// /// 鼠标移动 /// /// /// private void BDirectionBoard_MouseMove(object sender, MouseEventArgs e) { if (new Rectangle(0, 0, Width, 33).Contains(e.Location) || ((new Rectangle(5, 135, Width - 10, 25).Contains(e.Location)) && _current_method != 2)) //顶端 中部 鼠标成手型 { Cursor = Cursors.Hand; } else { Cursor = Cursors.Arrow; } } /// /// 鼠标点击 /// /// /// private void BDirectionBoard_Click(object sender, EventArgs e) { Point p = this.PointToClient(Cursor.Position); if (new Rectangle(0, 0, Width / 3, 33).Contains(p)) //公交模式 { if (_current_method != 0) { if (_current_method == 2) { flpRoutes.Height = flpRoutes.Height - (171 - 138); } _current_method = 0; _method_filter = 0; flpRoutes.Location = new Point(flpRoutes.Location.X, 171); StartSearch(); //开启搜索 } } else if (new Rectangle(Width / 3, 0, Width / 3, 33).Contains(p)) //驾车模式 { if (_current_method != 1) { if (_current_method == 2) { flpRoutes.Height = flpRoutes.Height - (171 - 138); } _current_method = 1; _method_filter = 3; flpRoutes.Location = new Point(flpRoutes.Location.X, 171); StartSearch(); //开启搜索 } } else if (new Rectangle(Width * 2 / 3, 0, Width / 3, 33).Contains(p)) //步行模式 { if (_current_method != 2) { _current_method = 2; flpRoutes.Height = flpRoutes.Height + (171 - 138); flpRoutes.Location = new Point(flpRoutes.Location.X, 138); StartSearch(); //开启搜索 } } if (_current_method == 0) //公交 { if (new Rectangle(5, 135, (Width - 10) / 3, 25).Contains(p)) //时间短 { _method_filter = 0; } else if (new Rectangle(5 + (Width - 10)/3, 135, (Width - 10) / 3, 25).Contains(p)) //少换乘 { _method_filter = 1; } else if (new Rectangle(5 + 2 * (Width - 10) / 3, 135, (Width - 10) / 3, 25).Contains(p)) //少步行 { _method_filter = 2; } } if (_current_method == 1) //驾车 { if (new Rectangle(5, 135, (Width - 10) / 3, 25).Contains(p)) //最短距离 { _method_filter = 3; } else if (new Rectangle(5 + (Width - 10) / 3, 135, (Width - 10) / 3, 25).Contains(p)) //最短时间 { _method_filter = 4; } else if (new Rectangle(5 + 2 * (Width - 10) / 3, 135, (Width - 10) / 3, 25).Contains(p)) //不走高速 { _method_filter = 5; } } Invalidate(); } /// /// 鼠标进入搜索按钮 /// /// /// private void label1_MouseEnter(object sender, EventArgs e) { lblSearch.ForeColor = Color.White; lblSearch.BackColor = Color.FromArgb(51, 133, 255); } /// /// 鼠标移出搜索按钮 /// /// /// private void label1_MouseLeave(object sender, EventArgs e) { lblSearch.ForeColor = Color.DarkGray; lblSearch.BackColor = Color.WhiteSmoke; } /// /// 互换位置 /// /// /// private void picExchange_Click(object sender, EventArgs e) { string te = bPlaceBoxDestination.QueryText; bPlaceBoxDestination.DontSearchNextTime(); bPlaceBoxSource.DontSearchNextTime(); bPlaceBoxDestination.QueryText = bPlaceBoxSource.QueryText; bPlaceBoxSource.QueryText = te; } /// /// 发起搜索 /// /// /// private void lblSearch_Click(object sender, EventArgs e) { StartSearch(); } /// /// 路线选中 /// /// void item_RouteSelected(BRoute bRoute) { foreach (Control c in flpRoutes.Controls) { if (c as BTransitRouteItem != null && (c as BTransitRouteItem).DataSource != bRoute) { (c as BTransitRouteItem).Selected = false; } if (c as BWalkingRouteItem != null && (c as BWalkingRouteItem).DataSource != bRoute) { (c as BWalkingRouteItem).Selected = false; } if (c as BDrivingRouteItem != null && (c as BDrivingRouteItem).DataSource != bRoute) { (c as BDrivingRouteItem).Selected = false; } } if (BMapControl != null) { BMapControl.SetRoute(bRoute); //更新地图中的路线 } } /// /// 路线步骤选中 /// /// /// void item_StepSelected(string stepPath, bool enlarge) { if (BMapControl != null) { BMapControl.SetHighlightPath(stepPath, enlarge); //高亮设置 } } /// /// 路线起点终点选中 /// /// void item_StepEndPointSelected(BPoint bPoint) { // if (BMapControl != null) { BMapControl.SelectBPoint(bPoint); } } /// /// 选择终点 /// /// /// void sugg_end_EndPointSelected(string placeName, PointType type) { DestinationPlace = placeName; } /// /// 选择起点 /// /// /// void sugg_start_EndPointSelected(string placeName, PointType type) { SourcePlace = placeName; } #endregion #region 公开方法 /// /// 开启搜索 /// internal void StartSearch() { flpRoutes.Controls.Clear(); if (BMapControl != null) { BMapControl.SetRoute(null); // BMapControl.SetRouteStartAndEnd(null, null); } if (BPlacesBoard != null) //位置列表初始化 { BPlacesBoard.Clear(); } _wait.Visible = true; //等待 ((Action)delegate() { JObject routes; DirectionService ds = new DirectionService(); if (_current_method == 0) //公交 { if (bPlaceBoxSource.City != "" && bPlaceBoxDestination.City != "" && bPlaceBoxSource.City != bPlaceBoxDestination.City) { MessageBox.Show("公交导航时,两地城市必须一致!"); return; } routes = ds.DirectionByTransit(bPlaceBoxSource.QueryText, bPlaceBoxDestination.QueryText, _currentCity); } else if (_current_method == 1) //驾车 { routes = ds.DirectionByDriving(bPlaceBoxSource.QueryText, bPlaceBoxDestination.QueryText, bPlaceBoxSource.City == "" ? bPlaceBoxSource.CurrentCity : bPlaceBoxSource.City , bPlaceBoxDestination.City == "" ? bPlaceBoxDestination.CurrentCity : bPlaceBoxDestination.City); } else //步行 { if (bPlaceBoxSource.City != "" && bPlaceBoxDestination.City != "" && bPlaceBoxSource.City != bPlaceBoxDestination.City) { MessageBox.Show("步行导航时,两地城市必须一致!"); return; } routes = ds.DirectionByWalking(bPlaceBoxSource.QueryText, bPlaceBoxDestination.QueryText, _currentCity); } if (routes != null && (string)routes["status"] == "0") //搜索成功 { this.Invoke((Action)delegate() { _wait.Visible = false; if ((string)routes["type"] == "2") //正常结果 { //生成起点终点 BPoint start = new BPoint { Type = PointType.RouteStart, Selected = false, Address = bPlaceBoxSource.QueryText, Location = new LatLngPoint(double.Parse((string)routes["result"]["origin"]["originPt"]["lng"]), double.Parse((string)routes["result"]["origin"]["originPt"]["lat"])) }; BPoint end = new BPoint { Type = PointType.RouteEnd, Selected = false, Address = bPlaceBoxDestination.QueryText, Location = new LatLngPoint(double.Parse((string)routes["result"]["destination"]["destinationPt"]["lng"]), double.Parse((string)routes["result"]["destination"]["destinationPt"]["lat"])) }; if (BMapControl != null) { BMapControl.SetRouteStartAndEnd(start, end); //设置地图中对应的起点 终点 } if (_current_method == 0) //公交 { BTaxiTipControl taxi = new BTaxiTipControl(); taxi.DataSource = routes["result"]["taxi"]; //打车信息 taxi.Width = flpRoutes.Width - 25; flpRoutes.Controls.Add(taxi); foreach (JObject route in routes["result"]["routes"]) { BTransitRouteItem item = new BTransitRouteItem(); BStepStartAndEndItem origin = new BStepStartAndEndItem(); origin.EndPoint = start; item.Origin = origin; //起点 BStepStartAndEndItem destination = new BStepStartAndEndItem(); destination.EndPoint = end; item.Destination = destination; //终点 item.DataSource = new BRoute { Type = RouteType.Transit, DataSource = route }; flpRoutes.Controls.Add(item); item.Width = flpRoutes.Width - 25; item.StepEndPointSelected += new StepEndPointSelectedEventHandler(item_StepEndPointSelected); item.StepSelected += new StepSelectedEventHandler(item_StepSelected); item.RouteSelected += new RouteSelectedEventHandler(item_RouteSelected); } } else if (_current_method == 1) //驾车 { BTaxiTipControl taxi = new BTaxiTipControl(); taxi.DataSource = routes["result"]["taxi"]; //打车信息 taxi.Width = flpRoutes.Width - 25; flpRoutes.Controls.Add(taxi); foreach (JObject route in routes["result"]["routes"]) { BDrivingRouteItem item = new BDrivingRouteItem(); BStepStartAndEndItem origin = new BStepStartAndEndItem(); origin.EndPoint = start; item.Origin = origin; //起点 BStepStartAndEndItem destination = new BStepStartAndEndItem(); destination.EndPoint = end; item.Destination = destination; //终点 item.DataSource = new BRoute { DataSource = route, Type = RouteType.Driving }; flpRoutes.Controls.Add(item); item.Width = flpRoutes.Width - 25; item.StepEndPointSelected += new StepEndPointSelectedEventHandler(item_StepEndPointSelected); item.StepSelected += new StepSelectedEventHandler(item_StepSelected); item.RouteSelected += new RouteSelectedEventHandler(item_RouteSelected); } } else //步行 { //步行没有打车信息 foreach (JObject route in routes["result"]["routes"]) { BWalkingRouteItem item = new BWalkingRouteItem(); BStepStartAndEndItem origin = new BStepStartAndEndItem(); origin.EndPoint = start; item.Origin = origin; //起点 BStepStartAndEndItem destination = new BStepStartAndEndItem(); destination.EndPoint = end; item.Destination = destination; //终点 item.DataSource = new BRoute { DataSource = route, Type = RouteType.Walking }; flpRoutes.Controls.Add(item); item.Width = flpRoutes.Width - 25; item.StepEndPointSelected += new StepEndPointSelectedEventHandler(item_StepEndPointSelected); item.StepSelected += new StepSelectedEventHandler(item_StepSelected); item.RouteSelected += new RouteSelectedEventHandler(item_RouteSelected); } } } else //地址模糊 需重新选择 具体json格式参见api文档 { // string start_keyword = (string)routes["result"]["originInfo"]["wd"]; string end_keyword = (string)routes["result"]["destinationInfo"]["wd"]; Label l = new Label(); l.AutoSize = false; l.ForeColor = Color.Red; l.Width = flpRoutes.Width - 25; l.Height = 20; l.TextAlign = ContentAlignment.MiddleCenter; l.Text = "请选择准确的位置"; flpRoutes.Controls.Add(l); if (routes["result"]["origin"] != null) //起点模糊 { if (routes["result"]["origin"] is JArray) //公交 { BPlacesSuggestionControl sugg_start = new BPlacesSuggestionControl(); sugg_start.Type = PointType.RouteStart; sugg_start.KeyWord = start_keyword; sugg_start.Content = routes["result"]["origin"]; sugg_start.Width = flpRoutes.Width - 25; sugg_start.EndPointSelected += new EndPointSelectedEventHandler(sugg_start_EndPointSelected); flpRoutes.Controls.Add(sugg_start); } else //驾车 步行 { BPlacesSuggestionControl sugg_start = new BPlacesSuggestionControl(); sugg_start.Type = PointType.RouteStart; sugg_start.KeyWord = start_keyword; sugg_start.Content = routes["result"]["origin"]["content"]; sugg_start.Width = flpRoutes.Width - 25; sugg_start.EndPointSelected += new EndPointSelectedEventHandler(sugg_start_EndPointSelected); flpRoutes.Controls.Add(sugg_start); } } if (routes["result"]["destination"] != null) //终点模糊 { if (routes["result"]["destination"] is JArray) //公交 { BPlacesSuggestionControl sugg_end = new BPlacesSuggestionControl(); sugg_end.Type = PointType.RouteEnd; sugg_end.KeyWord = end_keyword; sugg_end.Content = routes["result"]["destination"]; sugg_end.Width = flpRoutes.Width - 25; sugg_end.EndPointSelected += new EndPointSelectedEventHandler(sugg_end_EndPointSelected); flpRoutes.Controls.Add(sugg_end); } else { BPlacesSuggestionControl sugg_end = new BPlacesSuggestionControl(); sugg_end.Type = PointType.RouteEnd; sugg_end.KeyWord = end_keyword; sugg_end.Content = routes["result"]["destination"]["content"]; sugg_end.Width = flpRoutes.Width - 25; sugg_end.EndPointSelected += new EndPointSelectedEventHandler(sugg_end_EndPointSelected); flpRoutes.Controls.Add(sugg_end); } } } }); } }).BeginInvoke(null, null); } /// /// 清空导航控件(初始化) /// public void Clear() { flpRoutes.Controls.Clear(); if (BMapControl != null) { BMapControl.SetRoute(null); // BMapControl.SetRouteStartAndEnd(null, null); } } #endregion } } ================================================ FILE: BMap.NET.WindowsForm/BDirectionBoard.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 iVBORw0KGgoAAAANSUhEUgAAABoAAAAmCAIAAABVkBxPAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 YQUAAAAJcEhZcwAADrwAAA68AZW8ckkAAAAGYktHRAD/AP8A/6C9p5MAAAD1SURBVEhL7ZI9C4MwEIb7 //+Ji/g1uLjqqIhYcXFSHBT8BAuCPbyrWA3ShA6F5pl8L3cPScxt+SpSJ47UicPWdV1n23bTNJRf1HVd lmVVVZRPMHR93xuGoSiKpmlt21J1RVVVqAOUTxx1wzCgC9F1HXZKa7y6cRxN08SBDbDDfrGBT1cUxX3F siwc830fYp7n2MB9WMRxHBw7/I1/0M3z/FjZdBixec9HuizLMB7A5j2fHjZNU6xsJEmCS3s47i6OYywC URRR9R22Dt6a67qe503TRKWVMAzBFQQB5RNs3QXw1OmLBbfuGqkTR+rEkTpxflm3LE+JGC/8U9qGcgAA AABJRU5ErkJggg== iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 YQUAAAAJcEhZcwAADrwAAA68AZW8ckkAAAAGYktHRAD/AP8A/6C9p5MAAAC5SURBVDhPvZGxDoIwEIZ9 c6Mxgg8CuuoziOIuiot2JHGBBKgLwS/10OpSGfTPDf3v+uXu2kHbU/8HknI/zwJfeb6ahlmAlUKnN2B1 XY7Ow48gKWWjF5CUCeXJZbwrYt3oW6M5YEmm1VEu2cAiC6nFxVa80SaPSDKbeBuYKZ9a3dTijehDkn3E OwFmM4An3jlSlK9J8m7ibeDQLQ1DH+K59KlK5ZINoH7P+hB9mI19CA6Oj/tGvwba9g6zhMUAKbYqsQAA AABJRU5ErkJggg== iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 YQUAAAAJcEhZcwAADrwAAA68AZW8ckkAAAAGYktHRAD/AP8A/6C9p5MAAACeSURBVDhPxZExCoRQDET3 /pUg6DXU1iMIaq3gNdRq9oWNkL8Iq4XskMLMZML8+NJN/MEwz2oalaUVH9Pk/IHU0LbKsu+CDAgGdiPn ufpe62o1DNZCLovPJAYCoDEd0XVG1rW3iYHQaCyO2DYjkQ5cMxSFtyeRyB1BC3keiQui8UqGWLzvGkd/ dDhuMIB7Z/2AZQQgNFVVv37cBTxtkN4/o9GrfLGpTQAAAABJRU5ErkJggg== ================================================ FILE: BMap.NET.WindowsForm/BDrivingRouteItem.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class BDrivingRouteItem { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.flpSteps = new System.Windows.Forms.FlowLayoutPanel(); this.SuspendLayout(); // // flpSteps // this.flpSteps.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.flpSteps.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.flpSteps.Location = new System.Drawing.Point(0, 70); this.flpSteps.Margin = new System.Windows.Forms.Padding(0); this.flpSteps.Name = "flpSteps"; this.flpSteps.Size = new System.Drawing.Size(298, 303); this.flpSteps.TabIndex = 0; this.flpSteps.WrapContents = false; // // BDrivingRouteItem // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.flpSteps); this.Cursor = System.Windows.Forms.Cursors.Hand; this.Name = "BDrivingRouteItem"; this.Size = new System.Drawing.Size(298, 373); this.Click += new System.EventHandler(this.BDrivingRouteItem_Click); this.Paint += new System.Windows.Forms.PaintEventHandler(this.BDrivingRouteItem_Paint); this.MouseEnter += new System.EventHandler(this.BDrivingRouteItem_MouseEnter); this.MouseLeave += new System.EventHandler(this.BDrivingRouteItem_MouseLeave); this.ResumeLayout(false); } #endregion private System.Windows.Forms.FlowLayoutPanel flpSteps; } } ================================================ FILE: BMap.NET.WindowsForm/BDrivingRouteItem.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using Newtonsoft.Json.Linq; using BMap.NET.WindowsForm.BMapElements; namespace BMap.NET.WindowsForm { /// /// 驾车路线控件 /// partial class BDrivingRouteItem : UserControl { /// /// 步骤选择时激发该事件 /// public event StepSelectedEventHandler StepSelected; /// /// 路线选择时激发该事件 /// public event RouteSelectedEventHandler RouteSelected; /// /// 路线起点终点选中时激发该事件 /// public event StepEndPointSelectedEventHandler StepEndPointSelected; private BRoute _dataSource; /// /// 路线数据源 /// public BRoute DataSource { get { return _dataSource; } set { _dataSource = value; if (_dataSource != null) //解析 具体json格式参见api文档 { _distance = double.Parse((string)_dataSource.DataSource["distance"]); _duration = double.Parse((string)_dataSource.DataSource["duration"]); _toll = double.Parse((string)_dataSource.DataSource["toll"]); if (Origin != null) //起点 { flpSteps.Controls.Add(Origin); Origin.StepEndPointSelected+=new StepEndPointSelectedEventHandler(Origin_StepEndPointSelected); } foreach (JObject step in _dataSource.DataSource["steps"]) { BDrivingStepItem item = new BDrivingStepItem(); item.DataSource = step; item.Width = flpSteps.Width - 17; flpSteps.Controls.Add(item); item.Margin = new Padding(0); item.StepSelected+=new StepSelectedEventHandler(item_StepSelected); if (item.Step_POIs != null) _pois_near += item.Step_POIs + ","; } if (Destination != null) //终点 { flpSteps.Controls.Add(Destination); Destination.StepEndPointSelected+=new StepEndPointSelectedEventHandler(Destination_StepEndPointSelected); } if (_pois_near != null) { _pois_near = _pois_near.TrimEnd(new char[] { ',' }); } foreach (Control c in flpSteps.Controls) { _steps_height += c.Height; } Selected = false; } } } private double _distance; private double _duration; private string _pois_near; private double _toll; private int _steps_height; private bool _mouse_hover; private bool _selected; /// /// 是否被选中 /// public bool Selected { get { return _selected; } set { _selected = value; if (_selected) { Height = 70 + _steps_height; } else { Height = 70; } } } /// /// 起点 /// public BStepStartAndEndItem Origin { get; set; } /// /// 终点 /// public BStepStartAndEndItem Destination { get; set; } /// /// 构造方法 /// public BDrivingRouteItem() { InitializeComponent(); SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true); } #region 事件处理 /// /// 鼠标进入 /// /// /// private void BDrivingRouteItem_MouseEnter(object sender, EventArgs e) { _mouse_hover = true; Invalidate(); } /// /// 鼠标移出 /// /// /// private void BDrivingRouteItem_MouseLeave(object sender, EventArgs e) { _mouse_hover = false; Invalidate(); } /// /// 鼠标点击 /// /// /// private void BDrivingRouteItem_Click(object sender, EventArgs e) { Selected = true; if (_selected) { if (RouteSelected != null) { RouteSelected(_dataSource); } } } /// /// 重绘 /// /// /// private void BDrivingRouteItem_Paint(object sender, PaintEventArgs e) { if (Selected || _mouse_hover) { using (SolidBrush sb = new SolidBrush(Color.FromArgb(235, 241, 251))) { e.Graphics.FillRectangle(sb, new Rectangle(0, 0, Width - 1, 70 - 1)); } } e.Graphics.DrawRectangle(Pens.LightGray, new Rectangle(0, 0, Width - 1, 70 - 1)); using (Font f = new Font("微软雅黑", 9)) { e.Graphics.DrawString(Math.Round(_duration / 60, 0) + "分钟 | " + Math.Round(_distance / 1000, 1) + "公里 | 过路费" + Math.Round(_toll,1) + "元", f, Brushes.Gray, new PointF(20, 10)); e.Graphics.DrawString("途径:" + _pois_near, f, Brushes.DarkGray, new PointF(20, 35)); } } /// /// 路线步骤选中 /// /// /// void item_StepSelected(string stepPath, bool enlarge) { if (StepSelected != null) { StepSelected(stepPath, enlarge); } } /// /// 路线终点选中 /// /// void Destination_StepEndPointSelected(BPoint bPoint) { if (StepEndPointSelected != null) { StepEndPointSelected(bPoint); } } /// /// 路线起点选中 /// /// void Origin_StepEndPointSelected(BPoint bPoint) { if (StepEndPointSelected != null) { StepEndPointSelected(bPoint); } } #endregion } } ================================================ FILE: BMap.NET.WindowsForm/BDrivingRouteItem.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ================================================ FILE: BMap.NET.WindowsForm/BDrivingStepItem.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class BDrivingStepItem { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.lblStepInfo = new System.Windows.Forms.Label(); this.SuspendLayout(); // // lblStepInfo // this.lblStepInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblStepInfo.Cursor = System.Windows.Forms.Cursors.Hand; this.lblStepInfo.Font = new System.Drawing.Font("SimSun", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblStepInfo.ForeColor = System.Drawing.Color.DimGray; this.lblStepInfo.Location = new System.Drawing.Point(37, 7); this.lblStepInfo.Name = "lblStepInfo"; this.lblStepInfo.Size = new System.Drawing.Size(262, 43); this.lblStepInfo.TabIndex = 0; this.lblStepInfo.Text = "这里是步骤说明这里是步骤说明这里是步骤说明这里是步\r\n撒旦法阿斯蒂芬撒旦法撒旦发射点发\r\n撒旦法骤说明"; this.lblStepInfo.Click += new System.EventHandler(this.lblStepInfo_Click); this.lblStepInfo.MouseEnter += new System.EventHandler(this.BDrivingStepItem_MouseEnter); this.lblStepInfo.MouseLeave += new System.EventHandler(this.BDrivingStepItem_MouseLeave); // // BDrivingStepItem // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.lblStepInfo); this.Cursor = System.Windows.Forms.Cursors.Hand; this.Name = "BDrivingStepItem"; this.Size = new System.Drawing.Size(306, 56); this.Click += new System.EventHandler(this.lblStepInfo_Click); this.Paint += new System.Windows.Forms.PaintEventHandler(this.BDrivingStepItem_Paint); this.MouseEnter += new System.EventHandler(this.BDrivingStepItem_MouseEnter); this.MouseLeave += new System.EventHandler(this.BDrivingStepItem_MouseLeave); this.ResumeLayout(false); } #endregion private System.Windows.Forms.Label lblStepInfo; } } ================================================ FILE: BMap.NET.WindowsForm/BDrivingStepItem.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using Newtonsoft.Json.Linq; using System.Text.RegularExpressions; namespace BMap.NET.WindowsForm { /// /// 驾车路线步骤控件 /// partial class BDrivingStepItem : UserControl { /// /// 路线步骤选中时激发该事件 /// public event StepSelectedEventHandler StepSelected; private JObject _dataSource; /// /// 步骤数据源 /// public JObject DataSource { get { return _dataSource; } set { _dataSource = value; if (_dataSource != null) //解析 详细json结构参见api文档 { _step_direction = int.Parse((string)_dataSource["turn"]); _step_info = (string)_dataSource["instructions"]; Paths = (string)_dataSource["path"]; foreach (JObject poi in _dataSource["pois"]) { Step_POIs += (string)poi["name"] + ","; } if (Step_POIs != null) Step_POIs = Step_POIs.TrimEnd(new char[] { ',' }); Regex reg = new Regex(@"<(!|/)?\w+( ((.|\n)*?"")?)? *>"); _step_info = reg.Replace(_step_info, "").Replace("
",""); lblStepInfo.Text = _step_info; } } } private int _step_direction; private string _step_info; /// /// 路过POI信息点 /// public string Step_POIs { get; set; } /// /// 当前步骤路线 /// public string Paths { get; set; } /// /// 构造方法 /// public BDrivingStepItem() { InitializeComponent(); } #region 事件处理 /// /// 重绘 /// /// /// private void BDrivingStepItem_Paint(object sender, PaintEventArgs e) { //e.Graphics.DrawRectangle(Pens.LightGray, new Rectangle(0, 0, Width - 2, Height)); } /// /// 鼠标进入 /// /// /// private void BDrivingStepItem_MouseEnter(object sender, EventArgs e) { BackColor = Color.FromArgb(235, 241, 251); if (StepSelected != null) { StepSelected(Paths, false); } } /// /// 鼠标移出 /// /// /// private void BDrivingStepItem_MouseLeave(object sender, EventArgs e) { BackColor = Color.White; } /// /// 鼠标点击 /// /// /// private void lblStepInfo_Click(object sender, EventArgs e) { if (StepSelected != null) { StepSelected(Paths, true); } } #endregion } } ================================================ FILE: BMap.NET.WindowsForm/BDrivingStepItem.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ================================================ FILE: BMap.NET.WindowsForm/BLoadMapModeControl.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class BLoadMapModeControl { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BLoadMapModeControl)); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.rdoCache = new System.Windows.Forms.RadioButton(); this.rdoCachefirst = new System.Windows.Forms.RadioButton(); this.rdoServer = new System.Windows.Forms.RadioButton(); this.label1 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // // pictureBox1 // this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Hand; this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); this.pictureBox1.Location = new System.Drawing.Point(101, 9); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(13, 13); this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false; this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click); // // rdoCache // this.rdoCache.AutoSize = true; this.rdoCache.BackColor = System.Drawing.SystemColors.Control; this.rdoCache.Checked = true; this.rdoCache.Location = new System.Drawing.Point(15, 34); this.rdoCache.Name = "rdoCache"; this.rdoCache.Size = new System.Drawing.Size(71, 16); this.rdoCache.TabIndex = 1; this.rdoCache.TabStop = true; this.rdoCache.Text = "仅从本地"; this.rdoCache.UseVisualStyleBackColor = true; this.rdoCache.CheckedChanged += new System.EventHandler(this.rdo_CheckedChanged); // // rdoCachefirst // this.rdoCachefirst.AutoSize = true; this.rdoCachefirst.Location = new System.Drawing.Point(15, 56); this.rdoCachefirst.Name = "rdoCachefirst"; this.rdoCachefirst.Size = new System.Drawing.Size(71, 16); this.rdoCachefirst.TabIndex = 2; this.rdoCachefirst.Text = "本地优先"; this.rdoCachefirst.UseVisualStyleBackColor = true; this.rdoCachefirst.CheckedChanged += new System.EventHandler(this.rdo_CheckedChanged); // // rdoServer // this.rdoServer.AutoSize = true; this.rdoServer.Location = new System.Drawing.Point(15, 78); this.rdoServer.Name = "rdoServer"; this.rdoServer.Size = new System.Drawing.Size(71, 16); this.rdoServer.TabIndex = 3; this.rdoServer.Text = "仅从远程"; this.rdoServer.UseVisualStyleBackColor = true; this.rdoServer.CheckedChanged += new System.EventHandler(this.rdo_CheckedChanged); // // label1 // this.label1.BackColor = System.Drawing.Color.LightGray; this.label1.Location = new System.Drawing.Point(14, 25); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(100, 1); this.label1.TabIndex = 4; this.label1.Text = "label1"; // // BLoadMapModeControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.label1); this.Controls.Add(this.rdoServer); this.Controls.Add(this.rdoCachefirst); this.Controls.Add(this.rdoCache); this.Controls.Add(this.pictureBox1); this.Name = "BLoadMapModeControl"; this.Size = new System.Drawing.Size(126, 105); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.RadioButton rdoCache; private System.Windows.Forms.RadioButton rdoCachefirst; private System.Windows.Forms.RadioButton rdoServer; private System.Windows.Forms.Label label1; } } ================================================ FILE: BMap.NET.WindowsForm/BLoadMapModeControl.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; namespace BMap.NET.WindowsForm { /// /// 地图加载模式选择控件 /// partial class BLoadMapModeControl : UserControl { public event LoadMapModeChangedEventHandler LoadMapModeChanged; private LoadMapMode _loadMode = LoadMapMode.Cache; public LoadMapMode LoadMode { get { return _loadMode; } set { if (value != _loadMode) { _loadMode = value; if (_loadMode == LoadMapMode.Cache) { rdoCache.Checked = true; } if (_loadMode == LoadMapMode.CacheServer) { rdoCachefirst.Checked = true; } if (_loadMode == LoadMapMode.Server) { rdoServer.Checked = true; } } } } /// /// /// public BLoadMapModeControl() { InitializeComponent(); } /// /// 隐藏 /// /// /// private void pictureBox1_Click(object sender, EventArgs e) { Visible = false; } /// /// 选择改变 /// /// /// private void rdo_CheckedChanged(object sender, EventArgs e) { LoadMapMode lm = LoadMapMode.Cache; if (rdoCache.Checked) { lm = LoadMapMode.Cache; } if (rdoCachefirst.Checked) { lm = LoadMapMode.CacheServer; } if (rdoServer.Checked) { lm = LoadMapMode.Server; } if (lm != _loadMode) { _loadMode = lm; if (LoadMapModeChanged != null) { LoadMapModeChanged(_loadMode); } Visible = false; } } } delegate void LoadMapModeChangedEventHandler(LoadMapMode loadMode); } ================================================ FILE: BMap.NET.WindowsForm/BLoadMapModeControl.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 R0lGODlhDQANAIEBAAkkPP///wAAAAAAACH/C05FVFNDQVBFMi4wAwEBAAAh+QQBAAABACwAAAAADQAN AAAIMQADBABAsGBBgQMNKgSQcKFDhg0FLkQIsaFBhBIfUtSI0SHFjRcjWnx4kSRBkBMDBAQAOw== ================================================ FILE: BMap.NET.WindowsForm/BMap.NET.WindowsForm.csproj ================================================  Debug AnyCPU 8.0.30703 2.0 {1B32D6FD-3C74-40DC-9D43-102B19D40785} Library Properties BMap.NET.WindowsForm BMap.NET.WindowsForm v4.0 512 true full false bin\Debug\ DEBUG;TRACE prompt 4 pdbonly true bin\Release\ TRACE prompt 4 False libs\Newtonsoft.Json.dll UserControl BCityControl.cs UserControl BDirectionBoard.cs UserControl BDrivingRouteItem.cs UserControl BDrivingStepItem.cs UserControl BLoadMapModeControl.cs UserControl BMapControl.cs UserControl BMarkerTipControl.cs UserControl BPlaceItem.cs UserControl BMarkerEditorControl.cs UserControl BPlacesSuggestionControl.cs UserControl BPlacesSuggestionItem.cs UserControl BPointTipControl.cs UserControl BQuickSearchBoardcs.cs UserControl BQuickSearchControl.cs UserControl BPlaceBox.cs UserControl BPlacesBoard.cs UserControl BPOITipControl.cs UserControl BStepStartAndEndItem.cs UserControl BTaxiTipControl.cs UserControl BTransitRouteItem.cs UserControl BScreenshotMenu.cs UserControl BTransitStepItem.cs UserControl BWalkingRouteItem.cs UserControl BWalkingStepItem.cs Component UserControl CityList.cs Form MapDownloadDialog.cs UserControl MapDownloaderControl.cs True True BMap.resx True True Resources.resx BCityControl.cs BDirectionBoard.cs BDrivingRouteItem.cs BDrivingStepItem.cs BLoadMapModeControl.cs BMapControl.cs BMarkerEditorControl.cs BMarkerTipControl.cs BPlaceBox.cs BPlaceItem.cs BPlacesBoard.cs BPlacesSuggestionControl.cs BPlacesSuggestionItem.cs BPointTipControl.cs BPOITipControl.cs BQuickSearchBoardcs.cs BQuickSearchControl.cs BScreenshotMenu.cs BStepStartAndEndItem.cs BTaxiTipControl.cs BTransitRouteItem.cs BTransitStepItem.cs BWalkingRouteItem.cs BWalkingStepItem.cs CityList.cs MapDownloadDialog.cs ResXFileCodeGenerator BMap.Designer.cs ResXFileCodeGenerator Resources.Designer.cs {AFFEB71C-54B6-4A9B-A445-BB287EDBAC19} BMap.NET ================================================ FILE: BMap.NET.WindowsForm/BMapControl.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class BMapControl { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BMapControl)); this.cm_popup = new System.Windows.Forms.ContextMenuStrip(this.components); this.cmsWhere = new System.Windows.Forms.ToolStripMenuItem(); this.cmsSetStart = new System.Windows.Forms.ToolStripMenuItem(); this.cmsSetEnd = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.cmsCenter = new System.Windows.Forms.ToolStripMenuItem(); this.cmsLarge = new System.Windows.Forms.ToolStripMenuItem(); this.cmsSmall = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.cmsRegionSaveAs = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); this.cmsClearDrawings = new System.Windows.Forms.ToolStripMenuItem(); this.cmsClearMarkers = new System.Windows.Forms.ToolStripMenuItem(); this.cm_popup.SuspendLayout(); this.SuspendLayout(); // // cm_popup // this.cm_popup.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cmsWhere, this.cmsSetStart, this.cmsSetEnd, this.toolStripSeparator1, this.cmsCenter, this.cmsLarge, this.cmsSmall, this.toolStripSeparator2, this.cmsRegionSaveAs, this.toolStripSeparator3, this.cmsClearDrawings, this.cmsClearMarkers}); this.cm_popup.Name = "cm_popup"; this.cm_popup.Size = new System.Drawing.Size(180, 242); // // cmsWhere // this.cmsWhere.Image = ((System.Drawing.Image)(resources.GetObject("cmsWhere.Image"))); this.cmsWhere.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.cmsWhere.Name = "cmsWhere"; this.cmsWhere.Size = new System.Drawing.Size(179, 22); this.cmsWhere.Text = "这是哪里?"; this.cmsWhere.Click += new System.EventHandler(this.cm_popup_Click); // // cmsSetStart // this.cmsSetStart.Image = ((System.Drawing.Image)(resources.GetObject("cmsSetStart.Image"))); this.cmsSetStart.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.cmsSetStart.Name = "cmsSetStart"; this.cmsSetStart.Size = new System.Drawing.Size(179, 22); this.cmsSetStart.Text = "以此为起点"; this.cmsSetStart.Click += new System.EventHandler(this.cm_popup_Click); // // cmsSetEnd // this.cmsSetEnd.Image = ((System.Drawing.Image)(resources.GetObject("cmsSetEnd.Image"))); this.cmsSetEnd.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.cmsSetEnd.Name = "cmsSetEnd"; this.cmsSetEnd.Size = new System.Drawing.Size(179, 22); this.cmsSetEnd.Text = "以此为终点"; this.cmsSetEnd.Click += new System.EventHandler(this.cm_popup_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Size = new System.Drawing.Size(176, 6); // // cmsCenter // this.cmsCenter.Image = ((System.Drawing.Image)(resources.GetObject("cmsCenter.Image"))); this.cmsCenter.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.cmsCenter.Name = "cmsCenter"; this.cmsCenter.Size = new System.Drawing.Size(179, 22); this.cmsCenter.Text = "居中"; this.cmsCenter.Click += new System.EventHandler(this.cm_popup_Click); // // cmsLarge // this.cmsLarge.Image = ((System.Drawing.Image)(resources.GetObject("cmsLarge.Image"))); this.cmsLarge.Name = "cmsLarge"; this.cmsLarge.Size = new System.Drawing.Size(179, 22); this.cmsLarge.Text = "放大"; this.cmsLarge.Click += new System.EventHandler(this.cm_popup_Click); // // cmsSmall // this.cmsSmall.Image = ((System.Drawing.Image)(resources.GetObject("cmsSmall.Image"))); this.cmsSmall.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.cmsSmall.Name = "cmsSmall"; this.cmsSmall.Size = new System.Drawing.Size(179, 22); this.cmsSmall.Text = "缩小"; this.cmsSmall.Click += new System.EventHandler(this.cm_popup_Click); // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; this.toolStripSeparator2.Size = new System.Drawing.Size(176, 6); // // cmsRegionSaveAs // this.cmsRegionSaveAs.Name = "cmsRegionSaveAs"; this.cmsRegionSaveAs.Size = new System.Drawing.Size(179, 22); this.cmsRegionSaveAs.Text = "\"可视区域\"另存为..."; this.cmsRegionSaveAs.Click += new System.EventHandler(this.cm_popup_Click); // // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; this.toolStripSeparator3.Size = new System.Drawing.Size(176, 6); // // cmsClearDrawings // this.cmsClearDrawings.Image = ((System.Drawing.Image)(resources.GetObject("cmsClearDrawings.Image"))); this.cmsClearDrawings.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.cmsClearDrawings.Name = "cmsClearDrawings"; this.cmsClearDrawings.Size = new System.Drawing.Size(179, 22); this.cmsClearDrawings.Text = "清空所有绘图"; this.cmsClearDrawings.Click += new System.EventHandler(this.cm_popup_Click); // // cmsClearMarkers // this.cmsClearMarkers.Image = ((System.Drawing.Image)(resources.GetObject("cmsClearMarkers.Image"))); this.cmsClearMarkers.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.cmsClearMarkers.Name = "cmsClearMarkers"; this.cmsClearMarkers.Size = new System.Drawing.Size(179, 22); this.cmsClearMarkers.Text = "清空所有标记"; this.cmsClearMarkers.Click += new System.EventHandler(this.cm_popup_Click); // // BMapControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Name = "BMapControl"; this.Size = new System.Drawing.Size(232, 172); this.cm_popup.ResumeLayout(false); this.ResumeLayout(false); } #endregion private System.Windows.Forms.ContextMenuStrip cm_popup; private System.Windows.Forms.ToolStripMenuItem cmsWhere; private System.Windows.Forms.ToolStripMenuItem cmsSetStart; private System.Windows.Forms.ToolStripMenuItem cmsSetEnd; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripMenuItem cmsCenter; private System.Windows.Forms.ToolStripMenuItem cmsLarge; private System.Windows.Forms.ToolStripMenuItem cmsSmall; private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; private System.Windows.Forms.ToolStripMenuItem cmsClearMarkers; //private System.Windows.Forms.ToolStripMenuItem cmsClearDrawings; private System.Windows.Forms.ToolStripMenuItem cmsClearDrawings; private System.Windows.Forms.ToolStripMenuItem cmsRegionSaveAs; private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; } } ================================================ FILE: BMap.NET.WindowsForm/BMapControl.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using BMap.NET.WindowsForm.BMapElements; using System.Drawing.Drawing2D; using BMap.NET.HTTPService; using Newtonsoft.Json.Linq; using BMap.NET.WindowsForm.FunctionalControls; using BMap.NET.WindowsForm.DrawingObjects; namespace BMap.NET.WindowsForm { /// /// 百度地图显示控件 /// public partial class BMapControl : UserControl { private const double DISTANCE = 111319.49; //每(经纬)度距离m #region 属性 private LatLngPoint _center = new LatLngPoint(117.217412, 39.142191); //天津 /// /// 地图显示中心经纬度坐标 /// [Description("地图中心点"),Category("BMap.NET")] public LatLngPoint Center { get { return _center; } set { _center = value; } } private int _zoom = 12; /// /// 地图缩放级别(3-18) /// [Description("当前地图缩放级别"),Category("BMap.NET")] public int Zoom { get { return _zoom; } set { _zoom = value; _tiles.Clear(); Invalidate(); } } private MapMode _mode = MapMode.Normal; /// /// 地图模式 /// [Description("当前地图模式"),Category("BMap.NET")] public MapMode Mode { get { return _mode; } set { _mode = value; foreach (KeyValuePair p in _tiles) { p.Value.Mode = _mode; } Invalidate(); } } private LoadMapMode _loadmode = LoadMapMode.Cache; /// /// 地图加载模式 /// [Description("当前地图加载模式"),Category("BMap.NET")] public LoadMapMode LoadMode { get { return _loadmode; } set { _loadmode = value; foreach(KeyValuePair p in _tiles) { p.Value.LoadMode = _loadmode; } Invalidate(); } } //关联控件 /// /// 与之关联的位置输入框 /// [Description("与之关联的位置搜索输入框"),Category("BMap.NET")] public BPlaceBox BPlaceBox { get; set; } /// /// 与之关联的位置列表控件 /// [Description("与之关联的位置列表控件"),Category("BMap.NET")] public BPlacesBoard BPlacesBoard { set; get; } /// /// 导航控件 /// [Description("与之关联的导航控件"),Category("BMap.NET")] public BDirectionBoard BDirectionBoard { get; set; } #endregion #region 字段 /// /// 鼠标右键时鼠标位置 /// private Point _right_mouse_point_cache; /// /// 快速搜索控件 /// private BQuickSearchControl _bQuickSearchControl = new BQuickSearchControl(); /// /// 截图菜单 /// private BScreenshotMenu _bScreenshotMenu = new BScreenshotMenu(); /// /// 当前光标 /// private Cursor _current_cursor_cache = Cursors.Arrow; /// /// 地图中提示 /// private Label _toolTip = new Label(); /// /// 地图加载模式选择控件 /// private BLoadMapModeControl _bLoadMapModeControl = new BLoadMapModeControl(); /// /// 显示路网复选框 /// private CheckBox _chkShowRoadNet = new CheckBox(); /// /// 城市切换控件 /// private BCityControl _bCityControl = new BCityControl(); /// /// 当前城市 /// private string _currentCity = ""; /// /// 鼠标是否定位 /// private bool _cursor_located = false; /// /// 鼠标移动前一点缓存 /// private Point _previous_point_cache; /// /// 鼠标工作方式 /// private MouseType _mouse_type = MouseType.None; /// /// 地图中唯一的搜索区域矩形(没有则为null) /// private BBound _b_bound; /// /// 地图中唯一的附近区域(没有则为null) /// private BNearBy _b_nearby; /// /// 地图中唯一测量线条(没有则为null) /// private BDistance _b_distance; /// /// 地图中唯一路线(没有则为null) /// private BRoute _b_route; /// /// 当前绘制图形 没有则为null(包括截图矩形) /// private DrawingObject _current_drawing; /// /// 地图中瓦片容器 /// private Dictionary _tiles = new Dictionary(); /// /// 地图中普通信息点(POI)容器 /// private Dictionary _pois = new Dictionary(); /// /// 绘制图形容器 /// private Dictionary _drawingObjects = new Dictionary(); /// /// 地图中用户添加的标记点 /// private Dictionary _markers = new Dictionary(); /// /// 线路起点(没有则为null) /// private BPoint _theRouteStart; /// /// 线路终点(没有则为null) /// private BPoint _theRouteEnd; /// /// 地图中用户询问的未知点(没有则为null) /// private BPoint _theStrangePoint; /// /// POI信息显示控件 /// private BPOITipControl _bPOITipControl = new BPOITipControl(); /// /// 标记点信息编辑控件 /// private BMarkerEditorControl _bMarkerEditorControl = new BMarkerEditorControl(); /// /// 标记点信息显示控件 /// private BMarkerTipControl _bMarkerTipControl = new BMarkerTipControl(); /// /// 位置点信息显示控件 /// private BPointTipControl _bPointTipControl = new BPointTipControl(); /// /// 当前选择的POI(没有则为null) /// private BPOI _current_selected_poi; /// /// 当前选择的标记点(没有则为null) /// private BMarker _current_selected_marker; /// /// 当前选择的位置点(没有则为null) /// private BPoint _current_selected_point; #endregion /// /// 构造方法 /// public BMapControl() { InitializeComponent(); //绘制双缓冲 SetStyle(ControlStyles.OptimizedDoubleBuffer, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); UpdateStyles(); } #region 重写方法 /// /// 控件加载 /// /// protected override void OnLoad(EventArgs e) { base.OnLoad(e); Init(); } /// /// 地图重绘 /// /// protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); if (!DesignMode) //所有绘制工作均在运行时发生 { //瓦片 DrawTiles(e.Graphics); //绘制图形 DrawDrawingObjects(e.Graphics); //鼠标定位效果 DrawCursor(e.Graphics); //地图元素 DrawMapElements(e.Graphics); //地图信息 DrawMapInfo(e.Graphics); //当前城市 DrawCurrentCity(e.Graphics); //工具栏 DrawToolsBar(e.Graphics); } } /// /// 鼠标在地图上按下 /// /// protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); if (e.Button == System.Windows.Forms.MouseButtons.Left) //左键 { //检查设置鼠标工作方式 if (new Rectangle(Width - 384 + 26 * 8, 10, 26, 26).Contains(PointToClient(Cursor.Position))) //鼠标定位 { _cursor_located = !_cursor_located; Invalidate(); return; } else if (new Rectangle(Width - 384 + 26 * 7, 10, 26, 26).Contains(PointToClient(Cursor.Position))) //绘制多边形 { if (_mouse_type == MouseType.DrawPolygon) { _mouse_type = MouseType.None; _current_cursor_cache = Cursor = Cursors.Arrow; } else { _mouse_type = MouseType.DrawPolygon; _current_cursor_cache = Cursor = Cursors.Cross; //特定光标 _current_drawing = null; _bScreenshotMenu.Visible = false; } Invalidate(); return; } else if (new Rectangle(Width - 384 + 26 * 6, 10, 26, 26).Contains(PointToClient(Cursor.Position))) //绘制直线 { if (_mouse_type == MouseType.DrawLine) { _mouse_type = MouseType.None; _current_cursor_cache = Cursor = Cursors.Arrow; } else { _mouse_type = MouseType.DrawLine; _current_cursor_cache = Cursor = Cursors.Cross; //特定光标 _current_drawing = null; _bScreenshotMenu.Visible = false; } Invalidate(); return; } else if (new Rectangle(Width - 384 + 26 * 5, 10, 26, 26).Contains(PointToClient(Cursor.Position))) //绘制椭圆 { if (_mouse_type == MouseType.DrawCircle) { _mouse_type = MouseType.None; _current_cursor_cache = Cursor = Cursors.Arrow; } else { _mouse_type = MouseType.DrawCircle; _current_cursor_cache = Cursor = Cursors.Cross; //特定光标 _current_drawing = null; _bScreenshotMenu.Visible = false; } Invalidate(); return; } else if (new Rectangle(Width - 384 + 26 * 4, 10, 26, 26).Contains(PointToClient(Cursor.Position))) //绘制矩形 { if (_mouse_type == MouseType.DrawRectange) { _mouse_type = MouseType.None; _current_cursor_cache = Cursor = Cursors.Arrow; } else { _mouse_type = MouseType.DrawRectange; _current_cursor_cache = Cursor = Cursors.Cross; //特定光标 _current_drawing = null; _bScreenshotMenu.Visible = false; } Invalidate(); return; } else if (new Rectangle(Width - 384 + 26 * 3, 10, 26, 26).Contains(PointToClient(Cursor.Position))) //添加标记点 { if (_mouse_type == MouseType.DrawMarker) { _mouse_type = MouseType.None; _current_cursor_cache = Cursor = Cursors.Arrow; } else { _mouse_type = MouseType.DrawMarker; _current_drawing = null; _bScreenshotMenu.Visible = false; } Invalidate(); return; } else if (new Rectangle(Width - 384 + 26 * 2, 10, 26, 26).Contains(PointToClient(Cursor.Position))) //截图 { if (_current_drawing as BScreenShotRectangle == null) { if (_mouse_type == MouseType.DrawScreenshotArea) { _mouse_type = MouseType.None; _current_cursor_cache = Cursor = Cursors.Arrow; } else { _mouse_type = MouseType.DrawScreenshotArea; _current_cursor_cache = Cursor = Cursors.Cross; //特定光标 } Invalidate(); } return; } else if (new Rectangle(Width - 384 + 26 * 1, 10, 26, 26).Contains(PointToClient(Cursor.Position))) //测量距离 { if (_b_distance == null) { if (_mouse_type == MouseType.DrawDistance) { _mouse_type = MouseType.None; _current_cursor_cache = Cursor = Cursors.Arrow; } else { _mouse_type = MouseType.DrawDistance; _current_cursor_cache = Cursor = Cursors.Cross; //特定光标 _current_drawing = null; _bScreenshotMenu.Visible = false; } Invalidate(); } else { _b_distance = null; } return; } else if (new Rectangle(Width - 384, 10, 26, 26).Contains(PointToClient(Cursor.Position))) //矩形区域搜索 { if (_b_bound == null) { if (_mouse_type == MouseType.DrawBound) { _mouse_type = MouseType.None; _current_cursor_cache = Cursor = Cursors.Arrow; } else { _mouse_type = MouseType.DrawBound; _current_cursor_cache = Cursor = Cursors.Cross; //特定光标 _current_drawing = null; _bScreenshotMenu.Visible = false; } Invalidate(); } else { _b_bound = null; _bQuickSearchControl.Visible = false; } return; } if (new Rectangle(10, 10, 90, 25).Contains(e.Location)) //打开城市切换窗体 { if (_bCityControl.Visible) { _bCityControl.Visible = false; } else { _bCityControl.Location = new Point(10, 38); _bCityControl.Visible = true; _bCityControl.CurrentCity = _currentCity; } Invalidate(); return; } else if (new Rectangle(Width - 124, 10, 52, 52).Contains(e.Location)) //打开地图加载模式窗体 { if (_bLoadMapModeControl.Visible) { _bLoadMapModeControl.Visible = false; } else { _bLoadMapModeControl.Location = new Point(Width - 124 + 52 - _bLoadMapModeControl.Width, 10 + 55); _bLoadMapModeControl.LoadMode = _loadmode; _bLoadMapModeControl.Visible = true; } Invalidate(); return; } else if (new Rectangle(Width - 62, 10, 52, 52).Contains(e.Location)) //切换地图模式 { if (_mode == MapMode.Normal) { if (_chkShowRoadNet.Checked) { Mode = MapMode.Sate_RoadNet; } else { Mode = MapMode.Satellite; } _chkShowRoadNet.Location = new Point(Width - 62, 65); _chkShowRoadNet.Visible = true; } else { Mode = MapMode.Normal; _chkShowRoadNet.Visible = false; } return; } if (_mouse_type == MouseType.None) //拖拽地图 { //判断是否拖拽其他物体 地图优先级最低 if (_current_drawing as BScreenShotRectangle != null) //拖拽截图矩形 { if ((_current_drawing as BScreenShotRectangle).Rect.Contains(e.Location)) { _mouse_type = MouseType.DragScreenshotArea; _current_cursor_cache = Cursor = Cursors.SizeAll; _previous_point_cache = e.Location; return; } } if (_theStrangePoint != null && _theStrangePoint.Rect.Contains(e.Location)) //是否点击未知点 { _current_selected_point = _theStrangePoint; Point point = MapHelper.GetScreenLocationByLatLng(_current_selected_point.Location, _center, _zoom, ClientSize); //信息显示控件 _bPointTipControl.BPoint = _current_selected_point; _bPointTipControl.Location = new Point(point.X - _bPointTipControl.Width / 3 + 35, point.Y - _bPointTipControl.Height - _current_selected_point.Rect.Height); _bPointTipControl.Visible = true; return; } if (_theRouteStart !=null && _theRouteStart.Rect.Contains(e.Location)) //是否点击路线起点 { _current_selected_point = _theRouteStart; Point point = MapHelper.GetScreenLocationByLatLng(_current_selected_point.Location, _center, _zoom, ClientSize); //信息显示控件 _bPointTipControl.BPoint = _current_selected_point; _bPointTipControl.Location = new Point(point.X - _bPointTipControl.Width / 3 + 35, point.Y - _bPointTipControl.Height - _current_selected_point.Rect.Height); _bPointTipControl.Visible = true; return; } if (_theRouteEnd != null && _theRouteEnd.Rect.Contains(e.Location)) //是否点击路线终点 { _current_selected_point = _theRouteEnd; Point point = MapHelper.GetScreenLocationByLatLng(_current_selected_point.Location, _center, _zoom, ClientSize); //信息显示控件 _bPointTipControl.BPoint = _current_selected_point; _bPointTipControl.Location = new Point(point.X - _bPointTipControl.Width / 3 + 35, point.Y - _bPointTipControl.Height - _current_selected_point.Rect.Height); _bPointTipControl.Visible = true; return; } foreach (KeyValuePair p in _pois) //是否点击POI点 { if (p.Value.Rect.Contains(e.Location)) { _current_selected_poi = p.Value; //显示信息控件 p.Value.Selected = true; Point point = MapHelper.GetScreenLocationByLatLng(p.Value.Location, _center, _zoom, ClientSize); _bPOITipControl.POI = _current_selected_poi; _bPOITipControl.Location = new Point(point.X - _bPOITipControl.Width / 3 + 35, point.Y - _bPOITipControl.Height - _current_selected_poi.Rect.Height - 5); _bPOITipControl.Visible = true; foreach (KeyValuePair pp in _pois) { if (pp.Value != p.Value) { pp.Value.Selected = false; } } Invalidate(); //通知BPlacesBoard 同步选择 if (BPlacesBoard != null) { BPlacesBoard.SelectPlace(p.Value); } return; } } foreach (KeyValuePair p in _markers) //是否点击标记点 { if (p.Value.Rect.Contains(e.Location)) { _current_selected_marker = p.Value; //显示标记信息控件 Point point = MapHelper.GetScreenLocationByLatLng(p.Value.Location, _center, _zoom, ClientSize); _bMarkerTipControl.Deleted = false; _bMarkerTipControl.Edited = false; _bMarkerTipControl.Marker = _current_selected_marker; _bMarkerTipControl.Location = new Point(point.X - _bMarkerTipControl.Width / 3 + 37, point.Y - _bMarkerTipControl.Height - p.Value.Rect.Height); _bMarkerTipControl.Visible = true; return; } } _bCityControl.Visible = false; _bLoadMapModeControl.Visible = false; _mouse_type = MouseType.DragMap; _current_cursor_cache = Cursor = Cursors.SizeAll; _previous_point_cache = e.Location; } else if (_mouse_type == MouseType.DrawCircle) //绘制椭圆 { LatLngPoint theCenter = MapHelper.GetLatLngByScreenLocation(e.Location, _center, _zoom, ClientSize); _current_drawing = new BCircle { Center = theCenter, RightBottom = theCenter }; } else if (_mouse_type == MouseType.DrawRectange) //绘制矩形 { LatLngPoint leftTop = MapHelper.GetLatLngByScreenLocation(e.Location, _center, _zoom, ClientSize); _current_drawing = new BRectangle { LeftTop = leftTop, RightBottom = leftTop }; } else if (_mouse_type == MouseType.DrawLine) //绘制直线 { LatLngPoint p = MapHelper.GetLatLngByScreenLocation(e.Location, _center, _zoom, ClientSize); if (_current_drawing == null) { _current_drawing = new BLine { Points = new List { p, p } }; } (_current_drawing as BLine).Points.Add(p); } else if (_mouse_type == MouseType.DrawPolygon) //绘制多边形 { LatLngPoint p = MapHelper.GetLatLngByScreenLocation(e.Location, _center, _zoom, ClientSize); if (_current_drawing == null) { _current_drawing = new BPolygon { Points = new List { p, p } }; } (_current_drawing as BPolygon).Points.Add(p); } else if (_mouse_type == MouseType.DrawScreenshotArea) //绘制截图区域 { _current_drawing = new BScreenShotRectangle { LeftTop = e.Location, Width = 0, Height = 0 }; } else if (_mouse_type == MouseType.DrawBound) //矩形搜索开始 { LatLngPoint leftTop = MapHelper.GetLatLngByScreenLocation(e.Location, _center, _zoom, ClientSize); _b_bound = new BBound { LeftTop = leftTop, RightBottom = leftTop }; } else if (_mouse_type == MouseType.DrawDistance) //距离测量 { LatLngPoint p = MapHelper.GetLatLngByScreenLocation(e.Location, _center, _zoom, ClientSize); if (_b_distance == null) { _b_distance = new BDistance { Points = new List { p, p } }; } _b_distance.Points.Add(p); } else if (_mouse_type == MouseType.DrawMarker) //添加标记 { LatLngPoint p = MapHelper.GetLatLngByScreenLocation(e.Location, _center, _zoom, ClientSize); ((Action)delegate() { GeocodingService gs = new GeocodingService(); JObject place = gs.DeGeocoding(p.Lat + "," + p.Lng); if (place != null) { this.Invoke((Action)delegate() { BMarker marker = new BMarker { Index = _markers.Count, Location = p, Name = (string)place["result"]["formatted_address"], Remarks = "我的备注", Selected = false, Address = (string)place["result"]["formatted_address"] }; _markers.Add(marker.Index.ToString(), marker); _bMarkerEditorControl.Saved = false; _bMarkerEditorControl.Marker = marker; _bMarkerEditorControl.Location = new Point(e.Location.X - _bMarkerEditorControl.Width / 3 + 37, e.Location.Y - _bMarkerEditorControl.Height - 22); _bMarkerEditorControl.Visible = true; _current_selected_marker = marker; }); } }).BeginInvoke(null, null); } } if (e.Button == System.Windows.Forms.MouseButtons.Right) //右键弹菜单 { _right_mouse_point_cache = e.Location; cm_popup.Show(PointToScreen(e.Location)); } } /// /// 鼠标在地图上移动 /// /// protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); //提示信息 if (new Rectangle(Width - 62, 10, 52, 52).Contains(PointToClient(Cursor.Position))) { _toolTip.Text = "切换地图模式"; _toolTip.Location = new Point(Width - 10 - _toolTip.Width, 65 + 25); _toolTip.Visible = true; } else if (new Rectangle(Width - 62 - 62, 10, 52, 52).Contains(PointToClient(Cursor.Position))) { _toolTip.Text = "切换加载模式"; _toolTip.Location = new Point(Width - 62 - 62 - _toolTip.Width, 62 - _toolTip.Height); _toolTip.Visible = true; } else if (new Rectangle(Width - 384, 10, 26, 26).Contains(PointToClient(Cursor.Position))) { _toolTip.Text = "区域搜索"; _toolTip.Location = new Point(Width - 384, 36 + 10); _toolTip.Visible = true; } else if (new Rectangle(Width - 384 + 26 * 1, 10, 26, 26).Contains(PointToClient(Cursor.Position))) { _toolTip.Text = "距离测量"; _toolTip.Location = new Point(Width - 384 + 26 * 1, 36 + 10); _toolTip.Visible = true; } else if (new Rectangle(Width - 384 + 26 * 2, 10, 26, 26).Contains(PointToClient(Cursor.Position))) { _toolTip.Text = "截图"; _toolTip.Location = new Point(Width - 384 + 26 * 2, 36 + 10); _toolTip.Visible = true; } else if (new Rectangle(Width - 384 + 26 * 3, 10, 26, 26).Contains(PointToClient(Cursor.Position))) { _toolTip.Text = "标记"; _toolTip.Location = new Point(Width - 384 + 26 * 3, 36 + 10); _toolTip.Visible = true; } else if (new Rectangle(Width - 384 + 26 * 4, 10, 26, 26).Contains(PointToClient(Cursor.Position))) { _toolTip.Text = "绘制矩形"; _toolTip.Location = new Point(Width - 384 + 26 * 4, 36 + 10); _toolTip.Visible = true; } else if (new Rectangle(Width - 384 + 26 * 5, 10, 26, 26).Contains(PointToClient(Cursor.Position))) { _toolTip.Text = "绘制椭圆"; _toolTip.Location = new Point(Width - 384 + 26 * 5, 36 + 10); _toolTip.Visible = true; } else if (new Rectangle(Width - 384 + 26 * 6, 10, 26, 26).Contains(PointToClient(Cursor.Position))) { _toolTip.Text = "绘制直线"; _toolTip.Location = new Point(Width - 384 + 26 * 6, 36 + 10); _toolTip.Visible = true; } else if (new Rectangle(Width - 384 + 26 * 7, 10, 26, 26).Contains(PointToClient(Cursor.Position))) { _toolTip.Text = "绘制多边形"; _toolTip.Location = new Point(Width - 384 + 26 * 7, 36 + 10); _toolTip.Visible = true; } else if (new Rectangle(Width - 384 + 26 * 8, 10, 26, 26).Contains(PointToClient(Cursor.Position))) { _toolTip.Text = "鼠标定位"; _toolTip.Location = new Point(Width - 384 + 26 * 8, 36 + 10); _toolTip.Visible = true; } else { _toolTip.Visible = false; } //鼠标形状 if (new Rectangle(Width - 384, 10, 234, 26).Contains(e.Location) || new Rectangle(Width - 124, 10, 52, 52).Contains(e.Location) || new Rectangle(Width - 62, 10, 52, 52).Contains(e.Location)) { Cursor = Cursors.Hand; return; } else { Cursor = _current_cursor_cache; } if (_mouse_type == MouseType.None) // 鼠标无任何工作 { bool flag = false; foreach (KeyValuePair p in _pois) //POI信息点 { if (p.Value.Rect.Contains(e.Location)) { flag = true; break; } } foreach (KeyValuePair p in _markers) //标记点 { if(p.Value.Rect.Contains(e.Location)) { flag = true; break; } } if((_theStrangePoint != null && _theStrangePoint.Rect.Contains(e.Location)) || (_theRouteEnd != null && _theRouteEnd.Rect.Contains(e.Location)) || (_theRouteStart != null && _theRouteStart.Rect.Contains(e.Location))) // { flag = true; } if (flag) { Cursor = Cursors.Hand; } else { Cursor = _current_cursor_cache; } } else if (_mouse_type == MouseType.DragMap) //拖拽地图 { int deltax = e.Location.X - _previous_point_cache.X; int deltay = e.Location.Y - _previous_point_cache.Y; LatLngPoint llp = MapHelper.GetLatLngByScreenLocation(new Point(ClientSize.Width/2 - deltax, ClientSize.Height/2 - deltay), _center, _zoom, ClientSize); Center = llp; _previous_point_cache = e.Location; Locate(false); SyncControlsLocation(); } else if (_mouse_type == MouseType.DragScreenshotArea) { int deltax = e.Location.X - _previous_point_cache.X; int deltay = e.Location.Y - _previous_point_cache.Y; BScreenShotRectangle r = _current_drawing as BScreenShotRectangle; if (r != null) { r.LeftTop = new Point(r.LeftTop.X + deltax, r.LeftTop.Y + deltay); _previous_point_cache = e.Location; _bScreenshotMenu.Location = new Point(r.LeftTop.X + r.Width - _bScreenshotMenu.Width, r.LeftTop.Y + r.Height + 4); } } else if (_mouse_type == MouseType.DrawCircle && _current_drawing as BCircle != null) //绘制椭圆 { (_current_drawing as BCircle).RightBottom = MapHelper.GetLatLngByScreenLocation(e.Location, _center, _zoom, ClientSize); } else if (_mouse_type == MouseType.DrawRectange && _current_drawing as BRectangle != null) //绘制矩形 { (_current_drawing as BRectangle).RightBottom = MapHelper.GetLatLngByScreenLocation(e.Location, _center, _zoom, ClientSize); } else if (_mouse_type == MouseType.DrawLine && _current_drawing as BLine != null) //绘制线条 { (_current_drawing as BLine).UpdateTheEnd(MapHelper.GetLatLngByScreenLocation(e.Location, _center, _zoom, ClientSize)); } else if (_mouse_type == MouseType.DrawPolygon && _current_drawing as BPolygon != null) //绘制多边形 { (_current_drawing as BPolygon).UpdateTheEnd(MapHelper.GetLatLngByScreenLocation(e.Location, _center, _zoom, ClientSize)); } else if (_mouse_type == MouseType.DrawScreenshotArea && _current_drawing as BScreenShotRectangle != null) //绘制截图矩形 { (_current_drawing as BScreenShotRectangle).Width = e.Location.X - (_current_drawing as BScreenShotRectangle).LeftTop.X; (_current_drawing as BScreenShotRectangle).Height = e.Location.Y - (_current_drawing as BScreenShotRectangle).LeftTop.Y; } else if (_mouse_type == MouseType.DrawBound && _b_bound != null) //矩形搜索区域 { _b_bound.RightBottom = MapHelper.GetLatLngByScreenLocation(e.Location, _center, _zoom, ClientSize); } else if (_mouse_type == MouseType.DrawDistance && _b_distance != null) //距离测量 { _b_distance.UpdateTheEnd(MapHelper.GetLatLngByScreenLocation(e.Location, _center, _zoom, ClientSize)); } Invalidate(); } /// /// 鼠标在地图上弹起 /// /// protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); if (_mouse_type == MouseType.DragMap) //拖动地图 鼠标弹起 { _mouse_type = MouseType.None; _current_cursor_cache = Cursor = Cursors.Arrow; } else if (_mouse_type == MouseType.DragScreenshotArea) //拖拽截图矩形 { _mouse_type = MouseType.None; _current_cursor_cache = Cursor = Cursors.Arrow; } else if (_mouse_type == MouseType.DrawCircle && _current_drawing as BCircle != null) //绘制椭圆鼠标弹起 { _mouse_type = MouseType.None; _current_cursor_cache = Cursor = Cursors.Arrow; _drawingObjects.Add(_drawingObjects.Count + 1, _current_drawing); _current_drawing = null; } else if (_mouse_type == MouseType.DrawRectange && _current_drawing as BRectangle != null) //绘制矩形鼠标弹起 { _mouse_type = MouseType.None; _current_cursor_cache = Cursor = Cursors.Arrow; _drawingObjects.Add(_drawingObjects.Count + 1, _current_drawing); _current_drawing = null; } else if (_mouse_type == MouseType.DrawScreenshotArea && _current_drawing as BScreenShotRectangle != null) //绘制截图矩形鼠标弹起 { _current_cursor_cache = Cursor = Cursors.Arrow; _mouse_type = MouseType.None; BScreenShotRectangle r = _current_drawing as BScreenShotRectangle; _bScreenshotMenu.Location = new Point(r.LeftTop.X + r.Width - _bScreenshotMenu.Width, r.LeftTop.Y + r.Height + 4); _bScreenshotMenu.Visible = true; } else if (_mouse_type == MouseType.DrawBound && _b_bound != null) //矩形搜索 { _current_cursor_cache = Cursor = Cursors.Arrow; _mouse_type = MouseType.None; Point p1 = MapHelper.GetScreenLocationByLatLng(_b_bound.LeftTop, _center, _zoom, ClientSize); Point p2 = MapHelper.GetScreenLocationByLatLng(_b_bound.RightBottom, _center, _zoom, ClientSize); Point p = p1.Y > p2.Y ? p1 : p2; _bQuickSearchControl.Location = new Point(p.X - _bQuickSearchControl.Width, p.Y + 2); _bQuickSearchControl.Visible = true; } else if (_mouse_type == MouseType.DrawMarker) //添加标记点 { if (_current_selected_marker != null) { _mouse_type = MouseType.None; } } Invalidate(); } /// /// 鼠标滚轮在地图上滚动 /// /// protected override void OnMouseWheel(MouseEventArgs e) { base.OnMouseWheel(e); //缩放 int z = _zoom + e.Delta / 100; if (z >= 3 && z <= 19) { LatLngPoint p = MapHelper.GetLatLngByScreenLocation(e.Location, _center, _zoom, ClientSize); //鼠标经纬度坐标 PointF pt = MapHelper.GetLocationByLatLng(p, z); //鼠标像素坐标 PointF pt_center = new PointF(pt.X + (ClientSize.Width/2 - e.Location.X), pt.Y + (e.Location.Y - ClientSize.Height / 2)); //缩放后中心点像素坐标 LatLngPoint p_center = MapHelper.GetLatLngByLocation(pt_center, z); //像素坐标到经纬度坐标 Center = p_center; Zoom = z; Locate(false); SyncControlsLocation(); } } /// /// 鼠标离开地图控件区域 /// /// protected override void OnMouseLeave(EventArgs e) { base.OnMouseLeave(e); Invalidate(); } /// /// 地图大小发生变化 /// /// protected override void OnResize(EventArgs e) { base.OnResize(e); SyncControlsLocation(); Invalidate(); } /// /// 鼠标停留 /// /// protected override void OnMouseHover(EventArgs e) { base.OnMouseHover(e); } /// /// 鼠标双击 /// /// protected override void OnMouseDoubleClick(MouseEventArgs e) { base.OnMouseDoubleClick(e); if (_mouse_type == MouseType.DrawLine) //绘制线条结束 { _mouse_type = MouseType.None; _current_cursor_cache = Cursor = Cursors.Arrow; _drawingObjects.Add(_drawingObjects.Count + 1, _current_drawing); _current_drawing = null; } else if (_mouse_type == MouseType.DrawPolygon) //绘制多边形结束 { _mouse_type = MouseType.None; _current_cursor_cache = Cursor = Cursors.Arrow; _drawingObjects.Add(_drawingObjects.Count + 1, _current_drawing); _current_drawing = null; } else if (_mouse_type == MouseType.DrawDistance) //测量距离 { _mouse_type = MouseType.None; _current_cursor_cache = Cursor = Cursors.Arrow; } Invalidate(); } #endregion #region 功能方法 /// /// 初始化 /// private void Init() { if (!DesignMode) { //定位自己 Locate(true); //初始化功能控件 //城市切换控件 _bCityControl.Size = new Size(560, 400); _bCityControl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; Controls.Add(_bCityControl); _bCityControl.Visible = false; _bCityControl.SelectedCityChanged += new SelectedCityChangedEventHandler(_bCityControl_SelectedCityChanged); //显示路网控件 _chkShowRoadNet.Text = "道路网"; _chkShowRoadNet.Visible = false; Controls.Add(_chkShowRoadNet); _chkShowRoadNet.CheckedChanged += new EventHandler(_chkShowRoadNet_CheckedChanged); _chkShowRoadNet.Anchor = AnchorStyles.Right | AnchorStyles.Top; _chkShowRoadNet.BackColor = Color.White; //地图加载模式控件 _bLoadMapModeControl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; _bLoadMapModeControl.Visible = false; Controls.Add(_bLoadMapModeControl); _bLoadMapModeControl.LoadMapModeChanged += new LoadMapModeChangedEventHandler(_bLoadMapModeControl_LoadMapModeChanged); _bLoadMapModeControl.Anchor = AnchorStyles.Top | AnchorStyles.Right; _bLoadMapModeControl.BackColor = Color.White; //信息提示 _toolTip.BackColor = Color.White; _toolTip.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; _toolTip.Visible = false; _toolTip.TextAlign = ContentAlignment.MiddleLeft; _toolTip.AutoSize = true; _toolTip.Font = new System.Drawing.Font("微软雅黑", 9); _toolTip.Padding = new System.Windows.Forms.Padding(1); Controls.Add(_toolTip); _toolTip.BringToFront(); //截图菜单 _bScreenshotMenu.Visible = false; Controls.Add(_bScreenshotMenu); _bScreenshotMenu.ScreenshotDone += new ScreenshotDoneEventHandler(_bScreenshotMenu_ScreenshotDone); _bScreenshotMenu.BringToFront(); //快速搜索控件 _bQuickSearchControl.Visible = false; Controls.Add(_bQuickSearchControl); _bQuickSearchControl.QuickSearch += new QuickSearchEventHandler(_bQuickSearchControl_QuickSearch); _bQuickSearchControl.VisibleChanged += new EventHandler(_bQuickSearchControl_VisibleChanged); _bQuickSearchControl.BringToFront(); //标记点信息显示控件 _bMarkerTipControl.Visible = false; Controls.Add(_bMarkerTipControl); _bMarkerEditorControl.VisibleChanged += new EventHandler(_bMarkerEditorControl_VisibleChanged); _bMarkerTipControl.SearchNearbyStarted += new SearchNearbyStartedEventHandler(_bTipControl_SearchNearbyStarted); _bMarkerTipControl.DirecttionStarted += new DirectionStartedEventHandler(_bTipControl_DirecttionStarted); //标记点信息编辑控件 _bMarkerEditorControl.Visible = false; Controls.Add(_bMarkerEditorControl); _bMarkerTipControl.VisibleChanged += new EventHandler(_bMarkerTipControl_VisibleChanged); //POI信息显示控件 _bPOITipControl.Visible = false; Controls.Add(_bPOITipControl); _bPOITipControl.VisibleChanged+=new EventHandler(_bPOITipControl_VisibleChanged); _bPOITipControl.SearchNearbyStarted+=new SearchNearbyStartedEventHandler(_bTipControl_SearchNearbyStarted); _bPOITipControl.DirecttionStarted+=new DirectionStartedEventHandler(_bTipControl_DirecttionStarted); //位置点BPoint信息显示控件 _bPointTipControl.Visible = false; Controls.Add(_bPointTipControl); _bPointTipControl.VisibleChanged += new EventHandler(_bPointTipControl_VisibleChanged); _bPointTipControl.SearchNearbyStarted+=new SearchNearbyStartedEventHandler(_bTipControl_SearchNearbyStarted); _bPointTipControl.DirecttionStarted+=new DirectionStartedEventHandler(_bTipControl_DirecttionStarted); } } /// /// 定位 /// /// 为true表示定位自己 否则定位当前地图中的城市 private void Locate(bool mylocation) { //定位位置 ((Action)(delegate() { if (mylocation) //定位自己 { IPService ips = new IPService(); JObject _location = ips.LocationByIP(); if (_location != null && _location["content"] != null) { _currentCity = (string)(_location["content"]["address_detail"]["city"]); //返回JSON结构请参见百度API文档 _center = new LatLngPoint(double.Parse((string)_location["content"]["point"]["x"]), double.Parse((string)_location["content"]["point"]["y"])); } } else //定位地图中心点 { GeocodingService gs = new GeocodingService(); JObject _location = gs.DeGeocoding(_center.Lat + "," + _center.Lng); if (_location != null) { if (_location["result"] != null && _location["result"]["addressComponent"] != null) { if (_zoom <= 8) //定位到国家 { _currentCity = (string)(_location["result"]["addressComponent"]["country"]); //返回JSON结构请参见百度API文档 } else if (_zoom <= 10) //定位到省份 { _currentCity = (string)(_location["result"]["addressComponent"]["province"]); //返回JSON结构请参见百度API文档 } else if (_zoom <= 18) //定位到城市 { if (_location["result"]["addressComponent"]["city"] != null) _currentCity = (string)(_location["result"]["addressComponent"]["city"]); //返回JSON结构请参见百度API文档 } //else //定位到县区 //{ // if (_location["result"]["addressComponent"]["district"] != null) // _currentCity = (string)(_location["result"]["addressComponent"]["district"]); //返回JSON结构请参见百度API文档 //} } } } this.Invoke((Action)delegate() { Invalidate(); if (BPlaceBox != null) //关联的位置输入控件 { BPlaceBox.CurrentCity = _currentCity; } if (BPlacesBoard != null) //关联的位置列表控件 { BPlacesBoard.CurrentCity = _currentCity; } if (BDirectionBoard != null) //关联的导航控件 { BDirectionBoard.CurrentCity = _currentCity; } _bMarkerTipControl.CurrentCity = _currentCity; _bPOITipControl.CurrentCity = _currentCity; _bPointTipControl.CurrentCity = _currentCity; }); })).BeginInvoke(null, null); } /// /// 初始化瓦片 /// private void InitializeTiles() { PointF center = MapHelper.GetLocationByLatLng(_center, _zoom); //中心点像素坐标 PointF left_down = new PointF(center.X - ClientSize.Width / 2, center.Y - ClientSize.Height / 2); //左下角像素坐标 PointF right_up = new PointF(center.X + ClientSize.Width / 2, center.Y + ClientSize.Height / 2); //右上角像素坐标 int tile_left_down_x = (int)Math.Floor((left_down.X) / 256); //左下角瓦片X坐标 int tile_left_down_y = (int)Math.Floor((left_down.Y) / 256); //左下角瓦片Y坐标 int tile_right_up_x = (int)Math.Floor((right_up.X) / 256); //右上角瓦片X坐标 int tile_right_up_y = (int)Math.Floor((right_up.Y) / 256); //右上角瓦片Y坐标 for (int i = tile_left_down_x; i <= tile_right_up_x; ++i) { for (int j = tile_left_down_y; j <= tile_right_up_y; ++j) { if (!_tiles.ContainsKey(_zoom + "_" + i + "_" + j)) { _tiles.Add(_zoom + "_" + i + "_" + j, new BTile(i, j, _zoom, this, _mode, _loadmode)); } } } } /// /// 同步控件位置 /// private void SyncControlsLocation() { if (_bQuickSearchControl.Visible && _b_bound != null) //同步位置 { Point p1 = MapHelper.GetScreenLocationByLatLng(_b_bound.LeftTop, _center, _zoom, ClientSize); Point p2 = MapHelper.GetScreenLocationByLatLng(_b_bound.RightBottom, _center, _zoom, ClientSize); Point p = p1.Y > p2.Y ? p1 : p2; _bQuickSearchControl.Location = new Point(p.X - _bQuickSearchControl.Width, p.Y + 2); } if (_bMarkerEditorControl.Visible && _current_selected_marker != null)//同步位置 { Point p = MapHelper.GetScreenLocationByLatLng(_current_selected_marker.Location, _center, _zoom, ClientSize); _bMarkerEditorControl.Location = new Point(p.X - _bMarkerEditorControl.Width / 3 + 37, p.Y - _bMarkerEditorControl.Height - 22); } if (_bMarkerTipControl.Visible && _current_selected_marker != null) //同步位置 { Point p = MapHelper.GetScreenLocationByLatLng(_current_selected_marker.Location, _center, _zoom, ClientSize); _bMarkerTipControl.Location = new Point(p.X - _bMarkerTipControl.Width / 3 + 37, p.Y - _bMarkerTipControl.Height - _current_selected_marker.Rect.Height); } if (_bPOITipControl.Visible && _current_selected_poi != null) //同步位置 { Point p = MapHelper.GetScreenLocationByLatLng(_current_selected_poi.Location, _center, _zoom, ClientSize); _bPOITipControl.Location = new Point(p.X - _bPOITipControl.Width / 3 + 37, p.Y - _bPOITipControl.Height - _current_selected_poi.Rect.Height); } if (_bPointTipControl.Visible && _current_selected_point != null) //同步设置 { Point p = MapHelper.GetScreenLocationByLatLng(_current_selected_point.Location, _center, _zoom, ClientSize); _bPointTipControl.Location = new Point(p.X - _bPointTipControl.Width / 3 + 37, p.Y - _bPointTipControl.Height - _current_selected_point.Rect.Height); } } /// /// 绘制瓦片 /// /// private void DrawTiles(Graphics g) { InitializeTiles(); foreach (KeyValuePair p in _tiles) { if (p.Key.StartsWith(_zoom.ToString())) { p.Value.Draw(g, _center, _zoom, this.ClientSize); } } } /// /// 绘制地图左下角的一些附加信息 如当前坐标、地图级别、logo、版权等 /// /// private void DrawMapInfo(Graphics g) { using (GraphicsPath gp = MapHelper.CreateRoundedRectanglePath(new Rectangle(10, Height - 100, 250, 90),6)) { using (SolidBrush sb = new SolidBrush(Color.FromArgb(180, Color.White))) { g.FillPath(sb, gp); g.DrawPath(Pens.Black, gp); using (Font f = new Font("微软雅黑", 11)) { g.DrawString(MapHelper.GetMapModeTitle(_mode) + "," + _zoom + "级," + MapHelper.GetLoadMapModeTitle(_loadmode), f, Brushes.Teal, new PointF(20, Height - 100 + 10)); Point p = PointToClient(Cursor.Position); if (ClientRectangle.Contains(p)) { LatLngPoint llp = MapHelper.GetLatLngByScreenLocation(p, _center, _zoom, ClientSize); //当前鼠标经纬度 g.DrawString(Math.Round(llp.Lat,5) + "," + Math.Round(llp.Lng,5), f, Brushes.Teal, new PointF(20, Height - 100 + 35)); } g.DrawString("BMap.NET 2015 by 周见智", f, Brushes.Teal, new PointF(20, Height - 100 + 60)); } } } } /// /// 绘制左上角当前城市 /// /// private void DrawCurrentCity(Graphics g) { g.FillRectangle(Brushes.White, new Rectangle(10, 10, 90, 25)); g.DrawRectangle(Pens.DarkGray, new Rectangle(10, 10, 90, 25)); using (Font f = new Font("微软雅黑", 9)) { string info = _currentCity; if (_currentCity == "") { info = "定位失败"; } g.DrawString(info.Length <= 4 ? info : info.Substring(0, 4), f, Brushes.DarkGray, new PointF(20, 15)); } if (!_bCityControl.Visible) //城市切换窗体关闭 { g.FillPolygon(Brushes.Gray, new Point[] { new Point(74, 19), new Point(88, 19), new Point(81, 26) }); } else { g.FillPolygon(Brushes.Gray, new Point[] { new Point(74, 26), new Point(88, 26), new Point(81, 19) }); } } /// /// 绘制右上角工具栏 /// /// private void DrawToolsBar(Graphics g) { //工具 //g.FillRectangle(Brushes.White, new Rectangle(Width - 384, 10, 234, 26)); using (SolidBrush sb = new SolidBrush(Color.FromArgb(120, Color.Black))) { g.DrawImage(Properties.BMap.ico_search_in_bound, new Rectangle(Width - 384, 10, 26, 26)); //矩形区域搜索 if (_mouse_type == MouseType.DrawBound) { g.FillRectangle(sb, new Rectangle(Width - 384, 10, 26, 26)); } g.DrawImage(Properties.BMap.ico_distance, new Rectangle(Width - 384 + 26, 10, 26, 26)); //测量距离 if (_mouse_type == MouseType.DrawDistance) { g.FillRectangle(sb, new Rectangle(Width - 384 + 26 * 1, 10, 26, 26)); } g.DrawImage(Properties.BMap.ico_screenshot, new Rectangle(Width - 384 + 26 * 2, 10, 26, 26)); //截图 if (_mouse_type == MouseType.DrawScreenshotArea) { g.FillRectangle(sb, new Rectangle(Width - 384 + 26 * 2, 10, 26, 26)); } g.DrawImage(Properties.BMap.ico_setmarker, new Rectangle(Width - 384 + 26 * 3, 10, 26, 26)); //添加标记 if (_mouse_type == MouseType.DrawMarker) { g.FillRectangle(sb, new Rectangle(Width - 384 + 26 * 3, 10, 26, 26)); } g.DrawImage(Properties.BMap.ico_rectangle, new Rectangle(Width - 384 + 26 * 4, 10, 26, 26)); //绘制矩形 if (_mouse_type == MouseType.DrawRectange) { g.FillRectangle(sb, new Rectangle(Width - 384 + 26 * 4, 10, 26, 26)); } g.DrawImage(Properties.BMap.ico_circle, new Rectangle(Width - 384 + 26 * 5, 10, 26, 26)); //绘制椭圆 if (_mouse_type == MouseType.DrawCircle) { g.FillRectangle(sb, new Rectangle(Width - 384 + 26 * 5, 10, 26, 26)); } g.DrawImage(Properties.BMap.ico_line, new Rectangle(Width - 384 + 26 * 6, 10, 26, 26)); //绘制直线 if (_mouse_type == MouseType.DrawLine) { g.FillRectangle(sb, new Rectangle(Width - 384 + 26 * 6, 10, 26, 26)); } g.DrawImage(Properties.BMap.ico_polygon, new Rectangle(Width - 384 + 26 * 7, 10, 26, 26)); //绘制多边形 if (_mouse_type == MouseType.DrawPolygon) { g.FillRectangle(sb, new Rectangle(Width - 384 + 26 * 7, 10, 26, 26)); } g.DrawImage(Properties.BMap.ico_cursor_locate, new Rectangle(Width - 384 + 26 * 8, 10, 26, 26));//鼠标定位效果 if (_cursor_located) { g.FillRectangle(sb, new Rectangle(Width - 384 + 26 * 8, 10, 26, 26)); } } g.DrawRectangle(Pens.DarkGray, new Rectangle(Width - 384, 10, 234, 26)); for (int i = 0; i < 8; ++i) { g.DrawLine(Pens.LightGray, new Point(Width - 384 + (i + 1) * 26, 10), new Point(Width - 384 + (i + 1) * 26, 10 + 26)); } //地图加载模式 Image mode_image = ((Func)((LoadMapMode m) => //临时调用匿名方法 { if (_loadmode == LoadMapMode.Cache) { return Properties.BMap.ico_cache; } if (_loadmode == LoadMapMode.CacheServer) { return Properties.BMap.ico_cachefirst; } if (_loadmode == LoadMapMode.Server) { return Properties.BMap.ico_server; } return null; }))(_loadmode); g.DrawImage(mode_image, new Rectangle(Width - 124, 10, 52, 52)); using (SolidBrush sb = new SolidBrush(Color.FromArgb(180, Color.White))) { g.FillRectangle(sb, new Rectangle(Width - 124, 10 + 30, 52, 22)); } using (Font f = new System.Drawing.Font("微软雅黑", 8)) { g.DrawString(MapHelper.GetLoadMapModeTitle(_loadmode), f, Brushes.Black, new PointF(Width - 124 + 3, 10 + 30 + 5)); } g.DrawRectangle(Pens.DarkGray, new Rectangle(Width - 124, 10, 52, 52)); //地图模式 g.DrawImage(_mode == MapMode.Normal ? Properties.BMap.ico_sateshot : Properties.BMap.ico_mapshot, new Rectangle(Width - 62, 10, 52, 52)); using (SolidBrush sb = new SolidBrush(Color.FromArgb(180, Color.White))) { g.FillRectangle(sb, new Rectangle(Width - 62, 10 + 30, 52, 22)); } using (Font f = new Font("微软雅黑", 9)) { g.DrawString(_mode == MapMode.Normal ? "卫星" : "地图", f, Brushes.Black, new PointF(Width - 62 + 12, 10 + 30 + 4)); } g.DrawRectangle(Pens.DarkGray, new Rectangle(Width - 62, 10, 52, 52)); } /// /// 绘制鼠标效果 /// /// private void DrawCursor(Graphics g) { Point p = PointToClient(Cursor.Position); if (ClientRectangle.Contains(p)) { if (_cursor_located) //鼠标定位效果 { using (Pen pen = new Pen(Color.FromArgb(200, _mode == MapMode.Normal ? Color.Blue : Color.White), 2)) { pen.DashStyle = DashStyle.Dash; g.DrawLine(pen, new Point(0, p.Y), new Point(ClientSize.Width, p.Y)); g.DrawLine(pen, new Point(p.X, 0), new Point(p.X, ClientSize.Height)); } } if (_mouse_type == MouseType.DrawMarker) //鼠标绘制标记效果 { Bitmap b = Properties.BMap.ico_marker; g.DrawImage(b, new Rectangle(p.X - b.Width / 2, p.Y - b.Height, b.Width, b.Height)); } } } /// /// 绘制图形 /// /// private void DrawDrawingObjects(Graphics g) { if (_current_drawing != null) { _current_drawing.Draw(g, _center, _zoom, ClientSize); } foreach (KeyValuePair p in _drawingObjects) { p.Value.Draw(g, _center, _zoom, ClientSize); } } /// /// 绘制地图元素 /// /// private void DrawMapElements(Graphics g) { if (_b_route != null) //导航路线 { _b_route.Draw(g, _center, _zoom, ClientSize); } if (_b_bound != null) //矩形搜索区域 { _b_bound.Draw(g, _center, _zoom, ClientSize); } if(_b_distance != null) //距离测量 { _b_distance.Draw(g, _center, _zoom, ClientSize); } foreach(KeyValuePair p in _pois) //信息点 { p.Value.Draw(g, _center, _zoom, ClientSize); } foreach (KeyValuePair p in _markers) //标记点 { p.Value.Draw(g, _center, _zoom, ClientSize); } if (_theStrangePoint != null) { _theStrangePoint.Draw(g, _center, _zoom, ClientSize); } if (_theRouteStart != null) { _theRouteStart.Draw(g, _center, _zoom, ClientSize); } if(_theRouteEnd != null) { _theRouteEnd.Draw(g, _center, _zoom, ClientSize); } } #endregion #region 公开方法 /// /// 向地图中增加POI /// /// internal void AddPlaces(List places) { _pois.Clear(); _bPointTipControl.Visible = false; _bPOITipControl.Visible = false; _bMarkerEditorControl.Visible = false; _bMarkerTipControl.Visible = false; foreach (BPOI poi in places) { _pois.Add(poi.Index.ToString(), poi); } Invalidate(); } /// /// 清空地图中所有的POI /// internal void ClearPlaces() { _pois.Clear(); _bPointTipControl.Visible = false; _bPOITipControl.Visible = false; _bMarkerEditorControl.Visible = false; _bMarkerTipControl.Visible = false; Invalidate(); } /// /// 设置地图中路线起点、终点(可以设为null表示清空) /// /// /// internal void SetRouteStartAndEnd(BPoint start, BPoint end) { _theRouteStart = start; _theRouteEnd = end; Invalidate(); } /// /// 设置地图中的导航路线(可以设为null表示清空) /// /// internal void SetRoute(BRoute route) { _b_route = route; _bPointTipControl.Visible = false; _bPOITipControl.Visible = false; _bMarkerEditorControl.Visible = false; _bMarkerTipControl.Visible = false; if (_theRouteStart != null && _theRouteEnd != null) //定位到路线中心 { Center = new LatLngPoint((_theRouteEnd.Location.Lng + _theRouteStart.Location.Lng) / 2, (_theRouteStart.Location.Lat + _theRouteEnd.Location.Lat) / 2); Zoom = 13; Locate(false); SyncControlsLocation(); } Invalidate(); } /// /// 设置路线中高亮部分 /// /// /// internal void SetHighlightPath(string path, bool enlarge) { string[] points = path.Split(';'); if (_b_route != null) { _b_route.HighlightPath = path; if (enlarge) //放大定位 { LatLngPoint lp = new LatLngPoint(double.Parse(points[0].Split(',')[0]), double.Parse(points[0].Split(',')[1])); Center = lp; Zoom = 18; Locate(false); SyncControlsLocation(); } Invalidate(); } } /// /// 选中地图中的POI /// /// internal void SelectBPOI(BPOI poi) { foreach (KeyValuePair p in _pois) { if (p.Value == poi) { p.Value.Selected = true; _current_selected_poi = p.Value; //显示信息控件 Point point = MapHelper.GetScreenLocationByLatLng(p.Value.Location, _center, _zoom, ClientSize); _bPOITipControl.POI = _current_selected_poi; _bPOITipControl.Location = new Point(point.X - _bPOITipControl.Width / 3 + 35, point.Y - _bPOITipControl.Height - _current_selected_poi.Rect.Height); _bPOITipControl.Visible = true; //显示在屏幕区域 if (!ClientRectangle.Contains(new Rectangle(_bPOITipControl.Left, _bPOITipControl.Top, _bPOITipControl.Width, _bPOITipControl.Height))) { Center = p.Value.Location; Zoom = 13; Locate(false); SyncControlsLocation(); } } else { p.Value.Selected = false; } } Invalidate(); } /// /// 选中地图中的位置点 /// /// internal void SelectBPoint(BPoint bpoint) { if (_theRouteEnd == bpoint) { _theRouteEnd.Selected = true; // _current_selected_point = _theRouteEnd; Point point = MapHelper.GetScreenLocationByLatLng(_current_selected_point.Location, _center, _zoom, ClientSize); //信息显示控件 _bPointTipControl.BPoint = _current_selected_point; _bPointTipControl.Location = new Point(point.X - _bPointTipControl.Width / 3 + 35, point.Y - _bPointTipControl.Height - _current_selected_point.Rect.Height); _bPointTipControl.Visible = true; if (!ClientRectangle.Contains(new Rectangle(_bPointTipControl.Left, _bPointTipControl.Top, _bPointTipControl.Width, _bPointTipControl.Height))) { Center = _theRouteEnd.Location; Zoom = 15; Locate(false); SyncControlsLocation(); } } else if (_theRouteStart == bpoint) { _theRouteStart.Selected = true; // _current_selected_point = _theRouteStart; Point point = MapHelper.GetScreenLocationByLatLng(_current_selected_point.Location, _center, _zoom, ClientSize); //信息显示控件 _bPointTipControl.BPoint = _current_selected_point; _bPointTipControl.Location = new Point(point.X - _bPointTipControl.Width / 3 + 35, point.Y - _bPointTipControl.Height - _current_selected_point.Rect.Height); _bPointTipControl.Visible = true; if (!ClientRectangle.Contains(new Rectangle(_bPointTipControl.Left, _bPointTipControl.Top, _bPointTipControl.Width, _bPointTipControl.Height))) { Center = _theRouteStart.Location; Zoom = 15; Locate(false); SyncControlsLocation(); } } Invalidate(); } #endregion #region 事件处理方法 /// /// 城市切换 /// /// void _bCityControl_SelectedCityChanged(string cityName) { _bCityControl.Visible = false; _currentCity = cityName; if (BPlaceBox != null) //关联的位置输入框 { BPlaceBox.CurrentCity = cityName; } if (BPlacesBoard != null) //关联的位置列表控件 { BPlacesBoard.CurrentCity = cityName; } if (BDirectionBoard != null) //关联的导航控件 { BDirectionBoard.CurrentCity = _currentCity; } _bMarkerTipControl.CurrentCity = _currentCity; _bPOITipControl.CurrentCity = _currentCity; _bPointTipControl.CurrentCity = _currentCity; Invalidate(); ((Action)delegate() //定位到指定城市 { GeocodingService gs = new GeocodingService(); JObject city_location = gs.Geocoding(_currentCity); if (city_location != null && city_location["result"] != null) { Center = new LatLngPoint(double.Parse((string)city_location["result"]["location"]["lng"]), double.Parse((string)city_location["result"]["location"]["lat"])); Locate(false); } this.Invoke((Action)delegate() { Zoom = 12; Invalidate(); }); }).BeginInvoke(null, null); } /// /// 卫星图模式下是否显示路网 /// /// /// void _chkShowRoadNet_CheckedChanged(object sender, EventArgs e) { if (_mode != MapMode.Normal) { if (_chkShowRoadNet.Checked) { Mode = MapMode.Sate_RoadNet; } else { Mode = MapMode.Satellite; } } } /// /// 加载地图模式改变 /// /// void _bLoadMapModeControl_LoadMapModeChanged(LoadMapMode loadMode) { LoadMode = loadMode; } /// /// 截图完成 /// /// void _bScreenshotMenu_ScreenshotDone(bool saved) { if (saved) //保存 { using (SaveFileDialog sfd = new SaveFileDialog()) { sfd.Filter = "PNG文件(*.png)|*.png"; sfd.CheckPathExists = true; sfd.DefaultExt = ".png"; if (sfd.ShowDialog() == DialogResult.OK) { BScreenShotRectangle r = _current_drawing as BScreenShotRectangle; _current_drawing = null; _bScreenshotMenu.Visible = false; Bitmap b = new Bitmap(Width, Height); DrawToBitmap(b, new Rectangle(0, 0, Width, Height)); Bitmap image2save = new Bitmap(r.Width, r.Height); Graphics.FromImage(image2save).DrawImage(b, new Rectangle(0, 0, r.Width, r.Height), r.Rect, GraphicsUnit.Pixel); image2save.Save(sfd.FileName); } } } else { _current_drawing = null; _bScreenshotMenu.Visible = false; } } /// /// 矩形区域搜索 /// /// void _bQuickSearchControl_QuickSearch(string searchName) { LatLngPoint leftbottom = new LatLngPoint(_b_bound.LeftTop.Lng, _b_bound.RightBottom.Lat); LatLngPoint righttop = new LatLngPoint(_b_bound.RightBottom.Lng, _b_bound.LeftTop.Lat); ((Action)delegate() { PlaceService ps = new PlaceService(); JObject places = ps.SearchInBound(searchName, leftbottom.Lat + "," + leftbottom.Lng + "," + righttop.Lat + "," + righttop.Lng);//区域搜索 this.Invoke((Action)delegate() { if (BPlacesBoard != null) { BPlacesBoard.AddPlaces(places["results"]); //具体json格式参见api文档 } }); }).BeginInvoke(null, null); _bQuickSearchControl.Visible = false; } /// /// 矩形搜索框关闭 /// /// /// void _bQuickSearchControl_VisibleChanged(object sender, EventArgs e) { if (!_bQuickSearchControl.Visible) { _b_bound = null; } } /// /// 右键菜单 /// /// /// private void cm_popup_Click(object sender, EventArgs e) { ToolStripMenuItem item = sender as ToolStripMenuItem; if(item.Name == "cmsWhere") //这是哪里 { LatLngPoint location = MapHelper.GetLatLngByScreenLocation(_right_mouse_point_cache, _center, _zoom, ClientSize); ((Action)delegate() { GeocodingService gs = new GeocodingService(); JObject point = gs.DeGeocoding(location.Lat + "," + location.Lng); if (point != null) //具体json格式参见api文档 { this.Invoke((Action)delegate() { _current_selected_point = _theStrangePoint = new BPoint { Type = PointType.Strange, Selected = true, Address = (string)point["result"]["formatted_address"], Location = location }; _bPointTipControl.BPoint = _theStrangePoint; _bPointTipControl.Location = new Point(_right_mouse_point_cache.X - _bPointTipControl.Width / 3 + 37, _right_mouse_point_cache.Y - _bPointTipControl.Height - 34); _bPointTipControl.Visible = true; }); } }).BeginInvoke(null, null); } else if (item.Name == "cmsSetStart") //设为起点 { LatLngPoint location = MapHelper.GetLatLngByScreenLocation(_right_mouse_point_cache, _center, _zoom, ClientSize); ((Action)delegate() { GeocodingService gs = new GeocodingService(); JObject point = gs.DeGeocoding(location.Lat + "," + location.Lng); if (point != null) //具体json格式参见api文档 { this.Invoke((Action)delegate() { _current_selected_point = _theRouteStart = new BPoint { Type = PointType.RouteStart, Selected = true, Address = (string)point["result"]["formatted_address"], Location = location }; _bPointTipControl.BPoint = _theRouteStart; _bPointTipControl.Location = new Point(_right_mouse_point_cache.X - _bPointTipControl.Width / 3 + 37, _right_mouse_point_cache.Y - _bPointTipControl.Height - 34); _bPointTipControl.Visible = true; BDirectionBoard.SourcePlace = _theRouteStart.Address; }); } }).BeginInvoke(null, null); } else if (item.Name == "cmsSetEnd") //设为终点 { LatLngPoint location = MapHelper.GetLatLngByScreenLocation(_right_mouse_point_cache, _center, _zoom, ClientSize); ((Action)delegate() { GeocodingService gs = new GeocodingService(); JObject point = gs.DeGeocoding(location.Lat + "," + location.Lng); if (point != null) //具体json格式参见api文档 { this.Invoke((Action)delegate() { _current_selected_point = _theRouteEnd = new BPoint { Type = PointType.RouteEnd, Selected = true, Address = (string)point["result"]["formatted_address"], Location = location }; _bPointTipControl.BPoint = _theRouteEnd; _bPointTipControl.Location = new Point(_right_mouse_point_cache.X - _bPointTipControl.Width / 3 + 37, _right_mouse_point_cache.Y - _bPointTipControl.Height - 34); _bPointTipControl.Visible = true; BDirectionBoard.DestinationPlace = _theRouteEnd.Address; }); } }).BeginInvoke(null, null); } else if (item.Name == "cmsCenter") //居中 { LatLngPoint lp = MapHelper.GetLatLngByScreenLocation(PointToClient(Cursor.Position), _center, _zoom, ClientSize); Center = lp; Locate(false); SyncControlsLocation(); } else if (item.Name == "cmsLarge") //放大 { int z = _zoom + 1; if (z >= 3 && z <= 19) { Zoom = z; Locate(false); SyncControlsLocation(); } } else if (item.Name == "cmsSmall") //缩小 { int z = _zoom - 1; if (z >= 3 && z <= 19) { Zoom = z; Locate(false); SyncControlsLocation(); } } else if (item.Name == "cmsClearDrawings") //清空绘图 { _drawingObjects.Clear(); } else if (item.Name == "cmsClearMarkers") //清空标记 { _markers.Clear(); } else if (item.Name == "cmsRegionSaveAs") //可视区域另存为 { using (SaveFileDialog sf = new SaveFileDialog()) { sf.CheckPathExists = true; sf.Filter = "PNG文件(*.png)|*.png"; sf.DefaultExt = ".png"; if (sf.ShowDialog() == DialogResult.OK) { Bitmap b = new Bitmap(Width, Height); this.DrawToBitmap(b, ClientRectangle); b.Save(sf.FileName); } } } Invalidate(); } /// /// 标记编辑控件关闭 /// /// /// void _bMarkerEditorControl_VisibleChanged(object sender, EventArgs e) { if (!_bMarkerEditorControl.Visible) { if (_bMarkerEditorControl.Saved) //已点击保存 { Point p = MapHelper.GetScreenLocationByLatLng(_current_selected_marker.Location, _center, _zoom, ClientSize); _bMarkerTipControl.Edited = false; _bMarkerTipControl.Deleted = false; _bMarkerTipControl.Marker = _current_selected_marker; _bMarkerTipControl.Location = new Point(p.X - _bMarkerTipControl.Width / 3 + 37, p.Y - _bMarkerTipControl.Height - _current_selected_marker.Rect.Height); _bMarkerTipControl.Visible = true; } else { _current_selected_marker = null; } } } /// /// POI信息显示控件关闭 /// /// /// void _bPOITipControl_VisibleChanged(object sender, EventArgs e) { if (!_bPOITipControl.Visible) { _current_selected_poi = null; //取消选择 } } /// /// 位置点信息显示控件关闭 /// /// /// void _bPointTipControl_VisibleChanged(object sender, EventArgs e) { if (!_bPointTipControl.Visible) { _current_selected_point = _theStrangePoint = null; } } /// /// 标记信息显示控件关闭 /// /// /// void _bMarkerTipControl_VisibleChanged(object sender, EventArgs e) { if (!_bMarkerTipControl.Visible) { if (_bMarkerTipControl.Deleted) //已点击删除 { _markers.Remove(_current_selected_marker.Index.ToString()); _current_selected_marker = null; } else if (_bMarkerTipControl.Edited) //已点击编辑 { Point p = MapHelper.GetScreenLocationByLatLng(_current_selected_marker.Location, _center, _zoom, ClientSize); _bMarkerEditorControl.Saved = false; _bMarkerEditorControl.Marker = _current_selected_marker; _bMarkerEditorControl.Location = new Point(p.X - _bMarkerEditorControl.Width / 3 + 37, p.Y - _bMarkerEditorControl.Height - _current_selected_marker.Rect.Height); _bMarkerEditorControl.Visible = true; } else { _current_selected_marker = null; } } } /// /// 导航开始 /// /// /// /// void _bTipControl_DirecttionStarted(string source, string destination, RouteType type) { if (BDirectionBoard != null) { BDirectionBoard.SourcePlace = source; BDirectionBoard.DestinationPlace = destination; } } /// /// 周边搜索 /// /// /// void _bTipControl_SearchNearbyStarted(string query, LatLngPoint center) { ((Action)delegate() { PlaceService ps = new PlaceService(); JObject places = ps.SearchInCircle(query, center.Lat + "," + center.Lng, 5000); //默认周边5km this.Invoke((Action)delegate() { if (BPlacesBoard != null) { BPlacesBoard.AddPlaces(places["results"]); //具体json格式参见api文档 } }); }).BeginInvoke(null, null); } #endregion } /// /// 地图辅助类 /// public class MapHelper { public const double EARTH_RADIUS = 6378.137;//地球半径 private static double rad(double d) { return d * Math.PI / 180.0; } /// /// 根据经纬度计算两点实际距离(m) /// /// 第一个经纬度坐标点 /// 第二个经纬度坐标点 /// public static double GetDistanceByLatLng(LatLngPoint p1, LatLngPoint p2) { double radLat1 = rad(p1.Lat); double radLat2 = rad(p2.Lat); double a = radLat1 - radLat2; double b = rad(p1.Lng) - rad(p2.Lng); double s = 2 * Math.Asin(Math.Sqrt(Math.Pow(Math.Sin(a / 2), 2) + Math.Cos(radLat1) * Math.Cos(radLat2) * Math.Pow(Math.Sin(b / 2), 2))); s = s * EARTH_RADIUS; s = Math.Round(s * 10000) / 10000; return s; } /// /// 根据经纬度坐标计算该点在屏幕中的坐标 /// /// 要计算的经纬度 /// 屏幕中心经纬度 /// 地图当前缩放级别 /// 屏幕大小 /// public static Point GetScreenLocationByLatLng(LatLngPoint p, LatLngPoint center, int zoom, Size screen_size) { PointF dp = GetLocationByLatLng(p, zoom); //目标点的像素坐标 PointF cp = GetLocationByLatLng(center, zoom); //中心点的像素坐标 //计算目标点和中心点像素坐标差 double delta_x = dp.X - cp.X; double delta_y = dp.Y - cp.Y; //转换成屏幕坐标系统的坐标 并返回 return new Point((int)((float)screen_size.Width / 2 + delta_x), (int)((float)screen_size.Height / 2 + (-1) * delta_y)); } /// /// 根据屏幕坐标计算该点的经纬度坐标 /// /// /// /// /// /// public static LatLngPoint GetLatLngByScreenLocation(PointF p, LatLngPoint center, int zoom, Size screen_size) { PointF cp = GetLocationByLatLng(center, zoom); //中心点像素坐标 //目标点与中心点屏幕坐标差 float delta_x = p.X - screen_size.Width/2; float delta_y = p.Y - screen_size.Height/2; PointF dp = new PointF(cp.X + delta_x, cp.Y + delta_y * (-1)); //目标点像素坐标 return GetLatLngByLocation(dp, zoom); } /// /// 根据经纬度坐标计算该点的像素坐标 /// /// 要计算的经纬度 /// 地图当前缩放级别 /// public static PointF GetLocationByLatLng(LatLngPoint p, int zoom) { PointF mer_p = LatLng2Mercator(p); //墨卡托坐标 return new PointF((float)(mer_p.X / Math.Pow(2, 18 - zoom)), (float)(mer_p.Y / Math.Pow(2, 18 - zoom))); } /// /// 根据像素坐标计算该点的经纬度坐标 /// /// 要计算的像素坐标 /// 地图缩放级别 /// public static LatLngPoint GetLatLngByLocation(PointF p, int zoom) { PointF mer_p = new PointF((float)(p.X * Math.Pow(2, 18 - zoom)), (float)(p.Y * Math.Pow(2, 18 - zoom))); //墨卡托坐标 return Mercator2LatLng(mer_p); } /// /// 创建圆角矩形路径 /// /// /// /// public static GraphicsPath CreateRoundedRectanglePath(Rectangle rect, int cornerRadius) { GraphicsPath roundedRect = new GraphicsPath(); roundedRect.AddArc(rect.X, rect.Y, cornerRadius * 2, cornerRadius * 2, 180, 90); roundedRect.AddLine(rect.X + cornerRadius, rect.Y, rect.Right - cornerRadius * 2, rect.Y); roundedRect.AddArc(rect.X + rect.Width - cornerRadius * 2, rect.Y, cornerRadius * 2, cornerRadius * 2, 270, 90); roundedRect.AddLine(rect.Right, rect.Y + cornerRadius * 2, rect.Right, rect.Y + rect.Height - cornerRadius * 2); roundedRect.AddArc(rect.X + rect.Width - cornerRadius * 2, rect.Y + rect.Height - cornerRadius * 2, cornerRadius * 2, cornerRadius * 2, 0, 90); roundedRect.AddLine(rect.Right - cornerRadius * 2, rect.Bottom, rect.X + cornerRadius * 2, rect.Bottom); roundedRect.AddArc(rect.X, rect.Bottom - cornerRadius * 2, cornerRadius * 2, cornerRadius * 2, 90, 90); roundedRect.AddLine(rect.X, rect.Bottom - cornerRadius * 2, rect.X, rect.Y + cornerRadius * 2); roundedRect.CloseFigure(); return roundedRect; } /// /// 获取地图显示模式文本 /// /// /// public static string GetMapModeTitle(MapMode mode) { if (mode == MapMode.Normal) { return "地图"; } if (mode == MapMode.Satellite) { return "卫星图"; } if (mode == MapMode.RoadNet) { return "道路网"; } if (mode == MapMode.Sate_RoadNet) { return "卫星图(路网)"; } return ""; } /// /// 获取地图加载模式文本 /// /// /// public static string GetLoadMapModeTitle(LoadMapMode load_mode) { if (load_mode == LoadMapMode.Cache) { return "仅从本地"; } if (load_mode == LoadMapMode.CacheServer) { return "本地优先"; } if (load_mode == LoadMapMode.Server) { return "仅从远程"; } return ""; } //以下是根据百度地图JavaScript API破解得到 百度坐标<->墨卡托坐标 转换算法 private static double[] array1 = { 75, 60, 45, 30, 15, 0 }; private static double[] array3 = { 12890594.86, 8362377.87, 5591021, 3481989.83, 1678043.12, 0 }; private static double[][] array2 = {new double[]{-0.0015702102444, 111320.7020616939, 1704480524535203, -10338987376042340, 26112667856603880, -35149669176653700, 26595700718403920, -10725012454188240, 1800819912950474, 82.5} ,new double[]{0.0008277824516172526, 111320.7020463578, 647795574.6671607, -4082003173.641316, 10774905663.51142, -15171875531.51559, 12053065338.62167, -5124939663.577472, 913311935.9512032, 67.5} ,new double[]{0.00337398766765, 111320.7020202162, 4481351.045890365, -23393751.19931662, 79682215.47186455, -115964993.2797253, 97236711.15602145, -43661946.33752821, 8477230.501135234, 52.5} ,new double[]{0.00220636496208, 111320.7020209128, 51751.86112841131, 3796837.749470245, 992013.7397791013, -1221952.21711287, 1340652.697009075, -620943.6990984312, 144416.9293806241, 37.5} ,new double[]{-0.0003441963504368392, 111320.7020576856, 278.2353980772752, 2485758.690035394, 6070.750963243378, 54821.18345352118, 9540.606633304236, -2710.55326746645, 1405.483844121726, 22.5} ,new double[]{-0.0003218135878613132, 111320.7020701615, 0.00369383431289, 823725.6402795718, 0.46104986909093, 2351.343141331292, 1.58060784298199, 8.77738589078284, 0.37238884252424, 7.45}}; private static double[][] array4 = {new double[]{1.410526172116255e-8, 0.00000898305509648872, -1.9939833816331, 200.9824383106796, -187.2403703815547, 91.6087516669843, -23.38765649603339, 2.57121317296198, -0.03801003308653, 17337981.2} ,new double[]{-7.435856389565537e-9, 0.000008983055097726239, -0.78625201886289, 96.32687599759846, -1.85204757529826, -59.36935905485877, 47.40033549296737, -16.50741931063887, 2.28786674699375, 10260144.86} ,new double[]{-3.030883460898826e-8, 0.00000898305509983578, 0.30071316287616, 59.74293618442277, 7.357984074871, -25.38371002664745, 13.45380521110908, -3.29883767235584, 0.32710905363475, 6856817.37} ,new double[]{-1.981981304930552e-8, 0.000008983055099779535, 0.03278182852591, 40.31678527705744, 0.65659298677277, -4.44255534477492, 0.85341911805263, 0.12923347998204, -0.04625736007561, 4482777.06} ,new double[]{3.09191371068437e-9, 0.000008983055096812155, 0.00006995724062, 23.10934304144901, -0.00023663490511, -0.6321817810242, -0.00663494467273, 0.03430082397953, -0.00466043876332, 2555164.4} ,new double[]{2.890871144776878e-9, 0.000008983055095805407, -3.068298e-8, 7.47137025468032, -0.00000353937994, -0.02145144861037, -0.00001234426596, 0.00010322952773, -0.00000323890364, 826088.5}}; private static PointF LatLng2Mercator(LatLngPoint p) { double[] arr = null; double n_lat = p.Lat > 74 ? 74 : p.Lat; n_lat = n_lat < -74 ? -74 : n_lat; for (var i = 0; i < array1.Length; i++) { if (p.Lat >= array1[i]) { arr = array2[i]; break; } } if (arr == null) { for (var i = array1.Length - 1; i >= 0; i--) { if (p.Lat <= -array1[i]) { arr = array2[i]; break; } } } double[] res = Convertor(p.Lng, p.Lat, arr); return new PointF((float)res[0], (float)res[1]); } private static LatLngPoint Mercator2LatLng(PointF p) { double[] arr = null; PointF np = new PointF(Math.Abs(p.X),Math.Abs(p.Y)); for (var i = 0; i < array3.Length; i++) { if (np.Y >= array3[i]) { arr = array4[i]; break; } } double[] res = Convertor(np.X, np.Y, arr); return new LatLngPoint(res[0],res[1]); } private static double[] Convertor(double x, double y, double[] param) { var T = param[0] + param[1] * Math.Abs(x); var cC = Math.Abs(y) / param[9]; var cF = param[2] + param[3] * cC + param[4] * cC * cC + param[5] * cC * cC * cC + param[6] * cC * cC * cC * cC + param[7] * cC * cC * cC * cC * cC + param[8] * cC * cC * cC * cC * cC * cC; T *= (x < 0 ? -1 : 1); cF *= (y < 0 ? -1 : 1); return new double[] { T, cF }; } } /// /// 鼠标工作类型 /// public enum MouseType { None, //无 DragMap, //拖拽地图 DragNearby, //拖拽周边区域 DrawBound, //绘制矩形搜索区域 DrawDistance, //绘制测量线条 DrawScreenshotArea, //绘制截图矩形 DragScreenshotArea, //拖拽截图矩形 DrawMarker, //绘制标记点 DrawRectange, //绘制矩形 DrawCircle, //绘制圆形 DrawLine, //绘制直线 DrawPolygon, //绘制多边形 DrawDownloadArea //绘制下载区域 } } ================================================ FILE: BMap.NET.WindowsForm/BMapControl.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 17, 17 R0lGODlhDgAOAIQQACJOdFV3iJmto2aFj8zWuN3kvoignDNcehFBbbvJse7xxf///8zMzDNmmQAzZv// zP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBF Mi4wAwEBAAAh+QQBAAAQACwAAAAADgAOAAAIcQAhQFjQoKDBggITOnjwQEGCBAwfNFDIkAACAAgQEGA4 EcLCBwMQKFAAIABHBh4ZChDQsOTJlBEVHHAAUSLKjwwDOGD5EucDBwMi2oTJMEEBoQ1uCnVgAClKokYj Ong60IHVq1apJmTAtavWhGDDQggIADs= R0lGODlhDAAIAIEBAPAPCf///wAAAAAAACH/C05FVFNDQVBFMi4wAwEBAAAh+QQBAAABACwAAAAADAAI AAAIIgADCBxIsCCAgwgBGEx4sODAhA4DMHSIUKJCghUtUnx4MSAAOw== R0lGODlhDAAIAIECAB2cAP///////wAAACH/C05FVFNDQVBFMi4wAwEBAAAh+QQBAAACACwAAAAADAAI AAAIJgAFCBxIsGAAAAMBICSocKHCggIaRlxYsOFDiBMvJrSoUSDHiwEBADs= R0lGODlhDQANAIEBAAkkPP///wAAAAAAACH/C05FVFNDQVBFMi4wAwEBAAAh+QQBAAABACwAAAAADQAN AAAIOwADBABAsGBBgQMRKhQIIOHChQQVHkQYkWHChgwxNjyosePGiiAHRuxI8SJFjBlRinwIcSVLlAZj CgwIADs= R0lGODlhEAAQAIfAAAgAAPgAAP8JCQhUAAZBAABgmAAGCg6ZAI/W//X79Pf89wAQGju3/+/3+z9wjQCc +GbG/+/x8uPz4Q6YAAAGAAAaKgCR5gpoAACH1u/5//YAABehCSanGEWzOePw4e/z9SgAAABWiP+Hh/9e XpXLjwBMebDAr+/2+gMkAKgAAGkAAP8uLvH5/5CZj+zx7Pz+/P8eHnkAAIgAAOT1/5gAABGn//+cnC9W bO/y9Njv1vz+/zmvLPT7/wAtSEkAAMnr/4+eprgAAAB1uu/1+LPdr5Cej4+aoAA4Wuf2/wCS5//Pz8jo xP/T04/H6I/H583rygZAAAAkOkJhP+cAAK3eqP9zc/L68d/y3Yp/fwCI10u2QP8zM+P04f9ISP+ysq+z r0eUP/L68gleADRdLwIaAAARHAU2AGjCXkBKPxkAAIGXfw2PAAoAAAU3AFkAAI+epy9EUQAHAI/M74+n tgEQAI++2QAbK+Dy3rrl/wyl/zkAAPR/f+Tw4y+NxIXOfk++/wppAHDFZ//c3ABCai+f4ACS6DeELwB+ x//Hx4S3f/j8+G7J/0qsPwBqqENiP//x8QyGAEV4P93x2ssPD3vKcwdLAAyFAACI2EeVP7LQrwt7AOf1 5tgAANoPDwldAIKgf4Suf6jcome0X8gAAGWbX3HFaN7x3O/y7yAkH9HszghTAC9+rMDlvOvx6glfAJTG jy9FUcLfvwt8AA2OAJTTjS+e3wpyAEV/P+34/1O5SNzw2Y/Shw2QAMXnwf8AAP///wAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ACH/C05FVFNDQVBFMi4wAwEBAAAh+QQBAADAACwAAAAAEAAQAAAIrwCBCQRWo2DBgQgF5snz45fDHwsT AksiZwYEgxBmyEmSMAmSPwxChvyDhOPAQz8Q/Fn5a+UfBD8ODRTya5HNRTVv/hIysFEGBAgcCgX6q9HA Ar+AFvxVkGiBgSFS/cBD9RdVPD9ShUDoQMeMHz9qgJ2hA8gghEeA6MjAlq2OXx9uHEHYw0EsobHURPiF 40aPhFECC76xN8KNKBIR2oFV2E5ihGXgRIhQ5jFCA5iBBQQAOw== R0lGODlhEAAQAIfAAAgAAPgAAP8JCQhUAAZBAABgmAAGCg6ZAI/W//X79Pf89wAQGju3/+/3+z9wjQCc +GbG/+/x8uPz4Q6YAAAGAAAaKgCR5gpoAACH1u/5//YAABehCSanGEWzOePw4e/z9SgAAABWiP+Hh/9e XpXLjwBMebDAr+/2+gMkAKgAAGkAAP8uLvH5/5CZj+zx7Pz+/P8eHnkAAIgAAOT1/5gAABGn//+cnC9W bO/y9Njv1vz+/zmvLPT7/wAtSEkAAMnr/4+eprgAAAB1uu/1+LPdr5Cej4+aoAA4Wuf2/wCS5//Pz8jo xP/T04/H6I/H583rygZAAAAkOkJhP+cAAK3eqP9zc/L68d/y3Yp/fwCI10u2QP8zM+P04f9ISP+ysq+z r0eUP/L68gleADRdLwIaAAARHAU2AGjCXkBKPxkAAIGXfw2PAAoAAAU3AFkAAI+epy9EUQAHAI/M74+n tgEQAI++2QAbK+Dy3rrl/wyl/zkAAPR/f+Tw4y+NxIXOfk++/wppAHDFZ//c3ABCai+f4ACS6DeELwB+ x//Hx4S3f/j8+G7J/0qsPwBqqENiP//x8QyGAEV4P93x2ssPD3vKcwdLAAyFAACI2EeVP7LQrwt7AOf1 5tgAANoPDwldAIKgf4Suf6jcome0X8gAAGWbX3HFaN7x3O/y7yAkH9HszghTAC9+rMDlvOvx6glfAJTG jy9FUcLfvwt8AA2OAJTTjS+e3wpyAEV/P+34/1O5SNzw2Y/Shw2QAMXnwf8AAP///wAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ACH/C05FVFNDQVBFMi4wAwEBAAAh+QQBAADAACwAAAAAEAAQAAAIqACBCQRWo2DBgQgF5snz45fDHwsT AksiZwYEgxBmyEmSMAmSPwxChvyDhOPAQz8Q/FnJ8g+CH4cGCvm1qKZNm7+EDGyUAQECh0B9/mo0sMAv nwYLCi0wMESqH3iiSsXzI1UIhA50zPjBlesMHUAGITwCREeGs2d1/Ppw4wjCHg5iAY2lJsKvCDd6JIzC t+8Nu3ijSERoBxZgO4MRloETIUKZxAgNSAYWEAA7 R0lGODlhCwALAIEBAAkkPP///wAAAAAAACH/C05FVFNDQVBFMi4wAwEBAAAh+QQBAAABACwAAAAACwAL AAAIMAABBBBIcKDBAAgTKiQoECGAggMfRmxI8aHEgw4vOsxocePEjwY1SmyosGTBkwMDAgA7 R0lGODlhDQANAIEBAAkkPP///wAAAAAAACH/C05FVFNDQVBFMi4wAwEBAAAh+QQBAAABACwAAAAADQAN AAAIOQADBABAsGBBgQMRKhQIIOHChQQZNpRIcWDEgxYRGpyYUWNEjx4xdjyI8ePHkRwfMnSokuNGgwID AgA7 ================================================ FILE: BMap.NET.WindowsForm/BMapElements/BBound.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; namespace BMap.NET.WindowsForm.BMapElements { /// /// 矩形搜索区域 /// public class BBound:BMapElement { /// /// 左上角点 /// public LatLngPoint LeftTop { get; set; } /// /// 右下角点 /// public LatLngPoint RightBottom { set; get; } /// /// 绘制方法 /// /// /// /// /// public override void Draw(System.Drawing.Graphics g, LatLngPoint center, int zoom, System.Drawing.Size screen_size) { g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; Point theScreenLeftTop = MapHelper.GetScreenLocationByLatLng(LeftTop, center, zoom, screen_size); //矩形左上角屏幕坐标 Point theScreenRightBottom = MapHelper.GetScreenLocationByLatLng(RightBottom, center, zoom, screen_size); //矩形右下角屏幕坐标 int width = Math.Abs(theScreenRightBottom.X - theScreenLeftTop.X); int height = Math.Abs(theScreenRightBottom.Y - theScreenLeftTop.Y); Rectangle r = new Rectangle(Math.Min(theScreenLeftTop.X, theScreenRightBottom.X), Math.Min(theScreenLeftTop.Y, theScreenRightBottom.Y), width, height); if (new Rectangle(new Point(0, 0), screen_size).IntersectsWith(r)) { using (SolidBrush sb = new SolidBrush(Color.FromArgb(15, Color.DarkBlue))) { g.FillRectangle(sb, r); } using (Pen pen = new Pen(Color.FromArgb(150,Color.DarkBlue), 2)) { g.DrawRectangle(pen, r); } } double d1 = MapHelper.GetDistanceByLatLng(LeftTop, new LatLngPoint(LeftTop.Lng, RightBottom.Lat)); double d2 = MapHelper.GetDistanceByLatLng(LeftTop, new LatLngPoint(RightBottom.Lng, LeftTop.Lat)); double d3 = MapHelper.GetDistanceByLatLng(new LatLngPoint(LeftTop.Lng, RightBottom.Lat), RightBottom); double d4 = MapHelper.GetDistanceByLatLng(new LatLngPoint(RightBottom.Lng, LeftTop.Lat), RightBottom); using (Font f = new Font("微软雅黑", 9)) { g.FillRectangle(Brushes.DarkBlue, new Rectangle(theScreenLeftTop.X, (theScreenLeftTop.Y + theScreenRightBottom.Y) / 2 - 10, 60, 20)); g.DrawString(Math.Round(d1, 2).ToString() + "km", f, Brushes.White, new PointF(theScreenLeftTop.X + 5, (theScreenLeftTop.Y + theScreenRightBottom.Y) / 2 - 8)); g.FillRectangle(Brushes.DarkBlue, new Rectangle((theScreenLeftTop.X + theScreenRightBottom.X) / 2 - 30, theScreenLeftTop.Y, 60, 20)); g.DrawString(Math.Round(d2, 2).ToString() + "km", f, Brushes.White, new PointF((theScreenLeftTop.X + theScreenRightBottom.X) / 2 - 30 + 5, theScreenLeftTop.Y + 2)); g.FillRectangle(Brushes.DarkBlue, new Rectangle((theScreenLeftTop.X + theScreenRightBottom.X) / 2 - 30, theScreenRightBottom.Y - 20, 60, 20)); g.DrawString(Math.Round(d3, 2).ToString() + "km", f, Brushes.White, new PointF((theScreenLeftTop.X + theScreenRightBottom.X) / 2 - 30 + 5, theScreenRightBottom.Y + 4 - 20)); g.FillRectangle(Brushes.DarkBlue, new Rectangle(theScreenRightBottom.X - 60, (theScreenLeftTop.Y + theScreenRightBottom.Y) / 2 - 10, 60, 20)); g.DrawString(Math.Round(d4, 2).ToString() + "km", f, Brushes.White, new PointF(theScreenRightBottom.X - 60 + 3, (theScreenLeftTop.Y + theScreenRightBottom.Y) / 2 - 10)); } } } } ================================================ FILE: BMap.NET.WindowsForm/BMapElements/BDistance.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; namespace BMap.NET.WindowsForm.BMapElements { /// /// 距离测量类 /// public class BDistance : BMapElement { /// /// 点集 /// public List Points { get; set; } /// /// 更新最后一点 /// /// public void UpdateTheEnd(LatLngPoint p) { if (Points != null) { Points[Points.Count - 1] = p; } } /// /// 绘制方法 /// /// /// /// /// public override void Draw(System.Drawing.Graphics g, LatLngPoint center, int zoom, System.Drawing.Size screen_size) { if (Points != null && Points.Count >= 2) { g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; List l = new List(); foreach (LatLngPoint p in Points) { l.Add(MapHelper.GetScreenLocationByLatLng(p, center, zoom, screen_size)); //屏幕坐标 } double total = 0; double step = 0; using (Pen pen = new Pen(Color.FromArgb(150, Color.OrangeRed), 4)) { for (int i = 0; i < l.Count - 1; ++i) { g.DrawLine(pen, l[i], l[i + 1]); g.FillEllipse(Brushes.White, new Rectangle(new Point(l[i].X - 4, l[i].Y - 4), new Size(8, 8))); g.DrawEllipse(Pens.OrangeRed, new Rectangle(new Point(l[i].X - 4, l[i].Y - 4), new Size(8, 8))); if (i == 0) //起点 { g.FillRectangle(Brushes.White, new Rectangle(l[i].X + 3, l[i].Y, 35, 20)); g.DrawRectangle(Pens.DarkGray, new Rectangle(l[i].X + 3, l[i].Y, 35, 20)); g.DrawString("起点", new Font("微软雅黑", 9), Brushes.OrangeRed, new PointF(l[i].X + 6, l[i].Y + 2)); if (i == l.Count - 2) //终点 只有两点的时候 { step = MapHelper.GetDistanceByLatLng(Points[i], Points[i + 1]); total += step; g.FillRectangle(Brushes.White, new Rectangle(l[i + 1].X + 3, l[i + 1].Y, 90, 20)); g.DrawRectangle(Pens.DarkGray, new Rectangle(l[i + 1].X + 3, l[i + 1].Y, 90, 20)); g.DrawString("总长:" + Math.Round(total,2) + "公里", new Font("微软雅黑", 9), Brushes.OrangeRed, new PointF(l[i + 1].X + 10, l[i + 1].Y + 2)); } } else //其它点 { step = MapHelper.GetDistanceByLatLng(Points[i-1], Points[i]); total += step; g.FillRectangle(Brushes.White, new Rectangle(l[i].X + 3, l[i].Y, 70, 20)); g.DrawRectangle(Pens.DarkGray, new Rectangle(l[i].X + 3, l[i].Y, 70, 20)); g.DrawString(Math.Round(step,2) + "公里", new Font("微软雅黑", 9), Brushes.OrangeRed, new PointF(l[i].X + 10, l[i].Y + 2)); if (i == l.Count - 2) //终点 { step = MapHelper.GetDistanceByLatLng(Points[i], Points[i + 1]); total += step; g.FillRectangle(Brushes.White, new Rectangle(l[i + 1].X + 3, l[i + 1].Y, 100, 20)); g.DrawRectangle(Pens.DarkGray, new Rectangle(l[i + 1].X + 3, l[i + 1].Y, 100, 20)); g.DrawString("总长:" + Math.Round(total, 2) + "公里", new Font("微软雅黑", 9), Brushes.OrangeRed, new PointF(l[i + 1].X + 10, l[i + 1].Y + 2)); } } } } } } } } ================================================ FILE: BMap.NET.WindowsForm/BMapElements/BMapElement.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; namespace BMap.NET.WindowsForm.BMapElements { /// /// 地图元素基类 /// public abstract class BMapElement { /// /// 绘制方法 /// /// 画布 /// 地图中心点坐标 /// 当前地图缩放级别 /// 屏幕大小 public abstract void Draw(Graphics g, LatLngPoint center, int zoom, Size screen_size); } } ================================================ FILE: BMap.NET.WindowsForm/BMapElements/BMarker.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; using System.Windows.Forms; namespace BMap.NET.WindowsForm.BMapElements { /// /// 地图中的标记点 /// public class BMarker : BMapElement { /// /// 索引号 /// public int Index { get; set; } /// /// 位置 /// public LatLngPoint Location { set; get; } /// /// 标记点实际详细位置 /// public string Address { get; set; } private bool _selected; /// /// 当前POI是否被选中 /// public bool Selected { get { return _selected; } set { _selected = value; } } /// /// 标记名 /// public string Name { get; set; } /// /// 标记备注 /// public string Remarks { get; set; } private Rectangle _rect; /// /// 标记点在屏幕中的范围 /// public Rectangle Rect { get { return _rect; } } /// /// 绘制方法 /// /// /// /// /// public override void Draw(System.Drawing.Graphics g, LatLngPoint center, int zoom, System.Drawing.Size screen_size) { Point p = MapHelper.GetScreenLocationByLatLng(Location, center, zoom, screen_size); //屏幕坐标 Bitmap b = Properties.BMap.ico_marker; g.DrawImage(b, new Rectangle(p.X - b.Width / 2, p.Y - b.Height, b.Width, b.Height)); using (Font f = new Font("微软雅黑", 9)) { Size s = TextRenderer.MeasureText(Name, f); //字体占用像素 g.FillRectangle(Brushes.Wheat, new Rectangle(new Point(p.X + b.Width / 2 + 5, p.Y - b.Height), new Size(s.Width + 6, s.Height + 6))); g.DrawRectangle(Pens.Gray, new Rectangle(new Point(p.X + b.Width / 2 + 5, p.Y - b.Height), new Size(s.Width + 6, s.Height + 6))); g.DrawString(Name, f, Brushes.Black, new PointF(p.X + b.Width / 2 + 5 + 3, p.Y - b.Height + 3)); } _rect = new Rectangle(p.X - b.Width / 2, p.Y - b.Height, b.Width, b.Height); } } } ================================================ FILE: BMap.NET.WindowsForm/BMapElements/BNearBy.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BMap.NET.WindowsForm.BMapElements { /// /// 附近区域 /// public class BNearBy : BMapElement { /// /// 中心 /// public LatLngPoint Center { get; set; } /// /// 附近区域半径 米 /// public double Radius { get; set; } /// /// 周边点坐标 /// private List _points_arounds; /// /// 绘制方法 /// /// 画布 /// 中心 /// 地图缩放级别 /// 地图大小 public override void Draw(System.Drawing.Graphics g, LatLngPoint center, int zoom, System.Drawing.Size screen_size) { g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; if (_points_arounds == null) { _points_arounds = new List(); } } } } ================================================ FILE: BMap.NET.WindowsForm/BMapElements/BPOI.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using Newtonsoft.Json.Linq; using System.Drawing; namespace BMap.NET.WindowsForm.BMapElements { /// /// 地图中POI 信息点 /// public class BPOI : BMapElement { /// /// 位置 /// public LatLngPoint Location { set; get; } /// /// 索引号 /// public int Index { get; set; } /// /// POI的数据源 /// public JObject DataSource { get; set; } private bool _selected; /// /// 当前POI是否被选中 /// public bool Selected { get { return _selected; } set { _selected = value; } } private Rectangle _rect; /// /// POI在屏幕中的范围 /// public Rectangle Rect { get { return _rect; } } /// /// 绘制方法 /// /// /// /// /// public override void Draw(System.Drawing.Graphics g, LatLngPoint center, int zoom, System.Drawing.Size screen_size) { Point p = MapHelper.GetScreenLocationByLatLng(Location, center, zoom, screen_size); //屏幕坐标 Bitmap b; if (_selected) { b = Properties.BMap.ico_blue_point_big; } else { b = Properties.BMap.ico_red_point_small; } g.DrawImage(b, new Rectangle(p.X - b.Width / 2, p.Y - b.Height, b.Width, b.Height)); using (Font f = new Font("微软雅黑", 10, FontStyle.Bold)) { g.DrawString(((Char)(Index + 65)).ToString(), f, Brushes.White, new PointF(_selected ? (p.X - 5) : (p.X - 6), _selected ? (p.Y - 30) : (p.Y - 26))); } _rect = new Rectangle(p.X - b.Width / 2, p.Y - b.Height, b.Width, b.Height); } } } ================================================ FILE: BMap.NET.WindowsForm/BMapElements/BPoint.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; namespace BMap.NET.WindowsForm.BMapElements { /// /// 地图中位置点(与BPOI不同) /// public class BPoint : BMapElement { /// /// 位置点类型 /// public PointType Type { get; set; } /// /// 位置坐标 /// public LatLngPoint Location { get; set; } /// /// 具体地址 /// public string Address { get; set; } private bool _selected; /// /// 是否被选中 /// public bool Selected { get { return _selected; } set { _selected = value; } } private Rectangle _rect; /// /// 在屏幕中的范围 /// public Rectangle Rect { get { return _rect; } } /// /// 绘制 /// /// /// /// /// public override void Draw(System.Drawing.Graphics g, LatLngPoint center, int zoom, System.Drawing.Size screen_size) { Point p = MapHelper.GetScreenLocationByLatLng(Location, center, zoom, screen_size); //屏幕坐标 Bitmap b = null; if (Type == PointType.RouteEnd) { b = Properties.BMap.ico_route_end; } else if (Type == PointType.RouteStart) { b = Properties.BMap.ico_route_start; } else if(Type == PointType.Strange) { b = Properties.BMap.ico_strange_point; } _rect = new Rectangle(p.X - b.Width / 2, p.Y - b.Height, b.Width, b.Height); g.DrawImage(b, _rect); } } } ================================================ FILE: BMap.NET.WindowsForm/BMapElements/BRoute.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using Newtonsoft.Json.Linq; using System.Drawing; using System.Windows.Forms; using System.Drawing.Drawing2D; namespace BMap.NET.WindowsForm.BMapElements { /// /// 地图中的导航路线 /// public class BRoute : BMapElement { /// /// 路线类型 /// public RouteType Type { get; set; } /// /// 路线数据源 /// public JObject DataSource { get; set; } /// /// 路线高亮部分 /// public string HighlightPath { get; set; } /// /// 绘制 /// /// /// /// /// public override void Draw(System.Drawing.Graphics g, LatLngPoint center, int zoom, System.Drawing.Size screen_size) { //不同路线绘制不一样 数据源结构也不一样 if (DataSource != null) { g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; //质量优先 LatLngPoint first, second; Point s_first = new Point(), s_second = new Point(); if (Type == RouteType.Transit) //公交 { using (Pen p = new Pen(Color.FromArgb(250, Color.Blue),6)) //蓝色 { p.StartCap = System.Drawing.Drawing2D.LineCap.Round; //连接圆滑 p.EndCap = System.Drawing.Drawing2D.LineCap.Round; p.LineJoin = System.Drawing.Drawing2D.LineJoin.Round; JToken route = DataSource["scheme"][0]; foreach (JArray array in route["steps"]) { if ((string)array[0]["type"] == "5") //步行 { using (Pen p2 = new Pen(Color.FromArgb(250, Color.Gray), 6)) { p2.StartCap = System.Drawing.Drawing2D.LineCap.Round; //连接圆滑 p2.EndCap = System.Drawing.Drawing2D.LineCap.Round; p2.LineJoin = System.Drawing.Drawing2D.LineJoin.Round; string[] points = ((string)array[0]["path"]).Split(';'); //每一步骤中的点 for (int i = points.Length - 1; i > 0; --i) { first = new LatLngPoint(double.Parse(points[i - 1].Split(',')[0]), double.Parse(points[i - 1].Split(',')[1])); second = new LatLngPoint(double.Parse(points[i].Split(',')[0]), double.Parse(points[i].Split(',')[1])); s_first = MapHelper.GetScreenLocationByLatLng(first, center, zoom, screen_size); s_second = MapHelper.GetScreenLocationByLatLng(second, center, zoom, screen_size); if (new Rectangle(new Point(0, 0), screen_size).Contains(s_first) || new Rectangle(new Point(0, 0), screen_size).Contains(s_second)) //在屏幕范围内 g.DrawLine(p2, s_first, s_second); } } } else //公交 地铁 { string transits = ""; double duration = 0; int type = 0; //公交 还是 地铁 string start_name = ""; duration = double.Parse((string)array[0]["duration"]); type = int.Parse((string)array[0]["vehicle"]["type"]); start_name = (string)array[0]["vehicle"]["start_name"]; foreach (JObject jo in array) //多种方案 { transits += ((string)jo["vehicle"]["name"] + "/"); } transits = transits.TrimEnd(new char[] { '/'}); //只绘制一个方案即可 string[] points = ((string)array[0]["path"]).Split(';'); //每一步骤中的点 for (int i = points.Length - 1; i > 0; --i) { first = new LatLngPoint(double.Parse(points[i - 1].Split(',')[0]), double.Parse(points[i - 1].Split(',')[1])); second = new LatLngPoint(double.Parse(points[i].Split(',')[0]), double.Parse(points[i].Split(',')[1])); s_first = MapHelper.GetScreenLocationByLatLng(first, center, zoom, screen_size); s_second = MapHelper.GetScreenLocationByLatLng(second, center, zoom, screen_size); if (new Rectangle(new Point(0, 0), screen_size).Contains(s_first) || new Rectangle(new Point(0, 0), screen_size).Contains(s_second)) //在屏幕范围内 g.DrawLine(p, s_first, s_second); if (i == 1) //起点 { using (Font f = new Font("微软雅黑", 8)) { string info = start_name + " 上车\n乘坐" + transits + " \n车程约" + Math.Round(duration / 60, 0) + "分钟"; Size info_size = TextRenderer.MeasureText(info, f); GraphicsPath pt = new GraphicsPath(); pt.AddPolygon(new Point[] { new Point(s_first.X - info_size.Width / 2 - 5, s_first.Y - 25), new Point(s_first.X - info_size.Width / 2 - 5, s_first.Y - 25 - info_size.Height - 10), new Point(s_first.X + info_size.Width / 2 + 5, s_first.Y - 25 - info_size.Height - 10), new Point(s_first.X + info_size.Width / 2 + 5,s_first.Y - 25), new Point(s_first.X + 8,s_first.Y - 25), new Point(s_first.X,s_first.Y-15), new Point(s_first.X - 8,s_first.Y-25)}); g.FillPath(Brushes.Wheat, pt); g.DrawPath(Pens.LightGray, pt); g.DrawString(info, new Font("微软雅黑", 9), Brushes.Black, new PointF(s_first.X - info_size.Width/2, s_first.Y - info_size.Height - 25 - 5)); Bitmap b = type == 0 ? Properties.BMap.ico_bybus : Properties.BMap.ico_bysubway; //0公交 1地铁轻轨 g.DrawImage(b, new Rectangle(s_first.X - b.Width / 2, s_first.Y - b.Height / 2, b.Width, b.Height)); } } if (i == points.Length - 1) //终点 { Bitmap b = type == 0 ? Properties.BMap.ico_bybus : Properties.BMap.ico_bysubway; //0公交 1地铁轻轨 g.DrawImage(b, new Rectangle(s_second.X - b.Width / 2, s_second.Y - b.Height / 2, b.Width, b.Height)); } } } } } } else if (Type == RouteType.Driving) //驾车 { using (Pen p = new Pen(Color.FromArgb(250, Color.Green), 6)) //绿色 { p.StartCap = System.Drawing.Drawing2D.LineCap.Round; //连接圆滑 p.EndCap = System.Drawing.Drawing2D.LineCap.Round; p.LineJoin = System.Drawing.Drawing2D.LineJoin.Round; foreach (JObject step in DataSource["steps"]) { first = new LatLngPoint(double.Parse((string)step["stepOriginLocation"]["lng"]), double.Parse((string)step["stepOriginLocation"]["lat"])); s_first = MapHelper.GetScreenLocationByLatLng(first, center, zoom, screen_size); //第一点 string[] points = ((string)step["path"]).Split(';'); //每一步骤中的点 for (int i = 0; i < points.Length; ++i) { if (i == 0) //与前一点连接 { second = new LatLngPoint(double.Parse(points[i].Split(',')[0]), double.Parse(points[i].Split(',')[1])); s_second = MapHelper.GetScreenLocationByLatLng(second, center, zoom, screen_size); if (new Rectangle(new Point(0, 0), screen_size).Contains(s_first) || new Rectangle(new Point(0, 0), screen_size).Contains(s_second)) //在屏幕范围内 g.DrawLine(p, s_first, s_second); } else { first = new LatLngPoint(double.Parse(points[i - 1].Split(',')[0]), double.Parse(points[i - 1].Split(',')[1])); second = new LatLngPoint(double.Parse(points[i].Split(',')[0]), double.Parse(points[i].Split(',')[1])); s_first = MapHelper.GetScreenLocationByLatLng(first, center, zoom, screen_size); s_second = MapHelper.GetScreenLocationByLatLng(second, center, zoom, screen_size); if (new Rectangle(new Point(0, 0), screen_size).Contains(s_first) || new Rectangle(new Point(0, 0), screen_size).Contains(s_second)) //在屏幕范围内 g.DrawLine(p, s_first, s_second); } } s_first = s_second; second = new LatLngPoint(double.Parse((string)step["stepDestinationLocation"]["lng"]), double.Parse((string)step["stepDestinationLocation"]["lat"])); s_second = MapHelper.GetScreenLocationByLatLng(second, center, zoom, screen_size); if (new Rectangle(new Point(0, 0), screen_size).Contains(s_first) || new Rectangle(new Point(0, 0), screen_size).Contains(s_second)) //在屏幕范围内 g.DrawLine(p, s_first, s_second); //最后一点 } } } else //步行 { using (Pen p = new Pen(Color.FromArgb(250, Color.Gray), 6)) //灰色 { p.StartCap = System.Drawing.Drawing2D.LineCap.Round; //连接圆滑 p.EndCap = System.Drawing.Drawing2D.LineCap.Round; p.LineJoin = System.Drawing.Drawing2D.LineJoin.Round; foreach (JObject step in DataSource["steps"]) { first = new LatLngPoint(double.Parse((string)step["stepOriginLocation"]["lng"]), double.Parse((string)step["stepOriginLocation"]["lat"])); s_first = MapHelper.GetScreenLocationByLatLng(first, center, zoom, screen_size); //第一点 string[] points = ((string)step["path"]).Split(';'); //每一步骤中的点 for (int i = 0; i < points.Length; ++i) { if (i == 0) //与前一点连接 { second = new LatLngPoint(double.Parse(points[i].Split(',')[0]), double.Parse(points[i].Split(',')[1])); s_second = MapHelper.GetScreenLocationByLatLng(second, center, zoom, screen_size); if (new Rectangle(new Point(0, 0), screen_size).Contains(s_first) || new Rectangle(new Point(0, 0), screen_size).Contains(s_second)) //在屏幕范围内 g.DrawLine(p, s_first, s_second); } else { first = new LatLngPoint(double.Parse(points[i - 1].Split(',')[0]), double.Parse(points[i - 1].Split(',')[1])); second = new LatLngPoint(double.Parse(points[i].Split(',')[0]), double.Parse(points[i].Split(',')[1])); s_first = MapHelper.GetScreenLocationByLatLng(first, center, zoom, screen_size); s_second = MapHelper.GetScreenLocationByLatLng(second, center, zoom, screen_size); if (new Rectangle(new Point(0, 0), screen_size).Contains(s_first) || new Rectangle(new Point(0, 0), screen_size).Contains(s_second)) //在屏幕范围内 g.DrawLine(p, s_first, s_second); } } s_first = s_second; second = new LatLngPoint(double.Parse((string)step["stepDestinationLocation"]["lng"]), double.Parse((string)step["stepDestinationLocation"]["lat"])); s_second = MapHelper.GetScreenLocationByLatLng(second, center, zoom, screen_size); if (new Rectangle(new Point(0, 0), screen_size).Contains(s_first) || new Rectangle(new Point(0, 0), screen_size).Contains(s_second)) //在屏幕范围内 g.DrawLine(p, s_first, s_second); //最后一点 } } } if (HighlightPath != null) { using (Pen p3 = new Pen(Color.FromArgb(250, Color.Red), 6)) { p3.StartCap = System.Drawing.Drawing2D.LineCap.Round; //连接圆滑 p3.EndCap = System.Drawing.Drawing2D.LineCap.Round; p3.LineJoin = System.Drawing.Drawing2D.LineJoin.Round; string[] points = HighlightPath.Split(';'); //高亮部分中的点 for (int i = points.Length - 1; i > 0; --i) { first = new LatLngPoint(double.Parse(points[i - 1].Split(',')[0]), double.Parse(points[i - 1].Split(',')[1])); second = new LatLngPoint(double.Parse(points[i].Split(',')[0]), double.Parse(points[i].Split(',')[1])); s_first = MapHelper.GetScreenLocationByLatLng(first, center, zoom, screen_size); s_second = MapHelper.GetScreenLocationByLatLng(second, center, zoom, screen_size); if (new Rectangle(new Point(0, 0), screen_size).Contains(s_first) || new Rectangle(new Point(0, 0), screen_size).Contains(s_second)) //在屏幕范围内 g.DrawLine(p3, s_first, s_second); } } } } } } } ================================================ FILE: BMap.NET.WindowsForm/BMapElements/BTile.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; using BMap.NET.HTTPService; using System.ComponentModel; using System.Windows.Forms; using System.Threading; namespace BMap.NET.WindowsForm.BMapElements { /// /// 地图瓦片 /// public class BTile : BMapElement { static BTile() { int minWorker, minIOC; // 设置线程池最小线程数目 ThreadPool.GetMinThreads(out minWorker, out minIOC); ThreadPool.SetMinThreads(100, minIOC); } /// /// 瓦片X坐标 /// public int X { get; set; } /// /// 瓦片Y坐标 /// public int Y { get; set; } /// /// 当前地图缩放级别 /// public int Zoom { set; get; } /// /// 当前所在地图控件 /// public Control BMapControl { get; set; } private MapMode _mode; /// /// 地图模式 /// [DefaultValue(MapMode.Normal)] public MapMode Mode { get { return _mode; } set { if (value != _mode) { _mode = value; } } } private LoadMapMode _loadMode; /// /// 瓦片加载模式 /// [DefaultValue(LoadMapMode.CacheServer)] public LoadMapMode LoadMode { get { return _loadMode; } set { if (_loadMode != value) { _loadMode = value; _loading = false; _load_error = false; _normal = null; _sate = null; _road_net = null; } } } private Bitmap _normal; private Bitmap _sate; private Bitmap _road_net; private bool _loading = false; private bool _load_error = false; /// /// 构造方法 /// /// /// /// /// /// /// public BTile(int x, int y, int z, Control parent, MapMode mode,LoadMapMode loadmode) { X = x; Y = y; Zoom = z; BMapControl = parent; Mode = mode; LoadMode = loadmode; } /// /// 绘制 /// /// /// /// /// public override void Draw(System.Drawing.Graphics g, LatLngPoint center, int zoom, Size screen_size) { //偏移处理 //LatLngPoint offset = new LatLngPoint(MapHelper.OFFSET_LNG, MapHelper.OFFSET_LAT); //PointF offset_p = MapHelper.GetLocationByLatLng(offset, zoom); PointF center_p = MapHelper.GetLocationByLatLng(center, zoom); //中心点像素坐标 PointF toleft_p = new PointF(X * 256, (Y + 1) * 256); //瓦片左上角像素坐标 PointF p = new PointF((int)(screen_size.Width / 2 + (toleft_p.X - center_p.X)), (int)(screen_size.Height / 2 + (toleft_p.Y - center_p.Y) * (-1))); //屏幕坐标 //在绘制范围之内 if (!new Rectangle(-256, -256, screen_size.Width + 256, screen_size.Height + 256).Contains(new Point((int)p.X, (int)p.Y))) { return; } if (Mode == MapMode.Normal && _normal == null && !_loading) //开始下载普通瓦片 { _loading = true; if (!_load_error) ((Action)(delegate() { MapService ms = new MapService(); _normal = ms.LoadMapTile(X, Y, Zoom, Mode, LoadMode); _loading = false; if (_normal == null) { _load_error = true; } BMapControl.Invoke((Action)delegate() { BMapControl.Invalidate(); }); })).BeginInvoke(null, null); } if (Mode == MapMode.RoadNet && _road_net == null && !_loading) //开始下载道路网瓦片 { _loading = true; if (!_load_error) ((Action)(delegate() { MapService ms = new MapService(); _road_net = ms.LoadMapTile(X, Y, Zoom, Mode, LoadMode); _loading = false; if (_road_net == null) { _load_error = true; } BMapControl.Invoke((Action)delegate() { BMapControl.Invalidate(); }); })).BeginInvoke(null, null); } if (Mode == MapMode.Satellite && _sate == null && !_loading) //开始下载卫星图瓦片 { _loading = true; if (!_load_error) ((Action)(delegate() { MapService ms = new MapService(); _sate = ms.LoadMapTile(X, Y, Zoom, Mode, LoadMode); _loading = false; if (_sate == null) { _load_error = true; } BMapControl.Invoke((Action)delegate() { BMapControl.Invalidate(); }); })).BeginInvoke(null, null); } if (Mode == MapMode.Sate_RoadNet && _sate == null && !_loading) //开始下载卫星图瓦片 { _loading = true; if (!_load_error) ((Action)(delegate() { MapService ms = new MapService(); _sate = ms.LoadMapTile(X, Y, Zoom, MapMode.Satellite, LoadMode); _loading = false; if (_sate == null) { _load_error = true; } BMapControl.Invoke((Action)delegate() { BMapControl.Invalidate(); }); })).BeginInvoke(null, null); } if (Mode == MapMode.Sate_RoadNet && _road_net == null && !_loading) //开始下载道路网瓦片 { _loading = true; if (!_load_error) ((Action)(delegate() { MapService ms = new MapService(); _road_net = ms.LoadMapTile(X, Y, Zoom, MapMode.RoadNet, LoadMode); _loading = false; if (_road_net == null) { _load_error = true; } BMapControl.Invoke((Action)delegate() { BMapControl.Invalidate(); }); })).BeginInvoke(null, null); } string error = "tile loading"; if (_load_error) { error = "loading failed"; } if (Mode == MapMode.Normal) //绘制普通地图 { if (_normal == null) { g.FillRectangle(Brushes.LightGray, new RectangleF(p, new SizeF(256, 256))); g.DrawRectangle(Pens.LightGray, p.X, p.Y, 256, 256); using (Font f = new Font("微软雅黑", 9)) { g.DrawString(error, f, _load_error ? Brushes.Red : Brushes.Green, new PointF(p.X + 100, p.Y + 120)); } } else { g.DrawImage(_normal, new RectangleF(p, new SizeF(256, 256))); } } if (Mode == MapMode.RoadNet) //绘制道路网 { if (_road_net == null) { g.FillRectangle(Brushes.LightGray, new RectangleF(p, new SizeF(256, 256))); g.DrawRectangle(Pens.Gray, p.X, p.Y, 256, 256); using (Font f = new Font("微软雅黑", 10)) { g.DrawString(error, f, Brushes.Red, new PointF(p.X + 60, p.Y + 100)); } } else { g.DrawImage(_road_net, new RectangleF(p, new SizeF(256, 256))); } } if (Mode == MapMode.Satellite) //绘制卫星图 { if (_sate == null) { g.FillRectangle(Brushes.LightGray, new RectangleF(p, new SizeF(256, 256))); g.DrawRectangle(Pens.Gray, p.X, p.Y, 256, 256); using (Font f = new Font("微软雅黑", 10)) { g.DrawString(error, f, Brushes.Red, new PointF(p.X + 60, p.Y + 100)); } } else { g.DrawImage(_sate, new RectangleF(p, new SizeF(256, 256))); } } if (Mode == MapMode.Sate_RoadNet) //绘制卫星图和道路网 { if (_sate == null && _road_net == null) { g.FillRectangle(Brushes.LightGray, new RectangleF(p, new SizeF(256, 256))); g.DrawRectangle(Pens.Gray, p.X, p.Y, 256, 256); using (Font f = new Font("微软雅黑", 10)) { g.DrawString(error, f, Brushes.Red, new PointF(p.X + 60, p.Y + 100)); } } else { //先绘制卫星图 再绘制道路网 if (_sate != null) g.DrawImage(_sate, new RectangleF(p, new SizeF(256, 256))); if(_road_net != null) g.DrawImage(_road_net, new RectangleF(p, new SizeF(256, 256))); } } } } } ================================================ FILE: BMap.NET.WindowsForm/BMarkerEditorControl.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class BMarkerEditorControl { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BMarkerEditorControl)); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.picClose = new System.Windows.Forms.PictureBox(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.txtName = new System.Windows.Forms.TextBox(); this.txtRemarks = new System.Windows.Forms.TextBox(); this.btnOK = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.picClose)).BeginInit(); this.SuspendLayout(); // // label1 // this.label1.BackColor = System.Drawing.Color.LightGray; this.label1.Location = new System.Drawing.Point(1, 32); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(358, 1); this.label1.TabIndex = 1; this.label1.Text = "label1"; // // label2 // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("Microsoft YaHei", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label2.Location = new System.Drawing.Point(8, 8); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(79, 19); this.label2.TabIndex = 2; this.label2.Text = "编辑标记点"; // // picClose // this.picClose.Cursor = System.Windows.Forms.Cursors.Hand; this.picClose.Image = ((System.Drawing.Image)(resources.GetObject("picClose.Image"))); this.picClose.Location = new System.Drawing.Point(332, 9); this.picClose.Name = "picClose"; this.picClose.Size = new System.Drawing.Size(13, 14); this.picClose.TabIndex = 3; this.picClose.TabStop = false; this.picClose.Click += new System.EventHandler(this.picClose_Click); // // label3 // this.label3.AutoSize = true; this.label3.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label3.Location = new System.Drawing.Point(10, 47); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(32, 17); this.label3.TabIndex = 4; this.label3.Text = "名称"; // // label4 // this.label4.AutoSize = true; this.label4.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label4.Location = new System.Drawing.Point(10, 77); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(32, 17); this.label4.TabIndex = 5; this.label4.Text = "备注"; // // txtName // this.txtName.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtName.Location = new System.Drawing.Point(45, 45); this.txtName.Name = "txtName"; this.txtName.Size = new System.Drawing.Size(276, 23); this.txtName.TabIndex = 6; // // txtRemarks // this.txtRemarks.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtRemarks.Location = new System.Drawing.Point(45, 79); this.txtRemarks.Multiline = true; this.txtRemarks.Name = "txtRemarks"; this.txtRemarks.Size = new System.Drawing.Size(276, 76); this.txtRemarks.TabIndex = 7; // // btnOK // this.btnOK.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnOK.Location = new System.Drawing.Point(166, 165); this.btnOK.Name = "btnOK"; this.btnOK.Size = new System.Drawing.Size(75, 23); this.btnOK.TabIndex = 8; this.btnOK.Text = "保存"; this.btnOK.UseVisualStyleBackColor = true; this.btnOK.Click += new System.EventHandler(this.btnOK_Click); // // btnCancel // this.btnCancel.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnCancel.Location = new System.Drawing.Point(247, 165); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(75, 23); this.btnCancel.TabIndex = 9; this.btnCancel.Text = "取消"; this.btnCancel.UseVisualStyleBackColor = true; this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); // // BMarkerEditorControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnOK); this.Controls.Add(this.txtRemarks); this.Controls.Add(this.txtName); this.Controls.Add(this.label4); this.Controls.Add(this.label3); this.Controls.Add(this.picClose); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Name = "BMarkerEditorControl"; this.Size = new System.Drawing.Size(360, 247); this.Load += new System.EventHandler(this.BMarkerEditorControl_Load); this.Paint += new System.Windows.Forms.PaintEventHandler(this.BMarkerEditorControl_Paint); ((System.ComponentModel.ISupportInitialize)(this.picClose)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.PictureBox picClose; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; private System.Windows.Forms.TextBox txtName; private System.Windows.Forms.TextBox txtRemarks; private System.Windows.Forms.Button btnOK; private System.Windows.Forms.Button btnCancel; } } ================================================ FILE: BMap.NET.WindowsForm/BMarkerEditorControl.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using System.Drawing.Drawing2D; using BMap.NET.WindowsForm.BMapElements; namespace BMap.NET.WindowsForm { /// /// 标记点信息编辑控件 /// partial class BMarkerEditorControl : UserControl { /// /// 只是是否已保存 /// public bool Saved { get; set; } private BMarker _marker; /// /// 与之对应的标记点 /// public BMarker Marker { get { return _marker; } set { _marker = value; txtName.Text = _marker.Name; txtRemarks.Text = _marker.Remarks; } } /// /// 构造方法 /// public BMarkerEditorControl() { InitializeComponent(); } #region 事件处理 /// /// 加载 /// /// /// private void BMarkerEditorControl_Load(object sender, EventArgs e) { //显示形状 GraphicsPath gp = new GraphicsPath(); gp.AddLine(new Point(0, 0), new Point(Width, 0)); gp.AddLine(new Point(Width, 0), new Point(Width, Height - 40)); gp.AddLine(new Point(Width / 3 + 20, Height - 40), new Point(Width, Height - 40)); gp.AddLine(new Point(Width / 3 + 20, Height - 40), new Point(Width / 3 - 40, Height)); gp.AddLine(new Point(Width / 3 - 40, Height), new Point(Width / 3 - 20, Height - 40)); gp.AddLine(new Point(Width / 3 - 20, Height - 40), new Point(0, Height - 40)); this.Region = new Region(gp); } /// /// 重绘 /// /// /// private void BMarkerEditorControl_Paint(object sender, PaintEventArgs e) { e.Graphics.SmoothingMode = SmoothingMode.HighQuality; //边框 GraphicsPath gp = new GraphicsPath(); gp.AddLine(new Point(0, 0), new Point(Width - 1, 0)); gp.AddLine(new Point(Width - 1, 0), new Point(Width - 1, Height - 40 - 1)); gp.AddLine(new Point(Width / 3 + 20 - 1, Height - 40 - 1), new Point(Width - 1, Height - 40 - 1)); gp.AddLine(new Point(Width / 3 + 20 - 1, Height - 40 - 1), new Point(Width / 3 - 40, Height - 1)); gp.AddLine(new Point(Width / 3 - 40, Height - 1), new Point(Width / 3 - 20 + 1, Height - 40 - 1)); gp.AddLine(new Point(Width / 3 - 20 + 1, Height - 40 - 1), new Point(0, Height - 40 - 1)); gp.AddLine(new Point(0, 0), new Point(0, Height - 40 - 1)); e.Graphics.DrawPath(Pens.Gray, gp); } /// /// 点击关闭 /// /// /// private void picClose_Click(object sender, EventArgs e) { Visible = false; } /// /// 确定 /// /// /// private void btnOK_Click(object sender, EventArgs e) { _marker.Name = txtName.Text; _marker.Remarks = txtRemarks.Text; Saved = true; Visible = false; } /// /// 取消 /// /// /// private void btnCancel_Click(object sender, EventArgs e) { Visible = false; } #endregion } } ================================================ FILE: BMap.NET.WindowsForm/BMarkerEditorControl.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 R0lGODlhDQANAIEBAAkkPP///wAAAAAAACH/C05FVFNDQVBFMi4wAwEBAAAh+QQBAAABACwAAAAADQAN AAAIMQADBABAsGBBgQMNKgSQcKFDhg0FLkQIsaFBhBIfUtSI0SHFjRcjWnx4kSRBkBMDBAQAOw== ================================================ FILE: BMap.NET.WindowsForm/BMarkerTipControl.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class BMarkerTipControl { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BMarkerTipControl)); this.label1 = new System.Windows.Forms.Label(); this.lblName = new System.Windows.Forms.Label(); this.picClose = new System.Windows.Forms.PictureBox(); this.picEdit = new System.Windows.Forms.PictureBox(); this.picDelete = new System.Windows.Forms.PictureBox(); this.txtRemarks = new System.Windows.Forms.TextBox(); this.lnknearby_bus_station = new System.Windows.Forms.LinkLabel(); this.lnknearby_hospital = new System.Windows.Forms.LinkLabel(); this.lnknearby_bank = new System.Windows.Forms.LinkLabel(); this.lnknearby_eatting = new System.Windows.Forms.LinkLabel(); this.lnknearby_hotel = new System.Windows.Forms.LinkLabel(); this.btnsearch = new System.Windows.Forms.Button(); this.txtNearby = new System.Windows.Forms.TextBox(); this.lblPlace = new System.Windows.Forms.Label(); this.btndriving = new System.Windows.Forms.Button(); this.btntransit = new System.Windows.Forms.Button(); this.bPlaceBox = new BMap.NET.WindowsForm.BPlaceBox(); ((System.ComponentModel.ISupportInitialize)(this.picClose)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picEdit)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picDelete)).BeginInit(); this.SuspendLayout(); // // label1 // this.label1.BackColor = System.Drawing.Color.LightGray; this.label1.Location = new System.Drawing.Point(1, 32); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(358, 1); this.label1.TabIndex = 2; this.label1.Text = "label1"; // // lblName // this.lblName.AutoSize = true; this.lblName.Font = new System.Drawing.Font("Microsoft YaHei", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblName.Location = new System.Drawing.Point(8, 7); this.lblName.Name = "lblName"; this.lblName.Size = new System.Drawing.Size(79, 19); this.lblName.TabIndex = 3; this.lblName.Text = "标记点名称"; // // picClose // this.picClose.Cursor = System.Windows.Forms.Cursors.Hand; this.picClose.Image = ((System.Drawing.Image)(resources.GetObject("picClose.Image"))); this.picClose.Location = new System.Drawing.Point(334, 9); this.picClose.Name = "picClose"; this.picClose.Size = new System.Drawing.Size(13, 14); this.picClose.TabIndex = 4; this.picClose.TabStop = false; this.picClose.Click += new System.EventHandler(this.picClose_Click); // // picEdit // this.picEdit.Cursor = System.Windows.Forms.Cursors.Hand; this.picEdit.Image = ((System.Drawing.Image)(resources.GetObject("picEdit.Image"))); this.picEdit.Location = new System.Drawing.Point(290, 9); this.picEdit.Name = "picEdit"; this.picEdit.Size = new System.Drawing.Size(14, 14); this.picEdit.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.picEdit.TabIndex = 5; this.picEdit.TabStop = false; this.picEdit.Click += new System.EventHandler(this.picEdit_Click); // // picDelete // this.picDelete.Cursor = System.Windows.Forms.Cursors.Hand; this.picDelete.Image = ((System.Drawing.Image)(resources.GetObject("picDelete.Image"))); this.picDelete.Location = new System.Drawing.Point(306, 9); this.picDelete.Name = "picDelete"; this.picDelete.Size = new System.Drawing.Size(14, 14); this.picDelete.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.picDelete.TabIndex = 6; this.picDelete.TabStop = false; this.picDelete.Click += new System.EventHandler(this.picDelete_Click); // // txtRemarks // this.txtRemarks.BackColor = System.Drawing.Color.White; this.txtRemarks.BorderStyle = System.Windows.Forms.BorderStyle.None; this.txtRemarks.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtRemarks.Location = new System.Drawing.Point(12, 47); this.txtRemarks.Multiline = true; this.txtRemarks.Name = "txtRemarks"; this.txtRemarks.ReadOnly = true; this.txtRemarks.Size = new System.Drawing.Size(324, 65); this.txtRemarks.TabIndex = 7; // // lnknearby_bus_station // this.lnknearby_bus_station.AutoSize = true; this.lnknearby_bus_station.Location = new System.Drawing.Point(309, 186); this.lnknearby_bus_station.Name = "lnknearby_bus_station"; this.lnknearby_bus_station.Size = new System.Drawing.Size(41, 12); this.lnknearby_bus_station.TabIndex = 33; this.lnknearby_bus_station.TabStop = true; this.lnknearby_bus_station.Text = "公交站"; this.lnknearby_bus_station.Visible = false; this.lnknearby_bus_station.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnk_LinkClicked); // // lnknearby_hospital // this.lnknearby_hospital.AutoSize = true; this.lnknearby_hospital.Location = new System.Drawing.Point(274, 186); this.lnknearby_hospital.Name = "lnknearby_hospital"; this.lnknearby_hospital.Size = new System.Drawing.Size(29, 12); this.lnknearby_hospital.TabIndex = 32; this.lnknearby_hospital.TabStop = true; this.lnknearby_hospital.Text = "医院"; this.lnknearby_hospital.Visible = false; this.lnknearby_hospital.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnk_LinkClicked); // // lnknearby_bank // this.lnknearby_bank.AutoSize = true; this.lnknearby_bank.Location = new System.Drawing.Point(239, 186); this.lnknearby_bank.Name = "lnknearby_bank"; this.lnknearby_bank.Size = new System.Drawing.Size(29, 12); this.lnknearby_bank.TabIndex = 31; this.lnknearby_bank.TabStop = true; this.lnknearby_bank.Text = "银行"; this.lnknearby_bank.Visible = false; this.lnknearby_bank.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnk_LinkClicked); // // lnknearby_eatting // this.lnknearby_eatting.AutoSize = true; this.lnknearby_eatting.Location = new System.Drawing.Point(204, 186); this.lnknearby_eatting.Name = "lnknearby_eatting"; this.lnknearby_eatting.Size = new System.Drawing.Size(29, 12); this.lnknearby_eatting.TabIndex = 30; this.lnknearby_eatting.TabStop = true; this.lnknearby_eatting.Text = "餐馆"; this.lnknearby_eatting.Visible = false; this.lnknearby_eatting.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnk_LinkClicked); // // lnknearby_hotel // this.lnknearby_hotel.AutoSize = true; this.lnknearby_hotel.Location = new System.Drawing.Point(169, 186); this.lnknearby_hotel.Name = "lnknearby_hotel"; this.lnknearby_hotel.Size = new System.Drawing.Size(29, 12); this.lnknearby_hotel.TabIndex = 29; this.lnknearby_hotel.TabStop = true; this.lnknearby_hotel.Text = "酒店"; this.lnknearby_hotel.Visible = false; this.lnknearby_hotel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnk_LinkClicked); // // btnsearch // this.btnsearch.Location = new System.Drawing.Point(116, 181); this.btnsearch.Name = "btnsearch"; this.btnsearch.Size = new System.Drawing.Size(43, 23); this.btnsearch.TabIndex = 28; this.btnsearch.Text = "搜索"; this.btnsearch.UseVisualStyleBackColor = true; this.btnsearch.Visible = false; this.btnsearch.Click += new System.EventHandler(this.btnsearch_Click); // // txtNearby // this.txtNearby.Location = new System.Drawing.Point(10, 182); this.txtNearby.Name = "txtNearby"; this.txtNearby.Size = new System.Drawing.Size(100, 21); this.txtNearby.TabIndex = 27; this.txtNearby.Visible = false; // // lblPlace // this.lblPlace.AutoSize = true; this.lblPlace.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblPlace.ForeColor = System.Drawing.Color.Gray; this.lblPlace.Location = new System.Drawing.Point(8, 156); this.lblPlace.Name = "lblPlace"; this.lblPlace.Size = new System.Drawing.Size(32, 17); this.lblPlace.TabIndex = 26; this.lblPlace.Text = "起点"; // // btndriving // this.btndriving.Cursor = System.Windows.Forms.Cursors.Hand; this.btndriving.Location = new System.Drawing.Point(300, 153); this.btndriving.Name = "btndriving"; this.btndriving.Size = new System.Drawing.Size(52, 23); this.btndriving.TabIndex = 25; this.btndriving.Text = "驾车"; this.btndriving.UseVisualStyleBackColor = true; this.btndriving.Click += new System.EventHandler(this.btndriving_Click); // // btntransit // this.btntransit.Cursor = System.Windows.Forms.Cursors.Hand; this.btntransit.Location = new System.Drawing.Point(241, 153); this.btntransit.Name = "btntransit"; this.btntransit.Size = new System.Drawing.Size(54, 23); this.btntransit.TabIndex = 24; this.btntransit.Text = "公交"; this.btntransit.UseVisualStyleBackColor = true; this.btntransit.Click += new System.EventHandler(this.btntransit_Click); // // bPlaceBox // this.bPlaceBox.BPlacesBoard = null; this.bPlaceBox.CurrentCity = "天津"; this.bPlaceBox.Enter2Search = false; this.bPlaceBox.InputFont = new System.Drawing.Font("Microsoft YaHei", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.bPlaceBox.Location = new System.Drawing.Point(42, 154); this.bPlaceBox.Name = "bPlaceBox"; this.bPlaceBox.QueryText = ""; this.bPlaceBox.Size = new System.Drawing.Size(193, 21); this.bPlaceBox.TabIndex = 23; // // BMarkerTipControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.lnknearby_bus_station); this.Controls.Add(this.lnknearby_hospital); this.Controls.Add(this.lnknearby_bank); this.Controls.Add(this.lnknearby_eatting); this.Controls.Add(this.lnknearby_hotel); this.Controls.Add(this.btnsearch); this.Controls.Add(this.txtNearby); this.Controls.Add(this.lblPlace); this.Controls.Add(this.btndriving); this.Controls.Add(this.btntransit); this.Controls.Add(this.bPlaceBox); this.Controls.Add(this.txtRemarks); this.Controls.Add(this.picDelete); this.Controls.Add(this.picEdit); this.Controls.Add(this.picClose); this.Controls.Add(this.lblName); this.Controls.Add(this.label1); this.Name = "BMarkerTipControl"; this.Size = new System.Drawing.Size(360, 229); this.Load += new System.EventHandler(this.BMarkerTipControl_Load); this.Click += new System.EventHandler(this.BMarkerTipControl_Click); this.Paint += new System.Windows.Forms.PaintEventHandler(this.BMarkerTipControl_Paint); this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.BMarkerTipControl_MouseMove); ((System.ComponentModel.ISupportInitialize)(this.picClose)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picEdit)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picDelete)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.Label lblName; private System.Windows.Forms.PictureBox picClose; private System.Windows.Forms.PictureBox picEdit; private System.Windows.Forms.PictureBox picDelete; private System.Windows.Forms.TextBox txtRemarks; private System.Windows.Forms.LinkLabel lnknearby_bus_station; private System.Windows.Forms.LinkLabel lnknearby_hospital; private System.Windows.Forms.LinkLabel lnknearby_bank; private System.Windows.Forms.LinkLabel lnknearby_eatting; private System.Windows.Forms.LinkLabel lnknearby_hotel; private System.Windows.Forms.Button btnsearch; private System.Windows.Forms.TextBox txtNearby; private System.Windows.Forms.Label lblPlace; private System.Windows.Forms.Button btndriving; private System.Windows.Forms.Button btntransit; private BPlaceBox bPlaceBox; } } ================================================ FILE: BMap.NET.WindowsForm/BMarkerTipControl.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using System.Drawing.Drawing2D; using BMap.NET.WindowsForm.BMapElements; namespace BMap.NET.WindowsForm { /// /// 标记点信息显示控件 /// partial class BMarkerTipControl : UserControl { public event SearchNearbyStartedEventHandler SearchNearbyStarted; public event DirectionStartedEventHandler DirecttionStarted; /// /// 选项卡 /// int _tab_index = 0; private BMarker _marker; /// /// 与之对应的标记点 /// public BMarker Marker { get { return _marker; } set { _marker = value; lblName.Text = _marker.Name; txtRemarks.Text = _marker.Remarks; } } /// /// 是否已点击删除 /// public bool Deleted { get; set; } /// /// 是否已点击编辑 /// public bool Edited { get; set; } /// /// 当前建议搜索城市 /// public string CurrentCity { get { return bPlaceBox.CurrentCity; } set { bPlaceBox.CurrentCity = value; } } /// /// 构造方法 /// public BMarkerTipControl() { InitializeComponent(); SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); UpdateStyles(); } #region 事件处理 /// /// 编辑标记信息 /// /// /// private void picEdit_Click(object sender, EventArgs e) { Edited = true; Visible = false; } /// /// 删除标记 /// /// /// private void picDelete_Click(object sender, EventArgs e) { Deleted = true; Visible = false; } /// /// 关闭 /// /// /// private void picClose_Click(object sender, EventArgs e) { Visible = false; } /// /// 加载 /// /// /// private void BMarkerTipControl_Load(object sender, EventArgs e) { //显示形状 GraphicsPath gp = new GraphicsPath(); gp.AddLine(new Point(0, 0), new Point(Width, 0)); gp.AddLine(new Point(Width, 0), new Point(Width, Height - 40)); gp.AddLine(new Point(Width / 3 + 20, Height - 40), new Point(Width, Height - 40)); gp.AddLine(new Point(Width / 3 + 20, Height - 40), new Point(Width / 3 - 40, Height)); gp.AddLine(new Point(Width / 3 - 40, Height), new Point(Width / 3 - 20, Height - 40)); gp.AddLine(new Point(Width / 3 - 20, Height - 40), new Point(0, Height - 40)); this.Region = new Region(gp); } /// /// 重绘 /// /// /// private void BMarkerTipControl_Paint(object sender, PaintEventArgs e) { e.Graphics.SmoothingMode = SmoothingMode.HighQuality; //边框 GraphicsPath gp = new GraphicsPath(); gp.AddLine(new Point(0, 0), new Point(Width - 1, 0)); gp.AddLine(new Point(Width - 1, 0), new Point(Width - 1, Height - 40 - 1)); gp.AddLine(new Point(Width / 3 + 20 - 1, Height - 40 - 1), new Point(Width - 1, Height - 40 - 1)); gp.AddLine(new Point(Width / 3 + 20 - 1, Height - 40 - 1), new Point(Width / 3 - 40, Height - 1)); gp.AddLine(new Point(Width / 3 - 40, Height - 1), new Point(Width / 3 - 20 + 1, Height - 40 - 1)); gp.AddLine(new Point(Width / 3 - 20 + 1, Height - 40 - 1), new Point(0, Height - 40 - 1)); gp.AddLine(new Point(0, 0), new Point(0, Height - 40 - 1)); e.Graphics.DrawPath(Pens.Gray, gp); using (Pen p = new Pen(Color.FromArgb(150, Color.LightGray))) { e.Graphics.DrawLine(p, new Point(0, 130 - 15), new Point(Width, 130 - 15)); e.Graphics.DrawLine(p, new Point(Width / 3, 130 + 26 - 15), new Point(Width / 3, 130 - 15)); e.Graphics.DrawLine(p, new Point(Width * 2 / 3, 130 + 26 - 15), new Point(Width * 2 / 3, 130 - 15)); e.Graphics.DrawImage(Properties.BMap.ico_destination, new Point(10, 130 + 5 - 15)); e.Graphics.DrawImage(Properties.BMap.ico_source, new Point(Width / 3 + 10, 130 + 5 - 15)); e.Graphics.DrawImage(Properties.BMap.ico_search_in_bound, new Rectangle(Width * 2 / 3 + 10, 130 + 5 - 15, 18, 18)); using (Font f = new Font("微软雅黑", 9)) { if (_tab_index == 0) //到这里去 { e.Graphics.DrawLine(p, new Point(Width / 3, 130 + 26 - 15), new Point(Width, 130 + 26 - 15)); e.Graphics.DrawString("到这里去", f, Brushes.Gray, new PointF(25, 130 + 5 - 15)); e.Graphics.DrawString("从这里出发", f, Brushes.Blue, new PointF(Width / 3 + 25, 130 + 5 - 15)); e.Graphics.DrawString("周边搜索", f, Brushes.Blue, new PointF(Width * 2 / 3 + 25, 130 + 5 - 15)); } else if (_tab_index == 1) //从这里出发 { e.Graphics.DrawLine(p, new Point(0, 130 + 26 - 15), new Point(Width / 3, 130 + 26 - 15)); e.Graphics.DrawLine(p, new Point(Width * 2 / 3, 130 + 26 - 15), new Point(Width, 130 + 26 - 15)); e.Graphics.DrawString("到这里去", f, Brushes.Blue, new PointF(25, 130 + 5 - 15)); e.Graphics.DrawString("从这里出发", f, Brushes.Gray, new PointF(Width / 3 + 25, 130 + 5 - 15)); e.Graphics.DrawString("周边搜索", f, Brushes.Blue, new PointF(Width * 2 / 3 + 25, 130 + 5 - 15)); } else //周边搜索 { e.Graphics.DrawLine(p, new Point(0, 130 + 26 - 15), new Point(Width * 2 / 3, 130 + 26 - 15)); e.Graphics.DrawString("到这里去", f, Brushes.Blue, new PointF(25, 130 + 5 - 15)); e.Graphics.DrawString("从这里出发", f, Brushes.Blue, new PointF(Width / 3 + 25, 130 + 5 - 15)); e.Graphics.DrawString("周边搜索", f, Brushes.Gray, new PointF(Width * 2 / 3 + 25, 130 + 5 - 15)); } } } } /// /// 鼠标移动 /// /// /// private void BMarkerTipControl_MouseMove(object sender, MouseEventArgs e) { if (new Rectangle(0, 130 - 15, Width, 26).Contains(e.Location)) { Cursor = Cursors.Hand; } else { Cursor = Cursors.Arrow; } } /// /// 点击选项卡 /// /// /// private void BMarkerTipControl_Click(object sender, EventArgs e) { Point p = PointToClient(Cursor.Position); if (new Rectangle(0, 130 - 15, Width / 3, 26).Contains(p)) //到这里去 { _tab_index = 0; lblPlace.Text = "起点"; lblPlace.Visible = true; bPlaceBox.Visible = true; btndriving.Visible = true; btntransit.Visible = true; txtNearby.Visible = false; btnsearch.Visible = false; lnknearby_bank.Visible = false; lnknearby_bus_station.Visible = false; lnknearby_eatting.Visible = false; lnknearby_hospital.Visible = false; lnknearby_hotel.Visible = false; } if (new Rectangle(Width / 3, 130 - 15, Width / 3, 26).Contains(p)) //从这里出发 { _tab_index = 1; lblPlace.Text = "终点"; lblPlace.Visible = true; bPlaceBox.Visible = true; btndriving.Visible = true; btntransit.Visible = true; txtNearby.Visible = false; btnsearch.Visible = false; lnknearby_bank.Visible = false; lnknearby_bus_station.Visible = false; lnknearby_eatting.Visible = false; lnknearby_hospital.Visible = false; lnknearby_hotel.Visible = false; } if (new Rectangle(Width * 2 / 3, 130 - 15, Width / 3, 26).Contains(p)) //周边搜索 { _tab_index = 2; lblPlace.Visible = false; bPlaceBox.Visible = false; btndriving.Visible = false; btntransit.Visible = false; txtNearby.Visible = true; btnsearch.Visible = true; lnknearby_bank.Visible = true; lnknearby_bus_station.Visible = true; lnknearby_eatting.Visible = true; lnknearby_hospital.Visible = true; lnknearby_hotel.Visible = true; lnknearby_bank.Location = new Point(lnknearby_bank.Location.X, 232 - 15 - 54); lnknearby_bus_station.Location = new Point(lnknearby_bus_station.Location.X, 232 - 15 - 54); lnknearby_eatting.Location = new Point(lnknearby_eatting.Location.X, 232 - 15 - 54); lnknearby_hospital.Location = new Point(lnknearby_hospital.Location.X, 232 - 15 - 54); lnknearby_hotel.Location = new Point(lnknearby_hotel.Location.X, 232 - 15 - 54); btnsearch.Location = new Point(btnsearch.Location.X, 225 - 15 - 54); txtNearby.Location = new Point(txtNearby.Location.X, 226 - 15 - 54); } Invalidate(); } /// /// 搜索周边 /// /// /// private void btnsearch_Click(object sender, EventArgs e) { if (SearchNearbyStarted != null && txtNearby.Text != "") { SearchNearbyStarted(txtNearby.Text, _marker.Location); } } /// /// 公交 /// /// /// private void btntransit_Click(object sender, EventArgs e) { if (DirecttionStarted != null) { if (_tab_index == 0) //到这里去 { DirecttionStarted(bPlaceBox.QueryText, _marker.Address, RouteType.Transit); } else //从这里出发 { DirecttionStarted(_marker.Address, bPlaceBox.QueryText, RouteType.Transit); } } } /// /// 驾车 /// /// /// private void btndriving_Click(object sender, EventArgs e) { if (DirecttionStarted != null && bPlaceBox.QueryText != "") { if (_tab_index == 0) //到这里去 { DirecttionStarted(bPlaceBox.QueryText, _marker.Address, RouteType.Driving); } else //从这里出发 { DirecttionStarted(_marker.Address, bPlaceBox.QueryText, RouteType.Driving); } } } /// /// 快速搜索周边 /// /// /// private void lnk_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (SearchNearbyStarted != null) { SearchNearbyStarted((sender as LinkLabel).Text, _marker.Location); } } #endregion } } ================================================ FILE: BMap.NET.WindowsForm/BMarkerTipControl.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 R0lGODlhDQANAIEBAAkkPP///wAAAAAAACH/C05FVFNDQVBFMi4wAwEBAAAh+QQBAAABACwAAAAADQAN AAAIMQADBABAsGBBgQMNKgSQcKFDhg0FLkQIsaFBhBIfUtSI0SHFjRcjWnx4kSRBkBMDBAQAOw== iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAIAAADZrBkAAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO vwAADr8BOAVTJAAAAHpJREFUOE9j+EkWGGzaCqfdBiIoBwYIaANquPP0G4QBEYEAfNqAStcdfg3XgKwT pza4HggC2klYG5qepXtfIOsBAizaCOoBAnRtxOgBAhRtROoBAoQ2uGoIwqMHCFC0QUiCeoAA3TZkBh6A 3ZFQIdwAJUiIB/TU9vMnAAJ9dlDhEyA8AAAAAElFTkSuQmCC iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAIAAADZrBkAAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO vwAADr8BOAVTJAAAAGtJREFUOE/FkMENgDAMA1mZZViOSfIjCm4J6T0QIDj50dqxonayW/xbm5dVp8Ro nmoe79I9QPOo9TgPoenwNpSGAngbSnGj1pxScClIvFQrhS7FjcdfgkNoOrxN9wBNeJtOidGstYt8WTPb ADBiWqahAo/nAAAAAElFTkSuQmCC ================================================ FILE: BMap.NET.WindowsForm/BPOITipControl.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class BPOITipControl { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BPOITipControl)); this.label1 = new System.Windows.Forms.Label(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.lnkName = new System.Windows.Forms.LinkLabel(); this.piclogo = new System.Windows.Forms.PictureBox(); this.txtAddress = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.txtPhone = new System.Windows.Forms.TextBox(); this.txtTag = new System.Windows.Forms.TextBox(); this.txtPrice = new System.Windows.Forms.TextBox(); this.btntransit = new System.Windows.Forms.Button(); this.btndriving = new System.Windows.Forms.Button(); this.lblPlace = new System.Windows.Forms.Label(); this.txtNearby = new System.Windows.Forms.TextBox(); this.btnsearch = new System.Windows.Forms.Button(); this.lnknearby_hotel = new System.Windows.Forms.LinkLabel(); this.lnknearby_eatting = new System.Windows.Forms.LinkLabel(); this.lnknearby_bank = new System.Windows.Forms.LinkLabel(); this.lnknearby_hospital = new System.Windows.Forms.LinkLabel(); this.lnknearby_bus_station = new System.Windows.Forms.LinkLabel(); this.bPlaceBox = new BMap.NET.WindowsForm.BPlaceBox(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.piclogo)).BeginInit(); this.SuspendLayout(); // // label1 // this.label1.BackColor = System.Drawing.Color.LightGray; this.label1.Location = new System.Drawing.Point(1, 32); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(358, 1); this.label1.TabIndex = 0; this.label1.Text = "label1"; // // pictureBox1 // this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Hand; this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); this.pictureBox1.Location = new System.Drawing.Point(338, 9); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(13, 14); this.pictureBox1.TabIndex = 1; this.pictureBox1.TabStop = false; this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click); // // lnkName // this.lnkName.AutoSize = true; this.lnkName.Font = new System.Drawing.Font("Microsoft YaHei", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lnkName.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; this.lnkName.Location = new System.Drawing.Point(5, 6); this.lnkName.Name = "lnkName"; this.lnkName.Size = new System.Drawing.Size(93, 19); this.lnkName.TabIndex = 2; this.lnkName.TabStop = true; this.lnkName.Text = "天津城建大学"; this.lnkName.VisitedLinkColor = System.Drawing.Color.Blue; // // piclogo // this.piclogo.Image = ((System.Drawing.Image)(resources.GetObject("piclogo.Image"))); this.piclogo.Location = new System.Drawing.Point(9, 41); this.piclogo.Name = "piclogo"; this.piclogo.Size = new System.Drawing.Size(342, 63); this.piclogo.TabIndex = 5; this.piclogo.TabStop = false; this.piclogo.Paint += new System.Windows.Forms.PaintEventHandler(this.piclogo_Paint); // // txtAddress // this.txtAddress.BackColor = System.Drawing.Color.White; this.txtAddress.BorderStyle = System.Windows.Forms.BorderStyle.None; this.txtAddress.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtAddress.ForeColor = System.Drawing.Color.Gray; this.txtAddress.Location = new System.Drawing.Point(42, 108); this.txtAddress.Name = "txtAddress"; this.txtAddress.ReadOnly = true; this.txtAddress.Size = new System.Drawing.Size(308, 16); this.txtAddress.TabIndex = 6; this.txtAddress.Text = "阿斯顿发阿斯顿发生\r\n阿斯顿发"; // // label2 // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label2.ForeColor = System.Drawing.Color.Gray; this.label2.Location = new System.Drawing.Point(7, 108); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(35, 17); this.label2.TabIndex = 7; this.label2.Text = "地址:"; // // label3 // this.label3.AutoSize = true; this.label3.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label3.ForeColor = System.Drawing.Color.Gray; this.label3.Location = new System.Drawing.Point(7, 129); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(35, 17); this.label3.TabIndex = 9; this.label3.Text = "电话:"; // // txtPhone // this.txtPhone.BackColor = System.Drawing.Color.White; this.txtPhone.BorderStyle = System.Windows.Forms.BorderStyle.None; this.txtPhone.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtPhone.ForeColor = System.Drawing.Color.Gray; this.txtPhone.Location = new System.Drawing.Point(41, 129); this.txtPhone.Name = "txtPhone"; this.txtPhone.ReadOnly = true; this.txtPhone.Size = new System.Drawing.Size(311, 16); this.txtPhone.TabIndex = 8; this.txtPhone.Text = "123"; // // txtTag // this.txtTag.BackColor = System.Drawing.Color.White; this.txtTag.BorderStyle = System.Windows.Forms.BorderStyle.None; this.txtTag.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtTag.ForeColor = System.Drawing.Color.Gray; this.txtTag.Location = new System.Drawing.Point(10, 152); this.txtTag.Name = "txtTag"; this.txtTag.ReadOnly = true; this.txtTag.Size = new System.Drawing.Size(212, 16); this.txtTag.TabIndex = 10; this.txtTag.Text = "餐饮;美食"; // // txtPrice // this.txtPrice.BackColor = System.Drawing.Color.White; this.txtPrice.BorderStyle = System.Windows.Forms.BorderStyle.None; this.txtPrice.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtPrice.ForeColor = System.Drawing.Color.Red; this.txtPrice.Location = new System.Drawing.Point(239, 152); this.txtPrice.Name = "txtPrice"; this.txtPrice.ReadOnly = true; this.txtPrice.Size = new System.Drawing.Size(112, 16); this.txtPrice.TabIndex = 11; this.txtPrice.Text = "人均 ¥23"; // // btntransit // this.btntransit.Cursor = System.Windows.Forms.Cursors.Hand; this.btntransit.Location = new System.Drawing.Point(240, 216); this.btntransit.Name = "btntransit"; this.btntransit.Size = new System.Drawing.Size(54, 23); this.btntransit.TabIndex = 13; this.btntransit.Text = "公交"; this.btntransit.UseVisualStyleBackColor = true; this.btntransit.Click += new System.EventHandler(this.btntransit_Click); // // btndriving // this.btndriving.Cursor = System.Windows.Forms.Cursors.Hand; this.btndriving.Location = new System.Drawing.Point(299, 216); this.btndriving.Name = "btndriving"; this.btndriving.Size = new System.Drawing.Size(52, 23); this.btndriving.TabIndex = 14; this.btndriving.Text = "驾车"; this.btndriving.UseVisualStyleBackColor = true; this.btndriving.Click += new System.EventHandler(this.btndriving_Click); // // lblPlace // this.lblPlace.AutoSize = true; this.lblPlace.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblPlace.ForeColor = System.Drawing.Color.Gray; this.lblPlace.Location = new System.Drawing.Point(7, 219); this.lblPlace.Name = "lblPlace"; this.lblPlace.Size = new System.Drawing.Size(32, 17); this.lblPlace.TabIndex = 15; this.lblPlace.Text = "起点"; // // txtNearby // this.txtNearby.Location = new System.Drawing.Point(9, 245); this.txtNearby.Name = "txtNearby"; this.txtNearby.Size = new System.Drawing.Size(100, 21); this.txtNearby.TabIndex = 16; this.txtNearby.Visible = false; // // btnsearch // this.btnsearch.Location = new System.Drawing.Point(115, 244); this.btnsearch.Name = "btnsearch"; this.btnsearch.Size = new System.Drawing.Size(43, 23); this.btnsearch.TabIndex = 17; this.btnsearch.Text = "搜索"; this.btnsearch.UseVisualStyleBackColor = true; this.btnsearch.Visible = false; this.btnsearch.Click += new System.EventHandler(this.btnsearch_Click); // // lnknearby_hotel // this.lnknearby_hotel.AutoSize = true; this.lnknearby_hotel.Location = new System.Drawing.Point(168, 249); this.lnknearby_hotel.Name = "lnknearby_hotel"; this.lnknearby_hotel.Size = new System.Drawing.Size(29, 12); this.lnknearby_hotel.TabIndex = 18; this.lnknearby_hotel.TabStop = true; this.lnknearby_hotel.Text = "酒店"; this.lnknearby_hotel.Visible = false; this.lnknearby_hotel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnk_LinkClicked); // // lnknearby_eatting // this.lnknearby_eatting.AutoSize = true; this.lnknearby_eatting.Location = new System.Drawing.Point(203, 249); this.lnknearby_eatting.Name = "lnknearby_eatting"; this.lnknearby_eatting.Size = new System.Drawing.Size(29, 12); this.lnknearby_eatting.TabIndex = 19; this.lnknearby_eatting.TabStop = true; this.lnknearby_eatting.Text = "餐馆"; this.lnknearby_eatting.Visible = false; this.lnknearby_eatting.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnk_LinkClicked); // // lnknearby_bank // this.lnknearby_bank.AutoSize = true; this.lnknearby_bank.Location = new System.Drawing.Point(238, 249); this.lnknearby_bank.Name = "lnknearby_bank"; this.lnknearby_bank.Size = new System.Drawing.Size(29, 12); this.lnknearby_bank.TabIndex = 20; this.lnknearby_bank.TabStop = true; this.lnknearby_bank.Text = "银行"; this.lnknearby_bank.Visible = false; this.lnknearby_bank.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnk_LinkClicked); // // lnknearby_hospital // this.lnknearby_hospital.AutoSize = true; this.lnknearby_hospital.Location = new System.Drawing.Point(273, 249); this.lnknearby_hospital.Name = "lnknearby_hospital"; this.lnknearby_hospital.Size = new System.Drawing.Size(29, 12); this.lnknearby_hospital.TabIndex = 21; this.lnknearby_hospital.TabStop = true; this.lnknearby_hospital.Text = "医院"; this.lnknearby_hospital.Visible = false; this.lnknearby_hospital.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnk_LinkClicked); // // lnknearby_bus_station // this.lnknearby_bus_station.AutoSize = true; this.lnknearby_bus_station.Location = new System.Drawing.Point(308, 249); this.lnknearby_bus_station.Name = "lnknearby_bus_station"; this.lnknearby_bus_station.Size = new System.Drawing.Size(41, 12); this.lnknearby_bus_station.TabIndex = 22; this.lnknearby_bus_station.TabStop = true; this.lnknearby_bus_station.Text = "公交站"; this.lnknearby_bus_station.Visible = false; this.lnknearby_bus_station.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnk_LinkClicked); // // bPlaceBox // this.bPlaceBox.BPlacesBoard = null; this.bPlaceBox.CurrentCity = "天津"; this.bPlaceBox.Enter2Search = false; this.bPlaceBox.InputFont = new System.Drawing.Font("Microsoft YaHei", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.bPlaceBox.Location = new System.Drawing.Point(41, 217); this.bPlaceBox.Name = "bPlaceBox"; this.bPlaceBox.QueryText = ""; this.bPlaceBox.Size = new System.Drawing.Size(193, 21); this.bPlaceBox.TabIndex = 12; // // BPOITipControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.lnknearby_bus_station); this.Controls.Add(this.lnknearby_hospital); this.Controls.Add(this.lnknearby_bank); this.Controls.Add(this.lnknearby_eatting); this.Controls.Add(this.lnknearby_hotel); this.Controls.Add(this.btnsearch); this.Controls.Add(this.txtNearby); this.Controls.Add(this.lblPlace); this.Controls.Add(this.btndriving); this.Controls.Add(this.btntransit); this.Controls.Add(this.bPlaceBox); this.Controls.Add(this.txtPrice); this.Controls.Add(this.txtTag); this.Controls.Add(this.label3); this.Controls.Add(this.txtPhone); this.Controls.Add(this.label2); this.Controls.Add(this.txtAddress); this.Controls.Add(this.piclogo); this.Controls.Add(this.lnkName); this.Controls.Add(this.pictureBox1); this.Controls.Add(this.label1); this.Name = "BPOITipControl"; this.Size = new System.Drawing.Size(360, 291); this.Load += new System.EventHandler(this.BPOITipControl_Load); this.Click += new System.EventHandler(this.BPOITipControl_Click); this.Paint += new System.Windows.Forms.PaintEventHandler(this.BPOITipControl_Paint); this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.BPOITipControl_MouseMove); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.piclogo)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.LinkLabel lnkName; private System.Windows.Forms.PictureBox piclogo; private System.Windows.Forms.TextBox txtAddress; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; private System.Windows.Forms.TextBox txtPhone; private System.Windows.Forms.TextBox txtTag; private System.Windows.Forms.TextBox txtPrice; private BPlaceBox bPlaceBox; private System.Windows.Forms.Button btntransit; private System.Windows.Forms.Button btndriving; private System.Windows.Forms.Label lblPlace; private System.Windows.Forms.TextBox txtNearby; private System.Windows.Forms.Button btnsearch; private System.Windows.Forms.LinkLabel lnknearby_hotel; private System.Windows.Forms.LinkLabel lnknearby_eatting; private System.Windows.Forms.LinkLabel lnknearby_bank; private System.Windows.Forms.LinkLabel lnknearby_hospital; private System.Windows.Forms.LinkLabel lnknearby_bus_station; } } ================================================ FILE: BMap.NET.WindowsForm/BPOITipControl.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using System.Drawing.Drawing2D; using Newtonsoft.Json.Linq; using BMap.NET.WindowsForm.BMapElements; namespace BMap.NET.WindowsForm { /// /// POI信息显示控件 /// partial class BPOITipControl : UserControl { public event SearchNearbyStartedEventHandler SearchNearbyStarted; public event DirectionStartedEventHandler DirecttionStarted; /// /// 选项卡 /// int _tab_index = 0; private BPOI _poi; /// /// 与之对应的POI /// public BPOI POI { get { return _poi; } set { _poi = value; // if (_poi.DataSource["name"] != null) lnkName.Text = (string)_poi.DataSource["name"]; //具体json格式参见api文档 if (_poi.DataSource["address"] != null) txtAddress.Text = (string)_poi.DataSource["address"]; if (_poi.DataSource["telephone"] != null) txtPhone.Text = (string)_poi.DataSource["telephone"]; if (_poi.DataSource["detail_info"] != null && _poi.DataSource["detail_info"]["price"] != null) txtPrice.Text = "人均:¥" + (string)_poi.DataSource["detail_info"]["price"]; if (_poi.DataSource["detail_info"] != null && _poi.DataSource["detail_info"]["tag"] != null) txtTag.Text = (string)_poi.DataSource["detail_info"]["tag"]; } } /// /// 当前建议搜索城市 /// public string CurrentCity { get { return bPlaceBox.CurrentCity; } set { bPlaceBox.CurrentCity = value; } } /// /// 构造方法 /// public BPOITipControl() { InitializeComponent(); SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); UpdateStyles(); } #region 事件处理 /// /// 控件加载 /// /// /// private void BPOITipControl_Load(object sender, EventArgs e) { //显示形状 GraphicsPath gp = new GraphicsPath(); gp.AddLine(new Point(0, 0), new Point(Width, 0)); gp.AddLine(new Point(Width, 0), new Point(Width, Height - 40)); gp.AddLine(new Point(Width / 3 + 20, Height - 40), new Point(Width, Height - 40)); gp.AddLine(new Point(Width / 3 + 20, Height - 40), new Point(Width / 3 - 40, Height)); gp.AddLine(new Point(Width / 3 - 40, Height), new Point(Width / 3 - 20, Height - 40)); gp.AddLine(new Point(Width / 3 - 20, Height - 40), new Point(0, Height - 40)); this.Region = new Region(gp); } /// /// 重绘 /// /// /// private void BPOITipControl_Paint(object sender, PaintEventArgs e) { e.Graphics.SmoothingMode = SmoothingMode.HighQuality; //边框 GraphicsPath gp = new GraphicsPath(); gp.AddLine(new Point(0, 0), new Point(Width - 1, 0)); gp.AddLine(new Point(Width - 1, 0), new Point(Width - 1, Height - 40 - 1)); gp.AddLine(new Point(Width / 3 + 20 - 1, Height - 40 - 1), new Point(Width - 1, Height - 40 - 1)); gp.AddLine(new Point(Width / 3 + 20 - 1, Height - 40 - 1), new Point(Width / 3 - 40, Height - 1)); gp.AddLine(new Point(Width / 3 - 40, Height - 1), new Point(Width / 3 - 20 + 1, Height - 40 - 1)); gp.AddLine(new Point(Width / 3 - 20 + 1, Height - 40 - 1), new Point(0, Height - 40 - 1)); gp.AddLine(new Point(0, 0), new Point(0, Height - 40 - 1)); e.Graphics.DrawPath(Pens.Gray, gp); using (Pen p = new Pen(Color.FromArgb(150, Color.LightGray))) { e.Graphics.DrawLine(p, new Point(0, 194 -15), new Point(Width, 194 - 15)); e.Graphics.DrawLine(p, new Point(Width / 3, 194 + 26 - 15), new Point(Width / 3, 194 - 15)); e.Graphics.DrawLine(p, new Point(Width * 2 / 3, 194 + 26 - 15), new Point(Width * 2 / 3, 194 - 15)); e.Graphics.DrawImage(Properties.BMap.ico_destination, new Point(10, 194 + 5 - 15)); e.Graphics.DrawImage(Properties.BMap.ico_source, new Point(Width / 3 + 10, 194 + 5 - 15)); e.Graphics.DrawImage(Properties.BMap.ico_search_in_bound, new Rectangle(Width * 2 / 3 + 10, 194 + 5 - 15, 18, 18)); using (Font f = new Font("微软雅黑", 9)) { if (_tab_index == 0) //到这里去 { e.Graphics.DrawLine(p, new Point(Width / 3, 194 + 26 - 15), new Point(Width, 194 + 26 - 15)); e.Graphics.DrawString("到这里去", f, Brushes.Gray, new PointF(25, 194 + 5 - 15)); e.Graphics.DrawString("从这里出发", f, Brushes.Blue, new PointF(Width / 3 + 25, 194 + 5 - 15)); e.Graphics.DrawString("周边搜索", f, Brushes.Blue, new PointF(Width * 2 / 3 + 25, 194 + 5 - 15)); } else if (_tab_index == 1) //从这里出发 { e.Graphics.DrawLine(p, new Point(0, 194 + 26 - 15), new Point(Width / 3, 194 + 26 - 15)); e.Graphics.DrawLine(p, new Point(Width * 2 / 3, 194 + 26 - 15), new Point(Width, 194 + 26 - 15)); e.Graphics.DrawString("到这里去", f, Brushes.Blue, new PointF(25, 194 + 5 - 15)); e.Graphics.DrawString("从这里出发", f, Brushes.Gray, new PointF(Width / 3 + 25, 194 + 5 - 15)); e.Graphics.DrawString("周边搜索", f, Brushes.Blue, new PointF(Width * 2 / 3 + 25, 194 + 5 - 15)); } else //周边搜索 { e.Graphics.DrawLine(p, new Point(0, 194 + 26 - 15), new Point(Width * 2 / 3, 194 + 26 - 15)); e.Graphics.DrawString("到这里去", f, Brushes.Blue, new PointF(25, 194 + 5 - 15)); e.Graphics.DrawString("从这里出发", f, Brushes.Blue, new PointF(Width / 3 + 25, 194 + 5 - 15)); e.Graphics.DrawString("周边搜索", f, Brushes.Gray, new PointF(Width * 2 / 3 + 25, 194 + 5 - 15)); } } } } /// /// 鼠标移动 /// /// /// private void BPOITipControl_MouseMove(object sender, MouseEventArgs e) { if (new Rectangle(0, 194 - 15, Width, 26).Contains(e.Location)) { Cursor = Cursors.Hand; } else { Cursor = Cursors.Arrow; } } /// /// 鼠标点击 选项卡 /// /// /// private void BPOITipControl_Click(object sender, EventArgs e) { Point p = PointToClient(Cursor.Position); if (new Rectangle(0, 194 - 15, Width / 3, 26).Contains(p)) //到这里去 { _tab_index = 0; lblPlace.Text = "起点"; lblPlace.Visible = true; bPlaceBox.Visible = true; btndriving.Visible = true; btntransit.Visible = true; txtNearby.Visible = false; btnsearch.Visible = false; lnknearby_bank.Visible = false; lnknearby_bus_station.Visible = false; lnknearby_eatting.Visible = false; lnknearby_hospital.Visible = false; lnknearby_hotel.Visible = false; } if (new Rectangle(Width / 3, 194 - 15, Width / 3, 26).Contains(p)) //从这里出发 { _tab_index = 1; lblPlace.Text = "终点"; lblPlace.Visible = true; bPlaceBox.Visible = true; btndriving.Visible = true; btntransit.Visible = true; txtNearby.Visible = false; btnsearch.Visible = false; lnknearby_bank.Visible = false; lnknearby_bus_station.Visible = false; lnknearby_eatting.Visible = false; lnknearby_hospital.Visible = false; lnknearby_hotel.Visible = false; } if (new Rectangle(Width * 2 / 3, 194 - 15, Width / 3, 26).Contains(p)) //周边搜索 { _tab_index = 2; lblPlace.Visible = false; bPlaceBox.Visible = false; btndriving.Visible = false; btntransit.Visible = false; txtNearby.Visible = true; btnsearch.Visible = true; lnknearby_bank.Visible = true; lnknearby_bus_station.Visible = true; lnknearby_eatting.Visible = true; lnknearby_hospital.Visible = true; lnknearby_hotel.Visible = true; lnknearby_bank.Location = new Point(lnknearby_bank.Location.X, 232 - 15 + 7); lnknearby_bus_station.Location = new Point(lnknearby_bus_station.Location.X, 232 - 15 + 7); lnknearby_eatting.Location = new Point(lnknearby_eatting.Location.X, 232 - 15 + 7); lnknearby_hospital.Location = new Point(lnknearby_hospital.Location.X, 232 - 15 + 7); lnknearby_hotel.Location = new Point(lnknearby_hotel.Location.X, 232 - 15 + 7); btnsearch.Location = new Point(btnsearch.Location.X, 225 - 15 + 7); txtNearby.Location = new Point(txtNearby.Location.X, 226 - 15 + 7); } Invalidate(); } /// /// 关闭 /// /// /// private void pictureBox1_Click(object sender, EventArgs e) { Visible = false; } /// /// POI界面的logo绘制 /// /// /// private void piclogo_Paint(object sender, PaintEventArgs e) { using (SolidBrush sb = new SolidBrush(Color.FromArgb(200, Color.White))) { e.Graphics.FillRectangle(sb, e.ClipRectangle); } } /// /// 公交导航 /// /// /// private void btntransit_Click(object sender, EventArgs e) { if (DirecttionStarted != null) { if (_tab_index == 0) //到这里去 { DirecttionStarted(bPlaceBox.QueryText, (string)_poi.DataSource["name"], RouteType.Transit); } else //从这里出发 { DirecttionStarted((string)_poi.DataSource["name"], bPlaceBox.QueryText, RouteType.Transit); } } } /// /// 驾车导航 /// /// /// private void btndriving_Click(object sender, EventArgs e) { if (DirecttionStarted != null && bPlaceBox.QueryText != "") { if (_tab_index == 0) //到这里去 { DirecttionStarted(bPlaceBox.QueryText, (string)_poi.DataSource["name"], RouteType.Driving); } else //从这里出发 { DirecttionStarted((string)_poi.DataSource["name"], bPlaceBox.QueryText, RouteType.Driving); } } } /// /// 周边搜索 /// /// /// private void btnsearch_Click(object sender, EventArgs e) { if (SearchNearbyStarted != null && txtNearby.Text != "") { SearchNearbyStarted(txtNearby.Text, _poi.Location); } } /// /// 快速周边搜索 /// /// /// private void lnk_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (SearchNearbyStarted != null) { SearchNearbyStarted((sender as LinkLabel).Text, _poi.Location); } } #endregion } } ================================================ FILE: BMap.NET.WindowsForm/BPOITipControl.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 R0lGODlhDQANAIEBAAkkPP///wAAAAAAACH/C05FVFNDQVBFMi4wAwEBAAAh+QQBAAABACwAAAAADQAN AAAIMQADBABAsGBBgQMNKgSQcKFDhg0FLkQIsaFBhBIfUtSI0SHFjRcjWnx4kSRBkBMDBAQAOw== iVBORw0KGgoAAAANSUhEUgAAAVYAAAA/CAIAAAA0QXfyAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO wgAADsIBFShKgAAADHBJREFUeF7tnEuPFMkRx+cD+XUd+8wHAI4s3PkAcGfOsBdbsuAOggsCzsAZzBWQ T7s8LpbNQ961LGYAyb+uf0w4JnO6J6u7uqZmOn5qlTLjlVm9GZFZNb1sfUmSZIPJEpAkG02WgCTZaLIE JMlGkyUgSTaard0kSTaYLAFJstFkCUiSjWYSJeD+/ft/rUC4WPWXN3+68vet4vPnN39c7CWONBiQMcdK kr5MogRYWlQsVhXJ75/FXsL6FaYeFAtdYeokOVayBBzA1INioStMnSTHSpaAA5h6UCx0hamT5FjJEnAA Uw+Kha4w9dq4uc+zZ88k+fDhw+PHj1++fKnuErx584ZowkSjsHhEZsV9cadXrlzhHk26GgS01mknS8AB TD0oFrrC1Gtje5/r16/TvX37trqXL1+WwRKQZgoCJtrdpaYoRY+EXDWfnjBnDUqSmyhw9uxZaYHbNOmy MEkNx82a6GDta8HcTgJZAg5g6kGx0BWmXhueNsp5FvGZM2ckWXqLO7QE+EBHEpOqHTZ289/evnjxokkD cVaUA5Mui39L4Mkch2hBXieCSZSAe/fuWVoE7t69u1h146ffF8nP5/pPv13sJY40GJA1jWVrbTVUHdo5 lhJAwTL/7kRDkAKEpu64du2aKQLtO3McjnKgJwsimKgNhToRTKIEfPny5ZcKhEeqPv/3H8XnSC9xpMGA rGksW2urMXIJWO6UTkqb//b2gwcPrNUTZm7hGuBxw9z2Hz2yBKyXSf14ZrnJjH8LttZWo7EEsIWSAxCz XZJDH+/ZOYudme106ad0P5kzOjNRuy9M1cI1wPx9UJ4sln6FcSKY+ruA8bGxK0w9BzOqMPUa0AKFeYub hWsW3eYp4cuXL+n2ygfAXnFq6gM2kvh+DkjdpbMoHsu5C+ZPtCXwb6ARvT2lkA31J4bJkiWgxMauMPUc zKjC1GtAWQGck8m6AqWcpyI2dMkf39wkaaSxBJAt8dAOq2z+Ip7JR87GDfm7YJaAEhu7wtRzMKMKU68B S4s5aJ/3hCQVKQoXL16MXcVpoaUEkDBeXwR779KbvyDnLVaHhIxo/WbkuDScIPgG+hKL45TZ2psAli4V ph4XG7vC1HMwowpTD83bt29tdc+BJYhZ8XLbG69evaJBgXj+/LkCNkJYBQETdZO5evWqSTsYgs3f1Cug 07gjIXO2fjNybIHgBR8/fqSWWaA+6D/B9MkSUGJjV5h6DmZUYeqhefjwoS20g38D85M/a1eWxWO58h+t 9YNlCwxhbiGv+mZI+4jF5CWMk29Eji2YQ4DhsgSsHUuXClOPi41dYeo5mFGFqYcmPnKzTZl0b8+P+kqz egeT/MaNG9bvkx4QSwBliGkgXFMJiGVOmGKd2EgBZsvXxT0Kk3Z/KZgnEczfgk6bSZSAeT+eMfW4LDeZ MW+BxLZF1/1aju7sAHDzZkxsFi4UuyggwdIfCjjAW9A28JWjg5Dlbp02mJiiLcbLmSM5pxjlWDtybMFG CsTZ6gFK8FVIaP2Ts+0XTKIE7O7u/lqB0NTjstxkxryFmOp65PaUFnSjzQIas5GnfdZ3nZOAVk8W8dUj XVAXmEzc0lEp7AIOfdkhVYzciBxb6Cb+/3sBuqY7OLS/7LB+loBVmPe7mnWoVmHev1Nk6lFgz/e9nWTT U0B8G4eWnPT9ChvSr35dD+1HgHrzF8Q0i/DcrqcDnwB0adX77UM9YcljqEbk2E683zjbQwuZ9UMJaLzB iTD1dwHWqlhatQpF8vvH1GNB2ivnfc2xZ7LsgIYkgJZsVI2A4r09bVcdyaElgLJi6oOv7pUA0YUuQus0 lwAO8BjHZxnJmfbsVvsgx3bi5KN7PB34V239/f8cqn2cmKgX7d/wMZIloAdF5vvH1OPCctSDbi90mCev aFugBjwl6oQEksF3bA/rljprkEjqQmNO8vjAbItSAgyHsBdybAcXGzLMlnFNdPD4Y6L9EhDvVAYTJ0tA D4rM94+pxyUu0+WwQA2wobHPs6fFQaVCGN8RKGHigZk2kiVKACOyo9YjxlCNyLGdugQUt6mHHWGi7pUH XT8QUQRlMHGyBPSgyHz/mHpcxiwBTpGQ8xLDjwDsljoMx7yVTSNTKAEQjz/gTwFgou5mOQT5gaj9Vcvx kiWgB0Xm+8fU41Iv0/ikOk8SM9YC9SEOShrEaCSJsj3aeFGIv1OUpJHFJYBBZ483h+GpCHJsp/hu49cI 2u2dojo4Ov5MnywBPSgy3z+mHpc6N1ok5Ib1+ycGxIAxFPnGoR2D+IcA8N2ynkkjtWMsAWglrFnlTuN7 U7319CrgRc2J1c2hOJp68kyiBCz4Xc3gqlWY9+8UmXpc6txokQxYAvwpIOZ/3HvjbknbpD3HrW9h3SWg 2PO5I/0EgLqgRk3xhjL+rWT6bH2dAMzjPxUI16FaBSL8+8s/i8/qYZfj1q1btki3t9slMTEk6UXcHul+ +vSJgGQ+7SL/4cmTJ3/riNPg2NxFaqW+BQJav/lBQI4t4Gg+ByHazs7OnTt3dEdHgiUzf/funcWdMJMo AYPzww8//KbiwoULpl6WNYXti63KgWClWtz5FMd7YboOFn2d/9Y6CEXEfNpYXAIakWMLly5dMp8u7a21 FLhb0GlzOkuAZWeFqZfFolSYeixsiQ1ESwkAs96H3dIUHfGcDw8fPkR46HsyElgujYxcAvzPmez5dNnM ly4EijB9sgT0wKJUmHosbIkNRGMJKLbHOpP9IKD8h+JQjdZV7SwuAQyBwaHEAiTHFni0wT5mLxIKwbwH hAVwDrIQ0yZLQA8sSoWpTzVkr1KLDJz3iEu2xNJA210ArSn6gLul1GElAK2ENTFpTdTGgtTVDc5D70RO HFkCemBRKkydJCeQLAE9sCgVpk6SE0iWgB5YlApTJ8kJ5HSWgPPnz1t2Bs6dO2fqZVlT2CQ5Rk5nCdjb 2/tQMchPgyxW4Lh+GpQkgzCJErDgJzfz/qGexV6n+6dBSTIgkygBlkwVqIrk989iL2tVzAZbAYtSYeok OYFsfZsAlkkVqIrM989iL2tVzAZbAYtSYeqB+Pz589WOO3fu0L3c8fr1a64/dkgC79+/V/fp06dcHz16 hO/Ozg5trooGskHLlTYSIqsBCBlLWkYBjX7r1i0ZgCIUc1A3+sqYNkgoaMtFBswNCQ3ZaPIYSPvixYuZ T0dsMxDa4galKibm3wYG3AVtjHHUcJKD7lT2dA+NXLgUNt6N31XBLMr+jesnRgJfay10H4EsAT2wKBWm HgitWtJb64yulghCUkJZwfJFqO6Z7v9gQSgbGZMMLDIaQChsFJArEswkoY09ba11XGgTkwYROu8ZkmND ztDGQMNFX1kCGXX27FnMlLTb29tccdHEGPTSpUsYzEy/fcOdtu5FEtrcHV66R8EQXInJQJoY96KYQBc5 XSCgfxuoaOClBhJNBnRHTFUNHDFQKH11xV0IbOLo3nXfGuSuwkvliVqAu1QMgcSrzPhkCeiBRakw9UCw JlgrrEtWBm1WCWuRtlYq0CCLaGDMlVWIREnFEkfiu2IXbwYrDxuutDFgWQOR6Xbr0IZApSRRVsd1SVvB aXNFSyP6dlYGQyNUiVFAXLCk4S4KhSN41/FclTGo63MQ0hLBv5z4bSDHgAZyBfSwLgGZKXL86uJdiGJ0 7+KOl4QFqMA64asDV3njWMgS0AOLUmHqgWA16BGA9ceK8fXB0qGrNcS6JCfjTqgFjQohDa8Rjq94DOSi PKGhmEDFIX+ITMPtgcTAiytarrJHHn1lKdwAcNFs/bkGL6KBuhgXqQU++myi3ShcCYK9tuW4kdJVHJfI nYam4Q3JiaB7wV63TAMDTSmWV3k5dOPodIksOQ1iqsjSmFl3IJdKwWNMqZiARsQ3Oo5GloAeWJQKUw+E lktcXoCQK/sSSAKsG3VZRlwxpiFfrnE9KXm4Kg4NOUpOW6GwxGB2QuiQL2DjxiBfn5L7Om5AW0df5sPc FEGO4GbzZku7MzSI4DcYtT4TBcSGaxfJkj+Ori4qvLhHuspbj+yT8enNAnUUo3tX/6WIQ4N6R03pzGeg FXxLdGNMyUETwFeNkZlECZj3kxtUP/78hyL5+dz4+XeLvRaoVmFNYZPTBHVBFeGkMIkS8PXr148VCKX6 ZfdfxcdVZho4UrUKawqbJMfIJEpAkiTHRZaAJNlosgQkyUaTJSBJNposAUmy0Wx9T5Jkg8kSkCQbTZaA JNlosgQkyUaTJSBJNpjv3/8Hl7QyZjn66ooAAAAASUVORK5CYII= ================================================ FILE: BMap.NET.WindowsForm/BPlaceBox.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class BPlaceBox { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.txtInput = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // txtInput // this.txtInput.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.txtInput.BorderStyle = System.Windows.Forms.BorderStyle.None; this.txtInput.Font = new System.Drawing.Font("Microsoft YaHei", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtInput.Location = new System.Drawing.Point(1, 1); this.txtInput.Name = "txtInput"; this.txtInput.Size = new System.Drawing.Size(324, 26); this.txtInput.TabIndex = 0; this.txtInput.TextChanged += new System.EventHandler(this.txtInput_TextChanged); this.txtInput.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtInput_KeyDown); this.txtInput.Leave += new System.EventHandler(this.txtInput_Leave); this.txtInput.Resize += new System.EventHandler(this.txtInput_Resize); // // BPlaceBox // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.txtInput); this.Name = "BPlaceBox"; this.Size = new System.Drawing.Size(326, 28); this.Load += new System.EventHandler(this.BPlaceBox_Load); this.Paint += new System.Windows.Forms.PaintEventHandler(this.BPlaceBox_Paint); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.TextBox txtInput; } } ================================================ FILE: BMap.NET.WindowsForm/BPlaceBox.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using Newtonsoft.Json.Linq; using BMap.NET; using BMap.NET.HTTPService; namespace BMap.NET.WindowsForm { /// /// 位置搜索输入框(带自动提示) /// public partial class BPlaceBox : UserControl { private string _city = ""; /// /// 目标搜索城市 /// [Browsable(false)] internal string City { get { return _city; } } private string _district = ""; /// /// 目标搜索区县 /// [Browsable(false)] internal string District { get { return _district; } } private Font _intputFont; /// /// 输入字体 /// [Description("位置搜索时输入的字体"),Category("BMap.NET")] public Font InputFont { get { return txtInput.Font; } set { _intputFont = value; txtInput.Font = _intputFont; } } /// /// 当前建议搜索城市 /// [Description("当前建议搜索城市"), Category("BMap.NET")] public string CurrentCity { get; set; } /// /// 回车键是否发起搜索 /// [Description("指示回车键是否发起搜索"), Category("BMap.NET")] public bool Enter2Search { get; set; } /// /// 与之关联的位置列表控件 /// [Description("与之关联的位置列表控件,该控件负责显示搜索得到的结果"), Category("BMap.NET")] public BPlacesBoard BPlacesBoard { get; set; } /// /// 输入搜索内容 /// [Description("搜索输入框中的内容"),Category("BMap.NET")] public string QueryText { get { return txtInput.Text; } set { txtInput.Text = value; } } /// /// 构造方法 /// public BPlaceBox() { InitializeComponent(); } /// /// 开始发起搜索 /// public void StartSearch() { if (txtInput.Text != "") { ((Action)delegate() { PlaceService ps = new PlaceService(); JObject places = ps.SearchInCity(_district + txtInput.Text, _city == "" ? CurrentCity : _city); if (places != null) { this.Invoke((Action)delegate() { if (BPlacesBoard != null) //通知与之关联的位置列表控件 { BPlacesBoard.AddPlaces(places["results"]); } }); } }).BeginInvoke(null, null); } } /// /// 设置下一次输入内容变化时 不显示位置建议下拉框 /// public void DontSearchNextTime() { _search = false; } /// /// 建议位置 /// private FlowLayoutPanel _suggestion_places = new FlowLayoutPanel(); /// /// 当前可否发出位置建议请求 /// private bool _search = true; /// /// 输入框发生变化 /// /// /// private void txtInput_TextChanged(object sender, EventArgs e) { if (txtInput.Text != "") { if (!_search) { _search = true; return; } _district = ""; _city = ""; ((Action)(delegate() //异步调用API 获取建议位置 { PlaceSuggestionService pss = new PlaceSuggestionService(); JObject suggestion_places = pss.Suggestion(txtInput.Text, CurrentCity); //建议位置 if (suggestion_places != null) { this.Invoke((Action)delegate() { _suggestion_places.Controls.Clear(); _suggestion_places.Padding = new System.Windows.Forms.Padding(3); _suggestion_places.Width = Width; _suggestion_places.BackColor = Color.White; _suggestion_places.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; foreach (JObject place in suggestion_places["result"]) //返回JSON结构请参见百度API文档 { Label lbl = new Label(); lbl.MouseEnter += new EventHandler(lbl_MouseEnter); lbl.MouseLeave += new EventHandler(lbl_MouseLeave); lbl.Click += new EventHandler(lbl_Click); lbl.BackColor = Color.White; lbl.AutoSize = false; lbl.Padding = new System.Windows.Forms.Padding(0, 5, 0, 5); lbl.Font = new System.Drawing.Font("微软雅黑", 9); lbl.Width = _suggestion_places.Width - 15; lbl.Height = 30; lbl.TextAlign = ContentAlignment.MiddleLeft; lbl.Image = Properties.BMap.ico_search; lbl.ImageAlign = ContentAlignment.MiddleLeft; lbl.Tag = (string)place["name"] + "|" + (string)place["district"] + "|" + (string)place["city"]; lbl.Text = " " + (string)place["name"] + " " + (string)place["city"] + "-" + (string)place["district"]; //返回JSON结构请参见百度API文档 _suggestion_places.Controls.Add(lbl); } if (_suggestion_places.Controls.Count > 0) { Control top = FindTheTopControl(); if (top != null) { Point p = new Point(txtInput.Left - 1, txtInput.Top + txtInput.Height); //文本框在BPlaceBox中的位置 Point location = top.PointToClient(PointToScreen(p)); //文本框位置转换为最顶层控件坐标系中对应位置 _suggestion_places.Location = location; _suggestion_places.Height = _suggestion_places.Controls.Count * _suggestion_places.Controls[0].Height + 10; if (!top.Controls.Contains(_suggestion_places)) { top.Controls.Add(_suggestion_places); } _suggestion_places.Visible = true; _suggestion_places.BringToFront(); } } else { _suggestion_places.Visible = false; } }); } })).BeginInvoke(null, null); } else { _suggestion_places.Visible = false; } } /// /// 遍历获得顶层控件 /// /// private Control FindTheTopControl() { Control top = this.Parent; while (top.Parent != null) { top = top.Parent; } return top; } /// /// 鼠标点击建议位置列表 /// /// /// void lbl_Click(object sender, EventArgs e) { _search = false; txtInput.Text = (sender as Label).Tag.ToString().Split('|')[0]; //选择位置 _district = (sender as Label).Tag.ToString().Split('|')[1]; //所在区 _city = (sender as Label).Tag.ToString().Split('|')[2]; //所在城市 _suggestion_places.Visible = false; if (Enter2Search) StartSearch(); } /// /// 鼠标离开建议位置列表 /// /// /// void lbl_MouseLeave(object sender, EventArgs e) { (sender as Label).BackColor = Color.White; } /// /// 鼠标进入建议位置列表 /// /// /// void lbl_MouseEnter(object sender, EventArgs e) { (sender as Label).BackColor = Color.FromArgb(100, Color.LightGray); } /// /// 输入框大小改变 父控件大小保持相同 /// /// /// private void txtInput_Resize(object sender, EventArgs e) { Size = new Size(txtInput.Width + 2, txtInput.Height + 2); txtInput.Location = new Point(1, 1); } /// /// 控件加载 /// /// /// private void BPlaceBox_Load(object sender, EventArgs e) { } /// /// 回车键 搜索 /// /// /// private void txtInput_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter && Enter2Search) { _suggestion_places.Visible = false; StartSearch(); } } /// /// 重绘 /// /// /// private void BPlaceBox_Paint(object sender, PaintEventArgs e) { e.Graphics.DrawRectangle(Pens.LightGray, new Rectangle(0, 0, Width - 1, Height - 1)); } /// /// 失去焦点 隐藏建议下拉框 /// /// /// private void txtInput_Leave(object sender, EventArgs e) { _suggestion_places.Visible = false; } } } ================================================ FILE: BMap.NET.WindowsForm/BPlaceBox.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ================================================ FILE: BMap.NET.WindowsForm/BPlaceItem.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class BPlaceItem { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BPlaceItem)); this.lnkName = new System.Windows.Forms.LinkLabel(); this.txtAddress = new System.Windows.Forms.TextBox(); this.txtPhone = new System.Windows.Forms.TextBox(); this.txtTag = new System.Windows.Forms.TextBox(); this.txtPrice = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.btn_there = new System.Windows.Forms.Button(); this.btn_here = new System.Windows.Forms.Button(); this.SuspendLayout(); // // lnkName // this.lnkName.AutoSize = true; this.lnkName.Cursor = System.Windows.Forms.Cursors.Hand; this.lnkName.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lnkName.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline; this.lnkName.Location = new System.Drawing.Point(29, 9); this.lnkName.Name = "lnkName"; this.lnkName.Size = new System.Drawing.Size(109, 17); this.lnkName.TabIndex = 0; this.lnkName.TabStop = true; this.lnkName.Text = "天津城建大学-详情"; this.lnkName.VisitedLinkColor = System.Drawing.Color.Blue; this.lnkName.Click += new System.EventHandler(this.BPlaceItem_Click); this.lnkName.MouseEnter += new System.EventHandler(this.BPlaceItem_MouseEnter); // // txtAddress // this.txtAddress.BackColor = System.Drawing.Color.White; this.txtAddress.BorderStyle = System.Windows.Forms.BorderStyle.None; this.txtAddress.Cursor = System.Windows.Forms.Cursors.Hand; this.txtAddress.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtAddress.Location = new System.Drawing.Point(31, 31); this.txtAddress.Name = "txtAddress"; this.txtAddress.ReadOnly = true; this.txtAddress.Size = new System.Drawing.Size(221, 16); this.txtAddress.TabIndex = 1; this.txtAddress.Text = "天津市西青区津京公路26号"; this.txtAddress.Click += new System.EventHandler(this.BPlaceItem_Click); this.txtAddress.MouseEnter += new System.EventHandler(this.BPlaceItem_MouseEnter); // // txtPhone // this.txtPhone.BackColor = System.Drawing.Color.White; this.txtPhone.BorderStyle = System.Windows.Forms.BorderStyle.None; this.txtPhone.Cursor = System.Windows.Forms.Cursors.Hand; this.txtPhone.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtPhone.Location = new System.Drawing.Point(31, 52); this.txtPhone.Name = "txtPhone"; this.txtPhone.ReadOnly = true; this.txtPhone.Size = new System.Drawing.Size(221, 16); this.txtPhone.TabIndex = 2; this.txtPhone.Text = "电话 022-563269612"; this.txtPhone.Click += new System.EventHandler(this.BPlaceItem_Click); this.txtPhone.MouseEnter += new System.EventHandler(this.BPlaceItem_MouseEnter); // // txtTag // this.txtTag.BackColor = System.Drawing.Color.White; this.txtTag.BorderStyle = System.Windows.Forms.BorderStyle.None; this.txtTag.Cursor = System.Windows.Forms.Cursors.Hand; this.txtTag.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtTag.Location = new System.Drawing.Point(31, 80); this.txtTag.Name = "txtTag"; this.txtTag.ReadOnly = true; this.txtTag.Size = new System.Drawing.Size(156, 16); this.txtTag.TabIndex = 3; this.txtTag.Text = "学校,中餐厅"; this.txtTag.Click += new System.EventHandler(this.BPlaceItem_Click); this.txtTag.MouseEnter += new System.EventHandler(this.BPlaceItem_MouseEnter); // // txtPrice // this.txtPrice.BackColor = System.Drawing.Color.White; this.txtPrice.BorderStyle = System.Windows.Forms.BorderStyle.None; this.txtPrice.Cursor = System.Windows.Forms.Cursors.Hand; this.txtPrice.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtPrice.ForeColor = System.Drawing.Color.Red; this.txtPrice.Location = new System.Drawing.Point(193, 80); this.txtPrice.Name = "txtPrice"; this.txtPrice.ReadOnly = true; this.txtPrice.Size = new System.Drawing.Size(71, 16); this.txtPrice.TabIndex = 4; this.txtPrice.Text = "人均 $78"; this.txtPrice.Click += new System.EventHandler(this.BPlaceItem_Click); this.txtPrice.MouseEnter += new System.EventHandler(this.BPlaceItem_MouseEnter); // // label1 // this.label1.BackColor = System.Drawing.Color.LightGray; this.label1.Location = new System.Drawing.Point(7, 108); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(257, 1); this.label1.TabIndex = 7; this.label1.Text = "label1"; this.label1.MouseEnter += new System.EventHandler(this.BPlaceItem_MouseEnter); // // btn_there // this.btn_there.Cursor = System.Windows.Forms.Cursors.Hand; this.btn_there.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); this.btn_there.FlatAppearance.MouseDownBackColor = System.Drawing.Color.White; this.btn_there.FlatAppearance.MouseOverBackColor = System.Drawing.Color.White; this.btn_there.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btn_there.Image = ((System.Drawing.Image)(resources.GetObject("btn_there.Image"))); this.btn_there.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.btn_there.Location = new System.Drawing.Point(9, 113); this.btn_there.Name = "btn_there"; this.btn_there.Size = new System.Drawing.Size(108, 26); this.btn_there.TabIndex = 8; this.btn_there.Text = "到这里去"; this.btn_there.UseVisualStyleBackColor = true; this.btn_there.Click += new System.EventHandler(this.btn_there_Click); this.btn_there.MouseEnter += new System.EventHandler(this.BPlaceItem_MouseEnter); // // btn_here // this.btn_here.Cursor = System.Windows.Forms.Cursors.Hand; this.btn_here.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); this.btn_here.FlatAppearance.MouseDownBackColor = System.Drawing.Color.White; this.btn_here.FlatAppearance.MouseOverBackColor = System.Drawing.Color.White; this.btn_here.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btn_here.Image = ((System.Drawing.Image)(resources.GetObject("btn_here.Image"))); this.btn_here.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.btn_here.Location = new System.Drawing.Point(123, 113); this.btn_here.Name = "btn_here"; this.btn_here.Size = new System.Drawing.Size(118, 26); this.btn_here.TabIndex = 9; this.btn_here.Text = "从这里出发"; this.btn_here.UseVisualStyleBackColor = true; this.btn_here.Click += new System.EventHandler(this.btn_here_Click); this.btn_here.MouseEnter += new System.EventHandler(this.BPlaceItem_MouseEnter); // // BPlaceItem // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.btn_here); this.Controls.Add(this.btn_there); this.Controls.Add(this.label1); this.Controls.Add(this.txtPrice); this.Controls.Add(this.txtTag); this.Controls.Add(this.txtPhone); this.Controls.Add(this.txtAddress); this.Controls.Add(this.lnkName); this.Cursor = System.Windows.Forms.Cursors.Hand; this.Name = "BPlaceItem"; this.Size = new System.Drawing.Size(269, 145); this.Load += new System.EventHandler(this.BPlaceItem_Load); this.Click += new System.EventHandler(this.BPlaceItem_Click); this.Paint += new System.Windows.Forms.PaintEventHandler(this.BPlaceItem_Paint); this.MouseEnter += new System.EventHandler(this.BPlaceItem_MouseEnter); this.MouseLeave += new System.EventHandler(this.BPlaceItem_MouseLeave); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.LinkLabel lnkName; private System.Windows.Forms.TextBox txtAddress; private System.Windows.Forms.TextBox txtPhone; private System.Windows.Forms.TextBox txtTag; private System.Windows.Forms.TextBox txtPrice; private System.Windows.Forms.Label label1; private System.Windows.Forms.Button btn_there; private System.Windows.Forms.Button btn_here; } } ================================================ FILE: BMap.NET.WindowsForm/BPlaceItem.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using Newtonsoft.Json.Linq; using BMap.NET.WindowsForm.BMapElements; namespace BMap.NET.WindowsForm { /// /// POI显示项 /// partial class BPlaceItem : UserControl { private bool _selected; /// /// 是否选中 /// public bool Selected { get { return _selected; } set { if (_selected != value) { _selected = value; if (!_selected) //收缩 { Height = 104; BackColor = Color.White; txtAddress.BackColor = Color.White; txtPhone.BackColor = Color.White; txtPrice.BackColor = Color.White; txtTag.BackColor = Color.White; btn_here.BackColor = Color.White; btn_there.BackColor = Color.White; } else //展开 { Height = 145; BackColor = Color.FromArgb(235, 245, 250); txtAddress.BackColor = Color.FromArgb(235, 245, 250); txtPhone.BackColor = Color.FromArgb(235, 245, 250); txtPrice.BackColor = Color.FromArgb(235, 245, 250); txtTag.BackColor = Color.FromArgb(235, 245, 250); btn_there.BackColor = Color.White; btn_here.BackColor = Color.White; } Invalidate(); } } } /// /// 数据源 /// public BPOI POI { get; set; } /// /// 索引号 /// public int Index { set; get; } /// /// 设置起点 /// public event SetSourcePlaceEventHandler SetSourcePlace; /// /// 设置重点 /// public event SetDestinationPlaceEventHandler SetDestinationPlace; /// /// 选中位置 /// public event PlaceSelectedChangedEventHandler PlaceSelectedChanged; public BPlaceItem() { InitializeComponent(); } /// /// 鼠标进入 /// /// /// private void BPlaceItem_MouseEnter(object sender, EventArgs e) { BackColor = Color.FromArgb(235, 245, 250); txtAddress.BackColor = Color.FromArgb(235, 245, 250); txtPhone.BackColor = Color.FromArgb(235, 245, 250); txtPrice.BackColor = Color.FromArgb(235, 245, 250); txtTag.BackColor = Color.FromArgb(235, 245, 250); btn_there.BackColor = Color.White; btn_here.BackColor = Color.White; } /// /// 鼠标移出 /// /// /// private void BPlaceItem_MouseLeave(object sender, EventArgs e) { BackColor = Color.White; txtAddress.BackColor = Color.White; txtPhone.BackColor = Color.White; txtPrice.BackColor = Color.White; txtTag.BackColor = Color.White; btn_there.BackColor = Color.White; btn_here.BackColor = Color.White; } /// /// 到这里去 /// /// /// private void btn_there_Click(object sender, EventArgs e) { if (SetDestinationPlace != null) { SetDestinationPlace((string)POI.DataSource["name"]); //具体json格式参见api文档 } } /// /// 从这里出发 /// /// /// private void btn_here_Click(object sender, EventArgs e) { if (SetSourcePlace != null) { SetSourcePlace((string)POI.DataSource["name"]); //具体json格式参见api文档 } } /// /// 控件绘制 /// /// /// private void BPlaceItem_Paint(object sender, PaintEventArgs e) { Bitmap b; if (_selected) { b = Properties.BMap.ico_blue_point_big; } else { b = Properties.BMap.ico_red_point_small; } e.Graphics.DrawImage(b, new Rectangle(3, 8, b.Width * 5 / 6, b.Height * 5 / 6)); e.Graphics.DrawString(((Char)(Index + 65)).ToString(), new Font("微软雅黑", 10, FontStyle.Bold), Brushes.White, new PointF(_selected ? 9 : 7, _selected ? 12 : 9)); } /// /// 点击选中该项 /// /// /// private void BPlaceItem_Click(object sender, EventArgs e) { Selected = true; if (_selected) { if (PlaceSelectedChanged != null) { PlaceSelectedChanged(POI); } } } /// /// 控件加载 /// /// /// private void BPlaceItem_Load(object sender, EventArgs e) { if (POI.DataSource != null) { lnkName.Text = (string)POI.DataSource["name"] + " -详情"; //具体json格式参见api文档 txtAddress.Text = (string)POI.DataSource["address"]; txtPhone.Text = (string)POI.DataSource["telephone"]; if (POI.DataSource["detail_info"] != null && POI.DataSource["detail_info"]["tag"] != null) { txtTag.Text = (string)POI.DataSource["detail_info"]["tag"]; } else { txtTag.Visible = false; } if (POI.DataSource["detail_info"] != null && POI.DataSource["detail_info"]["price"] != null) { txtPrice.Text = "人均 ¥" + (string)POI.DataSource["detail_info"]["price"]; } else { txtPrice.Visible = false; } } } } /// /// 表示处理设置起点这一事件的方法 /// /// delegate void SetSourcePlaceEventHandler(string sourceName); /// /// 表示处理设置终点这一事件的方法 /// /// delegate void SetDestinationPlaceEventHandler(string destinationName); /// /// 表示处理选择某位置事件的方法 /// /// delegate void PlaceSelectedChangedEventHandler(BPOI poi); } ================================================ FILE: BMap.NET.WindowsForm/BPlaceItem.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 YQUAAAAJcEhZcwAADr0AAA69AUf7kK0AAAAGYktHRAD/AP8A/6C9p5MAAACeSURBVDhPxZExCoRQDET3 /pUg6DXU1iMIaq3gNdRq9oWNkL8Iq4XskMLMZML8+NJN/MEwz2oalaUVH9Pk/IHU0LbKsu+CDAgGdiPn ufpe62o1DNZCLovPJAYCoDEd0XVG1rW3iYHQaCyO2DYjkQ5cMxSFtyeRyB1BC3keiQui8UqGWLzvGkd/ dDhuMIB7Z/2AZQQgNFVVv37cBTxtkN4/o9GrfLGpTQAAAABJRU5ErkJggg== iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 YQUAAAAJcEhZcwAADr0AAA69AUf7kK0AAAAGYktHRAD/AP8A/6C9p5MAAAC5SURBVDhPvZGxDoIwEIZ9 c6Mxgg8CuuoziOIuiot2JHGBBKgLwS/10OpSGfTPDf3v+uXu2kHbU/8HknI/zwJfeb6ahlmAlUKnN2B1 XY7Ow48gKWWjF5CUCeXJZbwrYt3oW6M5YEmm1VEu2cAiC6nFxVa80SaPSDKbeBuYKZ9a3dTijehDkn3E OwFmM4An3jlSlK9J8m7ibeDQLQ1DH+K59KlK5ZINoH7P+hB9mI19CA6Oj/tGvwba9g6zhMUAKbYqsQAA AABJRU5ErkJggg== ================================================ FILE: BMap.NET.WindowsForm/BPlacesBoard.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class BPlacesBoard { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.flpPlaces = new System.Windows.Forms.FlowLayoutPanel(); this.bQuickSearch = new BMap.NET.WindowsForm.BQuickSearchBoardcs(); this.flpPlaces.SuspendLayout(); this.SuspendLayout(); // // flpPlaces // this.flpPlaces.AutoScroll = true; this.flpPlaces.BackColor = System.Drawing.Color.White; this.flpPlaces.Controls.Add(this.bQuickSearch); this.flpPlaces.Dock = System.Windows.Forms.DockStyle.Fill; this.flpPlaces.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.flpPlaces.Location = new System.Drawing.Point(0, 0); this.flpPlaces.Name = "flpPlaces"; this.flpPlaces.Size = new System.Drawing.Size(269, 436); this.flpPlaces.TabIndex = 0; this.flpPlaces.WrapContents = false; // // bQuickSearch // this.bQuickSearch.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.bQuickSearch.BackColor = System.Drawing.Color.White; this.bQuickSearch.Location = new System.Drawing.Point(3, 3); this.bQuickSearch.Name = "bQuickSearch"; this.bQuickSearch.Size = new System.Drawing.Size(263, 406); this.bQuickSearch.TabIndex = 0; this.bQuickSearch.QuickSearch += new BMap.NET.WindowsForm.QuickSearchEventHandler(this.bQuickSearch_QuickSearch); // // BPlacesBoard // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.flpPlaces); this.Name = "BPlacesBoard"; this.Size = new System.Drawing.Size(269, 436); this.flpPlaces.ResumeLayout(false); this.ResumeLayout(false); } #endregion private System.Windows.Forms.FlowLayoutPanel flpPlaces; private BQuickSearchBoardcs bQuickSearch; } } ================================================ FILE: BMap.NET.WindowsForm/BPlacesBoard.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using BMap.NET.HTTPService; using Newtonsoft.Json.Linq; using BMap.NET.WindowsForm.BMapElements; namespace BMap.NET.WindowsForm { /// /// 位置列表控件 /// public partial class BPlacesBoard : UserControl { /// /// 与之关联的地图控件 /// [Description("与之关联的地图控件"),Category("BMap.NET")] public BMapControl BMapControl { get; set; } /// /// 与之关联的导航面板控件 /// [Description("与之关联的导航控件"),Category("BMap.NET")] public BDirectionBoard BDirectionBoard { get; set; } /// /// 当前建议搜索城市 /// [Description("当前建议搜索城市"),Category("BMap.NET")] public string CurrentCity { get; set; } private Label _wait = new Label(); //等待框 /// /// 构造方法 /// public BPlacesBoard() { InitializeComponent(); _wait.AutoSize = false; _wait.Font = new System.Drawing.Font("微软雅黑", 10); _wait.Width = Width; _wait.Height = Height; _wait.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; _wait.BackColor = Color.FromArgb(200, Color.White); _wait.TextAlign = ContentAlignment.MiddleCenter; _wait.Text = "正在搜索,请稍候..."; _wait.Visible = false; _wait.Location = new Point(0, 0); Controls.Add(_wait); _wait.BringToFront(); } /// /// 清空所有位置(初始化控件) /// public void Clear() { flpPlaces.Controls.Clear(); //清空所有位置 flpPlaces.Controls.Add(bQuickSearch); //重新加载快速搜索控件 if (BMapControl != null) { BMapControl.ClearPlaces(); } } /// /// 将位置显示在列表中 /// /// internal void AddPlaces(JToken places) { flpPlaces.Controls.Clear(); //清空原来所有位置 if (Parent != null && Parent is TabPage) //如果父控件是tabpage 则选中 { ((Parent as TabPage).Parent as TabControl).SelectedTab = (Parent as TabPage); } if (BDirectionBoard != null) //导航控件初始化 { BDirectionBoard.Clear(); } //加载位置项 int index = 0; List _list = new List(); foreach (JObject place in places) { if (place["location"] != null && place["location"]["lng"] != null && (string)place["location"]["lng"] != "") { LatLngPoint location = new LatLngPoint(double.Parse((string)place["location"]["lng"]), double.Parse((string)place["location"]["lat"])); BPOI poi = new BPOI { DataSource = place, Index = index, Selected = false, Location = location }; _list.Add(poi); BPlaceItem item = new BPlaceItem(); item.Index = index++; item.POI = poi; item.SetDestinationPlace += new SetDestinationPlaceEventHandler(item_SetDestinationPlace); item.SetSourcePlace += new SetSourcePlaceEventHandler(item_SetSourcePlace); item.PlaceSelectedChanged += new PlaceSelectedChangedEventHandler(item_PlaceSelectedChanged); item.Height = 104; flpPlaces.Controls.Add(item); } } if (BMapControl != null) { BMapControl.AddPlaces(_list); } } /// /// 选中POI /// internal void SelectPlace(BPOI poi) { foreach (Control c in flpPlaces.Controls) { if (c is BPlaceItem) { BPlaceItem p = c as BPlaceItem; if (p.POI == poi) { p.Selected = true; flpPlaces.ScrollControlIntoView(c); } else { p.Selected = false; } } } } /// /// 点击快速搜索面板上的按钮 /// /// private void bQuickSearch_QuickSearch(string searchName) { _wait.Visible = true; ((Action)delegate() { PlaceService ps = new PlaceService(); JObject places = ps.SearchInCity(searchName, CurrentCity); if (places != null) { this.Invoke((Action)delegate() { _wait.Visible = false; flpPlaces.Controls.Remove(bQuickSearch); AddPlaces(places["results"]); //具体json格式参见api文档 }); } }).BeginInvoke(null, null); } /// /// 选中位置改变 /// /// void item_PlaceSelectedChanged(BPOI poi) { //BMapControl foreach (Control c in flpPlaces.Controls) { if (c is BPlaceItem && (c as BPlaceItem).POI != poi) { (c as BPlaceItem).Selected = false; } } if (BMapControl != null) { BMapControl.SelectBPOI(poi); } } /// /// 设置起点 /// /// void item_SetSourcePlace(string sourceName) { //BDirecttionBoard if (BDirectionBoard != null) { BDirectionBoard.SourcePlace = sourceName; } } /// /// 设置终点 /// /// void item_SetDestinationPlace(string destinationName) { //BDirectionBoard if (BDirectionBoard != null) { BDirectionBoard.DestinationPlace = destinationName; } } } } ================================================ FILE: BMap.NET.WindowsForm/BPlacesBoard.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ================================================ FILE: BMap.NET.WindowsForm/BPlacesSuggestionControl.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class BPlacesSuggestionControl { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.flpPlaces = new System.Windows.Forms.FlowLayoutPanel(); this.SuspendLayout(); // // flpPlaces // this.flpPlaces.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.flpPlaces.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.flpPlaces.Location = new System.Drawing.Point(0, 50); this.flpPlaces.Margin = new System.Windows.Forms.Padding(0); this.flpPlaces.Name = "flpPlaces"; this.flpPlaces.Size = new System.Drawing.Size(298, 253); this.flpPlaces.TabIndex = 1; this.flpPlaces.WrapContents = false; // // BPlacesSuggestionControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.flpPlaces); this.Cursor = System.Windows.Forms.Cursors.Hand; this.Name = "BPlacesSuggestionControl"; this.Size = new System.Drawing.Size(298, 303); this.Click += new System.EventHandler(this.BPlacesSuggestionControl_Click); this.Paint += new System.Windows.Forms.PaintEventHandler(this.BPlacesSuggestionControl_Paint); this.ResumeLayout(false); } #endregion private System.Windows.Forms.FlowLayoutPanel flpPlaces; } } ================================================ FILE: BMap.NET.WindowsForm/BPlacesSuggestionControl.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using Newtonsoft.Json.Linq; namespace BMap.NET.WindowsForm { /// /// 导航路线起点\终点位置建议控件 /// partial class BPlacesSuggestionControl : UserControl { public event EndPointSelectedEventHandler EndPointSelected; /// /// 类型(起点或终点) /// public PointType Type { get; set; } private JToken _content; /// /// 位置项 /// public JToken Content { get { return _content; } set { _content = value; // 解析 具体json格式参见api文档 if (_content != null) { int index=0; foreach (JObject place in _content) { BPlacesSuggestionItem item = new BPlacesSuggestionItem(); item.Type = Type; item.Index = index++; item.DataSource = place; item.Width = flpPlaces.Width; flpPlaces.Controls.Add(item); item.Margin = new System.Windows.Forms.Padding(0); item.EndPointSelected += new EndPointSelectedEventHandler(item_EndPointSelected); } foreach (Control c in flpPlaces.Controls) { _places_height += c.Height; } Selected = false; } } } private int _places_height; private string _selected_place; private bool _selected; /// /// 是否选中(展开收缩) /// public bool Selected { get { return _selected; } set { _selected = value; if (_selected) { Height = 50 + _places_height; } else { Height = 50; } } } /// /// 模糊位置 /// public string KeyWord { get; set; } /// /// 构造方法 /// public BPlacesSuggestionControl() { InitializeComponent(); } #region 事件处理 /// /// 重绘 /// /// /// private void BPlacesSuggestionControl_Paint(object sender, PaintEventArgs e) { using (SolidBrush sb = new SolidBrush(Color.FromArgb(50, Color.Wheat))) { e.Graphics.FillRectangle(sb, new Rectangle(0, 0, Width - 1, 50 - 1)); } e.Graphics.DrawRectangle(Pens.OrangeRed, new Rectangle(0, 0, Width - 1, 50 - 1)); string info = _selected_place == null ? KeyWord : _selected_place; using (Font f = new Font("微软雅黑", 10, FontStyle.Bold)) { e.Graphics.DrawString((Type == PointType.RouteEnd ? "终点:" : "起点:") + info, f, Brushes.OrangeRed, new PointF(20, 15)); } } /// /// 选中位置 /// /// /// void item_EndPointSelected(string placeName, PointType type) { _selected_place = placeName; if (EndPointSelected != null) { EndPointSelected(placeName, type); } Invalidate(); } /// /// 选中展开 /// /// /// private void BPlacesSuggestionControl_Click(object sender, EventArgs e) { Selected = !Selected; } #endregion } /// /// 表示处理选中起点/终点这一事件的方法 /// /// /// delegate void EndPointSelectedEventHandler(string placeName,PointType type); } ================================================ FILE: BMap.NET.WindowsForm/BPlacesSuggestionControl.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ================================================ FILE: BMap.NET.WindowsForm/BPlacesSuggestionItem.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class BPlacesSuggestionItem { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.lblName = new System.Windows.Forms.Label(); this.lblAddress = new System.Windows.Forms.Label(); this.lblSelect = new System.Windows.Forms.Label(); this.lblIndex = new System.Windows.Forms.Label(); this.SuspendLayout(); // // lblName // this.lblName.Cursor = System.Windows.Forms.Cursors.Hand; this.lblName.ForeColor = System.Drawing.Color.Blue; this.lblName.Location = new System.Drawing.Point(32, 6); this.lblName.Name = "lblName"; this.lblName.Size = new System.Drawing.Size(165, 26); this.lblName.TabIndex = 2; this.lblName.Text = "这里是名称"; this.lblName.MouseEnter += new System.EventHandler(this.label1_MouseEnter); this.lblName.MouseLeave += new System.EventHandler(this.label1_MouseLeave); // // lblAddress // this.lblAddress.Cursor = System.Windows.Forms.Cursors.Hand; this.lblAddress.ForeColor = System.Drawing.Color.Gray; this.lblAddress.Location = new System.Drawing.Point(32, 36); this.lblAddress.Name = "lblAddress"; this.lblAddress.Size = new System.Drawing.Size(164, 26); this.lblAddress.TabIndex = 3; this.lblAddress.Text = "这里是名称\r\n撒发射点发阿斯蒂芬"; this.lblAddress.MouseEnter += new System.EventHandler(this.label1_MouseEnter); this.lblAddress.MouseLeave += new System.EventHandler(this.label1_MouseLeave); // // lblSelect // this.lblSelect.BackColor = System.Drawing.Color.PeachPuff; this.lblSelect.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.lblSelect.Cursor = System.Windows.Forms.Cursors.Hand; this.lblSelect.ForeColor = System.Drawing.Color.Peru; this.lblSelect.Location = new System.Drawing.Point(208, 23); this.lblSelect.Name = "lblSelect"; this.lblSelect.Size = new System.Drawing.Size(63, 23); this.lblSelect.TabIndex = 4; this.lblSelect.Text = "设为起点"; this.lblSelect.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lblSelect.Click += new System.EventHandler(this.lblSelect_Click); this.lblSelect.MouseEnter += new System.EventHandler(this.label1_MouseEnter); this.lblSelect.MouseLeave += new System.EventHandler(this.label1_MouseLeave); // // lblIndex // this.lblIndex.AutoSize = true; this.lblIndex.Font = new System.Drawing.Font("Microsoft YaHei", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblIndex.Location = new System.Drawing.Point(3, 19); this.lblIndex.Name = "lblIndex"; this.lblIndex.Size = new System.Drawing.Size(20, 22); this.lblIndex.TabIndex = 5; this.lblIndex.Text = "1"; // // BPlacesSuggestionItem // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.lblIndex); this.Controls.Add(this.lblSelect); this.Controls.Add(this.lblAddress); this.Controls.Add(this.lblName); this.Cursor = System.Windows.Forms.Cursors.Hand; this.Name = "BPlacesSuggestionItem"; this.Size = new System.Drawing.Size(284, 67); this.Paint += new System.Windows.Forms.PaintEventHandler(this.BPlacesSuggestionItem_Paint); this.MouseEnter += new System.EventHandler(this.label1_MouseEnter); this.MouseLeave += new System.EventHandler(this.label1_MouseLeave); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label lblName; private System.Windows.Forms.Label lblAddress; private System.Windows.Forms.Label lblSelect; private System.Windows.Forms.Label lblIndex; } } ================================================ FILE: BMap.NET.WindowsForm/BPlacesSuggestionItem.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using Newtonsoft.Json.Linq; namespace BMap.NET.WindowsForm { /// /// 导航路线起点/终点位置建议项 /// partial class BPlacesSuggestionItem : UserControl { public event EndPointSelectedEventHandler EndPointSelected; private JObject _dataSource; /// /// 位置数据源 /// public JObject DataSource { get { return _dataSource; } set { _dataSource = value; if (_dataSource != null) //解析 具体json格式参见api文档 { lblName.Text = (string)_dataSource["name"]; lblAddress.Text = (string)_dataSource["address"]; if (Type == PointType.RouteEnd) { lblSelect.Text = "设为终点"; } else { lblSelect.Text = "设为起点"; } lblIndex.Text = Index.ToString(); } } } /// /// 序号 /// public int Index { get; set; } /// /// 位置类型 /// public PointType Type { get; set; } /// /// 构造方法 /// public BPlacesSuggestionItem() { InitializeComponent(); } /// /// 鼠标进入 /// /// /// private void label1_MouseEnter(object sender, EventArgs e) { BackColor = Color.FromArgb(235, 241, 251); } /// /// 鼠标离开 /// /// /// private void label1_MouseLeave(object sender, EventArgs e) { BackColor = Color.White; } /// /// 选择 /// /// /// private void lblSelect_Click(object sender, EventArgs e) { if (EndPointSelected != null) { EndPointSelected(lblName.Text, Type); } } /// /// 重绘 /// /// /// private void BPlacesSuggestionItem_Paint(object sender, PaintEventArgs e) { } } } ================================================ FILE: BMap.NET.WindowsForm/BPlacesSuggestionItem.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ================================================ FILE: BMap.NET.WindowsForm/BPointTipControl.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class BPointTipControl { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BPointTipControl)); this.picClose = new System.Windows.Forms.PictureBox(); this.lblName = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.lnknearby_bus_station = new System.Windows.Forms.LinkLabel(); this.lnknearby_hospital = new System.Windows.Forms.LinkLabel(); this.lnknearby_bank = new System.Windows.Forms.LinkLabel(); this.lnknearby_eatting = new System.Windows.Forms.LinkLabel(); this.lnknearby_hotel = new System.Windows.Forms.LinkLabel(); this.btnsearch = new System.Windows.Forms.Button(); this.txtNearby = new System.Windows.Forms.TextBox(); this.lblPlace = new System.Windows.Forms.Label(); this.btndriving = new System.Windows.Forms.Button(); this.btntransit = new System.Windows.Forms.Button(); this.bPlaceBox = new BMap.NET.WindowsForm.BPlaceBox(); ((System.ComponentModel.ISupportInitialize)(this.picClose)).BeginInit(); this.SuspendLayout(); // // picClose // this.picClose.Cursor = System.Windows.Forms.Cursors.Hand; this.picClose.Image = ((System.Drawing.Image)(resources.GetObject("picClose.Image"))); this.picClose.Location = new System.Drawing.Point(334, 9); this.picClose.Name = "picClose"; this.picClose.Size = new System.Drawing.Size(13, 14); this.picClose.TabIndex = 7; this.picClose.TabStop = false; this.picClose.Click += new System.EventHandler(this.picClose_Click); // // lblName // this.lblName.AutoSize = true; this.lblName.Font = new System.Drawing.Font("Microsoft YaHei", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblName.Location = new System.Drawing.Point(8, 7); this.lblName.Name = "lblName"; this.lblName.Size = new System.Drawing.Size(79, 19); this.lblName.TabIndex = 6; this.lblName.Text = "位置点位置"; // // label1 // this.label1.BackColor = System.Drawing.Color.LightGray; this.label1.Location = new System.Drawing.Point(1, 32); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(358, 1); this.label1.TabIndex = 5; this.label1.Text = "label1"; // // lnknearby_bus_station // this.lnknearby_bus_station.AutoSize = true; this.lnknearby_bus_station.Location = new System.Drawing.Point(309, 108); this.lnknearby_bus_station.Name = "lnknearby_bus_station"; this.lnknearby_bus_station.Size = new System.Drawing.Size(41, 12); this.lnknearby_bus_station.TabIndex = 44; this.lnknearby_bus_station.TabStop = true; this.lnknearby_bus_station.Text = "公交站"; this.lnknearby_bus_station.Visible = false; this.lnknearby_bus_station.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnk_LinkClicked); // // lnknearby_hospital // this.lnknearby_hospital.AutoSize = true; this.lnknearby_hospital.Location = new System.Drawing.Point(274, 108); this.lnknearby_hospital.Name = "lnknearby_hospital"; this.lnknearby_hospital.Size = new System.Drawing.Size(29, 12); this.lnknearby_hospital.TabIndex = 43; this.lnknearby_hospital.TabStop = true; this.lnknearby_hospital.Text = "医院"; this.lnknearby_hospital.Visible = false; this.lnknearby_hospital.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnk_LinkClicked); // // lnknearby_bank // this.lnknearby_bank.AutoSize = true; this.lnknearby_bank.Location = new System.Drawing.Point(239, 108); this.lnknearby_bank.Name = "lnknearby_bank"; this.lnknearby_bank.Size = new System.Drawing.Size(29, 12); this.lnknearby_bank.TabIndex = 42; this.lnknearby_bank.TabStop = true; this.lnknearby_bank.Text = "银行"; this.lnknearby_bank.Visible = false; this.lnknearby_bank.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnk_LinkClicked); // // lnknearby_eatting // this.lnknearby_eatting.AutoSize = true; this.lnknearby_eatting.Location = new System.Drawing.Point(204, 108); this.lnknearby_eatting.Name = "lnknearby_eatting"; this.lnknearby_eatting.Size = new System.Drawing.Size(29, 12); this.lnknearby_eatting.TabIndex = 41; this.lnknearby_eatting.TabStop = true; this.lnknearby_eatting.Text = "餐馆"; this.lnknearby_eatting.Visible = false; this.lnknearby_eatting.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnk_LinkClicked); // // lnknearby_hotel // this.lnknearby_hotel.AutoSize = true; this.lnknearby_hotel.Location = new System.Drawing.Point(169, 108); this.lnknearby_hotel.Name = "lnknearby_hotel"; this.lnknearby_hotel.Size = new System.Drawing.Size(29, 12); this.lnknearby_hotel.TabIndex = 40; this.lnknearby_hotel.TabStop = true; this.lnknearby_hotel.Text = "酒店"; this.lnknearby_hotel.Visible = false; this.lnknearby_hotel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnk_LinkClicked); // // btnsearch // this.btnsearch.Location = new System.Drawing.Point(116, 103); this.btnsearch.Name = "btnsearch"; this.btnsearch.Size = new System.Drawing.Size(43, 23); this.btnsearch.TabIndex = 39; this.btnsearch.Text = "搜索"; this.btnsearch.UseVisualStyleBackColor = true; this.btnsearch.Visible = false; this.btnsearch.Click += new System.EventHandler(this.btnsearch_Click); // // txtNearby // this.txtNearby.Location = new System.Drawing.Point(10, 104); this.txtNearby.Name = "txtNearby"; this.txtNearby.Size = new System.Drawing.Size(100, 21); this.txtNearby.TabIndex = 38; this.txtNearby.Visible = false; // // lblPlace // this.lblPlace.AutoSize = true; this.lblPlace.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblPlace.ForeColor = System.Drawing.Color.Gray; this.lblPlace.Location = new System.Drawing.Point(8, 78); this.lblPlace.Name = "lblPlace"; this.lblPlace.Size = new System.Drawing.Size(32, 17); this.lblPlace.TabIndex = 37; this.lblPlace.Text = "起点"; // // btndriving // this.btndriving.Cursor = System.Windows.Forms.Cursors.Hand; this.btndriving.Location = new System.Drawing.Point(300, 75); this.btndriving.Name = "btndriving"; this.btndriving.Size = new System.Drawing.Size(52, 23); this.btndriving.TabIndex = 36; this.btndriving.Text = "驾车"; this.btndriving.UseVisualStyleBackColor = true; this.btndriving.Click += new System.EventHandler(this.btndriving_Click); // // btntransit // this.btntransit.Cursor = System.Windows.Forms.Cursors.Hand; this.btntransit.Location = new System.Drawing.Point(241, 75); this.btntransit.Name = "btntransit"; this.btntransit.Size = new System.Drawing.Size(54, 23); this.btntransit.TabIndex = 35; this.btntransit.Text = "公交"; this.btntransit.UseVisualStyleBackColor = true; this.btntransit.Click += new System.EventHandler(this.btntransit_Click); // // bPlaceBox // this.bPlaceBox.BPlacesBoard = null; this.bPlaceBox.CurrentCity = "天津"; this.bPlaceBox.Enter2Search = false; this.bPlaceBox.InputFont = new System.Drawing.Font("Microsoft YaHei", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.bPlaceBox.Location = new System.Drawing.Point(42, 76); this.bPlaceBox.Name = "bPlaceBox"; this.bPlaceBox.QueryText = ""; this.bPlaceBox.Size = new System.Drawing.Size(193, 21); this.bPlaceBox.TabIndex = 34; // // BPointTipControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.lnknearby_bus_station); this.Controls.Add(this.lnknearby_hospital); this.Controls.Add(this.lnknearby_bank); this.Controls.Add(this.lnknearby_eatting); this.Controls.Add(this.lnknearby_hotel); this.Controls.Add(this.btnsearch); this.Controls.Add(this.txtNearby); this.Controls.Add(this.lblPlace); this.Controls.Add(this.btndriving); this.Controls.Add(this.btntransit); this.Controls.Add(this.bPlaceBox); this.Controls.Add(this.picClose); this.Controls.Add(this.lblName); this.Controls.Add(this.label1); this.Name = "BPointTipControl"; this.Size = new System.Drawing.Size(360, 152); this.Load += new System.EventHandler(this.BPointTipControl_Load); this.Paint += new System.Windows.Forms.PaintEventHandler(this.BPointTipControl_Paint); this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.BPointTipControl_MouseDown); this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.BPointTipControl_MouseMove); ((System.ComponentModel.ISupportInitialize)(this.picClose)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.PictureBox picClose; private System.Windows.Forms.Label lblName; private System.Windows.Forms.Label label1; private System.Windows.Forms.LinkLabel lnknearby_bus_station; private System.Windows.Forms.LinkLabel lnknearby_hospital; private System.Windows.Forms.LinkLabel lnknearby_bank; private System.Windows.Forms.LinkLabel lnknearby_eatting; private System.Windows.Forms.LinkLabel lnknearby_hotel; private System.Windows.Forms.Button btnsearch; private System.Windows.Forms.TextBox txtNearby; private System.Windows.Forms.Label lblPlace; private System.Windows.Forms.Button btndriving; private System.Windows.Forms.Button btntransit; private BPlaceBox bPlaceBox; } } ================================================ FILE: BMap.NET.WindowsForm/BPointTipControl.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using System.Drawing.Drawing2D; using BMap.NET.WindowsForm.BMapElements; namespace BMap.NET.WindowsForm { /// /// 位置点信息显示控件 /// partial class BPointTipControl : UserControl { public event SearchNearbyStartedEventHandler SearchNearbyStarted; public event DirectionStartedEventHandler DirecttionStarted; private int _tab_index; private BPoint _bpoint; /// /// 与之关联的BPoint数据 /// public BPoint BPoint { get { return _bpoint; } set { _bpoint = value; lblName.Text = _bpoint.Address; } } /// /// 当前建议搜索城市 /// public string CurrentCity { get { return bPlaceBox.CurrentCity; } set { bPlaceBox.CurrentCity = value; } } /// /// 构造方法 /// public BPointTipControl() { InitializeComponent(); SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); } /// /// 公交导航 /// /// /// private void btntransit_Click(object sender, EventArgs e) { if (DirecttionStarted != null) { if (_tab_index == 0) //到这里去 { DirecttionStarted(bPlaceBox.QueryText, _bpoint.Address, RouteType.Transit); } else //从这里出发 { DirecttionStarted(_bpoint.Address, bPlaceBox.QueryText, RouteType.Transit); } } } /// /// 驾车导航 /// /// /// private void btndriving_Click(object sender, EventArgs e) { if (DirecttionStarted != null && bPlaceBox.QueryText != "") { if (_tab_index == 0) //到这里去 { DirecttionStarted(bPlaceBox.QueryText, _bpoint.Address, RouteType.Driving); } else //从这里出发 { DirecttionStarted(_bpoint.Address, bPlaceBox.QueryText, RouteType.Driving); } } } /// /// 周边搜索 /// /// /// private void btnsearch_Click(object sender, EventArgs e) { if (SearchNearbyStarted != null && txtNearby.Text != "") { SearchNearbyStarted(txtNearby.Text, _bpoint.Location); } } /// /// 加载 /// /// /// private void BPointTipControl_Load(object sender, EventArgs e) { //显示形状 GraphicsPath gp = new GraphicsPath(); gp.AddLine(new Point(0, 0), new Point(Width, 0)); gp.AddLine(new Point(Width, 0), new Point(Width, Height - 40)); gp.AddLine(new Point(Width / 3 + 20, Height - 40), new Point(Width, Height - 40)); gp.AddLine(new Point(Width / 3 + 20, Height - 40), new Point(Width / 3 - 40, Height)); gp.AddLine(new Point(Width / 3 - 40, Height), new Point(Width / 3 - 20, Height - 40)); gp.AddLine(new Point(Width / 3 - 20, Height - 40), new Point(0, Height - 40)); this.Region = new Region(gp); } /// /// 关闭 /// /// /// private void picClose_Click(object sender, EventArgs e) { Visible = false; } /// /// 快速周边搜索 /// /// /// private void lnk_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (SearchNearbyStarted != null) { SearchNearbyStarted((sender as LinkLabel).Text, _bpoint.Location); } } /// /// 绘制 /// /// /// private void BPointTipControl_Paint(object sender, PaintEventArgs e) { e.Graphics.SmoothingMode = SmoothingMode.HighQuality; //边框 GraphicsPath gp = new GraphicsPath(); gp.AddLine(new Point(0, 0), new Point(Width - 1, 0)); gp.AddLine(new Point(Width - 1, 0), new Point(Width - 1, Height - 40 - 1)); gp.AddLine(new Point(Width / 3 + 20 - 1, Height - 40 - 1), new Point(Width - 1, Height - 40 - 1)); gp.AddLine(new Point(Width / 3 + 20 - 1, Height - 40 - 1), new Point(Width / 3 - 40, Height - 1)); gp.AddLine(new Point(Width / 3 - 40, Height - 1), new Point(Width / 3 - 20 + 1, Height - 40 - 1)); gp.AddLine(new Point(Width / 3 - 20 + 1, Height - 40 - 1), new Point(0, Height - 40 - 1)); gp.AddLine(new Point(0, 0), new Point(0, Height - 40 - 1)); e.Graphics.DrawPath(Pens.Gray, gp); using (Pen p = new Pen(Color.FromArgb(150, Color.LightGray))) { e.Graphics.DrawLine(p, new Point(0, 42), new Point(Width, 42)); e.Graphics.DrawLine(p, new Point(Width / 3, 42 + 26), new Point(Width / 3, 42)); e.Graphics.DrawLine(p, new Point(Width * 2 / 3, 42 + 26), new Point(Width * 2 / 3, 42)); e.Graphics.DrawImage(Properties.BMap.ico_destination, new Point(10, 42 + 5)); e.Graphics.DrawImage(Properties.BMap.ico_source, new Point(Width / 3 + 10, 42 + 5)); e.Graphics.DrawImage(Properties.BMap.ico_search_in_bound, new Rectangle(Width * 2 / 3 + 10, 42 + 5, 18, 18)); using (Font f = new Font("微软雅黑", 9)) { if (_tab_index == 0) //到这里去 { e.Graphics.DrawLine(p, new Point(Width / 3, 42 + 26), new Point(Width, 42 + 26)); e.Graphics.DrawString("到这里去", f, Brushes.Gray, new PointF(25, 42 + 5)); e.Graphics.DrawString("从这里出发", f, Brushes.Blue, new PointF(Width / 3 + 25, 42 + 5)); e.Graphics.DrawString("周边搜索", f, Brushes.Blue, new PointF(Width * 2 / 3 + 25, 42 + 5)); } else if (_tab_index == 1) //从这里出发 { e.Graphics.DrawLine(p, new Point(0, 42 + 26), new Point(Width / 3, 42 + 26)); e.Graphics.DrawLine(p, new Point(Width * 2 / 3, 42 + 26), new Point(Width, 42 + 26)); e.Graphics.DrawString("到这里去", f, Brushes.Blue, new PointF(25, 42 + 5)); e.Graphics.DrawString("从这里出发", f, Brushes.Gray, new PointF(Width / 3 + 25, 42 + 5)); e.Graphics.DrawString("周边搜索", f, Brushes.Blue, new PointF(Width * 2 / 3 + 25, 42 + 5)); } else //周边搜索 { e.Graphics.DrawLine(p, new Point(0, 42 + 26), new Point(Width * 2 / 3, 42 + 26)); e.Graphics.DrawString("到这里去", f, Brushes.Blue, new PointF(25, 42 + 5)); e.Graphics.DrawString("从这里出发", f, Brushes.Blue, new PointF(Width / 3 + 25, 42 + 5)); e.Graphics.DrawString("周边搜索", f, Brushes.Gray, new PointF(Width * 2 / 3 + 25, 42 + 5)); } } } } /// /// 鼠标移动 /// /// /// private void BPointTipControl_MouseMove(object sender, MouseEventArgs e) { if (new Rectangle(0, 42, Width, 26).Contains(e.Location)) { Cursor = Cursors.Hand; } else { Cursor = Cursors.Arrow; } } /// /// 点击选项卡 /// /// /// private void BPointTipControl_MouseDown(object sender, MouseEventArgs e) { Point p = PointToClient(Cursor.Position); if (new Rectangle(0, 42, Width / 3, 26).Contains(p)) //到这里去 { _tab_index = 0; lblPlace.Text = "起点"; lblPlace.Visible = true; bPlaceBox.Visible = true; btndriving.Visible = true; btntransit.Visible = true; txtNearby.Visible = false; btnsearch.Visible = false; lnknearby_bank.Visible = false; lnknearby_bus_station.Visible = false; lnknearby_eatting.Visible = false; lnknearby_hospital.Visible = false; lnknearby_hotel.Visible = false; } if (new Rectangle(Width / 3, 42, Width / 3, 26).Contains(p)) //从这里出发 { _tab_index = 1; lblPlace.Text = "终点"; lblPlace.Visible = true; bPlaceBox.Visible = true; btndriving.Visible = true; btntransit.Visible = true; txtNearby.Visible = false; btnsearch.Visible = false; lnknearby_bank.Visible = false; lnknearby_bus_station.Visible = false; lnknearby_eatting.Visible = false; lnknearby_hospital.Visible = false; lnknearby_hotel.Visible = false; } if (new Rectangle(Width * 2 / 3, 42, Width / 3, 26).Contains(p)) //周边搜索 { _tab_index = 2; lblPlace.Visible = false; bPlaceBox.Visible = false; btndriving.Visible = false; btntransit.Visible = false; txtNearby.Visible = true; btnsearch.Visible = true; lnknearby_bank.Visible = true; lnknearby_bus_station.Visible = true; lnknearby_eatting.Visible = true; lnknearby_hospital.Visible = true; lnknearby_hotel.Visible = true; lnknearby_bank.Location = new Point(lnknearby_bank.Location.X, 84); lnknearby_bus_station.Location = new Point(lnknearby_bus_station.Location.X, 84); lnknearby_eatting.Location = new Point(lnknearby_eatting.Location.X, 84); lnknearby_hospital.Location = new Point(lnknearby_hospital.Location.X, 84); lnknearby_hotel.Location = new Point(lnknearby_hotel.Location.X, 84); btnsearch.Location = new Point(btnsearch.Location.X, 78); txtNearby.Location = new Point(txtNearby.Location.X, 78); } Invalidate(); } } /// /// 表示处理开始导航这一事件的方法 /// /// /// /// delegate void DirectionStartedEventHandler(string source,string destination,RouteType type); /// /// 标出处理周边搜索这一事件的方法 /// /// /// delegate void SearchNearbyStartedEventHandler(string query,LatLngPoint center); } ================================================ FILE: BMap.NET.WindowsForm/BPointTipControl.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 R0lGODlhDQANAIEBAAkkPP///wAAAAAAACH/C05FVFNDQVBFMi4wAwEBAAAh+QQBAAABACwAAAAADQAN AAAIMQADBABAsGBBgQMNKgSQcKFDhg0FLkQIsaFBhBIfUtSI0SHFjRcjWnx4kSRBkBMDBAQAOw== ================================================ FILE: BMap.NET.WindowsForm/BQuickSearchBoardcs.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class BQuickSearchBoardcs { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BQuickSearchBoardcs)); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.pictureBox2 = new System.Windows.Forms.PictureBox(); this.pictureBox3 = new System.Windows.Forms.PictureBox(); this.linkLabel1 = new System.Windows.Forms.LinkLabel(); this.linkLabel2 = new System.Windows.Forms.LinkLabel(); this.linkLabel3 = new System.Windows.Forms.LinkLabel(); this.label1 = new System.Windows.Forms.Label(); this.pictureBox4 = new System.Windows.Forms.PictureBox(); this.pictureBox5 = new System.Windows.Forms.PictureBox(); this.pictureBox6 = new System.Windows.Forms.PictureBox(); this.linkLabel4 = new System.Windows.Forms.LinkLabel(); this.linkLabel5 = new System.Windows.Forms.LinkLabel(); this.linkLabel6 = new System.Windows.Forms.LinkLabel(); this.linkLabel7 = new System.Windows.Forms.LinkLabel(); this.linkLabel8 = new System.Windows.Forms.LinkLabel(); this.linkLabel9 = new System.Windows.Forms.LinkLabel(); this.linkLabel10 = new System.Windows.Forms.LinkLabel(); this.linkLabel11 = new System.Windows.Forms.LinkLabel(); this.linkLabel12 = new System.Windows.Forms.LinkLabel(); this.linkLabel13 = new System.Windows.Forms.LinkLabel(); this.linkLabel14 = new System.Windows.Forms.LinkLabel(); this.linkLabel15 = new System.Windows.Forms.LinkLabel(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).BeginInit(); this.SuspendLayout(); // // pictureBox1 // this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Hand; this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); this.pictureBox1.Location = new System.Drawing.Point(15, 19); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(54, 54); this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false; this.pictureBox1.Tag = "美食"; this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click); // // pictureBox2 // this.pictureBox2.Cursor = System.Windows.Forms.Cursors.Hand; this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image"))); this.pictureBox2.Location = new System.Drawing.Point(104, 19); this.pictureBox2.Name = "pictureBox2"; this.pictureBox2.Size = new System.Drawing.Size(54, 54); this.pictureBox2.TabIndex = 1; this.pictureBox2.TabStop = false; this.pictureBox2.Tag = "酒店"; this.pictureBox2.Click += new System.EventHandler(this.pictureBox1_Click); // // pictureBox3 // this.pictureBox3.Cursor = System.Windows.Forms.Cursors.Hand; this.pictureBox3.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox3.Image"))); this.pictureBox3.Location = new System.Drawing.Point(194, 19); this.pictureBox3.Name = "pictureBox3"; this.pictureBox3.Size = new System.Drawing.Size(54, 54); this.pictureBox3.TabIndex = 2; this.pictureBox3.TabStop = false; this.pictureBox3.Tag = "电影院"; this.pictureBox3.Click += new System.EventHandler(this.pictureBox1_Click); // // linkLabel1 // this.linkLabel1.AutoSize = true; this.linkLabel1.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel1.ForeColor = System.Drawing.Color.Black; this.linkLabel1.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline; this.linkLabel1.LinkColor = System.Drawing.Color.Black; this.linkLabel1.Location = new System.Drawing.Point(21, 76); this.linkLabel1.Name = "linkLabel1"; this.linkLabel1.Size = new System.Drawing.Size(44, 17); this.linkLabel1.TabIndex = 3; this.linkLabel1.TabStop = true; this.linkLabel1.Tag = "美食"; this.linkLabel1.Text = "找美食"; this.linkLabel1.VisitedLinkColor = System.Drawing.Color.Black; this.linkLabel1.Click += new System.EventHandler(this.linkLabel1_Click); // // linkLabel2 // this.linkLabel2.AutoSize = true; this.linkLabel2.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel2.ForeColor = System.Drawing.Color.Black; this.linkLabel2.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline; this.linkLabel2.LinkColor = System.Drawing.Color.Black; this.linkLabel2.Location = new System.Drawing.Point(110, 76); this.linkLabel2.Name = "linkLabel2"; this.linkLabel2.Size = new System.Drawing.Size(44, 17); this.linkLabel2.TabIndex = 4; this.linkLabel2.TabStop = true; this.linkLabel2.Tag = "酒店"; this.linkLabel2.Text = "订酒店"; this.linkLabel2.VisitedLinkColor = System.Drawing.Color.Black; this.linkLabel2.Click += new System.EventHandler(this.linkLabel1_Click); // // linkLabel3 // this.linkLabel3.AutoSize = true; this.linkLabel3.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel3.ForeColor = System.Drawing.Color.Black; this.linkLabel3.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline; this.linkLabel3.LinkColor = System.Drawing.Color.Black; this.linkLabel3.Location = new System.Drawing.Point(201, 76); this.linkLabel3.Name = "linkLabel3"; this.linkLabel3.Size = new System.Drawing.Size(44, 17); this.linkLabel3.TabIndex = 5; this.linkLabel3.TabStop = true; this.linkLabel3.Tag = "电影院"; this.linkLabel3.Text = "看电影"; this.linkLabel3.VisitedLinkColor = System.Drawing.Color.Black; this.linkLabel3.Click += new System.EventHandler(this.linkLabel1_Click); // // label1 // this.label1.BackColor = System.Drawing.Color.LightGray; this.label1.Location = new System.Drawing.Point(1, 103); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(260, 1); this.label1.TabIndex = 6; this.label1.Text = "label1"; // // pictureBox4 // this.pictureBox4.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox4.Image"))); this.pictureBox4.Location = new System.Drawing.Point(9, 120); this.pictureBox4.Name = "pictureBox4"; this.pictureBox4.Size = new System.Drawing.Size(64, 30); this.pictureBox4.TabIndex = 7; this.pictureBox4.TabStop = false; // // pictureBox5 // this.pictureBox5.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox5.Image"))); this.pictureBox5.Location = new System.Drawing.Point(9, 167); this.pictureBox5.Name = "pictureBox5"; this.pictureBox5.Size = new System.Drawing.Size(64, 30); this.pictureBox5.TabIndex = 8; this.pictureBox5.TabStop = false; // // pictureBox6 // this.pictureBox6.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox6.Image"))); this.pictureBox6.Location = new System.Drawing.Point(9, 214); this.pictureBox6.Name = "pictureBox6"; this.pictureBox6.Size = new System.Drawing.Size(64, 30); this.pictureBox6.TabIndex = 9; this.pictureBox6.TabStop = false; // // linkLabel4 // this.linkLabel4.AutoSize = true; this.linkLabel4.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel4.ForeColor = System.Drawing.Color.Black; this.linkLabel4.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline; this.linkLabel4.LinkColor = System.Drawing.Color.Black; this.linkLabel4.Location = new System.Drawing.Point(78, 126); this.linkLabel4.Name = "linkLabel4"; this.linkLabel4.Size = new System.Drawing.Size(44, 17); this.linkLabel4.TabIndex = 10; this.linkLabel4.TabStop = true; this.linkLabel4.Text = "公交站"; this.linkLabel4.VisitedLinkColor = System.Drawing.Color.Black; this.linkLabel4.Click += new System.EventHandler(this.linkLabel4_Click); // // linkLabel5 // this.linkLabel5.AutoSize = true; this.linkLabel5.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel5.ForeColor = System.Drawing.Color.Black; this.linkLabel5.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline; this.linkLabel5.LinkColor = System.Drawing.Color.Black; this.linkLabel5.Location = new System.Drawing.Point(123, 126); this.linkLabel5.Name = "linkLabel5"; this.linkLabel5.Size = new System.Drawing.Size(44, 17); this.linkLabel5.TabIndex = 11; this.linkLabel5.TabStop = true; this.linkLabel5.Text = "地铁站"; this.linkLabel5.VisitedLinkColor = System.Drawing.Color.Black; this.linkLabel5.Click += new System.EventHandler(this.linkLabel4_Click); // // linkLabel6 // this.linkLabel6.AutoSize = true; this.linkLabel6.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel6.ForeColor = System.Drawing.Color.Black; this.linkLabel6.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline; this.linkLabel6.LinkColor = System.Drawing.Color.Black; this.linkLabel6.Location = new System.Drawing.Point(165, 126); this.linkLabel6.Name = "linkLabel6"; this.linkLabel6.Size = new System.Drawing.Size(44, 17); this.linkLabel6.TabIndex = 12; this.linkLabel6.TabStop = true; this.linkLabel6.Text = "加油站"; this.linkLabel6.VisitedLinkColor = System.Drawing.Color.Black; this.linkLabel6.Click += new System.EventHandler(this.linkLabel4_Click); // // linkLabel7 // this.linkLabel7.AutoSize = true; this.linkLabel7.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel7.ForeColor = System.Drawing.Color.Black; this.linkLabel7.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline; this.linkLabel7.LinkColor = System.Drawing.Color.Black; this.linkLabel7.Location = new System.Drawing.Point(209, 126); this.linkLabel7.Name = "linkLabel7"; this.linkLabel7.Size = new System.Drawing.Size(44, 17); this.linkLabel7.TabIndex = 13; this.linkLabel7.TabStop = true; this.linkLabel7.Text = "停车场"; this.linkLabel7.VisitedLinkColor = System.Drawing.Color.Black; this.linkLabel7.Click += new System.EventHandler(this.linkLabel4_Click); // // linkLabel8 // this.linkLabel8.AutoSize = true; this.linkLabel8.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel8.ForeColor = System.Drawing.Color.Black; this.linkLabel8.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline; this.linkLabel8.LinkColor = System.Drawing.Color.Black; this.linkLabel8.Location = new System.Drawing.Point(78, 173); this.linkLabel8.Name = "linkLabel8"; this.linkLabel8.Size = new System.Drawing.Size(32, 17); this.linkLabel8.TabIndex = 14; this.linkLabel8.TabStop = true; this.linkLabel8.Text = "景点"; this.linkLabel8.VisitedLinkColor = System.Drawing.Color.Black; this.linkLabel8.Click += new System.EventHandler(this.linkLabel4_Click); // // linkLabel9 // this.linkLabel9.AutoSize = true; this.linkLabel9.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel9.ForeColor = System.Drawing.Color.Black; this.linkLabel9.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline; this.linkLabel9.LinkColor = System.Drawing.Color.Black; this.linkLabel9.Location = new System.Drawing.Point(123, 173); this.linkLabel9.Name = "linkLabel9"; this.linkLabel9.Size = new System.Drawing.Size(31, 17); this.linkLabel9.TabIndex = 15; this.linkLabel9.TabStop = true; this.linkLabel9.Text = "KTV"; this.linkLabel9.VisitedLinkColor = System.Drawing.Color.Black; this.linkLabel9.Click += new System.EventHandler(this.linkLabel4_Click); // // linkLabel10 // this.linkLabel10.AutoSize = true; this.linkLabel10.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel10.ForeColor = System.Drawing.Color.Black; this.linkLabel10.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline; this.linkLabel10.LinkColor = System.Drawing.Color.Black; this.linkLabel10.Location = new System.Drawing.Point(165, 173); this.linkLabel10.Name = "linkLabel10"; this.linkLabel10.Size = new System.Drawing.Size(32, 17); this.linkLabel10.TabIndex = 16; this.linkLabel10.TabStop = true; this.linkLabel10.Text = "丽人"; this.linkLabel10.VisitedLinkColor = System.Drawing.Color.Black; this.linkLabel10.Click += new System.EventHandler(this.linkLabel4_Click); // // linkLabel11 // this.linkLabel11.AutoSize = true; this.linkLabel11.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel11.ForeColor = System.Drawing.Color.Black; this.linkLabel11.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline; this.linkLabel11.LinkColor = System.Drawing.Color.Black; this.linkLabel11.Location = new System.Drawing.Point(209, 173); this.linkLabel11.Name = "linkLabel11"; this.linkLabel11.Size = new System.Drawing.Size(32, 17); this.linkLabel11.TabIndex = 17; this.linkLabel11.TabStop = true; this.linkLabel11.Text = "洗浴"; this.linkLabel11.VisitedLinkColor = System.Drawing.Color.Black; this.linkLabel11.Click += new System.EventHandler(this.linkLabel4_Click); // // linkLabel12 // this.linkLabel12.AutoSize = true; this.linkLabel12.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel12.ForeColor = System.Drawing.Color.Black; this.linkLabel12.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline; this.linkLabel12.LinkColor = System.Drawing.Color.Black; this.linkLabel12.Location = new System.Drawing.Point(209, 221); this.linkLabel12.Name = "linkLabel12"; this.linkLabel12.Size = new System.Drawing.Size(35, 17); this.linkLabel12.TabIndex = 21; this.linkLabel12.TabStop = true; this.linkLabel12.Text = "ATM"; this.linkLabel12.VisitedLinkColor = System.Drawing.Color.Black; this.linkLabel12.Click += new System.EventHandler(this.linkLabel4_Click); // // linkLabel13 // this.linkLabel13.AutoSize = true; this.linkLabel13.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel13.ForeColor = System.Drawing.Color.Black; this.linkLabel13.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline; this.linkLabel13.LinkColor = System.Drawing.Color.Black; this.linkLabel13.Location = new System.Drawing.Point(165, 221); this.linkLabel13.Name = "linkLabel13"; this.linkLabel13.Size = new System.Drawing.Size(32, 17); this.linkLabel13.TabIndex = 20; this.linkLabel13.TabStop = true; this.linkLabel13.Text = "药店"; this.linkLabel13.VisitedLinkColor = System.Drawing.Color.Black; this.linkLabel13.Click += new System.EventHandler(this.linkLabel4_Click); // // linkLabel14 // this.linkLabel14.AutoSize = true; this.linkLabel14.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel14.ForeColor = System.Drawing.Color.Black; this.linkLabel14.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline; this.linkLabel14.LinkColor = System.Drawing.Color.Black; this.linkLabel14.Location = new System.Drawing.Point(123, 221); this.linkLabel14.Name = "linkLabel14"; this.linkLabel14.Size = new System.Drawing.Size(32, 17); this.linkLabel14.TabIndex = 19; this.linkLabel14.TabStop = true; this.linkLabel14.Text = "超市"; this.linkLabel14.VisitedLinkColor = System.Drawing.Color.Black; this.linkLabel14.Click += new System.EventHandler(this.linkLabel4_Click); // // linkLabel15 // this.linkLabel15.AutoSize = true; this.linkLabel15.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel15.ForeColor = System.Drawing.Color.Black; this.linkLabel15.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline; this.linkLabel15.LinkColor = System.Drawing.Color.Black; this.linkLabel15.Location = new System.Drawing.Point(78, 221); this.linkLabel15.Name = "linkLabel15"; this.linkLabel15.Size = new System.Drawing.Size(32, 17); this.linkLabel15.TabIndex = 18; this.linkLabel15.TabStop = true; this.linkLabel15.Text = "银行"; this.linkLabel15.VisitedLinkColor = System.Drawing.Color.Black; this.linkLabel15.Click += new System.EventHandler(this.linkLabel4_Click); // // label2 // this.label2.BackColor = System.Drawing.Color.WhiteSmoke; this.label2.Location = new System.Drawing.Point(9, 158); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(240, 1); this.label2.TabIndex = 22; this.label2.Text = "label2"; // // label3 // this.label3.BackColor = System.Drawing.Color.WhiteSmoke; this.label3.Location = new System.Drawing.Point(11, 205); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(240, 1); this.label3.TabIndex = 23; this.label3.Text = "label3"; // // label4 // this.label4.BackColor = System.Drawing.Color.WhiteSmoke; this.label4.Location = new System.Drawing.Point(11, 256); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(240, 1); this.label4.TabIndex = 24; this.label4.Text = "label4"; // // BQuickSearchBoardcs // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.label4); this.Controls.Add(this.label3); this.Controls.Add(this.label2); this.Controls.Add(this.linkLabel12); this.Controls.Add(this.linkLabel13); this.Controls.Add(this.linkLabel14); this.Controls.Add(this.linkLabel15); this.Controls.Add(this.linkLabel11); this.Controls.Add(this.linkLabel10); this.Controls.Add(this.linkLabel9); this.Controls.Add(this.linkLabel8); this.Controls.Add(this.linkLabel7); this.Controls.Add(this.linkLabel6); this.Controls.Add(this.linkLabel5); this.Controls.Add(this.linkLabel4); this.Controls.Add(this.pictureBox6); this.Controls.Add(this.pictureBox5); this.Controls.Add(this.pictureBox4); this.Controls.Add(this.label1); this.Controls.Add(this.linkLabel3); this.Controls.Add(this.linkLabel2); this.Controls.Add(this.linkLabel1); this.Controls.Add(this.pictureBox3); this.Controls.Add(this.pictureBox2); this.Controls.Add(this.pictureBox1); this.Name = "BQuickSearchBoardcs"; this.Size = new System.Drawing.Size(263, 402); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.PictureBox pictureBox2; private System.Windows.Forms.PictureBox pictureBox3; private System.Windows.Forms.LinkLabel linkLabel1; private System.Windows.Forms.LinkLabel linkLabel2; private System.Windows.Forms.LinkLabel linkLabel3; private System.Windows.Forms.Label label1; private System.Windows.Forms.PictureBox pictureBox4; private System.Windows.Forms.PictureBox pictureBox5; private System.Windows.Forms.PictureBox pictureBox6; private System.Windows.Forms.LinkLabel linkLabel4; private System.Windows.Forms.LinkLabel linkLabel5; private System.Windows.Forms.LinkLabel linkLabel6; private System.Windows.Forms.LinkLabel linkLabel7; private System.Windows.Forms.LinkLabel linkLabel8; private System.Windows.Forms.LinkLabel linkLabel9; private System.Windows.Forms.LinkLabel linkLabel10; private System.Windows.Forms.LinkLabel linkLabel11; private System.Windows.Forms.LinkLabel linkLabel12; private System.Windows.Forms.LinkLabel linkLabel13; private System.Windows.Forms.LinkLabel linkLabel14; private System.Windows.Forms.LinkLabel linkLabel15; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; } } ================================================ FILE: BMap.NET.WindowsForm/BQuickSearchBoardcs.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; namespace BMap.NET.WindowsForm { /// /// 快速搜索面板 /// partial class BQuickSearchBoardcs : UserControl { public event QuickSearchEventHandler QuickSearch; public BQuickSearchBoardcs() { InitializeComponent(); } /// /// 点击搜索 /// /// /// private void pictureBox1_Click(object sender, EventArgs e) { if (QuickSearch != null) { QuickSearch((sender as PictureBox).Tag.ToString()); } } /// /// 点击搜索 /// /// /// private void linkLabel4_Click(object sender, EventArgs e) { if (QuickSearch != null) { QuickSearch((sender as LinkLabel).Text); } } /// /// 点击搜索 /// /// /// private void linkLabel1_Click(object sender, EventArgs e) { if (QuickSearch != null) { QuickSearch((sender as LinkLabel).Tag.ToString()); } } } } ================================================ FILE: BMap.NET.WindowsForm/BQuickSearchBoardcs.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 iVBORw0KGgoAAAANSUhEUgAAADYAAAA2CAIAAAADJ/2KAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAAGYktHRAD/AP8A/6C9p5MAAAVgSURBVGhD7ZnZTxtXFIf7 N2IbUhEFqS99aBqJVO1LVTVUSlLAC1AqlFZBUEoSIkAkTdQkfShLG5K2hEolwW0IahVswMsMY8cebI9n +rtzndH0eJY72ER9wPoeWGbu+XzOuYvHb1U143/OiWI7OFFsBy0pVtTD8ov14tJ0Yf5zefycNNojDXUx RnsOxs8V5i4Xl77FBbiM3BiIoynq5a0nyu24lDglRUNSLCzHOREb7C/4F7sgcUq5FcMtuLFpKH8CK5aS j+TJD16bReRE5AAMdTqTYBfgMu4qT5zH7WRAXwIoqrk95eZnLBIy5G3WTMOViSozfRiKDO6BqGLp2c/S cDfLXFA5O6Yoy+hwNwYkIdwQUiyuXOfJO7qcndfpxLAkkCP+ioUfvjb9WkheM7xBoyEM7juHfBSLy9eY XxvlbLCiI5eLUyQowUux/PSnRv6aRm8XPJeljRUS2o6rIiadNHK6bf3nBu/L4W41t0sELFwV2foSO2Y/ jjnHsRIRAQtnxVLy8fG1YDO8KUubq0SD46ioY/8QKXE+HtkbDO30dwRidzCUI/1tlht7j+PsdlDExi+Y QviV/3pkGLoR4KVXXj6DJRmKJ7L8fI3IAAdFbPmCXQhFdevXRmjRl15JJZsVGx25ECUygCri4ISDieBC wwutbv1WWJ3PTH9cPyyhjtXM3/KDK/bKElihYw7jswUo0VVRVaJEFcWrDLKx8P54L5zU7SfFxwt6rSLf G9OK+dLTZfzgRuabjzLRMBkKuNWaKuJ8Kr7WpAdCNXm3UUDhF5Kd6u8gQzHMWuMUTJSoIo7KbC6Tm11A FvO3YpqSre5vq89/0bXaq98f1NUiJgR+cGb9vvT9l45ZBAitzF4kSlQRB3pxRUB6EenhvbgfDbuBN0YG sWChr75PlKii9MWZQJuym6KHhwdsxoz2ECWqmPc7N0iJCDKBLrRwVLRfYOGwaP8XhM4nOolSYEX4Fdfu Vne3LGCmvZJr+ZSh1/Er5jXrTtsFFof/bOyOvSsn6JgWQoq+hcbCpte1xuQM/srfjnskEqH9C+07XVID HZqSQTDpzvD+5Ifi1OQ93JW99gkWfDKmhdB0Kcxd8lZk+3LyIYId/DiJOYHWFCE9+o6h60ZdSw+dlpvG tEBo/0XHd+lGmaTvElBE8+0MhD3iWaB9C6uzuEXdXnfYnS3wZkSWbpENMBXt1A72EVJZnEJ48l8CMr33 1Xt69ZBVeabPqxGhKLIBihwjMrFwbu4yQmLe5Of7YemWS1yJEtcktkmW/1xFk5AL7LC5InKMACKHMbN2 8wiM9lKWppFX2KDnuCuWFZxlUFNMDp7vWu5leviMx0ThVRY6jAGRWkNipz+krFxnk8AwMMeV5WlM21T8 7dRgBIufdHcEncfeg2FUdjaRS+/9xq3KwEFR8IMBLJHL7I0L2E64SvNLr5TxNpBj700FgRBOnugV/WAA SslV30RykJudgVBu9iJOMZjjmBbYXbAEqi/W5PtX0iM9ONR4bCccnsLS5kOiwXFWBMrNPt+OtECSkFHs wtijsf3w7Rj2vnIM3oU3PiUCFq6K+OyNT+C+5W4V66N+Nk0ELFwVQWljhZXbu41agy007IHJMgltx0sR FBenBJvyCPAWbOmxE+d4H97dG2v14Z2JzjZuZtmmvuT9h/wtTfv6ARFFBuvL9j5I/mOJhHBDVBFgjisz F3g6A4uacjx5WF885m8zARQ5WNXlifOIxDIa+EuNXvGn8BaBFU3Mr4YWBoW/GurCxW/uqyE7ODghMA6h yuwlHOjxuQdnGYAfDq6exR+xoOCCSpmerwLRkuKb4USxHZwoto5m/AtKhcVDzR1sfwAAAABJRU5ErkJg gg== iVBORw0KGgoAAAANSUhEUgAAADYAAAA2CAIAAAADJ/2KAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAAGYktHRAD/AP8A/6C9p5MAAAUuSURBVGhD7ZnbbxtFFMb5 02hIY7eAKGoBCQESiVQq8YJAasstIAo8IYF4pLQ09toO5ZI0FIk0jmxAalxn60t8WzvxFZrWidO0TeI4 zibhm1174xzvrndtB/khq+9hvJczvz1zzpmZ9VNVca/HdYTYDR0hdkMUcWt7F6pUd4zocbnqy5cuz6aH p2JDY4HTLv+zdh+ExuBYACdxaSZfwm3kQX0RpHa8uCXuzRRWPvcKz3H+ARtvsQcsXNjCzVkdEUX4yU7a A7gBt13yCngEDxJTRmQa8c/s8rmJ0IBt1sKFGI0zZnUmTjiFE64klVPAJXYDI2aPvDUR8maXicGWMoGY Xy2/fysqwYWtDomMoaQMKMlYHTE8iMcvTEZhihjXkVFEd7r4glP2XKzuM8LRUpJfGWgIpmCQdKElQ4hX 7+YGbH4WbSY8pyXmUZiCQZglHamqNeK3MwsIecRTu85rluzOCMzCOOmuWS0Qr9zNSnzR7vHJkikR2fx3 sxnSKZEe4vRCEcNR9x/poxuq+dI/taAXl5qISDopP+a0/DfgEIzI4tT1vVNAF+gop53jmogoDSx/1fID HVu5+AfT+U+9hZY6+1u63x4nFhokZ0/o/GSUAChSR0R9RgFj9UXNf322ePD++p7hAy+DtyJGGpRER+jO k1kiGLJUEDFNYf5AmdUKwaevRXd3a91vbu882RJVJdZvcswt99sxGtTOvthwh89OhFRnSBVETKY6LoSA KPf9Q7CI9jENnXTElzaqhhDrjrxdKBEYSAXxkgfvJEchMVSTgnjRXRtBFp31tLDU23222FxxwxhiSo7I zzwJAgNRxLWKiIUJKzQaLoQIYt9I7PxU7pWfk8c5Ac57dzL7+tj8cS5hClFyZARdP6mIBIkiSqPMY3nS ZGJfBxA54Yu//kU7/XATrO/8kUW7VN4+NhIziQhHYqx5ABAkivg9n8UiT2eUoUZEeO7rmUW0i+tVYOEM 2utbItxpHjFhsQcv83SyoYjD7rhOLssiXvzyb+bFzGoFXsQoo7262Y4X5bz+yB0nSBRxaDzIZhTtQIRI LPbbYh9O51/7NSXH4gV3bvDGApgaEVFKIQQoMXVQSXQ9OB4kSBTxRZe0qDGDCEeCBkxIZJY9rB3HvKcg 3l+r8ovrs/fWvvEttphpHJHTozxBooiWER9b19CHD4ggwmfx5TInjebLPyWBdTP1ECgKonKglOMGpTw1 CYjRk/Y7BKlTRCPp8qgi3hBWKuIO2ngf7YWFMUSzA60gPljTRLweKz1ji3tzj9FuhWhgoNtIlzfH52NL ZVt4CQP90vVk+MEGfNY40EgXILrTj9DWRzSULqaLjoF0MYposOiYLd1gIlcVmUU0WrpNT4DdRDQ2Abax jCBXFZlENLyMgPQXYwg4gojVl6oURFdEQszoIbJRNrgYg3SWtMiJN8bm35MmYhxXAkW0dYSJG7dhEfSx p4DCifZXt++du9m8m4ELzSxptTYG8N+rv6R2lD1BB8ewp3AgQsxuDCDV7ZXVmTo1KsjO6OTAduft3zMW h2K55kIT2ytZF2+pbFKxVMEUgljsUAiYfT4pCrEnJgCKNBGx1T/l0tvqd0edbPWhXv9gIuvq4X92ap5O iFogQr3+8U5Wr38CldXrH5JlIcdRiVDAUGbRkxmPMs9JcIf5OV6Rt4M/NTB/HO6fGoowTWEe792/hhqF ldudf1awCv5kOjE0HjrzI/8854fOjPLYYOAkLvkKK7iNPGhKHSH+PzpC7IaOEDuXuPcfNGWnyX+qdSUA AAAASUVORK5CYII= iVBORw0KGgoAAAANSUhEUgAAADYAAAA2CAIAAAADJ/2KAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAAGYktHRAD/AP8A/6C9p5MAAAc2SURBVGhD7ZlpVxNJFIbn H8+4Aeqo4zhnBgGJomwqCIiyhS2ssskOyk4SkE0gLGFxQAkBQiA9T6eYJhbp7gTinPlAn/dwOtVVdZ/c uvdWdfjp8Ej5n+sSMRa6RIyFZMSDw+PI5fH4PjlW3teMWl905iY1pt+tTo23WuKt3PCx/GUnj6YcK3Tz +QOIIdqNgSSkc3nRr0w5Vm0FfU9uVVjiYCp/HF8RVjyiA93oPDPhZqA8VQSKGtE5upSf2nxKlqDqSUJl WImnGmuBpXlidEma0FRRIK67d8qyOrBkSnZWp6xxVmt258aaR5rcQJEi2gcXn/5apXouSrhQibFM8uxu tWNwUTKhpwgQ/Up77bjmPMnqOaSCBt3Z2WCPJDrNEP1KY+lgDPmENMqWihFTShPEjrqg/2IHFypBiQnJ qCQjROJP+E+aOoYSlM4hl2Q6VLqI62se8iPC9U29YU25Vpp0pVgo+WoJHy1x5VK3sxIrTvZsrOvmuC6i Wl+C+StNKgmU5KvFZc87Bto/zU+515a23K6/5yZW+1smitJbH14penS9TBoiCRMYsj7vlAA0hUd0jiyZ hiC2gWu3jXo9+4rO9W3L21jy8eEvRbhZGh4qlTLOOjm2LGEIhUP0K+wfxkuM817+Vfdl7dsJi6LgPBwJ cVf9+EjPzKb768kDRVme38y4V2XgTgxhjr0nbHaHQWT/NXYhfK8tTQd7PswfHwfG+ucy71cTgrTDgbjB c3yHT6MuJaBSer7t8dGYEqMzk24JBoVBZMs3iEKWLPtBzcH+IYb3dg/epLWQHGQG7WCBnpNYL1oQN2XZ 7aLzzrY37bbaKE0opCLGl9cU9kswSEbc9fo5mOB2aQpNcKwufsGk13OQ/UcNDhPtydeKXTPrqscUBecl /vJWtNOhIPXdoe+I9unxJaBF+1lhNO12pXf/SEKSEaedboNVZqVqC/sER0lmm8ZHe5N1kEbX7PrG6jY3 HBa1FKFb3Zv+4CCFNNdLnZO15sz2PZKM2F47ZrDKBJwgmHUsh/oDiJ5GO+0dtWMkDTckcmjk4VSShnbq kZ4jxVqrG/f3SDJiZU633irTTshjhuvN0xacQQtwmIQmN6nh6OhYPCX40oMpzFfiL93obCvo5VHgOPD4 pu6ORXtVbo+EJCO+SmrUG4+xd2UDmCFLqMlYTY0ro0R/nlxtrRyipfBxs2Ngfrh7hoxJuV7S1TD+edLd WTdGmKrZk2Al/Rlufd6hu9bxFXmPmiQkGTH9XrUeIg4TiygWC806V/goru5Gu/Co+EslOnmgKJRJGoNB ohbLtqrh0BgIFaYzfrNJSDKiJUE97ksjhTBs//gZG87BBe5T40oDgQAl+sWftf7Do63NHZJd9Ez8+e2R /9jzdY+UZ+/Z9/p4BOLS3AbD+5qdEGvThgrThKOEFAUi8472zmID54GYdLWY6k01mRhaoJFcBoKxCKDt Lx6WlS9D8LEJCcT15S16EgAGXjRHNFho5mV2bGysbGMP4uq8brxFCzUyL6UR7qwHtqd31BwqzXrvO/Dz yHdwWJzRxlgoCWJa6os+GMSi+UIbpAvzEunYYH3hoJu6XrfKCyxNj26Uki5TYy6ecg11TfOIzOWRJV7d D+msVYNXyQ26ewzpkvJOQpIRK/SLDiL+Dn2qb0hhlU8sTXD3EyUdB29vergpetaqZnHcSdjQub91gna2 QS1kz4rO5kXHuHSrqdqnhiMri3s0Z2gx0FD0QdTw+rf92mpyk363UuzUIvFFu6ST0l1vVrqnnUbHHJgy f7eRvxibHF5kzxBOop3lIzNo5yIKM+6fxDSPOFYuBrdvYtGobuscdmRE02MEPnhfPSJQBjumRA0X7UQq B++psaXCJ83CVTxKulJEXov+tvwePRcijKbdqvTuqR4IlYyIbPm9BmuNcJ5zcF5YpYyTxWqZZLNRgdQX FzzHPTdsM6IWchmUQyRWueZ1BIcxZHqkhQDfaPsHWzP3vL4QnRRtRJpXveomEsh9tUdA6W1y8MVMECM/ 0nI6z0ttwu3GlDip5nWvKHXaRRSKo2HoBSgbDNuMXkXEEOaieDFAE8MuY0cK4RVOEi0VQ7z4iRcA42u8 f44vJk2ChAsnoni9Cqo0spdURMVRt76bVk46FTmdLHFYqYfcuNM6pUnl4yU1O8qXVLTu3on8VR/RU2SJ gaQhiMkZ+OxO1Xle9ZF9YEFdbv0CdHEFv5jVMWT0Q54RIvqxPzsFQ/BCPzup+sE/3jVZh8JmcajMENEP +wm0zTZqyociQAxqfGAhhj8kM5U9lj8k/ytyvDSzXXNnVKCiv3BeWVYHU0mTGygKRCHnsIuXNCypHjVj PSUL/lMjP7WZTUGa0FRRIyKfPzBlX6nO643iX0P5fWz9kUTeWZ0HUdPu7iGG22vGy1925SQ2ZNyzWYL/ YOMm92EDjeQZHTjgSQOj0oUQ/xtdIsZCl4gX15HyD/yHYWPwAW2CAAAAAElFTkSuQmCC iVBORw0KGgoAAAANSUhEUgAAAEAAAAAeCAIAAAATj48OAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAGYktHRAD/AP8A/6C9p5MAAANxSURBVFhH7ZjLTxNRFMb9 N925ceXKhYk7Vy7cmBii0Z1hISxMjLogIUHBApa3hECBQt/Q92v6nE479UfvdDK9U+5MGtNiwpcTcs+9 5wznu/ec++iD/n+OewKzhjeBnmlozUy2EkoW92P5YDy/nSoeoNLJkGU0O6gIdHudUj1GxAXtsqmXjG7b NHs9s9vpNlELtQhDGHR7uuUwC9xKoNbKMd/lRtI0u1aXCwxhgBnGVtfUMZ5ApZFKFnbbRs3SlcAMY1ws fboYQ4DpTBb2jF7b0n0AY1xmsg4yAVKclPA5907gguP0y1omUKrHERpGtxXNbcbyW1Sqp0RzvzGm1oWv HxRr0aWDF2wGlj4K/vvq8et0+Wg99HZ+7aFTFjce42vZSQSYP6JhEWhHshstvUKDmJyxukUE3dTLuKAq FoFoENGWCNA+SnwVbaJfO3mzfvrO7JuiR4ERAlozXaxFRJtJtRtGT2evHCtkv9MSdz4iVDf8EGgb2srR q+XDl9AQQ2qMEOB4sr+YKOyIBgdWqvhHIRgIS1xYh0wlJFQ3/BDYDn/8dTJH9JtnH/YjC2JUgRECzs2H aJjgertAfE6hx93J/sMZJ1zYUsUX3CB6KaGdYqcQuMwGvu0827mYl2yEwNaykwjEckE77Yim3dHC6Z97 kQWnUKyI1Jko7Db1ymDRzNgwo9RQ1AC1+zn45PRqWag2nDY2VAR0o3GSWpJiHUvgIrNG8qgJEOv33ecU ulAlAkQm5jWSDbDPfAo8si1teBOQUmgCAooU8klg4/T9fnTRaWnDm4BUxBMQUBSxTwJAsrThTcC5jU5G gLCqzWvxBQnTIOA8yCYgIM612w4ywvqy/VTaT5yiJiA6z69XLH2IEQLAvkoM8qGSLh+fp384hR53Z64a 1o36ZSbg/yohQbECgdCcYAh/9/LKBOzLHARQW50qbW/paPwNp1dnf5kD4jody23RJlOZiUrjinPqqnQo kkSIKNa8dsENYvB+4DqdHXxgqhhDABBQKLXUMRrx/M06EC6nL5njnHU6eWTapYILT03hPk2MJwB48pJL ueoZyU0isQLS9UFrZXlSZqtn1PRw7/K+PP5z3EoAcCpZj/pahMLijOOcJmjxqCdohu7uo94Gdcl83/ys clMYwXh+a/izSnr6JeuGN4E7jnsCs0W//xdmLHM1/XaxGgAAAABJRU5ErkJggg== iVBORw0KGgoAAAANSUhEUgAAAEAAAAAeCAIAAAATj48OAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAGYktHRAD/AP8A/6C9p5MAAASlSURBVFhH7VdZb9tGEO6/ Tx8SNL0QF71yPNTuEaA5jBaNAzR+sWXJcuRDl5XYkayTohiJ5rmk+g1ntaYpmnZRQEqBfCAM7uysPN+c y0+m/3N8JLBs3ICAEGI08ppNt9FwqhWnUnaP61hCOA0CqbM8ZBEIfd/v9Zxq1W+3Rb8vej0xGASaJrQB XvxOG3ygEAohDywDVxIQxgjO9jsdmBuen0/DMHSc0LZCywpdl5amCTJ+tws1YRjy2MKRTkBomluviW6H jHZdEGAOs23BEtqyLESGlDVN7i4WKQTgTrdeF90uUhxuhrlS3ut5hwfe0SEczxLkGBFDkRCHOlXFwjFH IAgoc87OpjAO1s8gOh1ne0s9wXAoN0AjIolw4eDiyzpJwO/3vJMTGBSMx1IUwdsvxQl4lYrciEDp5Pto TX6/L0VXIDDN0epPKt8mL/7Cw+8Kbq3KOu6bN/07t/uf3rr03LkNuVRNEoD7qxV4F8UqJTNkE6CaRjFo Go5nB8He3zfWVlVaphIA7L2isbaGCpTrGULbHj16eCUBzn5K/bmTGSnEAAHQ8N6+zepIQsB6cJDLNAIw DibCUF6Kka7/8D3+8vIaApQDp6cq9aEdGEboebycFfHRRRE7TmCMqKvSIsQLjnutVrSZAsQH1jgHBymJ ET323t5/IoBuGOhDaiw42Wyys91cDlOMFeIQ7baT2yad3Da1rOjXMeAwp1khAdDTHz6ANco4vGA5uPsZ piFLACbglMup2Q95FgHn8DC0zhEBPGy94oAahQI1/igg+N/Sen5y27SF0TaZUC9Kw2RjQ/v6K/3BfUUA /h5+9y0ec3OTJUAiAubmK+3LL24aASIQjS24/MK46OGmhCHg12p4QQ0kFZBLtk3MUcdpMF++tPJ5ZRx+ 8P2T38fPn42fPY33pTgB3L4oRJ/fHa6ssF+uIeDWavhdui/MR2DmeDCkF8uKK8gIWFag6/iv0Y+lIG7c ZOOFVShwEVu53Hh9PaEDJyI49uvXVDbl8vCblcmff8C8LAJUxO029RMMhHfv2DiqgR6leAKi1bqogU4H EjD3W82MIlbGWYW8sbqKWckEINHv/wih0sEkhfWQqCJGXhi//GwXd7MI4ALnlo/gfl7iDDzKLgeCwcCr lDEBgtmVgVxOQyPK16gL4XhGG2XjkKjavXt+lzgzAdpqNFAh+Asd1AkCYr76G/J/14UwAexiEdkibYoh URWKgwINYyGc/VLGIGPjjN9+RfKwRBEAIByvP8cg4iixMEEAbR1L7/SEl8BlAtFVwj0+VkFQuH4Sm6bX OI43xHlwBOLeiRNgzOswkD/cTN8/fozck9J5AlEQdpEbCQ5uKUHgUq+EMi45TqnE3XaRmCOAqOm6XSjA B1zNDBpbMQJqGAOwHsr2buHDuE5HwEC1C3mKA6byLKdF+wxxQC5dDOboyyY4N6GMI1K4WKQTACgOOzvU VR2bojHrRYSo4ZDQcfxWi6xfhu8ZVxIA6KP+rGXnd1D1mCB0sUOrQevE+3iMzwZsEcOF530cWQQk8LWF b4tazSkW7VzO3tqCy118yGsDda1fIm5A4MPGRwLLxXT6D9akp6+FjJWbAAAAAElFTkSuQmCC iVBORw0KGgoAAAANSUhEUgAAAEAAAAAeCAIAAAATj48OAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAGYktHRAD/AP8A/6C9p5MAAATPSURBVFhH7Zh7U9paFMXv 9/8a9zFjr7W1tdb6arVTi1WQl6AiSEIgQAiBQICAXu4v7DQDweb2/uNjpmsyznnsE/baZ699Tvxt+szx i8Bj478J3N39Y/eGjaZdrVlKxeTRqu2GYTPIlG/0eIgicHt717YcVTNbZn8wcMfjWzwGk8mdM3AZZAoD zPwFj4EfEiDABNvqDPDYH1oCU1bHwQxjf+jBcT+BTndAnrjjid+PBGYYs8TvPyzuIdDrjyrV9uT/JAbG LHmUfQgTIMtJCdf9qdjPg31g4cPrIUwAUfLQgEn+qpnN13lG7q3MAsN0yqol7arevSg03e+z6EHW3gvK wOt3Z7+vfOWhkUgp0g6elVcnptUXY+rEzqdc+lyTbgQWCEj4pTgi3/OLBo1CqVWr27P5ab3ZO8vUktka kcYsk6tjk87psGIWTQfLlwGBrb0sLt4oxsaHFATo+nPTKeOwEgJUjS+xQoiePPMkBQsEyH6j1ZM2YVY1 L9I4Xa54DSgl0lVc1xv2yJ1QVbVal3EEkMrWmKXNcl5CYxnRBC4KOoPD4ZjYHx5dvXwTX9tIJDNqUAKr usVI7LQYKooLBJqGTYGXNrnR6XqixFE2gWXXpVbb8rwsKZ7EiXTustFqO/2+e1Ewvp4oTDmOy0u89UtY TiEI4PH6pjf4598xSZh4Svn4+YIADYbjvYP87qdcrd7ZP8xjRq2TV81jgcB88fGcmyVG33Gvii3GZR/A 5bXR63s89bp9VTTgUyybbBQjxO/enwHROxAC25i/0ncPckR97zD/4vXJ1m4mmakQHd7jG82wQKCsepEW 4Fwmp9MgumiAeN+ovmf4yiD5Y5h90qlS7SiaJToRGYhZCMsEZDeC56/V40Kxsf3xHHffz9zt2v7Zglfc ZY6Or+GDGQoJ/FwgwG/Pn7sEHv/IH9kWIh0IFNfJ+0y+brad4XAyHE0oVoxj8PME+Lu5k1Y1Ly7tjvNu Ox06DTF+u5WKPiIXCGg1azxZqJg4ja/Svb5pabqnWsAm3CjtQrHVMLzZdmdAXtFAMNz5ZiZh3KsBRHnw 5ZLZ43gJ7YbMlp+1t/HQcflDEQPCT27wV7rOYEwN7dreetkZEQNOJ1LVru0VnwgRE0jCGdJAy+ytbyZp v9pILC8M6AlYy5IoDSAd3uh3Zl5SSQMCwO6N4IA8oFG8Mctqm9QneaQ6gYgyWm90CS2pEhJxPKn88SJ2 llbFLAAiDrEiOUkzCpffn2GBgGTwXKI75AyFUroC4s3hRbwpOHTZBKm2IPogw0V+nmOkVDY2d9CoCgHa q2/i2/vnK2vfEmlF1hIdqufq+ikpLWsB2sQAifv971ggAIKrBCBJUCoXipBP3CCo/dKmBAX3H86yiKtE 7KSYv9QpL6Qy6Z7NVTmtyB8+Kphl6+CD35nzKpTiyTJHgSz8sJ8VAUCypHhKm0eYgGwCl7nRaIJzXoms WBwF/vQM5JWcA4BZuSk9lcscIIk50aj6sVOVe863REUqTIBlAtTZp3KdFlAxONROk1osrh4claj381kU IsD+PK0PGoF8UhZKBjROzrT53AgIwKqqk2NP75NSgNOIkq0olVt9Z0T9oc4ALhHo1Ww/7Y/6AISZAIf/ rdJ8Dv9WeRb4ReBxMZ3+CwQqqEPzRWjfAAAAAElFTkSuQmCC ================================================ FILE: BMap.NET.WindowsForm/BQuickSearchControl.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class BQuickSearchControl { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BQuickSearchControl)); this.label1 = new System.Windows.Forms.Label(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.pictureBox2 = new System.Windows.Forms.PictureBox(); this.pictureBox3 = new System.Windows.Forms.PictureBox(); this.pictureBox4 = new System.Windows.Forms.PictureBox(); this.pictureBox5 = new System.Windows.Forms.PictureBox(); this.linkLabel1 = new System.Windows.Forms.LinkLabel(); this.linkLabel2 = new System.Windows.Forms.LinkLabel(); this.linkLabel3 = new System.Windows.Forms.LinkLabel(); this.linkLabel4 = new System.Windows.Forms.LinkLabel(); this.linkLabel5 = new System.Windows.Forms.LinkLabel(); this.linkLabel6 = new System.Windows.Forms.LinkLabel(); this.linkLabel7 = new System.Windows.Forms.LinkLabel(); this.linkLabel8 = new System.Windows.Forms.LinkLabel(); this.linkLabel9 = new System.Windows.Forms.LinkLabel(); this.linkLabel10 = new System.Windows.Forms.LinkLabel(); this.linkLabel11 = new System.Windows.Forms.LinkLabel(); this.linkLabel12 = new System.Windows.Forms.LinkLabel(); this.linkLabel13 = new System.Windows.Forms.LinkLabel(); this.linkLabel14 = new System.Windows.Forms.LinkLabel(); this.linkLabel15 = new System.Windows.Forms.LinkLabel(); this.linkLabel16 = new System.Windows.Forms.LinkLabel(); this.linkLabel17 = new System.Windows.Forms.LinkLabel(); this.linkLabel18 = new System.Windows.Forms.LinkLabel(); this.linkLabel19 = new System.Windows.Forms.LinkLabel(); this.linkLabel20 = new System.Windows.Forms.LinkLabel(); this.linkLabel21 = new System.Windows.Forms.LinkLabel(); this.linkLabel22 = new System.Windows.Forms.LinkLabel(); this.linkLabel23 = new System.Windows.Forms.LinkLabel(); this.linkLabel24 = new System.Windows.Forms.LinkLabel(); this.label2 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit(); this.SuspendLayout(); // // label1 // this.label1.BackColor = System.Drawing.Color.LightGray; this.label1.Location = new System.Drawing.Point(13, 24); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(273, 1); this.label1.TabIndex = 0; // // pictureBox1 // this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Hand; this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); this.pictureBox1.Location = new System.Drawing.Point(273, 7); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(13, 13); this.pictureBox1.TabIndex = 1; this.pictureBox1.TabStop = false; this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click); // // pictureBox2 // this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image"))); this.pictureBox2.Location = new System.Drawing.Point(15, 36); this.pictureBox2.Name = "pictureBox2"; this.pictureBox2.Size = new System.Drawing.Size(20, 20); this.pictureBox2.TabIndex = 2; this.pictureBox2.TabStop = false; // // pictureBox3 // this.pictureBox3.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox3.Image"))); this.pictureBox3.Location = new System.Drawing.Point(15, 67); this.pictureBox3.Name = "pictureBox3"; this.pictureBox3.Size = new System.Drawing.Size(20, 20); this.pictureBox3.TabIndex = 3; this.pictureBox3.TabStop = false; // // pictureBox4 // this.pictureBox4.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox4.Image"))); this.pictureBox4.Location = new System.Drawing.Point(15, 97); this.pictureBox4.Name = "pictureBox4"; this.pictureBox4.Size = new System.Drawing.Size(20, 20); this.pictureBox4.TabIndex = 4; this.pictureBox4.TabStop = false; // // pictureBox5 // this.pictureBox5.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox5.Image"))); this.pictureBox5.Location = new System.Drawing.Point(15, 149); this.pictureBox5.Name = "pictureBox5"; this.pictureBox5.Size = new System.Drawing.Size(20, 20); this.pictureBox5.TabIndex = 5; this.pictureBox5.TabStop = false; // // linkLabel1 // this.linkLabel1.AutoSize = true; this.linkLabel1.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel1.Location = new System.Drawing.Point(41, 37); this.linkLabel1.Name = "linkLabel1"; this.linkLabel1.Size = new System.Drawing.Size(56, 17); this.linkLabel1.TabIndex = 6; this.linkLabel1.TabStop = true; this.linkLabel1.Text = "快捷酒店"; this.linkLabel1.VisitedLinkColor = System.Drawing.Color.Blue; this.linkLabel1.Click += new System.EventHandler(this.linkLabel2_Click); // // linkLabel2 // this.linkLabel2.AutoSize = true; this.linkLabel2.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel2.Location = new System.Drawing.Point(100, 37); this.linkLabel2.Name = "linkLabel2"; this.linkLabel2.Size = new System.Drawing.Size(56, 17); this.linkLabel2.TabIndex = 7; this.linkLabel2.TabStop = true; this.linkLabel2.Text = "星级酒店"; this.linkLabel2.VisitedLinkColor = System.Drawing.Color.Blue; this.linkLabel2.Click += new System.EventHandler(this.linkLabel2_Click); // // linkLabel3 // this.linkLabel3.AutoSize = true; this.linkLabel3.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel3.Location = new System.Drawing.Point(159, 37); this.linkLabel3.Name = "linkLabel3"; this.linkLabel3.Size = new System.Drawing.Size(32, 17); this.linkLabel3.TabIndex = 8; this.linkLabel3.TabStop = true; this.linkLabel3.Text = "旅馆"; this.linkLabel3.VisitedLinkColor = System.Drawing.Color.Blue; this.linkLabel3.Click += new System.EventHandler(this.linkLabel2_Click); // // linkLabel4 // this.linkLabel4.AutoSize = true; this.linkLabel4.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel4.Location = new System.Drawing.Point(194, 37); this.linkLabel4.Name = "linkLabel4"; this.linkLabel4.Size = new System.Drawing.Size(32, 17); this.linkLabel4.TabIndex = 9; this.linkLabel4.TabStop = true; this.linkLabel4.Text = "如家"; this.linkLabel4.VisitedLinkColor = System.Drawing.Color.Blue; this.linkLabel4.Click += new System.EventHandler(this.linkLabel2_Click); // // linkLabel5 // this.linkLabel5.AutoSize = true; this.linkLabel5.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel5.Location = new System.Drawing.Point(263, 37); this.linkLabel5.Name = "linkLabel5"; this.linkLabel5.Size = new System.Drawing.Size(27, 17); this.linkLabel5.TabIndex = 10; this.linkLabel5.TabStop = true; this.linkLabel5.Text = "7天"; this.linkLabel5.VisitedLinkColor = System.Drawing.Color.Blue; this.linkLabel5.Click += new System.EventHandler(this.linkLabel2_Click); // // linkLabel6 // this.linkLabel6.AutoSize = true; this.linkLabel6.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel6.Location = new System.Drawing.Point(229, 37); this.linkLabel6.Name = "linkLabel6"; this.linkLabel6.Size = new System.Drawing.Size(32, 17); this.linkLabel6.TabIndex = 11; this.linkLabel6.TabStop = true; this.linkLabel6.Text = "汉庭"; this.linkLabel6.VisitedLinkColor = System.Drawing.Color.Blue; this.linkLabel6.Click += new System.EventHandler(this.linkLabel2_Click); // // linkLabel7 // this.linkLabel7.AutoSize = true; this.linkLabel7.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel7.Location = new System.Drawing.Point(41, 69); this.linkLabel7.Name = "linkLabel7"; this.linkLabel7.Size = new System.Drawing.Size(32, 17); this.linkLabel7.TabIndex = 12; this.linkLabel7.TabStop = true; this.linkLabel7.Text = "餐馆"; this.linkLabel7.VisitedLinkColor = System.Drawing.Color.Blue; this.linkLabel7.Click += new System.EventHandler(this.linkLabel2_Click); // // linkLabel8 // this.linkLabel8.AutoSize = true; this.linkLabel8.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel8.Location = new System.Drawing.Point(76, 69); this.linkLabel8.Name = "linkLabel8"; this.linkLabel8.Size = new System.Drawing.Size(32, 17); this.linkLabel8.TabIndex = 13; this.linkLabel8.TabStop = true; this.linkLabel8.Text = "快餐"; this.linkLabel8.VisitedLinkColor = System.Drawing.Color.Blue; this.linkLabel8.Click += new System.EventHandler(this.linkLabel2_Click); // // linkLabel9 // this.linkLabel9.AutoSize = true; this.linkLabel9.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel9.Location = new System.Drawing.Point(111, 69); this.linkLabel9.Name = "linkLabel9"; this.linkLabel9.Size = new System.Drawing.Size(44, 17); this.linkLabel9.TabIndex = 14; this.linkLabel9.TabStop = true; this.linkLabel9.Text = "肯德基"; this.linkLabel9.VisitedLinkColor = System.Drawing.Color.Blue; this.linkLabel9.Click += new System.EventHandler(this.linkLabel2_Click); // // linkLabel10 // this.linkLabel10.AutoSize = true; this.linkLabel10.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel10.Location = new System.Drawing.Point(158, 69); this.linkLabel10.Name = "linkLabel10"; this.linkLabel10.Size = new System.Drawing.Size(44, 17); this.linkLabel10.TabIndex = 15; this.linkLabel10.TabStop = true; this.linkLabel10.Text = "麦当劳"; this.linkLabel10.VisitedLinkColor = System.Drawing.Color.Blue; this.linkLabel10.Click += new System.EventHandler(this.linkLabel2_Click); // // linkLabel11 // this.linkLabel11.AutoSize = true; this.linkLabel11.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel11.Location = new System.Drawing.Point(205, 69); this.linkLabel11.Name = "linkLabel11"; this.linkLabel11.Size = new System.Drawing.Size(44, 17); this.linkLabel11.TabIndex = 16; this.linkLabel11.TabStop = true; this.linkLabel11.Text = "咖啡厅"; this.linkLabel11.VisitedLinkColor = System.Drawing.Color.Blue; this.linkLabel11.Click += new System.EventHandler(this.linkLabel2_Click); // // linkLabel12 // this.linkLabel12.AutoSize = true; this.linkLabel12.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel12.Location = new System.Drawing.Point(41, 99); this.linkLabel12.Name = "linkLabel12"; this.linkLabel12.Size = new System.Drawing.Size(56, 17); this.linkLabel12.TabIndex = 17; this.linkLabel12.TabStop = true; this.linkLabel12.Text = "公交车站"; this.linkLabel12.VisitedLinkColor = System.Drawing.Color.Blue; this.linkLabel12.Click += new System.EventHandler(this.linkLabel2_Click); // // linkLabel13 // this.linkLabel13.AutoSize = true; this.linkLabel13.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel13.Location = new System.Drawing.Point(100, 99); this.linkLabel13.Name = "linkLabel13"; this.linkLabel13.Size = new System.Drawing.Size(32, 17); this.linkLabel13.TabIndex = 18; this.linkLabel13.TabStop = true; this.linkLabel13.Text = "银行"; this.linkLabel13.VisitedLinkColor = System.Drawing.Color.Blue; this.linkLabel13.Click += new System.EventHandler(this.linkLabel2_Click); // // linkLabel14 // this.linkLabel14.AutoSize = true; this.linkLabel14.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel14.Location = new System.Drawing.Point(134, 99); this.linkLabel14.Name = "linkLabel14"; this.linkLabel14.Size = new System.Drawing.Size(32, 17); this.linkLabel14.TabIndex = 19; this.linkLabel14.TabStop = true; this.linkLabel14.Text = "医院"; this.linkLabel14.VisitedLinkColor = System.Drawing.Color.Blue; this.linkLabel14.Click += new System.EventHandler(this.linkLabel2_Click); // // linkLabel15 // this.linkLabel15.AutoSize = true; this.linkLabel15.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel15.Location = new System.Drawing.Point(171, 99); this.linkLabel15.Name = "linkLabel15"; this.linkLabel15.Size = new System.Drawing.Size(32, 17); this.linkLabel15.TabIndex = 20; this.linkLabel15.TabStop = true; this.linkLabel15.Text = "超市"; this.linkLabel15.VisitedLinkColor = System.Drawing.Color.Blue; this.linkLabel15.Click += new System.EventHandler(this.linkLabel2_Click); // // linkLabel16 // this.linkLabel16.AutoSize = true; this.linkLabel16.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel16.Location = new System.Drawing.Point(207, 99); this.linkLabel16.Name = "linkLabel16"; this.linkLabel16.Size = new System.Drawing.Size(35, 17); this.linkLabel16.TabIndex = 21; this.linkLabel16.TabStop = true; this.linkLabel16.Text = "ATM"; this.linkLabel16.VisitedLinkColor = System.Drawing.Color.Blue; this.linkLabel16.Click += new System.EventHandler(this.linkLabel2_Click); // // linkLabel17 // this.linkLabel17.AutoSize = true; this.linkLabel17.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel17.Location = new System.Drawing.Point(246, 99); this.linkLabel17.Name = "linkLabel17"; this.linkLabel17.Size = new System.Drawing.Size(44, 17); this.linkLabel17.TabIndex = 22; this.linkLabel17.TabStop = true; this.linkLabel17.Text = "加油站"; this.linkLabel17.VisitedLinkColor = System.Drawing.Color.Blue; this.linkLabel17.Click += new System.EventHandler(this.linkLabel2_Click); // // linkLabel18 // this.linkLabel18.AutoSize = true; this.linkLabel18.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel18.Location = new System.Drawing.Point(41, 122); this.linkLabel18.Name = "linkLabel18"; this.linkLabel18.Size = new System.Drawing.Size(44, 17); this.linkLabel18.TabIndex = 23; this.linkLabel18.TabStop = true; this.linkLabel18.Text = "停车场"; this.linkLabel18.VisitedLinkColor = System.Drawing.Color.Blue; this.linkLabel18.Click += new System.EventHandler(this.linkLabel2_Click); // // linkLabel19 // this.linkLabel19.AutoSize = true; this.linkLabel19.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel19.Location = new System.Drawing.Point(88, 122); this.linkLabel19.Name = "linkLabel19"; this.linkLabel19.Size = new System.Drawing.Size(56, 17); this.linkLabel19.TabIndex = 24; this.linkLabel19.TabStop = true; this.linkLabel19.Text = "楼盘小区"; this.linkLabel19.VisitedLinkColor = System.Drawing.Color.Blue; this.linkLabel19.Click += new System.EventHandler(this.linkLabel2_Click); // // linkLabel20 // this.linkLabel20.AutoSize = true; this.linkLabel20.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel20.Location = new System.Drawing.Point(41, 151); this.linkLabel20.Name = "linkLabel20"; this.linkLabel20.Size = new System.Drawing.Size(31, 17); this.linkLabel20.TabIndex = 25; this.linkLabel20.TabStop = true; this.linkLabel20.Text = "KTV"; this.linkLabel20.VisitedLinkColor = System.Drawing.Color.Blue; this.linkLabel20.Click += new System.EventHandler(this.linkLabel2_Click); // // linkLabel21 // this.linkLabel21.AutoSize = true; this.linkLabel21.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel21.Location = new System.Drawing.Point(80, 151); this.linkLabel21.Name = "linkLabel21"; this.linkLabel21.Size = new System.Drawing.Size(44, 17); this.linkLabel21.TabIndex = 26; this.linkLabel21.TabStop = true; this.linkLabel21.Text = "电影院"; this.linkLabel21.VisitedLinkColor = System.Drawing.Color.Blue; this.linkLabel21.Click += new System.EventHandler(this.linkLabel2_Click); // // linkLabel22 // this.linkLabel22.AutoSize = true; this.linkLabel22.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel22.Location = new System.Drawing.Point(128, 151); this.linkLabel22.Name = "linkLabel22"; this.linkLabel22.Size = new System.Drawing.Size(32, 17); this.linkLabel22.TabIndex = 27; this.linkLabel22.TabStop = true; this.linkLabel22.Text = "网吧"; this.linkLabel22.VisitedLinkColor = System.Drawing.Color.Blue; this.linkLabel22.Click += new System.EventHandler(this.linkLabel2_Click); // // linkLabel23 // this.linkLabel23.AutoSize = true; this.linkLabel23.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel23.Location = new System.Drawing.Point(169, 151); this.linkLabel23.Name = "linkLabel23"; this.linkLabel23.Size = new System.Drawing.Size(32, 17); this.linkLabel23.TabIndex = 28; this.linkLabel23.TabStop = true; this.linkLabel23.Text = "酒吧"; this.linkLabel23.VisitedLinkColor = System.Drawing.Color.Blue; this.linkLabel23.Click += new System.EventHandler(this.linkLabel2_Click); // // linkLabel24 // this.linkLabel24.AutoSize = true; this.linkLabel24.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLabel24.Location = new System.Drawing.Point(208, 151); this.linkLabel24.Name = "linkLabel24"; this.linkLabel24.Size = new System.Drawing.Size(56, 17); this.linkLabel24.TabIndex = 29; this.linkLabel24.TabStop = true; this.linkLabel24.Text = "健身中心"; this.linkLabel24.VisitedLinkColor = System.Drawing.Color.Blue; this.linkLabel24.Click += new System.EventHandler(this.linkLabel2_Click); // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(13, 7); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(89, 12); this.label2.TabIndex = 30; this.label2.Text = "在区域内搜索:"; // // BQuickSearchControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.label2); this.Controls.Add(this.linkLabel24); this.Controls.Add(this.linkLabel23); this.Controls.Add(this.linkLabel22); this.Controls.Add(this.linkLabel21); this.Controls.Add(this.linkLabel20); this.Controls.Add(this.linkLabel19); this.Controls.Add(this.linkLabel18); this.Controls.Add(this.linkLabel17); this.Controls.Add(this.linkLabel16); this.Controls.Add(this.linkLabel15); this.Controls.Add(this.linkLabel14); this.Controls.Add(this.linkLabel13); this.Controls.Add(this.linkLabel12); this.Controls.Add(this.linkLabel11); this.Controls.Add(this.linkLabel10); this.Controls.Add(this.linkLabel9); this.Controls.Add(this.linkLabel8); this.Controls.Add(this.linkLabel7); this.Controls.Add(this.linkLabel6); this.Controls.Add(this.linkLabel5); this.Controls.Add(this.linkLabel4); this.Controls.Add(this.linkLabel3); this.Controls.Add(this.linkLabel2); this.Controls.Add(this.linkLabel1); this.Controls.Add(this.pictureBox5); this.Controls.Add(this.pictureBox4); this.Controls.Add(this.pictureBox3); this.Controls.Add(this.pictureBox2); this.Controls.Add(this.pictureBox1); this.Controls.Add(this.label1); this.Name = "BQuickSearchControl"; this.Size = new System.Drawing.Size(298, 183); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.PictureBox pictureBox2; private System.Windows.Forms.PictureBox pictureBox3; private System.Windows.Forms.PictureBox pictureBox4; private System.Windows.Forms.PictureBox pictureBox5; private System.Windows.Forms.LinkLabel linkLabel1; private System.Windows.Forms.LinkLabel linkLabel2; private System.Windows.Forms.LinkLabel linkLabel3; private System.Windows.Forms.LinkLabel linkLabel4; private System.Windows.Forms.LinkLabel linkLabel5; private System.Windows.Forms.LinkLabel linkLabel6; private System.Windows.Forms.LinkLabel linkLabel7; private System.Windows.Forms.LinkLabel linkLabel8; private System.Windows.Forms.LinkLabel linkLabel9; private System.Windows.Forms.LinkLabel linkLabel10; private System.Windows.Forms.LinkLabel linkLabel11; private System.Windows.Forms.LinkLabel linkLabel12; private System.Windows.Forms.LinkLabel linkLabel13; private System.Windows.Forms.LinkLabel linkLabel14; private System.Windows.Forms.LinkLabel linkLabel15; private System.Windows.Forms.LinkLabel linkLabel16; private System.Windows.Forms.LinkLabel linkLabel17; private System.Windows.Forms.LinkLabel linkLabel18; private System.Windows.Forms.LinkLabel linkLabel19; private System.Windows.Forms.LinkLabel linkLabel20; private System.Windows.Forms.LinkLabel linkLabel21; private System.Windows.Forms.LinkLabel linkLabel22; private System.Windows.Forms.LinkLabel linkLabel23; private System.Windows.Forms.LinkLabel linkLabel24; private System.Windows.Forms.Label label2; } } ================================================ FILE: BMap.NET.WindowsForm/BQuickSearchControl.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; namespace BMap.NET.WindowsForm { /// /// 快速搜索控件 /// partial class BQuickSearchControl : UserControl { public event QuickSearchEventHandler QuickSearch; public BQuickSearchControl() { InitializeComponent(); } /// /// 关闭 /// /// /// private void pictureBox1_Click(object sender, EventArgs e) { Visible = false; } /// /// 点击搜索 /// /// /// private void linkLabel2_Click(object sender, EventArgs e) { string search_name = (sender as LinkLabel).Text; if (QuickSearch != null) { QuickSearch(search_name); } } } /// /// 表示处理快速搜索事件的方法 /// /// delegate void QuickSearchEventHandler(string searchName); } ================================================ FILE: BMap.NET.WindowsForm/BQuickSearchControl.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 R0lGODlhDQANAIEBAAkkPP///wAAAAAAACH/C05FVFNDQVBFMi4wAwEBAAAh+QQBAAABACwAAAAADQAN AAAIMQADBABAsGBBgQMNKgSQcKFDhg0FLkQIsaFBhBIfUtSI0SHFjRcjWnx4kSRBkBMDBAQAOw== iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAAGYktHRAD/AP8A/6C9p5MAAABVSURBVDhPY/hFARg8mhev O4iGoBLYAIpmNG1wBJXGAOiaoSwkQIJmrAgqjQFGbcbQhomgSsGA2pqhHDCA64EjqAQYUEkzmiI8CKoB zWZSwZDU/OsXAMmiP+WOJOJ2AAAAAElFTkSuQmCC iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAAGYktHRAD/AP8A/6C9p5MAAABNSURBVDhPY/hFARgOmhev Owgh4QywMFQEzoWDwaMZDaGJQ7hwQD3NEICpji6a4eqQlWKKQADtNQMBpggQDB7NQIBVHbGaiQcDpfnX LwCQu0sREcUJbQAAAABJRU5ErkJggg== iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAAGYktHRAD/AP8A/6C9p5MAAABkSURBVDhPY/hFARgqmhev OwhlgQFCM1CCGARVDQZU0gwEmNLIgCjN+BFUKRiQphmqDgaIdTaxmvEgqDoYoJ5m/ICAZmRLsCKoOhhA aMalAgKwyqJrhnIwAFZZEvyMCYak5l+/AOQvPHUttmvbAAAAAElFTkSuQmCC iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAAGYktHRAD/AP8A/6C9p5MAAABvSURBVDhP3dBBCoAwDERR 738N997Ba2VlyUxrjLE1iAh+srHpg+IkD/onnpe1DY9MPWwlhotaDpfhTrvEzrThWnsBO2CHN7Qc5roW YFyyBifnPMa9IUMHbE2foR1nZSnGPBoVPJsfN/I/LNVXWGQDcJFR8VBy9yYAAAAASUVORK5CYII= ================================================ FILE: BMap.NET.WindowsForm/BScreenshotMenu.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class BScreenshotMenu { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BScreenshotMenu)); this.label1 = new System.Windows.Forms.Label(); this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.label2 = new System.Windows.Forms.Label(); this.SuspendLayout(); // // label1 // this.label1.Cursor = System.Windows.Forms.Cursors.Hand; this.label1.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.label1.ImageIndex = 0; this.label1.ImageList = this.imageList1; this.label1.Location = new System.Drawing.Point(0, 0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(63, 25); this.label1.TabIndex = 0; this.label1.Text = "取消"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label1.Click += new System.EventHandler(this.label1_Click); this.label1.MouseEnter += new System.EventHandler(this.label1_MouseEnter); this.label1.MouseLeave += new System.EventHandler(this.label1_MouseLeave); // // imageList1 // this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); this.imageList1.TransparentColor = System.Drawing.Color.Transparent; this.imageList1.Images.SetKeyName(0, "ico_screenshotCancel.gif"); this.imageList1.Images.SetKeyName(1, "ico_screenshotOK.gif"); // // label2 // this.label2.Cursor = System.Windows.Forms.Cursors.Hand; this.label2.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.label2.ImageIndex = 1; this.label2.ImageList = this.imageList1; this.label2.Location = new System.Drawing.Point(67, 0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(63, 25); this.label2.TabIndex = 1; this.label2.Text = "确定"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label2.Click += new System.EventHandler(this.label1_Click); this.label2.MouseEnter += new System.EventHandler(this.label1_MouseEnter); this.label2.MouseLeave += new System.EventHandler(this.label1_MouseLeave); // // BScreenshotMenu // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Name = "BScreenshotMenu"; this.Size = new System.Drawing.Size(132, 27); this.ResumeLayout(false); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.ImageList imageList1; private System.Windows.Forms.Label label2; } } ================================================ FILE: BMap.NET.WindowsForm/BScreenshotMenu.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; namespace BMap.NET.WindowsForm { /// /// 截图菜单 /// partial class BScreenshotMenu : UserControl { public event ScreenshotDoneEventHandler ScreenshotDone; public BScreenshotMenu() { InitializeComponent(); } /// /// 鼠标进入变色 /// /// /// private void label1_MouseEnter(object sender, EventArgs e) { (sender as Label).BackColor = Color.Gray; } /// /// 鼠标移出变色 /// /// /// private void label1_MouseLeave(object sender, EventArgs e) { (sender as Label).BackColor = Color.White; } /// /// 鼠标点击 /// /// /// private void label1_Click(object sender, EventArgs e) { if ((sender as Label).Text == "确定") { if (ScreenshotDone != null) { ScreenshotDone(true); } } else { if (ScreenshotDone != null) { ScreenshotDone(false); } } } } /// /// 表示处理截图完成事件的方法 /// /// delegate void ScreenshotDoneEventHandler(bool saved); } ================================================ FILE: BMap.NET.WindowsForm/BScreenshotMenu.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 17, 17 AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABY CwAAAk1TRnQBSQFMAgEBAgEAAQgBAAEIAQABGQEAARkBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABZAMAARkDAAEBAQABCAUAAcQBCRgAAYACAAGAAwACgAEAAYADAAGAAQABgAEAAoACAAPAAQABwAHc AcABAAHwAcoBpgEAATMFAAEzAQABMwEAATMBAAIzAgADFgEAAxwBAAMiAQADKQEAA1UBAANNAQADQgEA AzkBAAGAAXwB/wEAAlAB/wEAAZMBAAHWAQAB/wHsAcwBAAHGAdYB7wEAAdYC5wEAAZABqQGtAgAB/wEz AwABZgMAAZkDAAHMAgABMwMAAjMCAAEzAWYCAAEzAZkCAAEzAcwCAAEzAf8CAAFmAwABZgEzAgACZgIA AWYBmQIAAWYBzAIAAWYB/wIAAZkDAAGZATMCAAGZAWYCAAKZAgABmQHMAgABmQH/AgABzAMAAcwBMwIA AcwBZgIAAcwBmQIAAswCAAHMAf8CAAH/AWYCAAH/AZkCAAH/AcwBAAEzAf8CAAH/AQABMwEAATMBAAFm AQABMwEAAZkBAAEzAQABzAEAATMBAAH/AQAB/wEzAgADMwEAAjMBZgEAAjMBmQEAAjMBzAEAAjMB/wEA ATMBZgIAATMBZgEzAQABMwJmAQABMwFmAZkBAAEzAWYBzAEAATMBZgH/AQABMwGZAgABMwGZATMBAAEz AZkBZgEAATMCmQEAATMBmQHMAQABMwGZAf8BAAEzAcwCAAEzAcwBMwEAATMBzAFmAQABMwHMAZkBAAEz AswBAAEzAcwB/wEAATMB/wEzAQABMwH/AWYBAAEzAf8BmQEAATMB/wHMAQABMwL/AQABZgMAAWYBAAEz AQABZgEAAWYBAAFmAQABmQEAAWYBAAHMAQABZgEAAf8BAAFmATMCAAFmAjMBAAFmATMBZgEAAWYBMwGZ AQABZgEzAcwBAAFmATMB/wEAAmYCAAJmATMBAANmAQACZgGZAQACZgHMAQABZgGZAgABZgGZATMBAAFm AZkBZgEAAWYCmQEAAWYBmQHMAQABZgGZAf8BAAFmAcwCAAFmAcwBMwEAAWYBzAGZAQABZgLMAQABZgHM Af8BAAFmAf8CAAFmAf8BMwEAAWYB/wGZAQABZgH/AcwBAAHMAQAB/wEAAf8BAAHMAQACmQIAAZkBMwGZ AQABmQEAAZkBAAGZAQABzAEAAZkDAAGZAjMBAAGZAQABZgEAAZkBMwHMAQABmQEAAf8BAAGZAWYCAAGZ AWYBMwEAAZkBMwFmAQABmQFmAZkBAAGZAWYBzAEAAZkBMwH/AQACmQEzAQACmQFmAQADmQEAApkBzAEA ApkB/wEAAZkBzAIAAZkBzAEzAQABZgHMAWYBAAGZAcwBmQEAAZkCzAEAAZkBzAH/AQABmQH/AgABmQH/ ATMBAAGZAcwBZgEAAZkB/wGZAQABmQH/AcwBAAGZAv8BAAHMAwABmQEAATMBAAHMAQABZgEAAcwBAAGZ AQABzAEAAcwBAAGZATMCAAHMAjMBAAHMATMBZgEAAcwBMwGZAQABzAEzAcwBAAHMATMB/wEAAcwBZgIA AcwBZgEzAQABmQJmAQABzAFmAZkBAAHMAWYBzAEAAZkBZgH/AQABzAGZAgABzAGZATMBAAHMAZkBZgEA AcwCmQEAAcwBmQHMAQABzAGZAf8BAALMAgACzAEzAQACzAFmAQACzAGZAQADzAEAAswB/wEAAcwB/wIA AcwB/wEzAQABmQH/AWYBAAHMAf8BmQEAAcwB/wHMAQABzAL/AQABzAEAATMBAAH/AQABZgEAAf8BAAGZ AQABzAEzAgAB/wIzAQAB/wEzAWYBAAH/ATMBmQEAAf8BMwHMAQAB/wEzAf8BAAH/AWYCAAH/AWYBMwEA AcwCZgEAAf8BZgGZAQAB/wFmAcwBAAHMAWYB/wEAAf8BmQIAAf8BmQEzAQAB/wGZAWYBAAH/ApkBAAH/ AZkBzAEAAf8BmQH/AQAB/wHMAgAB/wHMATMBAAH/AcwBZgEAAf8BzAGZAQAB/wLMAQAB/wHMAf8BAAL/ ATMBAAHMAf8BZgEAAv8BmQEAAv8BzAEAAmYB/wEAAWYB/wFmAQABZgL/AQAB/wJmAQAB/wFmAf8BAAL/ AWYBAAEhAQABpQEAA18BAAN3AQADhgEAA5YBAAPLAQADsgEAA9cBAAPdAQAD4wEAA+oBAAPxAQAD+AEA AfAB+wH/AQABpAKgAQADgAMAAf8CAAH/AwAC/wEAAf8DAAH/AQAB/wEAAv8CAAP/0AABHAoAARxXAAFu AUUBbggAAW4BRQFLVQABSwFvAXUBTAFuBgABbgFGAXUBTAFLDgABngFQQwABSwF0AXUBJQHjAUwBbgQA AW4BTAFNASYBTQFMAUsMAAGeAngBUAH/QAABHAFFAZQDJQHjAUwBSwIAAUsBTAFNAiUBRwF1AUUBHAoA AZ4BlwGeAX0BeAFQAf9AAAFuAW8BdQMlAXUBTAJFAUwB4wIlAUcBdQFMAW4KAAGeAXgBngJbAX0BeAFQ Af9AAAFuAW8BdQMlAXUCTAF1AyUBdQFMAW4KAAGeAXgBnwRbAX0BeAFQAf9AAAFuAW8BdQMlAnUDJQF1 AUwBbgoAAZ4BmAGfAlwEWwF9AXgBUAH/QAABSwFvAXUGJQF1AUwBSwoAAX0BmAGfAn0BXAKfA1sBngF4 AVAB/0AAAUUBbwF1ASYDJQF1AW8BRQoAAZcBCAGfA30BwgIIAZ8BXAJbAZ8BeAFQAf8/AAFFAW8BlAMm ASUBdQFvAUUJAAFPAQgBwgGfAn0BwgEIAU8BLgEIAcIBXAJbAZ8BeAFPPgABSwFvAZoDRwMmAXUBbwFL BwABUAGYAf8DnwHCAQgBeAEAAf8BLgEIAcIBXAJbAZ8BmAFPPAABbgF0AZoDRwKUAUcCJgF1AW8BbgcA AVYBCAH1AZ8BGwEIAX0DAAH/AU8BCAHCA1wBnwGZAU86AAFuAXQBvQFNAUcBTQGaAm8BmgFHASYBRwF1 AW8BbgcAAZcBCAH/AZgBngYAAVABmQHCAX0CXAGfAQgBTzgAAW4BdAEaA00BmgFvAkUBbwGaA0cBdQFv AW4HAAGXAXIBnggAAVYBmAEbAX0CXAGfAZkBTzYAARwBSwHDAXUCTQGaAXQBSwIAAUsBbwGaAU0BRwFN ARoBbgEcBwABwgoAAZcBmAEbAn0B9AGYAVY3AAFuAZMBGgFNAZoBdAFuBAABbgF0AZoBTQGaAZMBSxQA AZcBmAH0AfUBmQFWOQABbgGTARsBdAFuBgABbgF0AcMBkwFLFgABlwGYAZkBVjsAAUsCbggAAm4BSxgA AZcBVj0AARwKAAEc/wB+AAFCAU0BPgcAAT4DAAEoAwABZAMAARkDAAEBAQABAQUAAZABARYAA/8BAAb/ AcAJAAb/AcAJAAH+Af8B3wP/AcAJAAH8AX8BjwP/AcAJAAH4AT8BBwH/AecB/wHACQAB8AEeAQMB/wHB Af8BwAkAAeABDAEBAf8BgAH/AcAJAAHwAQABAwH/AQABfwHACQAB+AEAAQcB/gEAAT8BwAkAAfwBAAEP AfwBAAEfAcAJAAH+AQABHwH4AQABDwHACQAB/wEAAT8B8AEAAQcBwAkAAf8BAAE/AeABAAEHAcAJAAH+ AQABHwHAARABAwHACQAB/AEAAQ8B4AE4AQEBwAkAAfgBAAEHAfABfgEAAcAJAAHwAQABAwH4Af8BAAFA CQAB4AEMAQEB/QH/AYABQAkAAfABHgEDAv8CwAkAAfgBPwEHAv8B4QHACQAB/AF/AY8C/wHzAcAJAAH+ Af8B3wP/AcAJAAb/AcAJAAb/AcAJAAb/AcAJAAs= ================================================ FILE: BMap.NET.WindowsForm/BStepStartAndEndItem.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class BStepStartAndEndItem { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); this.SuspendLayout(); // // label1 // this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.label1.Cursor = System.Windows.Forms.Cursors.Hand; this.label1.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label1.Location = new System.Drawing.Point(30, 7); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(264, 23); this.label1.TabIndex = 0; this.label1.Text = "起点终点"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.label1.Click += new System.EventHandler(this.label1_Click); // // BStepStartAndEndItem // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.label1); this.Cursor = System.Windows.Forms.Cursors.Hand; this.Name = "BStepStartAndEndItem"; this.Size = new System.Drawing.Size(298, 36); this.Load += new System.EventHandler(this.BStepStartAndEndItem_Load); this.Click += new System.EventHandler(this.label1_Click); this.Paint += new System.Windows.Forms.PaintEventHandler(this.BStepStartAndEndItem_Paint); this.ResumeLayout(false); } #endregion private System.Windows.Forms.Label label1; } } ================================================ FILE: BMap.NET.WindowsForm/BStepStartAndEndItem.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using BMap.NET.WindowsForm.BMapElements; namespace BMap.NET.WindowsForm { /// /// 路线起点/终点控件 /// partial class BStepStartAndEndItem : UserControl { public event StepEndPointSelectedEventHandler StepEndPointSelected; /// /// 起点/终点数据源 /// public BPoint EndPoint { get; set; } /// /// 构造方法 /// public BStepStartAndEndItem() { InitializeComponent(); SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); UpdateStyles(); } /// /// 重绘 /// /// /// private void BStepStartAndEndItem_Paint(object sender, PaintEventArgs e) { if (EndPoint != null) { Bitmap b = null; if (EndPoint.Type == PointType.RouteStart) { b = Properties.BMap.ico_source; } if (EndPoint.Type == PointType.RouteEnd) { b = Properties.BMap.ico_destination; } e.Graphics.DrawImage(b, new Rectangle(5, (Height - b.Height) / 2, b.Width, b.Height)); } } /// /// 鼠标点击 /// /// /// private void label1_Click(object sender, EventArgs e) { if (StepEndPointSelected != null) { StepEndPointSelected(EndPoint); } } /// /// 加载 /// /// /// private void BStepStartAndEndItem_Load(object sender, EventArgs e) { label1.Text = EndPoint.Address; } } } ================================================ FILE: BMap.NET.WindowsForm/BStepStartAndEndItem.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ================================================ FILE: BMap.NET.WindowsForm/BTaxiTipControl.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class BTaxiTipControl { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.lnkTaxiTip = new System.Windows.Forms.LinkLabel(); this.SuspendLayout(); // // lnkTaxiTip // this.lnkTaxiTip.AutoSize = true; this.lnkTaxiTip.BackColor = System.Drawing.Color.Linen; this.lnkTaxiTip.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lnkTaxiTip.LinkColor = System.Drawing.Color.Gray; this.lnkTaxiTip.Location = new System.Drawing.Point(85, 7); this.lnkTaxiTip.Name = "lnkTaxiTip"; this.lnkTaxiTip.Size = new System.Drawing.Size(132, 17); this.lnkTaxiTip.TabIndex = 0; this.lnkTaxiTip.TabStop = true; this.lnkTaxiTip.Text = "打车需23元,共32分钟"; this.lnkTaxiTip.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lnkTaxiTip.VisitedLinkColor = System.Drawing.Color.Gray; this.lnkTaxiTip.MouseEnter += new System.EventHandler(this.linkLabel1_MouseEnter); this.lnkTaxiTip.MouseLeave += new System.EventHandler(this.linkLabel1_MouseLeave); // // BTaxiTipControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Linen; this.Controls.Add(this.lnkTaxiTip); this.Name = "BTaxiTipControl"; this.Size = new System.Drawing.Size(303, 50); this.Paint += new System.Windows.Forms.PaintEventHandler(this.BTaxiTipControl_Paint); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.LinkLabel lnkTaxiTip; } } ================================================ FILE: BMap.NET.WindowsForm/BTaxiTipControl.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using Newtonsoft.Json.Linq; namespace BMap.NET.WindowsForm { /// /// 导航时,选择打车方案信息显示控件 /// partial class BTaxiTipControl : UserControl { private JToken _dataSource; /// /// 打车数据源 /// public JToken DataSource { get { return _dataSource; } set { _dataSource = value; if (_dataSource != null) //解析 具体json格式参见api文档 { lnkTaxiTip.Text = "打车费用\n"; string info = "总距离:" + Math.Round(double.Parse((string)_dataSource["distance"]) / 1000, 1) + "公里" + " 总时间:" + Math.Round(double.Parse((string)_dataSource["duration"]) / 60, 0) + "分钟" + "\n"; foreach (JObject p in _dataSource["detail"]) { info += ((string)p["desc"] + " " + (string)p["km_price"] + "元/km 起步价:" + (string)p["start_price"] + " 总费用:" + (string)p["total_price"] + "\n"); lnkTaxiTip.Text += ((string)p["desc"] + ":" + (string)p["total_price"]) + "元\n"; } lnkTaxiTip.Text = lnkTaxiTip.Text.TrimEnd(new char[] { '|'}); Height = lnkTaxiTip.Height + 20; lnkTaxiTip.Location = new Point((Width - lnkTaxiTip.Width) / 2, (Height - lnkTaxiTip.Height) / 2); info += ("备注:\n" + (string)_dataSource["remark"]); lbl_more_info.Text = info; } } } /// /// 打车更详细的信息 /// Label lbl_more_info = new Label(); /// /// 构造方法 /// public BTaxiTipControl() { InitializeComponent(); SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true); UpdateStyles(); lbl_more_info.BackColor = Color.White; lbl_more_info.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; lbl_more_info.Padding = new Padding(5); lbl_more_info.Visible = false; lbl_more_info.AutoSize = true; } /// /// 绘制 /// /// /// private void BTaxiTipControl_Paint(object sender, PaintEventArgs e) { e.Graphics.DrawRectangle(Pens.LightGray, new Rectangle(0, 0, Width - 1, Height - 1)); } /// /// 鼠标进入,显示详细 /// /// /// private void linkLabel1_MouseEnter(object sender, EventArgs e) { Control p = FindTheTopControl(); if (!p.Controls.Contains(lbl_more_info)) { p.Controls.Add(lbl_more_info); lbl_more_info.BringToFront(); } Point location = p.PointToClient(this.PointToScreen(lnkTaxiTip.Location)); lbl_more_info.Location = new Point(location.X + 2, location.Y + lnkTaxiTip.Height); lbl_more_info.Visible = true; } /// /// 鼠标移出 /// /// /// private void linkLabel1_MouseLeave(object sender, EventArgs e) { lbl_more_info.Visible = false; } /// /// 寻找最顶层控件 /// /// private Control FindTheTopControl() { Control parent = this.Parent; while (parent.Parent != null) { parent = parent.Parent; } return parent; } } } ================================================ FILE: BMap.NET.WindowsForm/BTaxiTipControl.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ================================================ FILE: BMap.NET.WindowsForm/BTransitRouteItem.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class BTransitRouteItem { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.flpSteps = new System.Windows.Forms.FlowLayoutPanel(); this.SuspendLayout(); // // flpSteps // this.flpSteps.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.flpSteps.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.flpSteps.Location = new System.Drawing.Point(0, 70); this.flpSteps.Margin = new System.Windows.Forms.Padding(0); this.flpSteps.Name = "flpSteps"; this.flpSteps.Size = new System.Drawing.Size(298, 275); this.flpSteps.TabIndex = 0; this.flpSteps.WrapContents = false; // // BTransitRouteItem // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.flpSteps); this.Cursor = System.Windows.Forms.Cursors.Hand; this.Name = "BTransitRouteItem"; this.Size = new System.Drawing.Size(298, 345); this.Click += new System.EventHandler(this.BTransitRouteItem_Click); this.Paint += new System.Windows.Forms.PaintEventHandler(this.BTransitRouteItem_Paint); this.MouseEnter += new System.EventHandler(this.BTransitRouteItem_MouseEnter); this.MouseLeave += new System.EventHandler(this.BTransitRouteItem_MouseLeave); this.ResumeLayout(false); } #endregion private System.Windows.Forms.FlowLayoutPanel flpSteps; } } ================================================ FILE: BMap.NET.WindowsForm/BTransitRouteItem.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using Newtonsoft.Json.Linq; using BMap.NET.WindowsForm.BMapElements; namespace BMap.NET.WindowsForm { /// /// 公交路线控件 /// partial class BTransitRouteItem : UserControl { /// /// 步骤选择时激发该事件 /// public event StepSelectedEventHandler StepSelected; /// /// 路线选择时激发该事件 /// public event RouteSelectedEventHandler RouteSelected; /// /// 路线起点终点选中时激发该事件 /// public event StepEndPointSelectedEventHandler StepEndPointSelected; private BRoute _dataSource; /// /// 路线数据源 /// public BRoute DataSource { get { return _dataSource; } set { _dataSource = value; // if (_dataSource != null) //解析 具体json格式参见api文档 { JToken r = _dataSource.DataSource["scheme"][0]; _distance = double.Parse((string)r["distance"]); _duration = double.Parse((string)r["duration"]); if (Origin != null) //起点 { flpSteps.Controls.Add(Origin); Origin.StepEndPointSelected += new StepEndPointSelectedEventHandler(Origin_StepEndPointSelected); } foreach (JArray step in r["steps"]) { BTransitStepItem item = new BTransitStepItem(); item.DataSource = step; _need_walk += item.Step_Walk_Distance; if (item.Step_Transit_Name != "") { _transits += item.Step_Transit_Name + "→"; } item.Width = flpSteps.Width; flpSteps.Controls.Add(item); item.Margin = new Padding(0); item.StepSelected += new StepSelectedEventHandler(item_StepSelected); } if (Destination != null) //终点 { flpSteps.Controls.Add(Destination); Destination.StepEndPointSelected += new StepEndPointSelectedEventHandler(Destination_StepEndPointSelected); } _transits = _transits.TrimEnd(new char[] { '→'}); foreach (Control c in flpSteps.Controls) { _steps_height += c.Height; } Selected = false; } } } private double _distance; private double _duration; private int _need_walk; private string _transits; private int _steps_height; private bool _selected; /// /// 是否选中 /// public bool Selected { get { return _selected; } set { _selected = value; if (_selected) { Height = 70 + _steps_height; } else { Height = 70; //默认70g高度 } } } /// /// 起点 /// public BStepStartAndEndItem Origin { get; set; } /// /// 终点 /// public BStepStartAndEndItem Destination { get; set; } private bool _mouse_hover; /// /// 构造方法 /// public BTransitRouteItem() { InitializeComponent(); SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); } #region 事件处理 /// /// 重绘 /// /// /// private void BTransitRouteItem_Paint(object sender, PaintEventArgs e) { if (Selected || _mouse_hover) { using (SolidBrush sb = new SolidBrush(Color.FromArgb(235, 241, 251))) { e.Graphics.FillRectangle(sb, new Rectangle(0, 0, Width - 1, 70 - 1)); } } e.Graphics.DrawRectangle(Pens.LightGray, new Rectangle(0, 0, Width - 1, 70 - 1)); using(Font f = new Font("微软雅黑",10)) { e.Graphics.DrawString(_transits, f, Brushes.Blue, new PointF(20, 10)); } using (Font f = new Font("微软雅黑", 9)) { e.Graphics.DrawString(Math.Round(_duration / 60, 0) + "分钟 | " + Math.Round(_distance / 1000, 1) + "公里 | 步行" + _need_walk + "米", f, Brushes.Gray, new PointF(20, 35)); } } /// /// 点击 /// /// /// private void BTransitRouteItem_Click(object sender, EventArgs e) { Selected = true; if (_selected) //选中 { if (RouteSelected != null) { RouteSelected(_dataSource); } } } /// /// 鼠标进入 /// /// /// private void BTransitRouteItem_MouseEnter(object sender, EventArgs e) { _mouse_hover = true; Invalidate(); } /// /// 鼠标移出 /// /// /// private void BTransitRouteItem_MouseLeave(object sender, EventArgs e) { _mouse_hover = false; Invalidate(); } /// /// 步骤选中 /// /// /// void item_StepSelected(string stepPath, bool enlarge) { if (StepSelected != null) { StepSelected(stepPath, enlarge); } } /// /// 终点选中 /// /// void Destination_StepEndPointSelected(BPoint bPoint) { if (StepEndPointSelected != null) { StepEndPointSelected(bPoint); } } /// /// 起点选中 /// /// void Origin_StepEndPointSelected(BPoint bPoint) { if (StepEndPointSelected != null) { StepEndPointSelected(bPoint); } } #endregion } /// /// 表示处理选择路线事件的方法 /// /// delegate void RouteSelectedEventHandler(BRoute bRoute); /// /// 表示处理选择路线步骤事件的方法 /// /// /// delegate void StepSelectedEventHandler(string stepPath, bool enlarge); /// /// 表示处理选择路线起点、终点事件的方法 /// /// delegate void StepEndPointSelectedEventHandler(BPoint bPoint); } ================================================ FILE: BMap.NET.WindowsForm/BTransitRouteItem.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ================================================ FILE: BMap.NET.WindowsForm/BTransitStepItem.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class BTransitStepItem { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.SuspendLayout(); // // BTransitStepItem // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Name = "BTransitStepItem"; this.Size = new System.Drawing.Size(298, 70); this.Click += new System.EventHandler(this.BTransitStepItem_Click); this.Paint += new System.Windows.Forms.PaintEventHandler(this.BTransitStepItem_Paint); this.MouseEnter += new System.EventHandler(this.BTransitStepItem_MouseEnter); this.MouseLeave += new System.EventHandler(this.BTransitStepItem_MouseLeave); this.ResumeLayout(false); } #endregion } } ================================================ FILE: BMap.NET.WindowsForm/BTransitStepItem.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using Newtonsoft.Json.Linq; namespace BMap.NET.WindowsForm { /// /// 公交路线步骤控件 /// partial class BTransitStepItem : UserControl { /// /// 鼠标进入或点击时激发该事件 /// public event StepSelectedEventHandler StepSelected; private JArray _dataSource; /// /// 步骤数据源 /// public JArray DataSource { get { return _dataSource; } set { _dataSource = value; if (_dataSource != null) //解析 具体json结构参见api文档 { if ((string)_dataSource[0]["type"] == "5") //步行 { JToken step = _dataSource[0]; _step_type = 0; _step_walk_string = (string)step["stepInstruction"]; _step_walk_distance = int.Parse((string)step["distance"]); Paths = (string)step["path"]; Height = 35; } else { _step_type = 1; Paths = (string)_dataSource[0]["path"]; _step_transit_start = (string)_dataSource[0]["vehicle"]["start_name"]; _step_transit_end = (string)_dataSource[0]["vehicle"]["end_name"]; _step_transit_stops = int.Parse((string)_dataSource[0]["vehicle"]["stop_num"]); foreach (JObject step in _dataSource) //多种方案 { _step_transits += (string)step["vehicle"]["name"] + ","; } _step_transits = _step_transits.TrimEnd(new char[]{','}); Height = 70; } } } } private int _step_type; //当前步骤类型:0步行 1公交 private string _step_walk_string; //步行信息 private int _step_walk_distance; //步行距离 private string _step_transit_start; //公交起始站 private string _step_transit_end; //公交终点站 private string _step_transits; //可乘坐公交名称 private int _step_transit_stops; //公交站数 /// /// 当前步骤路线 /// public string Paths { get; set; } /// /// 步行距离(默认为0) /// public int Step_Walk_Distance { get { return _step_walk_distance; } } /// /// 公交线路(默认为空) /// public string Step_Transit_Name { get { if (_step_type == 0) { return ""; } else { return _step_transits.Split(',')[0]; //取第一个 } } } /// /// 构造方法 /// public BTransitStepItem() { InitializeComponent(); SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); } /// /// 重绘 /// /// /// private void BTransitStepItem_Paint(object sender, PaintEventArgs e) { if (_step_type == 0) //当前步骤为 步行 { using (Font f = new Font("微软雅黑", 9)) { using (Pen p = new Pen(Color.FromArgb(50, Color.Gray), 3)) { e.Graphics.DrawLine(p, new Point(5 + 9, 3), new Point(5 + 9, Height - 3)); } e.Graphics.DrawString(_step_walk_string, f, Brushes.Gray, new PointF(30, 10)); e.Graphics.DrawImage(Properties.BMap.ico_bywalk, new Rectangle(5, 8, Properties.BMap.ico_bywalk.Width, Properties.BMap.ico_bywalk.Height)); } } else //当前步骤为公交 { using (Font f = new Font("微软雅黑", 9)) { using (Pen p = new Pen(Color.FromArgb(50, Color.Gray), 3)) { e.Graphics.DrawLine(p, new Point(5 + 9, 3), new Point(5 + 9, Height - 3)); } e.Graphics.DrawString(_step_transit_start + " 上车", f, Brushes.Gray, new PointF(30,5)); e.Graphics.DrawString(_step_transits, f, Brushes.Black, new PointF(35, 5 + 20)); e.Graphics.DrawString(_step_transit_end + " 下车", f, Brushes.Gray, new PointF(30, 5 + 20 + 20)); e.Graphics.DrawString(_step_transit_stops + "站", f, Brushes.Gray, new PointF(Width - 50, 5 + 20)); e.Graphics.DrawImage(Properties.BMap.ico_bytransit, new Rectangle(5, 5, Properties.BMap.ico_bytransit.Width, Properties.BMap.ico_bytransit.Height)); e.Graphics.DrawImage(Properties.BMap.ico_bytransit, new Rectangle(5, 5 + 20 + 20 - 2, Properties.BMap.ico_bytransit.Width, Properties.BMap.ico_bytransit.Height)); } } } /// /// 鼠标进入 /// /// /// private void BTransitStepItem_MouseEnter(object sender, EventArgs e) { BackColor = Color.FromArgb(235, 241, 251); if (StepSelected != null) { StepSelected(Paths, false); } } /// /// 鼠标移出 /// /// /// private void BTransitStepItem_MouseLeave(object sender, EventArgs e) { BackColor = Color.White; } /// /// 鼠标点击 /// /// /// private void BTransitStepItem_Click(object sender, EventArgs e) { if (StepSelected != null) { StepSelected(Paths, true); } } } } ================================================ FILE: BMap.NET.WindowsForm/BTransitStepItem.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ================================================ FILE: BMap.NET.WindowsForm/BWalkingRouteItem.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class BWalkingRouteItem { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.flpSteps = new System.Windows.Forms.FlowLayoutPanel(); this.SuspendLayout(); // // flpSteps // this.flpSteps.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.flpSteps.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.flpSteps.Location = new System.Drawing.Point(0, 70); this.flpSteps.Margin = new System.Windows.Forms.Padding(0); this.flpSteps.Name = "flpSteps"; this.flpSteps.Size = new System.Drawing.Size(298, 235); this.flpSteps.TabIndex = 1; this.flpSteps.WrapContents = false; // // BWalkingRouteItem // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.flpSteps); this.Name = "BWalkingRouteItem"; this.Size = new System.Drawing.Size(298, 305); this.Click += new System.EventHandler(this.BWalkingRouteItem_Click); this.Paint += new System.Windows.Forms.PaintEventHandler(this.BWalkingRouteItem_Paint); this.MouseEnter += new System.EventHandler(this.BWalkingRouteItem_MouseEnter); this.MouseLeave += new System.EventHandler(this.BWalkingRouteItem_MouseLeave); this.ResumeLayout(false); } #endregion private System.Windows.Forms.FlowLayoutPanel flpSteps; } } ================================================ FILE: BMap.NET.WindowsForm/BWalkingRouteItem.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using Newtonsoft.Json.Linq; using BMap.NET.WindowsForm.BMapElements; namespace BMap.NET.WindowsForm { /// /// 步行路线控件 /// partial class BWalkingRouteItem : UserControl { /// /// 步骤选择时激发该事件 /// public event StepSelectedEventHandler StepSelected; /// /// 路线选择时激发该事件 /// public event RouteSelectedEventHandler RouteSelected; /// /// 路线起点终点选中时激发该事件 /// public event StepEndPointSelectedEventHandler StepEndPointSelected; private BRoute _dataSource; /// /// 步行路线数据源 /// public BRoute DataSource { get { return _dataSource; } set { _dataSource = value; if (_dataSource != null) //解析 具体json格式参见api文档 { _distance = double.Parse((string)_dataSource.DataSource["distance"]); _duration = double.Parse((string)_dataSource.DataSource["duration"]); if (Origin != null) //起点 { flpSteps.Controls.Add(Origin); Origin.StepEndPointSelected += new StepEndPointSelectedEventHandler(Origin_StepEndPointSelected); } foreach (JObject step in _dataSource.DataSource["steps"]) { BWalkingStepItem item = new BWalkingStepItem(); item.DataSource = step; item.Width = flpSteps.Width - 17; flpSteps.Controls.Add(item); item.Margin = new Padding(0); item.StepSelected += new StepSelectedEventHandler(item_StepSelected); } if (Destination != null) //终点 { flpSteps.Controls.Add(Destination); } foreach (Control c in flpSteps.Controls) { _steps_height += c.Height; Destination.StepEndPointSelected += new StepEndPointSelectedEventHandler(Destination_StepEndPointSelected); } Selected = false; } } } private double _distance; private double _duration; private int _steps_height; private bool _mouse_hover; private bool _selected; /// /// 是否选中 /// public bool Selected { get { return _selected; } set { _selected = value; if (_selected) { Height = 70 + _steps_height; } else { Height = 70; } } } /// /// 起点 /// public BStepStartAndEndItem Origin { get; set; } /// /// 终点 /// public BStepStartAndEndItem Destination { get; set; } /// /// 构造方法 /// public BWalkingRouteItem() { InitializeComponent(); SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true); UpdateStyles(); } #region 事件处理 /// /// 绘制 /// /// /// private void BWalkingRouteItem_Paint(object sender, PaintEventArgs e) { if (Selected || _mouse_hover) { using (SolidBrush sb = new SolidBrush(Color.FromArgb(235, 241, 251))) { e.Graphics.FillRectangle(sb, new Rectangle(0, 0, Width - 1, 70 - 1)); } } e.Graphics.DrawRectangle(Pens.LightGray, new Rectangle(0, 0, Width - 1, 70 - 1)); using (Font f = new Font("微软雅黑", 9)) { e.Graphics.DrawString(Math.Round(_duration / 60, 0) + "分钟 | " + Math.Round(_distance / 1000, 1) + "公里", f, Brushes.Gray, new PointF(20, 10)); } } /// /// 点击 /// /// /// private void BWalkingRouteItem_Click(object sender, EventArgs e) { Selected = true; if (RouteSelected != null) { RouteSelected(_dataSource); } } /// /// 鼠标进入 /// /// /// private void BWalkingRouteItem_MouseEnter(object sender, EventArgs e) { _mouse_hover = true; Invalidate(); } /// /// 鼠标移出 /// /// /// private void BWalkingRouteItem_MouseLeave(object sender, EventArgs e) { _mouse_hover = false; Invalidate(); } /// /// 路线步骤选中 /// /// /// void item_StepSelected(string stepPath, bool enlarge) { if (StepSelected != null) { StepSelected(stepPath, enlarge); } } /// /// 路线终点选中 /// /// void Destination_StepEndPointSelected(BPoint bPoint) { if (StepEndPointSelected != null) { StepEndPointSelected(bPoint); } } /// /// 路线起点选中 /// /// void Origin_StepEndPointSelected(BPoint bPoint) { if (StepEndPointSelected != null) { StepEndPointSelected(bPoint); } } #endregion } } ================================================ FILE: BMap.NET.WindowsForm/BWalkingRouteItem.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ================================================ FILE: BMap.NET.WindowsForm/BWalkingStepItem.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class BWalkingStepItem { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.lblStepInfo = new System.Windows.Forms.Label(); this.SuspendLayout(); // // lblStepInfo // this.lblStepInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblStepInfo.Cursor = System.Windows.Forms.Cursors.Hand; this.lblStepInfo.Font = new System.Drawing.Font("SimSun", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblStepInfo.ForeColor = System.Drawing.Color.DimGray; this.lblStepInfo.Location = new System.Drawing.Point(37, 7); this.lblStepInfo.Name = "lblStepInfo"; this.lblStepInfo.Size = new System.Drawing.Size(294, 39); this.lblStepInfo.TabIndex = 2; this.lblStepInfo.Text = "这里是步骤说明这里是步骤说明这里是步骤说明这里是步\r\n撒旦法阿斯蒂芬撒旦法撒旦发射点发\r\n撒旦法骤说明"; this.lblStepInfo.Click += new System.EventHandler(this.BWalkingStepItem_Click); this.lblStepInfo.MouseEnter += new System.EventHandler(this.BWalkingStepItem_MouseEnter); this.lblStepInfo.MouseLeave += new System.EventHandler(this.BWalkingStepItem_MouseLeave); // // BWalkingStepItem // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.lblStepInfo); this.Cursor = System.Windows.Forms.Cursors.Hand; this.Name = "BWalkingStepItem"; this.Size = new System.Drawing.Size(338, 52); this.Click += new System.EventHandler(this.BWalkingStepItem_Click); this.Paint += new System.Windows.Forms.PaintEventHandler(this.BWalkingStepItem_Paint); this.MouseEnter += new System.EventHandler(this.BWalkingStepItem_MouseEnter); this.MouseLeave += new System.EventHandler(this.BWalkingStepItem_MouseLeave); this.ResumeLayout(false); } #endregion private System.Windows.Forms.Label lblStepInfo; } } ================================================ FILE: BMap.NET.WindowsForm/BWalkingStepItem.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using Newtonsoft.Json.Linq; using System.Text.RegularExpressions; namespace BMap.NET.WindowsForm { /// /// 步行路线步骤控件 /// partial class BWalkingStepItem : UserControl { /// /// 步骤选中时激发该事件 /// public event StepSelectedEventHandler StepSelected; private JObject _dataSource; /// /// 步行路线步骤数据源 /// public JObject DataSource { get { return _dataSource; } set { _dataSource = value; if (_dataSource != null) //解析 具体json格式参见api文档 { Paths = (string)_dataSource["path"]; _step_info = (string)_dataSource["instructions"]; _step_direction = int.Parse((string)_dataSource["direction"]); Regex reg = new Regex(@"<(!|/)?\w+( ((.|\n)*?"")?)? *>"); _step_info = reg.Replace(_step_info, "").Replace("
", ""); lblStepInfo.Text = _step_info; } } } private string _step_info; private int _step_direction; /// /// 当前步骤路线 /// public string Paths { get; set; } /// /// 构造方法 /// public BWalkingStepItem() { InitializeComponent(); } #region 事件处理 /// /// 绘制 /// /// /// private void BWalkingStepItem_Paint(object sender, PaintEventArgs e) { //e.Graphics.DrawRectangle(Pens.LightGray, new Rectangle(0, 0, Width - 2, Height)); } /// /// 点击 /// /// /// private void BWalkingStepItem_Click(object sender, EventArgs e) { if (StepSelected != null) { StepSelected(Paths, true); } } /// /// 鼠标进入 /// /// /// private void BWalkingStepItem_MouseEnter(object sender, EventArgs e) { BackColor = Color.FromArgb(235, 241, 251); if (StepSelected != null) { StepSelected(Paths, false); } } /// /// 鼠标移出 /// /// /// private void BWalkingStepItem_MouseLeave(object sender, EventArgs e) { BackColor = Color.White; } #endregion } } ================================================ FILE: BMap.NET.WindowsForm/BWalkingStepItem.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ================================================ FILE: BMap.NET.WindowsForm/BaiduJSAPI_cracker.js ================================================ window.VTC = { "ditu": { "normal": { "version": "087", "updateDate": "20150815" }, "satellite": { "version": "009", "updateDate": "20150601" }, "normalTraffic": { "version": "081", "updateDate": "20150815" }, "satelliteTraffic": { "version": "083", "updateDate": "20150815" }, "mapJS": { "version": "104", "updateDate": "20150815" }, "satelliteStreet": { "version": "083", "updateDate": "20150815" }, "panoClick": { "version": "1033", "updateDate": "201400823" }, "panoUdt": { "version": "20150815", "updateDate": "20150814" }, "panoSwfAPI": { "version": "20150123", "updateDate": "20150123" }, "panoSwfPlace": { "version": "20141112", "updateDate": "20141112" } }, "webapp": { "high_normal": { "version": "001", "updateDate": "20141209" }, "lower_normal": { "version": "002", "updateDate": "20150529" } }, "api_for_mobile": { "vector": { "version": "002", "updateDate": "20150529" }, "vectorIcon": { "version": "002", "updateDate": "20150529" } } }; window.BMAP_AUTHENTIC_KEY = ""; (function () { var bU, a1 = bU = a1 || { version: "1.3.4" }; a1.guid = "$BAIDU$"; window[a1.guid] = window[a1.guid] || {}; a1.object = a1.object || {}; a1.extend = a1.object.extend = function (cD, T) { for (var cC in T) { if (T.hasOwnProperty(cC)) { cD[cC] = T[cC] } } return cD }; a1.dom = a1.dom || {}; a1.dom.g = function (T) { if ("string" == typeof T || T instanceof String) { return document.getElementById(T) } else { if (T && T.nodeName && (T.nodeType == 1 || T.nodeType == 9)) { return T } } return null }; a1.g = a1.G = a1.dom.g; a1.dom.hide = function (T) { T = a1.dom.g(T); T.style.display = "none"; return T }; a1.hide = a1.dom.hide; a1.lang = a1.lang || {}; a1.lang.isString = function (T) { return "[object String]" == Object.prototype.toString.call(T) }; a1.isString = a1.lang.isString; a1.dom._g = function (T) { if (a1.lang.isString(T)) { return document.getElementById(T) } return T }; a1._g = a1.dom._g; a1.dom.contains = function (T, cC) { var cD = a1.dom._g; T = cD(T); cC = cD(cC); return T.contains ? T != cC && T.contains(cC) : !!(T.compareDocumentPosition(cC) & 16) }; a1.browser = a1.browser || {}; if (/msie (\d+\.\d)/i.test(navigator.userAgent)) { a1.browser.ie = a1.ie = document.documentMode || +RegExp["\x241"] } a1.dom._NAME_ATTRS = (function () { var T = { cellpadding: "cellPadding", cellspacing: "cellSpacing", colspan: "colSpan", rowspan: "rowSpan", valign: "vAlign", usemap: "useMap", frameborder: "frameBorder" }; if (a1.browser.ie < 8) { T["for"] = "htmlFor"; T["class"] = "className" } else { T.htmlFor = "for"; T.className = "class" } return T })(); a1.dom.setAttr = function (cC, T, cD) { cC = a1.dom.g(cC); if ("style" == T) { cC.style.cssText = cD } else { T = a1.dom._NAME_ATTRS[T] || T; cC.setAttribute(T, cD) } return cC }; a1.setAttr = a1.dom.setAttr; a1.dom.setAttrs = function (cD, T) { cD = a1.dom.g(cD); for (var cC in T) { a1.dom.setAttr(cD, cC, T[cC]) } return cD }; a1.setAttrs = a1.dom.setAttrs; a1.string = a1.string || {}; (function () { var T = new RegExp("(^[\\s\\t\\xa0\\u3000]+)|([\\u3000\\xa0\\s\\t]+\x24)", "g"); a1.string.trim = function (cC) { return String(cC).replace(T, "") } })(); a1.trim = a1.string.trim; a1.string.format = function (cD, T) { cD = String(cD); var cC = Array.prototype.slice.call(arguments, 1), cE = Object.prototype.toString; if (cC.length) { cC = cC.length == 1 ? (T !== null && (/\[object Array\]|\[object Object\]/.test(cE.call(T))) ? T : cC) : cC; return cD.replace(/#\{(.+?)\}/g, function (cF, cH) { var cG = cC[cH]; if ("[object Function]" == cE.call(cG)) { cG = cG(cH) } return ("undefined" == typeof cG ? "" : cG) }) } return cD }; a1.format = a1.string.format; a1.dom.removeClass = function (cG, cH) { cG = a1.dom.g(cG); var cE = cG.className.split(/\s+/), cI = cH.split(/\s+/), cC, T = cI.length, cD, cF = 0; for (; cF < T; ++cF) { for (cD = 0, cC = cE.length; cD < cC; ++cD) { if (cE[cD] == cI[cF]) { cE.splice(cD, 1); break } } } cG.className = cE.join(" "); return cG }; a1.removeClass = a1.dom.removeClass; a1.dom.insertHTML = function (cE, T, cD) { cE = a1.dom.g(cE); var cC, cF; if (cE.insertAdjacentHTML) { cE.insertAdjacentHTML(T, cD) } else { cC = cE.ownerDocument.createRange(); T = T.toUpperCase(); if (T == "AFTERBEGIN" || T == "BEFOREEND") { cC.selectNodeContents(cE); cC.collapse(T == "AFTERBEGIN") } else { cF = T == "BEFOREBEGIN"; cC[cF ? "setStartBefore" : "setEndAfter"](cE); cC.collapse(cF) } cC.insertNode(cC.createContextualFragment(cD)) } return cE }; a1.insertHTML = a1.dom.insertHTML; a1.dom.show = function (T) { T = a1.dom.g(T); T.style.display = ""; return T }; a1.show = a1.dom.show; a1.dom.getDocument = function (T) { T = a1.dom.g(T); return T.nodeType == 9 ? T : T.ownerDocument || T.document }; a1.dom.addClass = function (cG, cH) { cG = a1.dom.g(cG); var cC = cH.split(/\s+/), T = cG.className, cF = " " + T + " ", cE = 0, cD = cC.length; for (; cE < cD; cE++) { if (cF.indexOf(" " + cC[cE] + " ") < 0) { T += " " + cC[cE] } } cG.className = T; return cG }; a1.addClass = a1.dom.addClass; a1.dom._styleFixer = a1.dom._styleFixer || {}; a1.dom._styleFilter = a1.dom._styleFilter || []; a1.dom._styleFilter.filter = function (cC, cF, cG) { for (var T = 0, cE = a1.dom._styleFilter, cD; cD = cE[T]; T++) { if (cD = cD[cG]) { cF = cD(cC, cF) } } return cF }; a1.string.toCamelCase = function (T) { if (T.indexOf("-") < 0 && T.indexOf("_") < 0) { return T } return T.replace(/[-_][^-_]/g, function (cC) { return cC.charAt(1).toUpperCase() }) }; a1.dom.getStyle = function (cD, cC) { var cG = a1.dom; cD = cG.g(cD); cC = a1.string.toCamelCase(cC); var cF = cD.style[cC]; if (!cF) { var T = cG._styleFixer[cC], cE = cD.currentStyle || (a1.browser.ie ? cD.style : getComputedStyle(cD, null)); cF = T && T.get ? T.get(cD, cE) : cE[T || cC] } if (T = cG._styleFilter) { cF = T.filter(cC, cF, "get") } return cF }; a1.getStyle = a1.dom.getStyle; if (/opera\/(\d+\.\d)/i.test(navigator.userAgent)) { a1.browser.opera = +RegExp["\x241"] } a1.browser.isWebkit = /webkit/i.test(navigator.userAgent); a1.browser.isGecko = /gecko/i.test(navigator.userAgent) && !/like gecko/i.test(navigator.userAgent); a1.browser.isStrict = document.compatMode == "CSS1Compat"; a1.dom.getPosition = function (T) { T = a1.dom.g(T); var cK = a1.dom.getDocument(T), cE = a1.browser, cH = a1.dom.getStyle, cD = cE.isGecko > 0 && cK.getBoxObjectFor && cH(T, "position") == "absolute" && (T.style.top === "" || T.style.left === ""), cI = { left: 0, top: 0 }, cG = (cE.ie && !cE.isStrict) ? cK.body : cK.documentElement, cL, cC; if (T == cG) { return cI } if (T.getBoundingClientRect) { cC = T.getBoundingClientRect(); cI.left = Math.floor(cC.left) + Math.max(cK.documentElement.scrollLeft, cK.body.scrollLeft); cI.top = Math.floor(cC.top) + Math.max(cK.documentElement.scrollTop, cK.body.scrollTop); cI.left -= cK.documentElement.clientLeft; cI.top -= cK.documentElement.clientTop; var cJ = cK.body, cM = parseInt(cH(cJ, "borderLeftWidth")), cF = parseInt(cH(cJ, "borderTopWidth")); if (cE.ie && !cE.isStrict) { cI.left -= isNaN(cM) ? 2 : cM; cI.top -= isNaN(cF) ? 2 : cF } } else { cL = T; do { cI.left += cL.offsetLeft; cI.top += cL.offsetTop; if (cE.isWebkit > 0 && cH(cL, "position") == "fixed") { cI.left += cK.body.scrollLeft; cI.top += cK.body.scrollTop; break } cL = cL.offsetParent } while (cL && cL != T); if (cE.opera > 0 || (cE.isWebkit > 0 && cH(T, "position") == "absolute")) { cI.top -= cK.body.offsetTop } cL = T.offsetParent; while (cL && cL != cK.body) { cI.left -= cL.scrollLeft; if (!cE.opera || cL.tagName != "TR") { cI.top -= cL.scrollTop } cL = cL.offsetParent } } return cI }; if (/firefox\/(\d+\.\d)/i.test(navigator.userAgent)) { a1.browser.firefox = +RegExp["\x241"] } (function () { var T = navigator.userAgent; if (/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(T) && !/chrome/i.test(T)) { a1.browser.safari = +(RegExp["\x241"] || RegExp["\x242"]) } })(); if (/chrome\/(\d+\.\d)/i.test(navigator.userAgent)) { a1.browser.chrome = +RegExp["\x241"] } a1.array = a1.array || {}; a1.array.each = function (cG, cE) { var cD, cF, cC, T = cG.length; if ("function" == typeof cE) { for (cC = 0; cC < T; cC++) { cF = cG[cC]; cD = cE.call(cG, cF, cC); if (cD === false) { break } } } return cG }; a1.each = a1.array.each; a1.lang.guid = function () { return "TANGRAM__" + (window[a1.guid]._counter++).toString(36) }; window[a1.guid]._counter = window[a1.guid]._counter || 1; window[a1.guid]._instances = window[a1.guid]._instances || {}; a1.lang.isFunction = function (T) { return "[object Function]" == Object.prototype.toString.call(T) }; a1.lang.Class = function (T) { this.guid = T || a1.lang.guid(); window[a1.guid]._instances[this.guid] = this }; window[a1.guid]._instances = window[a1.guid]._instances || {}; a1.lang.Class.prototype.dispose = function () { delete window[a1.guid]._instances[this.guid]; for (var T in this) { if (!a1.lang.isFunction(this[T])) { delete this[T] } } this.disposed = true }; a1.lang.Class.prototype.toString = function () { return "[object " + (this._className || "Object") + "]" }; a1.lang.Event = function (T, cC) { this.type = T; this.returnValue = true; this.target = cC || null; this.currentTarget = null }; a1.lang.Class.prototype.addEventListener = function (cE, cD, cC) { if (!a1.lang.isFunction(cD)) { return } !this.__listeners && (this.__listeners = {}); var T = this.__listeners, cF; if (typeof cC == "string" && cC) { if (/[^\w\-]/.test(cC)) { throw ("nonstandard key:" + cC) } else { cD.hashCode = cC; cF = cC } } cE.indexOf("on") != 0 && (cE = "on" + cE); typeof T[cE] != "object" && (T[cE] = {}); cF = cF || a1.lang.guid(); cD.hashCode = cF; T[cE][cF] = cD }; a1.lang.Class.prototype.removeEventListener = function (cD, cC) { if (a1.lang.isFunction(cC)) { cC = cC.hashCode } else { if (!a1.lang.isString(cC)) { return } } !this.__listeners && (this.__listeners = {}); cD.indexOf("on") != 0 && (cD = "on" + cD); var T = this.__listeners; if (!T[cD]) { return } T[cD][cC] && delete T[cD][cC] }; a1.lang.Class.prototype.dispatchEvent = function (cE, T) { if (a1.lang.isString(cE)) { cE = new a1.lang.Event(cE) } !this.__listeners && (this.__listeners = {}); T = T || {}; for (var cD in T) { cE[cD] = T[cD] } var cD, cC = this.__listeners, cF = cE.type; cE.target = cE.target || this; cE.currentTarget = this; cF.indexOf("on") != 0 && (cF = "on" + cF); a1.lang.isFunction(this[cF]) && this[cF].apply(this, arguments); if (typeof cC[cF] == "object") { for (cD in cC[cF]) { cC[cF][cD].apply(this, arguments) } } return cE.returnValue }; a1.lang.inherits = function (cH, cF, cE) { var cD, cG, T = cH.prototype, cC = new Function(); cC.prototype = cF.prototype; cG = cH.prototype = new cC(); for (cD in T) { cG[cD] = T[cD] } cH.prototype.constructor = cH; cH.superClass = cF.prototype; if ("string" == typeof cE) { cG._className = cE } }; a1.inherits = a1.lang.inherits; a1.lang.instance = function (T) { return window[a1.guid]._instances[T] || null }; a1.platform = a1.platform || {}; a1.platform.isMacintosh = /macintosh/i.test(navigator.userAgent); a1.platform.isWindows = /windows/i.test(navigator.userAgent); a1.platform.isX11 = /x11/i.test(navigator.userAgent); a1.platform.isAndroid = /android/i.test(navigator.userAgent); a1.platform.isIpad = /ipad/i.test(navigator.userAgent); a1.platform.isIphone = /iphone/i.test(navigator.userAgent); a1.lang.Event.prototype.inherit = function (cD) { var cC = this; this.domEvent = cD = window.event || cD; cC.clientX = cD.clientX || cD.pageX; cC.clientY = cD.clientY || cD.pageY; cC.offsetX = cD.offsetX || cD.layerX; cC.offsetY = cD.offsetY || cD.layerY; cC.screenX = cD.screenX; cC.screenY = cD.screenY; cC.ctrlKey = cD.ctrlKey || cD.metaKey; cC.shiftKey = cD.shiftKey; cC.altKey = cD.altKey; if (cD.touches) { cC.touches = []; for (var T = 0; T < cD.touches.length; T++) { cC.touches.push({ clientX: cD.touches[T].clientX, clientY: cD.touches[T].clientY, screenX: cD.touches[T].screenX, screenY: cD.touches[T].screenY, pageX: cD.touches[T].pageX, pageY: cD.touches[T].pageY, target: cD.touches[T].target, identifier: cD.touches[T].identifier }) } } if (cD.changedTouches) { cC.changedTouches = []; for (var T = 0; T < cD.changedTouches.length; T++) { cC.changedTouches.push({ clientX: cD.changedTouches[T].clientX, clientY: cD.changedTouches[T].clientY, screenX: cD.changedTouches[T].screenX, screenY: cD.changedTouches[T].screenY, pageX: cD.changedTouches[T].pageX, pageY: cD.changedTouches[T].pageY, target: cD.changedTouches[T].target, identifier: cD.changedTouches[T].identifier }) } } if (cD.targetTouches) { cC.targetTouches = []; for (var T = 0; T < cD.targetTouches.length; T++) { cC.targetTouches.push({ clientX: cD.targetTouches[T].clientX, clientY: cD.targetTouches[T].clientY, screenX: cD.targetTouches[T].screenX, screenY: cD.targetTouches[T].screenY, pageX: cD.targetTouches[T].pageX, pageY: cD.targetTouches[T].pageY, target: cD.targetTouches[T].target, identifier: cD.targetTouches[T].identifier }) } } cC.rotation = cD.rotation; cC.scale = cD.scale; return cC }; a1.lang.decontrol = function (cC) { var T = window[a1.guid]; T._instances && (delete T._instances[cC]) }; a1.event = {}; a1.on = a1.event.on = function (cD, cC, T) { if (!(cD = a1.g(cD))) { return cD } cC = cC.replace(/^on/, ""); if (cD.addEventListener) { cD.addEventListener(cC, T, false) } else { if (cD.attachEvent) { cD.attachEvent("on" + cC, T) } } return cD }; a1.un = a1.event.un = function (cD, cC, T) { if (!(cD = a1.g(cD))) { return cD } cC = cC.replace(/^on/, ""); if (cD.removeEventListener) { cD.removeEventListener(cC, T, false) } else { if (cD.detachEvent) { cD.detachEvent("on" + cC, T) } } return cD }; a1.dom.hasClass = function (cD, cC) { if (!cD || !cD.className || typeof cD.className != "string") { return false } var T = -1; try { T = cD.className == cC || cD.className.search(new RegExp("(\\s|^)" + cC + "(\\s|$)")) } catch (cE) { return false } return T > -1 }; window.BMap = window.BMap || {}; window.BMap.version = "1.2"; window.BMap._register = []; window.BMap.register = function (T) { this._register.push(T) }; window.BMap.apiLoad = window.BMap.apiLoad || function () { }; function bs(cE, cG) { cE = a1.g(cE); if (!cE) { return } var cF = this; a1.lang.Class.call(cF); cF.config = { clickInterval: 200, enableDragging: true, enableKeyboard: false, enableDblclickZoom: true, enableContinuousZoom: false, enableWheelZoom: false, enableMouseDown: true, enablePinchToZoom: true, enableAutoResize: true, fps: 25, zoomerDuration: 240, actionDuration: 450, defaultCursor: b3.defaultCursor, draggingCursor: b3.draggingCursor, isOverviewMap: false, minZoom: 1, maxZoom: 18, mapType: BMAP_NORMAL_MAP, restrictBounds: false, drawer: BMAP_SYS_DRAWER, enableInertialDragging: false, drawMargin: 500, enableHighResolution: false }; a1.extend(cF.config, cG || {}); if (cF.highResolutionEnabled()) { var cI = document.querySelector("meta[name=viewport]"); cI.content = "initial-scale=0.5, minimum-scale=0.5, maximum-scale=0.5, user-scalable=no, target-densitydpi=high-dpi" } cF.container = cE; cF._setStyle(cE); cE.unselectable = "on"; cE.innerHTML = ""; cE.appendChild(cF.render()); var cC = cF.getSize(); cF.width = cC.width; cF.height = cC.height; cF.offsetX = 0; cF.offsetY = 0; cF.platform = cE.firstChild; cF.maskLayer = cF.platform.firstChild; cF.maskLayer.style.width = cF.width + "px"; cF.maskLayer.style.height = cF.height + "px"; cF._panes = {}; cF.centerPoint = new b4(0, 0); cF.mercatorCenter = new b4(0, 0); cF.zoomLevel = 1; cF.lastLevel = 0; cF.defaultZoomLevel = null; cF.defaultCenter = null; cF.currentCity = ""; cF.cityCode = ""; cF._hotspots = {}; cF.currentOperation = 0; cG = cG || {}; var cH = cF.mapType = cF.config.mapType; cF.projection = cH.getProjection(); if (cH === BMAP_PERSPECTIVE_MAP) { _addStat(5002) } if (cH === BMAP_SATELLITE_MAP || cH === BMAP_HYBRID_MAP) { _addStat(5003) } var T = cF.config; T.userMinZoom = cG.minZoom; T.userMaxZoom = cG.maxZoom; cF._checkZoom(); cF.temp = { operating: false, arrow: 0, lastDomMoveTime: 0, lastLoadTileTime: 0, lastMovingTime: 0, canKeyboard: false, registerIndex: -1, curSpots: [] }; cF.platform.style.cursor = cF.config.defaultCursor; for (var cD = 0; cD < BMap._register.length; cD++) { BMap._register[cD](cF) } cF.temp.registerIndex = cD; cF._bind(); cr.load("map", function () { cF._draw() }); if (bG()) { cr.load("oppc", function () { cF._asyncRegister() }) } if (av()) { cr.load("opmb", function () { cF._asyncRegister() }) } cE = null } a1.lang.inherits(bs, a1.lang.Class, "Map"); a1.extend(bs.prototype, { render: function () { var T = W("div"); var cE = T.style; cE.overflow = "visible"; cE.position = "absolute"; cE.zIndex = "0"; cE.top = cE.left = "0px"; var cC = W("div", { "class": "BMap_mask" }); var cD = cC.style; cD.position = "absolute"; cD.top = cD.left = "0px"; cD.zIndex = "9"; cD.overflow = "hidden"; cD.WebkitUserSelect = "none"; T.appendChild(cC); return T }, _setStyle: function (cC) { var T = cC.style; T.overflow = "hidden"; if (aD(cC).position != "absolute") { T.position = "relative"; T.zIndex = 0 } T.backgroundColor = "#F3F1EC"; T.color = "#000"; T.textAlign = "left" }, _bind: function () { var T = this; T._watchSize = function () { var cC = T.getSize(); if (T.width != cC.width || T.height != cC.height) { var cE = new aB(T.width, T.height); var cF = new a9("onbeforeresize"); cF.size = cE; T.dispatchEvent(cF); T._updateCenterPoint((cC.width - T.width) / 2, (cC.height - T.height) / 2); T.maskLayer.style.width = (T.width = cC.width) + "px"; T.maskLayer.style.height = (T.height = cC.height) + "px"; var cD = new a9("onresize"); cD.size = cC; T.dispatchEvent(cD) } }; if (T.config.enableAutoResize) { T.temp.autoResizeTimer = setInterval(T._watchSize, 80) } }, _updateCenterPoint: function (cE, cC, cI, cH) { var cF = this.getMapType().getZoomUnits(this.getZoom()); var cJ = this.projection; var cG = true; if (cI && b4.isInRange(cI)) { this.centerPoint = new b4(cI.lng, cI.lat); cG = false } var cD = (cI && cH) ? cJ.lngLatToMercator(cI, this.currentCity) : this.mercatorCenter; if (cD) { this.mercatorCenter = new b4(cD.lng + cE * cF, cD.lat - cC * cF); var T = cJ.mercatorToLngLat(this.mercatorCenter, this.currentCity); if (T && cG) { this.centerPoint = T } } }, zoomTo: function (cE, cC) { if (!aE(cE)) { return } cE = this._getProperZoom(cE).zoom; if (cE == this.zoomLevel) { return } this.lastLevel = this.zoomLevel; this.zoomLevel = cE; var cD; if (cC) { cD = cC } else { if (this.getInfoWindow()) { cD = this.getInfoWindow().getPosition() } } if (cD) { var T = this.pointToPixel(cD, this.lastLevel); this._updateCenterPoint(this.width / 2 - T.x, this.height / 2 - T.y, this.pixelToPoint(T, this.lastLevel), true) } this.dispatchEvent(new a9("onzoomstart")); this.dispatchEvent(new a9("onzoomstartcode")) }, setZoom: function (T) { this.zoomTo(T) }, zoomIn: function (T) { this.zoomTo(this.zoomLevel + 1, T) }, zoomOut: function (T) { this.zoomTo(this.zoomLevel - 1, T) }, panTo: function (T, cC) { if (!(T instanceof b4)) { return } this.mercatorCenter = this.projection.lngLatToMercator(T, this.currentCity); if (b4.isInRange(T)) { this.centerPoint = new b4(T.lng, T.lat) } else { this.centerPoint = this.projection.mercatorToLngLat(this.mercatorCenter, this.currentCity) } }, panBy: function (cC, T) { cC = Math.round(cC) || 0; T = Math.round(T) || 0; this._updateCenterPoint(-cC, -T) }, addControl: function (T) { if (T && G(T._i)) { T._i(this); this.dispatchEvent(new a9("onaddcontrol", T)) } }, removeControl: function (T) { if (T && G(T.remove)) { T.remove(); this.dispatchEvent(new a9("onremovecontrol", T)) } }, addContextMenu: function (T) { if (T && G(T.initialize)) { T.initialize(this); this.dispatchEvent(new a9("onaddcontextmenu", T)) } }, removeContextMenu: function (T) { if (T && G(T.remove)) { this.dispatchEvent(new a9("onremovecontextmenu", T)); T.remove() } }, addOverlay: function (T) { if (T && G(T._i)) { T._i(this); this.dispatchEvent(new a9("onaddoverlay", T)) } }, removeOverlay: function (T) { if (T && G(T.remove)) { T.remove(); this.dispatchEvent(new a9("onremoveoverlay", T)) } }, clearOverlays: function () { this.dispatchEvent(new a9("onclearoverlays")) }, addTileLayer: function (T) { if (T) { this.dispatchEvent(new a9("onaddtilelayer", T)) } }, removeTileLayer: function (T) { if (T) { this.dispatchEvent(new a9("onremovetilelayer", T)) } }, setMapType: function (cC) { if (this.mapType === cC) { return } var cD = new a9("onsetmaptype"); var T = this.mapType; cD.preMapType = T; this.mapType = this.config.mapType = cC; this.projection = this.mapType.getProjection(); this._updateCenterPoint(0, 0, this.getCenter(), true); this._checkZoom(); var cE = this._getProperZoom(this.getZoom()).zoom; this.zoomTo(cE); this.dispatchEvent(cD); var cD = new a9("onmaptypechange"); cD.zoomLevel = cE; cD.mapType = cC; this.dispatchEvent(cD); if (cC === BMAP_SATELLITE_MAP || cC === BMAP_HYBRID_MAP) { _addStat(5003) } }, setCenter: function (T) { var cD = this; if (T instanceof b4) { cD.panTo(T, { noAnimation: true }) } else { if (bV(T)) { var cC = this._getLocal(); cC.setSearchCompleteCallback(function (cE) { if (cC.getStatus() == 0 && cC._json.result.type == 2) { cD.setCenter(cE.getPoi(0).point); if (BMAP_PERSPECTIVE_MAP.getCityName(T)) { cD.setCurrentCity(T) } } }); cC.search(T) } } }, centerAndZoom: function (T, cD) { var cC = this; if (bV(T)) { var cG = cC._getLocal(); cG.setSearchCompleteCallback(function (cH) { if (cG.getStatus() == 0 && cG._json.result.type == 2) { var cJ = cH.getPoi(0).point; var cI = cD || P.getBestLevel(cG._json.content.level, cC); cC.centerAndZoom(cJ, cI); if (BMAP_PERSPECTIVE_MAP.getCityName(T)) { cC.setCurrentCity(T) } } }); cG.search(T); return } if (!(T instanceof b4) || !cD) { return } cD = cC._getProperZoom(cD).zoom; cC.lastLevel = cC.zoomLevel || cD; cC.zoomLevel = cD; cC.centerPoint = new b4(T.lng, T.lat); cC.mercatorCenter = cC.projection.lngLatToMercator(cC.centerPoint, cC.currentCity); cC.defaultZoomLevel = cC.defaultZoomLevel || cC.zoomLevel; cC.defaultCenter = cC.defaultCenter || cC.centerPoint; var cF = new a9("onload"); var cE = new a9("onloadcode"); cF.point = new b4(T.lng, T.lat); cF.pixel = cC.pointToPixel(cC.centerPoint, cC.zoomLevel); cF.zoom = cD; if (!cC.loaded) { cC.loaded = true; cC.dispatchEvent(cF) } cC.dispatchEvent(cE); cC.dispatchEvent(new a9("onmoveend")); if (cC.lastLevel != cC.zoomLevel) { cC.dispatchEvent(new a9("onzoomend")) } }, _getLocal: function () { if (!this.temp.local) { this.temp.local = new aX(1) } return this.temp.local }, reset: function () { this.centerAndZoom(this.defaultCenter, this.defaultZoomLevel, true) }, enableDragging: function () { this.config.enableDragging = true }, disableDragging: function () { this.config.enableDragging = false }, enableInertialDragging: function () { this.config.enableInertialDragging = true }, disableInertialDragging: function () { this.config.enableInertialDragging = false }, enableScrollWheelZoom: function () { this.config.enableWheelZoom = true }, disableScrollWheelZoom: function () { this.config.enableWheelZoom = false }, enableContinuousZoom: function () { this.config.enableContinuousZoom = true }, disableContinuousZoom: function () { this.config.enableContinuousZoom = false }, enableDoubleClickZoom: function () { this.config.enableDblclickZoom = true }, disableDoubleClickZoom: function () { this.config.enableDblclickZoom = false }, enableKeyboard: function () { this.config.enableKeyboard = true }, disableKeyboard: function () { this.config.enableKeyboard = false }, enablePinchToZoom: function () { this.config.enablePinchToZoom = true }, disablePinchToZoom: function () { this.config.enablePinchToZoom = false }, enableAutoResize: function () { this.config.enableAutoResize = true; this._watchSize(); if (!this.temp.autoResizeTimer) { this.temp.autoResizeTimer = setInterval(this._watchSize, 80) } }, disableAutoResize: function () { this.config.enableAutoResize = false; if (this.temp.autoResizeTimer) { clearInterval(this.temp.autoResizeTimer); this.temp.autoResizeTimer = null } }, getSize: function () { return new aB(this.container.clientWidth, this.container.clientHeight) }, getCenter: function () { return this.centerPoint }, getZoom: function () { return this.zoomLevel }, checkResize: function () { this._watchSize() }, _getProperZoom: function (cD) { var cC = this.config.minZoom, T = this.config.maxZoom, cE = false; if (cD < cC) { cE = true; cD = cC } if (cD > T) { cE = true; cD = T } return { zoom: cD, exceeded: cE } }, getContainer: function () { return this.container }, pointToPixel: function (T, cC) { cC = cC || this.getZoom(); return this.projection.pointToPixel(T, cC, this.mercatorCenter, this.getSize(), this.currentCity) }, pixelToPoint: function (T, cC) { cC = cC || this.getZoom(); return this.projection.pixelToPoint(T, cC, this.mercatorCenter, this.getSize(), this.currentCity) }, pointToOverlayPixel: function (T, cD) { if (!T) { return } var cE = new b4(T.lng, T.lat); var cC = this.pointToPixel(cE, cD); cC.x -= this.offsetX; cC.y -= this.offsetY; return cC }, overlayPixelToPoint: function (T, cD) { if (!T) { return } var cC = new bn(T.x, T.y); cC.x += this.offsetX; cC.y += this.offsetY; return this.pixelToPoint(cC, cD) }, getBounds: function () { if (!this.isLoaded()) { return new bF() } var cC = arguments[0] || {}, cE = cC.margins || [0, 0, 0, 0], T = cC.zoom || null, cF = this.pixelToPoint({ x: cE[3], y: this.height - cE[2] }, T), cD = this.pixelToPoint({ x: this.width - cE[1], y: cE[0] }, T); return new bF(cF, cD) }, isLoaded: function () { return !!this.loaded }, _getBestLevel: function (cC, cD) { var cG = this.getMapType(); var cI = cD.margins || [10, 10, 10, 10], cF = cD.zoomFactor || 0, cJ = cI[1] + cI[3], cH = cI[0] + cI[2], T = cG.getMinZoom(), cL = cG.getMaxZoom(); for (var cE = cL; cE >= T; cE--) { var cK = this.getMapType().getZoomUnits(cE); if (cC.toSpan().lng / cK < this.width - cJ && cC.toSpan().lat / cK < this.height - cH) { break } } cE += cF; if (cE < T) { cE = T } if (cE > cL) { cE = cL } return cE }, getViewport: function (cK, cC) { var cO = { center: this.getCenter(), zoom: this.getZoom() }; if (!cK || !cK instanceof bF && cK.length == 0 || cK instanceof bF && cK.isEmpty()) { return cO } var cM = []; if (cK instanceof bF) { cM.push(cK.getNorthEast()); cM.push(cK.getSouthWest()) } else { cM = cK.slice(0) } cC = cC || {}; var cG = []; for (var cH = 0, cF = cM.length; cH < cF; cH++) { cG.push(this.projection.lngLatToMercator(cM[cH], this.currentCity)) } var cD = new bF(); for (var cH = cG.length - 1; cH >= 0; cH--) { cD.extend(cG[cH]) } if (cD.isEmpty()) { return cO } var T = cD.getCenter(); var cN = this._getBestLevel(cD, cC); if (cC.margins) { var cJ = cC.margins, cI = (cJ[1] - cJ[3]) / 2, cL = (cJ[0] - cJ[2]) / 2, cE = this.getMapType().getZoomUnits(cN); T.lng = T.lng + cE * cI; T.lat = T.lat + cE * cL } T = this.projection.mercatorToLngLat(T, this.currentCity); return { center: T, zoom: cN } }, setViewport: function (cC, cF) { var T; if (cC && cC.center) { T = cC } else { T = this.getViewport(cC, cF) } cF = cF || {}; var cD = cF.delay || 200; if (T.zoom == this.zoomLevel && cF.enableAnimation != false) { var cE = this; setTimeout(function () { cE.panTo(T.center, { duration: 210 }) }, cD) } else { this.centerAndZoom(T.center, T.zoom) } }, getPanes: function () { return this._panes }, getInfoWindow: function () { if (this.temp.infoWin && this.temp.infoWin.isOpen()) { return this.temp.infoWin } return null }, getDistance: function (cD, T) { if (!cD || !T) { return } var cC = 0; cC = a3.getDistanceByLL(cD, T); return cC }, getOverlays: function () { var cE = [], cF = this._overlays, cD = this._customOverlays; if (cF) { for (var cC in cF) { if (cF[cC] instanceof U) { cE.push(cF[cC]) } } } if (cD) { for (var cC = 0, T = cD.length; cC < T; cC++) { cE.push(cD[cC]) } } return cE }, getMapType: function () { return this.mapType }, _asyncRegister: function () { for (var T = this.temp.registerIndex; T < BMap._register.length; T++) { BMap._register[T](this) } this.temp.registerIndex = T }, setCurrentCity: function (T) { this.currentCity = BMAP_PERSPECTIVE_MAP.getCityName(T); this.cityCode = BMAP_PERSPECTIVE_MAP.getCityCode(this.currentCity) }, setDefaultCursor: function (T) { this.config.defaultCursor = T; if (this.platform) { this.platform.style.cursor = this.config.defaultCursor } }, getDefaultCursor: function () { return this.config.defaultCursor }, setDraggingCursor: function (T) { this.config.draggingCursor = T }, getDraggingCursor: function () { return this.config.draggingCursor }, highResolutionEnabled: function () { return this.config.enableHighResolution && window.devicePixelRatio > 1 }, addHotspot: function (cC) { if (cC instanceof cd) { this._hotspots[cC.guid] = cC; cC.initialize(this) } var T = this; cr.load("hotspot", function () { T._asyncRegister() }) }, removeHotspot: function (T) { if (this._hotspots[T.guid]) { delete this._hotspots[T.guid] } }, clearHotspots: function () { this._hotspots = {} }, _checkZoom: function () { var cC = this.mapType.getMinZoom(); var cD = this.mapType.getMaxZoom(); var T = this.config; T.minZoom = T.userMinZoom || cC; T.maxZoom = T.userMaxZoom || cD; if (T.minZoom < cC) { T.minZoom = cC } if (T.maxZoom > cD) { T.maxZoom = cD } }, setMinZoom: function (T) { if (T > this.config.maxZoom) { T = this.config.maxZoom } this.config.userMinZoom = T; this._updateZoom() }, setMaxZoom: function (T) { if (T < this.config.minZoom) { T = this.config.minZoom } this.config.userMaxZoom = T; this._updateZoom() }, _updateZoom: function () { this._checkZoom(); var T = this.config; if (this.zoomLevel < T.minZoom) { this.setZoom(T.minZoom) } else { if (this.zoomLevel > T.maxZoom) { this.setZoom(T.maxZoom) } } var cC = new a9("onzoomspanchange"); cC.minZoom = T.minZoom; cC.maxZoom = T.maxZoom; this.dispatchEvent(cC) } }); window.BMAP_API_VERSION = "1.2"; window.BMAP_COORD_LNGLAT = 0; window.BMAP_COORD_MERCATOR = 1; window.BMAP_SYS_DRAWER = 0; window.BMAP_SVG_DRAWER = 1; window.BMAP_VML_DRAWER = 2; window.BMAP_CANVAS_DRAWER = 3; window._addStat = function (cG, cF) { if (!cG) { return } cF = cF || {}; var cE = ""; for (var cC in cF) { cE = cE + "&" + cC + "=" + encodeURIComponent(cF[cC]) } var cH = function (cI) { if (!cI) { return } _addStat._sending = true; setTimeout(function () { _addStat._img.src = b3.imgPath + "blank.gif?" + cI.src }, 50) }; var T = function () { var cI = _addStat._reqQueue.shift(); if (cI) { cH(cI) } }; var cD = (Math.random() * 100000000).toFixed(0); if (_addStat._sending) { _addStat._reqQueue.push({ src: "t=" + cD + "&code=" + cG + cE }) } else { cH({ src: "t=" + cD + "&code=" + cG + cE }) } if (!_addStat._binded) { a1.on(_addStat._img, "load", function () { _addStat._sending = false; T() }); a1.on(_addStat._img, "error", function () { _addStat._sending = false; T() }); _addStat._binded = true } }; window._addStat._reqQueue = []; window._addStat._img = new Image(); _addStat(5000, { v: BMap.version }); function g(cE) { var T = { duration: 1000, fps: 30, delay: 0, transition: aq.linear, onStop: function () { } }; this._anis = []; if (cE) { for (var cC in cE) { T[cC] = cE[cC] } } this._opts = T; if (aE(T.delay)) { var cD = this; setTimeout(function () { cD.start() }, T.delay) } else { if (T.delay != g.INFINITE) { this.start() } } } g.INFINITE = "INFINITE"; g.prototype.start = function () { this._beginTime = az(); this._endTime = this._beginTime + this._opts.duration; this._launch() }; g.prototype.add = function (T) { this._anis.push(T) }; g.prototype._launch = function () { var cD = this; var T = az(); if (T >= cD._endTime) { if (G(cD._opts.render)) { cD._opts.render(cD._opts.transition(1)) } if (G(cD._opts.finish)) { cD._opts.finish() } if (cD._anis.length > 0) { var cC = cD._anis[0]; cC._anis = [].concat(cD._anis.slice(1)); cC.start() } return } cD.schedule = cD._opts.transition((T - cD._beginTime) / cD._opts.duration); if (G(cD._opts.render)) { cD._opts.render(cD.schedule) } if (!cD.terminative) { cD._timer = setTimeout(function () { cD._launch() }, 1000 / cD._opts.fps) } }; g.prototype.stop = function (cC) { this.terminative = true; for (var T = 0; T < this._anis.length; T++) { this._anis[T].stop(); this._anis[T] = null } this._anis.length = 0; if (this._timer) { clearTimeout(this._timer); this._timer = null } this._opts.onStop(this.schedule); if (cC) { this._endTime = this._beginTime; this._launch() } }; g.prototype.cancel = function () { if (this._timer) { clearTimeout(this._timer) } this._endTime = this._beginTime; this.schedule = 0 }; g.prototype.setFinishCallback = function (T) { if (this._anis.length > 0) { this._anis[this._anis.length - 1]._opts.finish = T } else { this._opts.finish = T } }; var aq = { linear: function (T) { return T }, reverse: function (T) { return 1 - T }, easeInQuad: function (T) { return T * T }, easeInCubic: function (T) { return Math.pow(T, 3) }, easeOutQuad: function (T) { return -(T * (T - 2)) }, easeOutCubic: function (T) { return Math.pow((T - 1), 3) + 1 }, easeInOutQuad: function (T) { if (T < 0.5) { return T * T * 2 } else { return -2 * (T - 2) * T - 1 } return }, easeInOutCubic: function (T) { if (T < 0.5) { return Math.pow(T, 3) * 4 } else { return Math.pow(T - 1, 3) * 4 + 1 } }, easeInOutSine: function (T) { return (1 - Math.cos(Math.PI * T)) / 2 } }; aq["ease-in"] = aq.easeInQuad; aq["ease-out"] = aq.easeOutQuad; var b3 = { imgPath: "http://api.map.baidu.com/images/", cityNames: { "\u5317\u4eac": "bj", "\u4e0a\u6d77": "sh", "\u6df1\u5733": "sz", "\u5e7f\u5dde": "gz" }, fontFamily: "arial,sans-serif" }; if (a1.browser.firefox) { a1.extend(b3, { distCursor: "url(" + b3.imgPath + "ruler.cur),crosshair", defaultCursor: "-moz-grab", draggingCursor: "-moz-grabbing" }); if (a1.platform.isWindows) { b3.fontFamily = "arial,simsun,sans-serif" } } else { if (a1.browser.chrome || a1.browser.safari) { a1.extend(b3, { distCursor: "url(" + b3.imgPath + "ruler.cur) 2 6,crosshair", defaultCursor: "url(" + b3.imgPath + "openhand.cur) 8 8,default", draggingCursor: "url(" + b3.imgPath + "closedhand.cur) 8 8,move" }) } else { a1.extend(b3, { distCursor: "url(" + b3.imgPath + "ruler.cur),crosshair", defaultCursor: "url(" + b3.imgPath + "openhand.cur),default", draggingCursor: "url(" + b3.imgPath + "closedhand.cur),move" }) } } function ap(cD, cC, T) { this.id = cD; this.bounds = cC; this.content = T } var bg = { undo: 1, redo: 2, zoom: 4, drag: 8, move: 16, mousewheel: 32, toolbarOperation: 64, stdMapCtrlDrag: 128, dblclick: 256 }; function bB(cD, T) { var cC = cD.style; cC.left = T[0] + "px"; cC.top = T[1] + "px" } function cn(T) { if (a1.browser.ie > 0) { T.unselectable = "on" } else { T.style.MozUserSelect = "none" } } function w(T) { return T && T.parentNode && T.parentNode.nodeType != 11 } function an(cC, T) { a1.dom.insertHTML(cC, "beforeEnd", T); return cC.lastChild } function bQ(T) { var cC = { left: 0, top: 0 }; while (T && T.offsetParent) { cC.left += T.offsetLeft; cC.top += T.offsetTop; T = T.offsetParent } return cC } function aJ(T) { var T = window.event || T; T.stopPropagation ? T.stopPropagation() : T.cancelBubble = true } function ct(T) { var T = window.event || T; T.preventDefault ? T.preventDefault() : T.returnValue = false; return false } function cf(T) { aJ(T); return ct(T) } function cx() { var T = document.documentElement, cC = document.body; if (T && (T.scrollTop || T.scrollLeft)) { return [T.scrollTop, T.scrollLeft] } else { if (cC) { return [cC.scrollTop, cC.scrollLeft] } else { return [0, 0] } } } function ck(cC, T) { if (!cC || !T) { return } return Math.round(Math.sqrt(Math.pow(cC.x - T.x, 2) + Math.pow(cC.y - T.y, 2))) } function M(T, cD) { var cC = []; cD = cD || function (cF) { return cF }; for (var cE in T) { cC.push(cE + "=" + cD(T[cE])) } return cC.join("&") } function W(cC, T, cD) { var cE = document.createElement(cC); if (cD) { cE = document.createElementNS(cD, cC) } return a1.dom.setAttrs(cE, T || {}) } function aD(T) { if (T.currentStyle) { return T.currentStyle } else { if (T.ownerDocument && T.ownerDocument.defaultView) { return T.ownerDocument.defaultView.getComputedStyle(T, null) } } } function G(T) { return typeof T == "function" } function aE(T) { return typeof T == "number" } function bV(T) { return typeof T == "string" } function b8(T) { return typeof T != "undefined" } function cA(T) { return typeof T == "object" } function aS(T) { return "[object Array]" == Object.prototype.toString.call(T) } var b6 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; function bN(cE) { var cC = ""; var cL, cJ, cH = ""; var cK, cI, cG, cF = ""; var cD = 0; var T = /[^A-Za-z0-9\+\/\=]/g; if (!cE || T.exec(cE)) { return cE } cE = cE.replace(/[^A-Za-z0-9\+\/\=]/g, ""); do { cK = b6.indexOf(cE.charAt(cD++)); cI = b6.indexOf(cE.charAt(cD++)); cG = b6.indexOf(cE.charAt(cD++)); cF = b6.indexOf(cE.charAt(cD++)); cL = (cK << 2) | (cI >> 4); cJ = ((cI & 15) << 4) | (cG >> 2); cH = ((cG & 3) << 6) | cF; cC = cC + String.fromCharCode(cL); if (cG != 64) { cC = cC + String.fromCharCode(cJ) } if (cF != 64) { cC = cC + String.fromCharCode(cH) } cL = cJ = cH = ""; cK = cI = cG = cF = "" } while (cD < cE.length); return cC } var a9 = a1.lang.Event; function av() { return !!(a1.platform.isIphone || a1.platform.isIpad || a1.platform.isAndroid) } function bG() { return !!(a1.platform.isWindows || a1.platform.isMacintosh || a1.platform.isX11) } function az() { return (new Date).getTime() } var co = { request: function (cC) { var T = W("script", { src: cC, type: "text/javascript", charset: "utf-8" }); if (T.addEventListener) { T.addEventListener("load", function (cE) { var cD = cE.target; cD.parentNode.removeChild(cD) }, false) } else { if (T.attachEvent) { T.attachEvent("onreadystatechange", function (cE) { var cD = window.event.srcElement; if (cD && (cD.readyState == "loaded" || cD.readyState == "complete")) { cD.parentNode.removeChild(cD) } }) } } setTimeout(function () { document.getElementsByTagName("head")[0].appendChild(T); T = null }, 1) } }; function cr() { } a1.object.extend(cr, { Request: { INITIAL: -1, WAITING: 0, COMPLETED: 1 }, Dependency: { control: [], marker: [], poly: ["marker"], infowindow: ["marker"], menu: [], oppc: [], opmb: [], scommon: [], local: ["scommon"], route: ["scommon"], othersearch: ["scommon"], autocomplete: ["scommon"], buslinesearch: ["route"], hotspot: [] }, preLoaded: {}, Config: { _baseUrl: "http://api.map.baidu.com/getmodules?v=1.2", _timeout: 5000 }, delayFlag: false, Module: { _modules: {}, _arrMdls: [] }, load: function (cC, cE) { var T = this.current(cC); if (T._status == this.Request.COMPLETED) { return } else { if (T._status == this.Request.INITIAL) { this.combine(cC); this.pushUniqueMdl(cC); var cD = this; if (cD.delayFlag == false) { cD.delayFlag = true; window.setTimeout(function () { var cF = cD.Config._baseUrl + "&mod=" + cD.Module._arrMdls.join(","); co.request(cF); cD.Module._arrMdls.length = 0; cD.delayFlag = false }, 1) } T._status = this.Request.WAITING } T._callbacks.push(cE) } }, combine: function (T) { if (T && this.Dependency[T]) { var cD = this.Dependency[T]; for (var cC = 0; cC < cD.length; cC++) { this.combine(cD[cC]); if (!this.Module._modules[cD[cC]]) { this.pushUniqueMdl(cD[cC]) } } } }, pushUniqueMdl: function (cC) { for (var T = 0; T < this.Module._arrMdls.length; T++) { if (this.Module._arrMdls[T] == cC) { return } } this.Module._arrMdls.push(cC) }, run: function (cD, cF) { var cC = this.current(cD); try { eval(cF) } catch (cG) { return } cC._status = this.Request.COMPLETED; for (var cE = 0, T = cC._callbacks.length; cE < T; cE++) { cC._callbacks[cE]() } cC._callbacks.length = 0 }, check: function (cC, cD) { var T = this; T.timeout = setTimeout(function () { var cE = T.Module._modules[cC]._status; if (cE != T.Request.COMPLETED) { T.remove(cC); T.load(cC, cD) } else { clearTimeout(T.timeout) } }, T.Config._timeout) }, current: function (cC) { var T; if (!this.Module._modules[cC]) { this.Module._modules[cC] = {}; this.Module._modules[cC]._status = this.Request.INITIAL; this.Module._modules[cC]._callbacks = [] } T = this.Module._modules[cC]; return T }, remove: function (cC) { var T = this.current(cC); delete T } }); window._jsload = function (T, cC) { cr.run(T, cC) }; function bn(T, cC) { this.x = T || 0; this.y = cC || 0 } bn.prototype.equals = function (T) { return T && T.x == this.x && T.y == this.y }; function aB(cC, T) { this.width = cC || 0; this.height = T || 0 } aB.prototype.equals = function (T) { return T && this.width == T.width && this.height == T.height }; function cd(T, cC) { if (!T) { return } this._position = T; this.guid = "spot" + (cd.guid++); cC = cC || {}; this._text = cC.text || ""; this._offsets = cC.offsets ? cC.offsets.slice(0) : [5, 5, 5, 5]; this._userData = cC.userData || null; this._minZoom = cC.minZoom || null; this._maxZoom = cC.maxZoom || null } cd.guid = 0; a1.extend(cd.prototype, { initialize: function (T) { if (this._minZoom == null) { this._minZoom = T.config.minZoom } if (this._maxZoom == null) { this._maxZoom = T.config.maxZoom } }, setPosition: function (T) { if (T instanceof b4) { this._position = T } }, getPosition: function () { return this._position }, setText: function (T) { this._text = T }, getText: function () { return this._text }, setUserData: function (T) { this._userData = T }, getUserData: function () { return this._userData } }); function cg() { this._map = null; this._container; this._type = "control"; this.blockInfoWindow = true; this._visible = true } a1.lang.inherits(cg, a1.lang.Class, "Control"); a1.extend(cg.prototype, { initialize: function (T) { this._map = T; if (this._container) { T.container.appendChild(this._container); return this._container } return }, _i: function (T) { if (!this._container && this.initialize && G(this.initialize)) { this._container = this.initialize(T) } this._opts = this._opts || { printable: false }; this._setStyle(); this._setPosition(); if (this._container) { this._container._jsobj = this } }, _setStyle: function () { var cC = this._container; if (cC) { var T = cC.style; T.position = "absolute"; T.zIndex = this._cZIndex || "10"; T.MozUserSelect = "none"; T.WebkitTextSizeAdjust = "none"; if (!this._opts.printable) { a1.dom.addClass(cC, "BMap_noprint") } a1.on(cC, "contextmenu", cf) } }, remove: function () { this._map = null; if (!this._container) { return } this._container.parentNode && this._container.parentNode.removeChild(this._container); this._container._jsobj = null; this._container = null }, _render: function () { this._container = an(this._map.container, "
"); if (this._visible == false) { a1.dom.hide(this._container) } return this._container }, _setPosition: function () { this.setAnchor(this._opts.anchor) }, setAnchor: function (cE) { if (this.anchorFixed || !aE(cE) || isNaN(cE) || cE < BMAP_ANCHOR_TOP_LEFT || cE > BMAP_ANCHOR_BOTTOM_RIGHT) { cE = this.defaultAnchor } this._opts = this._opts || { printable: false }; this._opts.offset = this._opts.offset || this.defaultOffset; var cD = this._opts.anchor; this._opts.anchor = cE; if (!this._container) { return } var cG = this._container; var T = this._opts.offset.width; var cF = this._opts.offset.height; cG.style.left = cG.style.top = cG.style.right = cG.style.bottom = "auto"; switch (cE) { case BMAP_ANCHOR_TOP_LEFT: cG.style.top = cF + "px"; cG.style.left = T + "px"; break; case BMAP_ANCHOR_TOP_RIGHT: cG.style.top = cF + "px"; cG.style.right = T + "px"; break; case BMAP_ANCHOR_BOTTOM_LEFT: cG.style.bottom = cF + "px"; cG.style.left = T + "px"; break; case BMAP_ANCHOR_BOTTOM_RIGHT: cG.style.bottom = cF + "px"; cG.style.right = T + "px"; break; default: break } var cC = ["TL", "TR", "BL", "BR"]; a1.dom.removeClass(this._container, "anchor" + cC[cD]); a1.dom.addClass(this._container, "anchor" + cC[cE]) }, getAnchor: function () { return this._opts.anchor }, setOffset: function (T) { if (!(T instanceof aB)) { return } this._opts = this._opts || { printable: false }; this._opts.offset = new aB(T.width, T.height); if (!this._container) { return } this.setAnchor(this._opts.anchor) }, getOffset: function () { return this._opts.offset }, getDom: function () { return this._container }, show: function () { if (this._visible == true) { return } this._visible = true; if (this._container) { a1.dom.show(this._container) } }, hide: function () { if (this._visible == false) { return } this._visible = false; if (this._container) { a1.dom.hide(this._container) } }, isPrintable: function () { return !!this._opts.printable }, isVisible: function () { if (!this._container && !this._map) { return false } return !!this._visible } }); window.BMAP_ANCHOR_TOP_LEFT = 0; window.BMAP_ANCHOR_TOP_RIGHT = 1; window.BMAP_ANCHOR_BOTTOM_LEFT = 2; window.BMAP_ANCHOR_BOTTOM_RIGHT = 3; window.BMAP_NAVIGATION_CONTROL_LARGE = 0; window.BMAP_NAVIGATION_CONTROL_SMALL = 1; window.BMAP_NAVIGATION_CONTROL_PAN = 2; window.BMAP_NAVIGATION_CONTROL_ZOOM = 3; function J(T) { cg.call(this); T = T || {}; this._opts = { printable: false, showZoomInfo: true }; a1.object.extend(this._opts, T); this.defaultAnchor = BMAP_ANCHOR_TOP_LEFT; this.defaultOffset = new aB(10, 10); this.setAnchor(T.anchor); this.setType(T.type); this._asyncLoadCode() } a1.lang.inherits(J, cg, "NavigationControl"); a1.extend(J.prototype, { initialize: function (T) { this._map = T; return this._container }, setType: function (T) { if (aE(T) && T >= BMAP_NAVIGATION_CONTROL_LARGE && T <= BMAP_NAVIGATION_CONTROL_ZOOM) { this._opts.type = T } else { this._opts.type = BMAP_NAVIGATION_CONTROL_LARGE } }, getType: function () { return this._opts.type }, _asyncLoadCode: function () { var T = this; cr.load("control", function () { T._asyncDraw() }) } }); function ai(T) { cg.call(this); T = T || {}; this._opts = { printable: false }; a1.object.extend(this._opts, T); this._copyrightCollection = []; this.defaultAnchor = BMAP_ANCHOR_BOTTOM_LEFT; this.defaultOffset = new aB(5, 2); this.setAnchor(T.anchor); this._canShow = true; this.blockInfoWindow = false; this._asyncLoadCode() } a1.lang.inherits(ai, cg, "CopyrightControl"); a1.object.extend(ai.prototype, { initialize: function (T) { this._map = T; return this._container }, addCopyright: function (cD) { if (!cD || !aE(cD.id) || isNaN(cD.id)) { return } var T = { bounds: null, content: "" }; for (var cC in cD) { T[cC] = cD[cC] } var cE = this.getCopyright(cD.id); if (cE) { for (var cF in T) { cE[cF] = T[cF] } } else { this._copyrightCollection.push(T) } }, getCopyright: function (cD) { for (var cC = 0, T = this._copyrightCollection.length; cC < T; cC++) { if (this._copyrightCollection[cC].id == cD) { return this._copyrightCollection[cC] } } }, getCopyrightCollection: function () { return this._copyrightCollection }, removeCopyright: function (cD) { for (var cC = 0, T = this._copyrightCollection.length; cC < T; cC++) { if (this._copyrightCollection[cC].id == cD) { r = this._copyrightCollection.splice(cC, 1); cC--; T = this._copyrightCollection.length } } }, _asyncLoadCode: function () { var T = this; cr.load("control", function () { T._asyncDraw() }) } }); function cB(T) { cg.call(this); T = T || {}; this._opts = { printable: false }; this._opts = a1.extend(a1.extend(this._opts, { size: new aB(150, 150), padding: 8, isOpen: false, zoomInterval: 4 }), T); this.defaultAnchor = BMAP_ANCHOR_BOTTOM_RIGHT; this.defaultOffset = new aB(0, 0); this._btnWidth = 15; this._btnHeight = 15; this.setAnchor(T.anchor); this.setSize(this._opts.size); this._asyncLoadCode() } a1.lang.inherits(cB, cg, "OverviewMapControl"); a1.extend(cB.prototype, { initialize: function (T) { this._map = T; return this._container }, setAnchor: function (T) { cg.prototype.setAnchor.call(this, T) }, changeView: function () { this.changeView._running = true; this._opts.isOpen = !this._opts.isOpen; if (!this._container) { this.changeView._running = false } }, setSize: function (T) { if (!(T instanceof aB)) { T = new aB(150, 150) } T.width = T.width > 0 ? T.width : 150; T.height = T.height > 0 ? T.height : 150; this._opts.size = T }, getSize: function () { return this._opts.size }, isOpen: function () { return this._opts.isOpen }, _asyncLoadCode: function () { var T = this; cr.load("control", function () { T._asyncDraw() }) } }); function bC(T) { cg.call(this); T = T || {}; this._opts = { printable: false }; this._opts = a1.object.extend(a1.object.extend(this._opts, { color: "black", unit: "metric" }), T); this.defaultAnchor = BMAP_ANCHOR_BOTTOM_LEFT; this.defaultOffset = new aB(81, 18); this.setAnchor(T.anchor); this._units = { metric: { name: "metric", conv: 1, incon: 1000, u1: "\u7c73", u2: "\u516c\u91cc" }, us: { name: "us", conv: 3.2808, incon: 5280, u1: "\u82f1\u5c3a", u2: "\u82f1\u91cc" } }; if (!this._units[this._opts.unit]) { this._opts.unit = "metric" } this._scaleText = null; this._numberArray = {}; this._asyncLoadCode() } window.BMAP_UNIT_METRIC = "metric"; window.BMAP_UNIT_IMPERIAL = "us"; a1.lang.inherits(bC, cg, "ScaleControl"); a1.object.extend(bC.prototype, { initialize: function (T) { this._map = T; return this._container }, setColor: function (T) { this._opts.color = T + "" }, getColor: function () { return this._opts.color }, setUnit: function (T) { this._opts.unit = this._units[T] && this._units[T].name || this._opts.unit }, getUnit: function () { return this._opts.unit }, _asyncLoadCode: function () { var T = this; cr.load("control", function () { T._asyncDraw() }) } }); window.BMAP_MAPTYPE_CONTROL_HORIZONTAL = 0; window.BMAP_MAPTYPE_CONTROL_DROPDOWN = 1; function aF(T) { cg.call(this); T = T || {}; this._opts = { printable: false, mapTypes: [BMAP_NORMAL_MAP, BMAP_SATELLITE_MAP, BMAP_HYBRID_MAP, BMAP_PERSPECTIVE_MAP], type: BMAP_MAPTYPE_CONTROL_HORIZONTAL }; this.defaultAnchor = BMAP_ANCHOR_TOP_RIGHT; this.defaultOffset = new aB(10, 10); this.setAnchor(T.anchor); this._opts = a1.extend(a1.extend(this._opts, { offset: this.defaultOffset, enableSwitch: true }), T); if (aS(T.mapTypes)) { this._opts.mapTypes = T.mapTypes.slice(0) } this._asyncLoadCode() } a1.lang.inherits(aF, cg, "MapTypeControl"); a1.object.extend(aF.prototype, { initialize: function (T) { this._map = T; return this._container }, _asyncLoadCode: function () { var T = this; cr.load("control", function () { T._asyncDraw() }) } }); function cq(cC) { a1.lang.Class.call(this); this._opts = { container: null, cursor: "default" }; this._opts = a1.extend(this._opts, cC); this._type = "contextmenu"; this._map = null; this._container; this._shadow; this._left = 0; this._top = 0; this._items = []; this._rItems = []; this._dividers = []; this.curPixel = null; this.curPoint = null; this._isOpen = false; var T = this; cr.load("menu", function () { T._draw() }) } a1.lang.inherits(cq, a1.lang.Class, "ContextMenu"); a1.object.extend(cq.prototype, { initialize: function (cC, T) { this._map = cC; this._overlay = T || null }, remove: function () { this._map = this._overlay = null }, addItem: function (cD) { if (!cD || cD._type != "menuitem" || cD._text == "" || cD._width <= 0) { return } for (var cC = 0, T = this._items.length; cC < T; cC++) { if (this._items[cC] === cD) { return } } this._items.push(cD); this._rItems.push(cD) }, removeItem: function (cD) { if (!cD || cD._type != "menuitem") { return } for (var cC = 0, T = this._items.length; cC < T; cC++) { if (this._items[cC] === cD) { this._items[cC].remove(); this._items.splice(cC, 1); T-- } } for (var cC = 0, T = this._rItems.length; cC < T; cC++) { if (this._rItems[cC] === cD) { this._rItems[cC].remove(); this._rItems.splice(cC, 1); T-- } } }, addSeparator: function () { this._items.push({ _type: "divider", _dIndex: this._dividers.length }); this._dividers.push({ dom: null }) }, removeSeparator: function (cC) { if (!this._dividers[cC]) { return } for (var cD = 0, T = this._items.length; cD < T; cD++) { if (this._items[cD] && this._items[cD]._type == "divider" && this._items[cD]._dIndex == cC) { this._items.splice(cD, 1); T-- } if (this._items[cD] && this._items[cD]._type == "divider" && this._items[cD]._dIndex > cC) { this._items[cD]._dIndex-- } } this._dividers.splice(cC, 1) }, getDom: function () { return this._container }, show: function () { if (this._isOpen == true) { return } this._isOpen = true }, hide: function () { if (this._isOpen == false) { return } this._isOpen = false }, setCursor: function (T) { if (!T) { return } this._opts.cursor = T }, getItem: function (T) { return this._rItems[T] } }); function a7(cD, cE, cC) { if (!cD || !G(cE)) { return } a1.lang.Class.call(this); this._opts = { width: 100, id: "" }; cC = cC || {}; this._opts.width = (cC.width * 1) ? cC.width : 100; this._opts.id = cC.id ? cC.id : ""; this._text = cD + ""; this._callback = cE; this._map = null; this._type = "menuitem"; this._contextmenu = null; this._container = null; this._enabled = true; var T = this; cr.load("menu", function () { T._draw() }) } a1.lang.inherits(a7, a1.lang.Class, "MenuItem"); a1.object.extend(a7.prototype, { initialize: function (T, cC) { this._map = T; this._contextmenu = cC }, remove: function () { this._contextmenu = null; this._map = null }, setText: function (T) { if (!T) { return } this._text = T + "" }, getDom: function () { return this._container }, enable: function () { this._enabled = true }, disable: function () { this._enabled = false } }); function bF(T, cC) { if (T && !cC) { cC = T } this._sw = this._ne = null; this._swLng = this._swLat = null; this._neLng = this._neLat = null; if (T) { this._sw = new b4(T.lng, T.lat); this._ne = new b4(cC.lng, cC.lat); this._swLng = T.lng; this._swLat = T.lat; this._neLng = cC.lng; this._neLat = cC.lat } } a1.object.extend(bF.prototype, { isEmpty: function () { return !this._sw || !this._ne }, equals: function (T) { if (!(T instanceof bF) || this.isEmpty()) { return false } return this.getSouthWest().equals(T.getSouthWest()) && this.getNorthEast().equals(T.getNorthEast()) }, getSouthWest: function () { return this._sw }, getNorthEast: function () { return this._ne }, containsBounds: function (T) { if (!(T instanceof bF) || this.isEmpty() || T.isEmpty()) { return false } return (T._swLng > this._swLng && T._neLng < this._neLng && T._swLat > this._swLat && T._neLat < this._neLat) }, getCenter: function () { if (this.isEmpty()) { return null } return new b4((this._swLng + this._neLng) / 2, (this._swLat + this._neLat) / 2) }, intersects: function (cD) { if (!(cD instanceof bF)) { return null } if (Math.max(cD._swLng, cD._neLng) < Math.min(this._swLng, this._neLng) || Math.min(cD._swLng, cD._neLng) > Math.max(this._swLng, this._neLng) || Math.max(cD._swLat, cD._neLat) < Math.min(this._swLat, this._neLat) || Math.min(cD._swLat, cD._neLat) > Math.max(this._swLat, this._neLat)) { return null } var cF = Math.max(this._swLng, cD._swLng); var cC = Math.min(this._neLng, cD._neLng); var cE = Math.max(this._swLat, cD._swLat); var T = Math.min(this._neLat, cD._neLat); return new bF(new b4(cF, cE), new b4(cC, T)) }, containsPoint: function (T) { if (!(T instanceof b4) || this.isEmpty()) { return false } return (T.lng >= this._swLng && T.lng <= this._neLng && T.lat >= this._swLat && T.lat <= this._neLat) }, extend: function (T) { if (!(T instanceof b4)) { return } var cC = T.lng, cD = T.lat; if (!this._sw) { this._sw = new b4(0, 0) } if (!this._ne) { this._ne = new b4(0, 0) } if (!this._swLng || this._swLng > cC) { this._sw.lng = this._swLng = cC } if (!this._neLng || this._neLng < cC) { this._ne.lng = this._neLng = cC } if (!this._swLat || this._swLat > cD) { this._sw.lat = this._swLat = cD } if (!this._neLat || this._neLat < cD) { this._ne.lat = this._neLat = cD } }, toSpan: function () { if (this.isEmpty()) { return new b4(0, 0) } return new b4(Math.abs(this._neLng - this._swLng), Math.abs(this._neLat - this._swLat)) } }); function b4(T, cC) { if (isNaN(T)) { T = bN(T); T = isNaN(T) ? 0 : T } if (bV(T)) { T = parseFloat(T) } if (isNaN(cC)) { cC = bN(cC); cC = isNaN(cC) ? 0 : cC } if (bV(cC)) { cC = parseFloat(cC) } this.lng = T; this.lat = cC } b4.isInRange = function (T) { return T && T.lng <= 180 && T.lng >= -180 && T.lat <= 74 && T.lat >= -74 }; b4.prototype.equals = function (T) { return T && this.lat == T.lat && this.lng == T.lng }; function a6() { } a6.prototype.lngLatToPoint = function () { throw "lngLatToPoint\u65b9\u6cd5\u672a\u5b9e\u73b0" }; a6.prototype.pointToLngLat = function () { throw "pointToLngLat\u65b9\u6cd5\u672a\u5b9e\u73b0" }; function bX() { } a1.extend(bX, { num: { bj: { num: Math.sin(Math.PI / 4), num2: Math.sin(Math.PI / 6) }, gz: { num: Math.sin(Math.PI / 4), num2: Math.sin(Math.PI / 4) }, sz: { num: Math.sin(Math.PI / 4), num2: Math.sin(Math.PI / 4) }, sh: { num: Math.sin(Math.PI / 4), num2: Math.sin(Math.PI / 4) } }, correct_pts: { bj: [{ j: 116.305687, w: 39.990912, utm_x: 12947230.73, utm_y: 4836903.65, x: 630412, y: 547340 }, { j: 116.381837, w: 40.000198, utm_x: 12955707.8, utm_y: 4838247.62, x: 667412, y: 561832 }, { j: 116.430651, w: 39.995216, utm_x: 12961141.81, utm_y: 4837526.55, x: 686556, y: 573372 }, { j: 116.474111, w: 39.976323, utm_x: 12965979.81, utm_y: 4834792.55, x: 697152, y: 586816 }, { j: 116.280328, w: 39.953159, utm_x: 12944407.75, utm_y: 4831441.53, x: 603272, y: 549976 }, { j: 116.316117, w: 39.952496, utm_x: 12948391.8, utm_y: 4831345.64, x: 618504, y: 557872 }, { j: 116.350477, w: 39.938107, utm_x: 12952216.78, utm_y: 4829264.65, x: 627044, y: 568220 }, { j: 116.432025, w: 39.947158, utm_x: 12961294.76, utm_y: 4830573.59, x: 666280, y: 584016 }, { j: 116.46873, w: 39.949516, utm_x: 12965380.79, utm_y: 4830914.63, x: 683328, y: 591444 }, { j: 116.280077, w: 39.913823, utm_x: 12944379.8, utm_y: 4825753.62, x: 586150, y: 558552 }, { j: 116.308625, w: 39.91374, utm_x: 12947557.79, utm_y: 4825741.62, x: 598648, y: 564732 }, { j: 116.369853, w: 39.912979, utm_x: 12954373.73, utm_y: 4825631.62, x: 624561, y: 578039 }, { j: 116.433552, w: 39.914694, utm_x: 12961464.75, utm_y: 4825879.53, x: 652972, y: 591348 }, { j: 116.457034, w: 39.914273, utm_x: 12964078.78, utm_y: 4825818.67, x: 663028, y: 596444 }, { j: 116.490927, w: 39.914127, utm_x: 12967851.77, utm_y: 4825797.57, x: 677968, y: 604188 }, { j: 116.483839, w: 39.877198, utm_x: 12967062.73, utm_y: 4820460.67, x: 658596, y: 610312 }, { j: 116.405777, w: 39.864461, utm_x: 12958372.82, utm_y: 4818620.62, x: 619256, y: 596088 }, { j: 116.35345, w: 39.859774, utm_x: 12952547.74, utm_y: 4817943.6, x: 594633, y: 585851 }, { j: 116.403818, w: 39.9141, utm_x: 12958154.74, utm_y: 4825793.66, x: 639699, y: 585226 }, { j: 116.318111, w: 39.891101, utm_x: 12948613.78, utm_y: 4822469.56, x: 592856, y: 571480 }, { j: 116.413047, w: 39.907238, utm_x: 12959182.12, utm_y: 4824801.76, x: 640680, y: 588704 }, { j: 116.390843, w: 39.906113, utm_x: 12956710.35, utm_y: 4824639.16, x: 630620, y: 584108 }, { j: 116.446527, w: 39.899438, utm_x: 12962909.14, utm_y: 4823674.4, x: 651752, y: 597416 }, { j: 116.388665, w: 39.95527, utm_x: 12956467.9, utm_y: 4831746.87, x: 650656, y: 572800 }, { j: 116.398343, w: 39.939704, utm_x: 12957545.26, utm_y: 4829495.6, x: 648036, y: 578452 }, { j: 116.355101, w: 39.973581, utm_x: 12952731.53, utm_y: 4834395.82, x: 643268, y: 560944 }, { j: 116.380727, w: 39.88464, utm_x: 12955584.23, utm_y: 4821535.94, x: 616920, y: 586496 }, { j: 116.360843, w: 39.946452, utm_x: 12953370.73, utm_y: 4830471.48, x: 635293, y: 568765 }, { j: 116.340955, w: 39.973421, utm_x: 12951156.79, utm_y: 4834372.67, x: 638420, y: 558632 }, { j: 116.322585, w: 40.023941, utm_x: 12949111.83, utm_y: 4841684.79, x: 652135, y: 543802 }, { j: 116.356486, w: 39.883341, utm_x: 12952885.71, utm_y: 4821348.24, x: 606050, y: 581443 }, { j: 116.339592, w: 39.992259, utm_x: 12951005.06, utm_y: 4837098.59, x: 645664, y: 554400 }, { j: 116.3778, w: 39.86392, utm_x: 12955258.4, utm_y: 4818542.48, x: 606848, y: 590328 }, { j: 116.377354, w: 39.964124, utm_x: 12955208.75, utm_y: 4833027.64, x: 649911, y: 568581 }, { j: 116.361837, w: 39.963897, utm_x: 12953481.39, utm_y: 4832994.8, x: 643286, y: 565175 }, { j: 116.441397, w: 39.939403, utm_x: 12962338.06, utm_y: 4829452.07, x: 666772, y: 587728 }, { j: 116.359176, w: 40.006631, utm_x: 12953185.16, utm_y: 4839178.78, x: 660440, y: 555411 }], sz: [{ j: 113.88099, w: 22.58884, utm_x: 12677311.76, utm_y: 2565810.52, x: 569078, y: 532290 }, { j: 113.902002, w: 22.566098, utm_x: 12679650.83, utm_y: 2563084.58, x: 568318, y: 545457 }, { j: 113.869843, w: 22.577711, utm_x: 12676070.87, utm_y: 2564476.5, x: 561115, y: 532494 }, { j: 113.943387, w: 22.555192, utm_x: 12684257.84, utm_y: 2561777.5, x: 579437, y: 558427 }, { j: 113.899505, w: 22.577052, utm_x: 12679372.86, utm_y: 2564397.51, x: 571923, y: 540181 }, { j: 113.900376, w: 22.596431, utm_x: 12679469.82, utm_y: 2566720.51, x: 580142, y: 535463 }, { j: 113.92101, w: 22.528931, utm_x: 12681766.81, utm_y: 2558630.58, x: 560296, y: 559780 }, { j: 113.919672, w: 22.517839, utm_x: 12681617.86, utm_y: 2557301.57, x: 555296, y: 562549 }, { j: 113.938716, w: 22.505569, utm_x: 12683737.86, utm_y: 2555831.55, x: 557349, y: 571072 }, { j: 113.919203, w: 22.483494, utm_x: 12681565.66, utm_y: 2553187.17, x: 540853, y: 572118 }, { j: 113.942875, w: 22.492046, utm_x: 12684200.84, utm_y: 2554211.57, x: 553296, y: 575994 }, { j: 113.9567, w: 22.530183, utm_x: 12685739.85, utm_y: 2558780.59, x: 573378, y: 568442 }, { j: 113.989102, w: 22.52697, utm_x: 12689346.86, utm_y: 2558395.61, x: 584796, y: 578728 }, { j: 114.015467, w: 22.533746, utm_x: 12692281.83, utm_y: 2559207.53, x: 597126, y: 584075 }, { j: 113.972977, w: 22.55702, utm_x: 12687551.81, utm_y: 2561996.58, x: 591204, y: 565924 }, { j: 113.990368, w: 22.561133, utm_x: 12689487.79, utm_y: 2562489.51, x: 599240, y: 569528 }, { j: 114.143745, w: 22.580535, utm_x: 12706561.83, utm_y: 2564815, x: 663830, y: 605622 }, { j: 114.150374, w: 22.557704, utm_x: 12707299.77, utm_y: 2562078.56, x: 657016, y: 613828 }, { j: 114.106905, w: 22.541858, utm_x: 12702460.77, utm_y: 2560179.58, x: 634284, y: 606528 }, { j: 114.083927, w: 22.535065, utm_x: 12699902.85, utm_y: 2559365.58, x: 623132, y: 602096 }, { j: 114.049584, w: 22.517997, utm_x: 12696079.76, utm_y: 2557320.5, x: 603390, y: 597564 }, { j: 114.056304, w: 22.542425, utm_x: 12696827.84, utm_y: 2560247.52, x: 615980, y: 592534 }, { j: 114.051552, w: 22.551321, utm_x: 12696298.84, utm_y: 2561313.59, x: 617887, y: 588719 }, { j: 114.096377, w: 22.559064, utm_x: 12701288.79, utm_y: 2562241.55, x: 637568, y: 598739 }, { j: 114.135858, w: 22.575851, utm_x: 12705683.84, utm_y: 2564253.55, x: 659024, y: 604806 }, { j: 114.092029, w: 22.575592, utm_x: 12700804.77, utm_y: 2564222.51, x: 642776, y: 592932 }, { j: 114.054795, w: 22.570617, utm_x: 12696659.85, utm_y: 2563626.21, x: 626988, y: 584142 }, { j: 114.03075, w: 22.553687, utm_x: 12693983.15, utm_y: 2561597.14, x: 611068, y: 582552 }, { j: 114.074153, w: 22.554124, utm_x: 12698814.8, utm_y: 2561649.51, x: 627380, y: 594008 }, { j: 113.926721, w: 22.546028, utm_x: 12682402.56, utm_y: 2560679.29, x: 569340, y: 556468 }, { j: 113.938125, w: 22.538296, utm_x: 12683672.07, utm_y: 2559752.74, x: 570548, y: 561748 }], gz: [{ j: 113.335098, w: 23.147289, utm_x: 12616542.68, utm_y: 2632892.7, x: 1129109, y: 1073920 }, { j: 113.320932, w: 23.146956, utm_x: 12614965.71, utm_y: 2632852.62, x: 1125620, y: 1071640 }, { j: 113.321435, w: 23.140119, utm_x: 12615021.7, utm_y: 2632029.65, x: 1124032, y: 1072882 }, { j: 113.321471, w: 23.119165, utm_x: 12615025.71, utm_y: 2629507.68, x: 1118932, y: 1076530 }, { j: 113.340201, w: 23.118616, utm_x: 12617110.75, utm_y: 2629441.61, x: 1123238, y: 1079667 }, { j: 113.358068, w: 23.116323, utm_x: 12619099.71, utm_y: 2629165.66, x: 1126968, y: 1083116 }, { j: 113.357529, w: 23.131271, utm_x: 12619039.71, utm_y: 2630964.68, x: 1130508, y: 1080440 }, { j: 113.365811, w: 23.150595, utm_x: 12619961.67, utm_y: 2633290.66, x: 1137205, y: 1078567 }, { j: 113.294145, w: 23.118467, utm_x: 12611983.76, utm_y: 2629423.68, x: 1112245, y: 1072043 }, { j: 113.28615, w: 23.121525, utm_x: 12611093.75, utm_y: 2629791.7, x: 1110993, y: 1070197 }, { j: 113.307152, w: 23.055497, utm_x: 12613431.71, utm_y: 2621847.21, x: 1100144, y: 1085123 }, { j: 113.333445, w: 23.052687, utm_x: 12616358.66, utm_y: 2621509.2, x: 1105784, y: 1089948 }, { j: 113.347476, w: 23.048755, utm_x: 12617920.6, utm_y: 2621036.24, x: 1108099, y: 1093064 }, { j: 113.385774, w: 23.036574, utm_x: 12622183.96, utm_y: 2619571.12, x: 1113850, y: 1101834 }, { j: 113.364185, w: 22.89798, utm_x: 12619780.66, utm_y: 2602910.64, x: 1073186, y: 1123374 }, { j: 113.404577, w: 22.906481, utm_x: 12624277.13, utm_y: 2603932.06, x: 1084888, y: 1128692 }, { j: 113.430856, w: 22.913156, utm_x: 12627202.52, utm_y: 2604734.12, x: 1092892, y: 1131761 }, { j: 113.384554, w: 22.933021, utm_x: 12622048.15, utm_y: 2607121.32, x: 1086975, y: 1120403 }, { j: 113.263566, w: 23.146333, utm_x: 12608579.68, utm_y: 2632777.63, x: 1111742, y: 1062098 }, { j: 113.239213, w: 23.152996, utm_x: 12605868.69, utm_y: 2633579.69, x: 1107616, y: 1056740 }, { j: 113.253865, w: 23.131628, utm_x: 12607499.76, utm_y: 2631007.65, x: 1105912, y: 1062966 }, { j: 113.240767, w: 23.088434, utm_x: 12606041.68, utm_y: 2625809.7, x: 1092270, y: 1068184 }, { j: 113.279628, w: 23.088284, utm_x: 12610367.72, utm_y: 2625791.65, x: 1101412, y: 1074883 }, { j: 113.462271, w: 23.107058, utm_x: 12630699.66, utm_y: 2628050.7, x: 1148752, y: 1101736 }, { j: 113.401618, w: 23.052957, utm_x: 12623947.73, utm_y: 2621541.68, x: 1121925, y: 1101535 }, { j: 113.422504, w: 23.05905, utm_x: 12626272.77, utm_y: 2622274.61, x: 1128470, y: 1104049 }, { j: 113.362506, w: 23.107149, utm_x: 12619593.75, utm_y: 2628061.65, x: 1125835, y: 1085505 }, { j: 113.419629, w: 23.143176, utm_x: 12625952.73, utm_y: 2632397.61, x: 1148133, y: 1089052 }, { j: 113.23315, w: 23.062251, utm_x: 12605193.75, utm_y: 2622659.67, x: 1084184, y: 1071368 }, { j: 113.314525, w: 23.101412, utm_x: 12614252.48, utm_y: 2627371.29, x: 1113011, y: 1078426 }, { j: 113.307947, w: 23.131369, utm_x: 12613520.21, utm_y: 2630976.47, x: 1118622, y: 1072198 }], sh: [{ j: 121.524411, w: 31.245875, utm_x: 13528182.75, utm_y: 3642354.51, x: 1086581, y: 1065728 }, { j: 121.419229, w: 31.244887, utm_x: 13516473.81, utm_y: 3642226.51, x: 1032616, y: 1029148 }, { j: 121.405637, w: 31.237871, utm_x: 13514960.74, utm_y: 3641317.54, x: 1022724, y: 1027244 }, { j: 121.415348, w: 31.222879, utm_x: 13516041.78, utm_y: 3639375.47, x: 1018548, y: 1036980 }, { j: 121.422561, w: 31.224261, utm_x: 13516844.73, utm_y: 3639554.48, x: 1022976, y: 1038908 }, { j: 121.412581, w: 31.204148, utm_x: 13515733.75, utm_y: 3636949.48, x: 1006568, y: 1043696 }, { j: 121.443025, w: 31.206202, utm_x: 13519122.8, utm_y: 3637215.49, x: 1022656, y: 1053704 }, { j: 121.524061, w: 31.246917, utm_x: 13528143.79, utm_y: 3642489.52, x: 1082052, y: 1064124 }, { j: 121.529343, w: 31.217769, utm_x: 13528731.78, utm_y: 3638713.59, x: 1072696, y: 1079064 }, { j: 121.530268, w: 31.210341, utm_x: 13528834.75, utm_y: 3637751.53, x: 1068748, y: 1082416 }, { j: 121.511601, w: 31.227303, utm_x: 13526756.73, utm_y: 3639948.53, x: 1069276, y: 1068716 }, { j: 121.4966, w: 31.243614, utm_x: 13525086.81, utm_y: 3642061.58, x: 1071220, y: 1056805 }, { j: 121.485021, w: 31.26138, utm_x: 13523797.82, utm_y: 3644363.54, x: 1075708, y: 1045540 }, { j: 121.465114, w: 31.278803, utm_x: 13521581.76, utm_y: 3646621.48, x: 1073740, y: 1031268 }, { j: 121.454784, w: 31.266566, utm_x: 13520431.82, utm_y: 3645035.58, x: 1063591, y: 1033191 }, { j: 121.46851, w: 31.24951, utm_x: 13521959.81, utm_y: 3642825.48, x: 1060200, y: 1044520 }, { j: 121.446384, w: 31.248422, utm_x: 13519496.73, utm_y: 3642684.51, x: 1048784, y: 1037750 }, { j: 121.509499, w: 31.246469, utm_x: 13526522.73, utm_y: 3642431.47, x: 1079309, y: 1060105 }, { j: 121.481643, w: 31.283943, utm_x: 13523421.78, utm_y: 3647287.68, x: 1087096, y: 1035304 }, { j: 121.508054, w: 31.280609, utm_x: 13526361.87, utm_y: 3646855.56, x: 1098432, y: 1045648 }, { j: 121.493854, w: 31.19121, utm_x: 13524781.12, utm_y: 3635274.07, x: 1039624, y: 1077288 }, { j: 121.500079, w: 31.185541, utm_x: 13525474.09, utm_y: 3634540.04, x: 1039960, y: 1081640 }, { j: 121.484482, w: 31.202846, utm_x: 13523737.82, utm_y: 3636780.87, x: 1041388, y: 1069232 }, { j: 121.480877, w: 31.189587, utm_x: 13523336.51, utm_y: 3635063.92, x: 1032484, y: 1073640 }, { j: 121.502652, w: 31.195209, utm_x: 13525760.52, utm_y: 3635791.9, x: 1046384, y: 1078728 }] }, getLnglatIndex: function (cE, cI, cH) { var cD = 0; var cC = 0; var cJ = 10000000, cG = 1000000000; for (var cF = 0; cF < this.correct_pts[cE].length; cF++) { var T = this.getDis(this.correct_pts[cE][cF].x, this.correct_pts[cE][cF].y, cI, cH); if (T < cG) { if (T < cJ) { cG = cJ; cJ = T; cC = cD; cD = cF } else { sedMinDis = T; cC = cF } } } return { lt: cD, rb: cC } }, getOMapIndex_mm: function (cE, cJ, cI) { var cD = 0; var cC = 0; var cH = 1294723000, cG = 1294723000; for (var cF = 0; cF < this.correct_pts[cE].length; cF++) { var T = this.getDis(this.correct_pts[cE][cF].utm_x, this.correct_pts[cE][cF].utm_y, cJ, cI); if (T < cG) { if (T < cH) { cG = cH; cH = T; cC = cD; cD = cF } else { sedMinDis = T; cC = cF } } } return { lt: cD, rb: cC } }, getDis: function (T, cE, cC, cD) { return Math.abs(T - cC) + Math.abs(cE - cD) }, toMap: function (cE, T, cF) { var cC = (T - cF) * this.num[cE].num; var cD = (T + cF) * this.num[cE].num * this.num[cE].num2; return { x: cC, y: cD } }, fromMap: function (cE, T, cF) { cF = cF / this.num[cE].num2; var cC = (T + cF) / (this.num[cE].num * 2); var cD = (cF - T) / (this.num[cE].num * 2); return { x: cC, y: cD } }, getDgPix_mm: function (cF, cK, cG) { var cJ = this.fromMap(cF, this.correct_pts[cF][cK].x, this.correct_pts[cF][cK].y); var cH = this.fromMap(cF, this.correct_pts[cF][cG].x, this.correct_pts[cF][cG].y); var cP = cJ.x, cC = cJ.y; var cO = cH.x, T = cH.y; var cM = this.correct_pts[cF][cK].utm_x, cE = this.correct_pts[cF][cK].utm_y; var cI = this.correct_pts[cF][cG].utm_x, cD = this.correct_pts[cF][cG].utm_y; var cN = Math.abs((cI - cM) * 100000 / (cO - cP)); var cL = Math.abs((cD - cE) * 100000 / (T - cC)); return { j: cN, w: cL, x: 100000 / cN, y: 100000 / cL } }, getPx_mm: function (cS, cO, cN, cF, cE) { var cD = this.correct_pts[cS][cF]; var T = this.correct_pts[cS][cF]; var cL = this.getDgPix_mm(cS, cF, cE); var cH = this.fromMap(cS, cD.x, cD.y); var cG = T.utm_x, cU = T.utm_y; var cT = cO, cM = cN; var cR = cH.x; var cC = cH.y; var cJ = cT - cG, cQ = cM - cU; var cK = cJ * cL.x + cR; var cI = -cQ * cL.y + cC; var cP = this.toMap(cS, cK, cI); return cP }, getJw_mm: function (cQ, cL, cK, cG, cF) { var cJ = this.correct_pts[cQ][cG]; var cC = this.correct_pts[cQ][cG]; var cM = this.getDgPix_mm(cQ, cG, cF); var cO = this.fromMap(cQ, cL, cK); var cE = this.fromMap(cQ, cJ.x, cJ.y); var cH = cC.utm_x, cR = cC.utm_y; var cP = cE.x; var cD = cE.y; var cS = cO.x - cP, cN = cD - cO.y; var cI = cS / cM.x + cH; var T = cN / cM.y + cR; return { lng: cI, lat: T } }, getOMap_pts: function (cC, T) { return this.getOMap_index(cC, T.lng, T.lat, T.lt, T.rb) }, getMapJw_pts: function (cC, T) { return this.getMapJw_index(cC, T.lng, 9998336 - T.lat, T.lt, T.rb) }, getOMap_index: function (cH, cG, cF, T, cE) { if (!T || !cE) { var cC = this.getOMapIndex_mm(cH, cG, cF) } else { var cC = { lt: T, rb: cE } } var cD = this.getPx_mm(cH, cG, cF, cC.lt, cC.rb); return { x: Math.floor(cD.x), y: 9998336 - Math.floor(cD.y), lt: cC.lt, rb: cC.rb } }, getMapJw_index: function (cG, cD, cH, cC, cF) { if (!cC || !cF) { var cE = this.getLnglatIndex(cG, cD, cH) } else { var cE = { lt: cC, rb: cF } } var T = this.getJw_mm(cG, cD, cH, cE.lt, cE.rb); return { lng: T.lng, lat: T.lat, lt: cE.lt, rb: cE.rb } } }); function a3() { } a3.prototype = new a6(); a1.extend(a3, { EARTHRADIUS: 6370996.81, MCBAND: [12890594.86, 8362377.87, 5591021, 3481989.83, 1678043.12, 0], LLBAND: [75, 60, 45, 30, 15, 0], MC2LL: [[1.410526172116255e-8, 0.00000898305509648872, -1.9939833816331, 200.9824383106796, -187.2403703815547, 91.6087516669843, -23.38765649603339, 2.57121317296198, -0.03801003308653, 17337981.2], [-7.435856389565537e-9, 0.000008983055097726239, -0.78625201886289, 96.32687599759846, -1.85204757529826, -59.36935905485877, 47.40033549296737, -16.50741931063887, 2.28786674699375, 10260144.86], [-3.030883460898826e-8, 0.00000898305509983578, 0.30071316287616, 59.74293618442277, 7.357984074871, -25.38371002664745, 13.45380521110908, -3.29883767235584, 0.32710905363475, 6856817.37], [-1.981981304930552e-8, 0.000008983055099779535, 0.03278182852591, 40.31678527705744, 0.65659298677277, -4.44255534477492, 0.85341911805263, 0.12923347998204, -0.04625736007561, 4482777.06], [3.09191371068437e-9, 0.000008983055096812155, 0.00006995724062, 23.10934304144901, -0.00023663490511, -0.6321817810242, -0.00663494467273, 0.03430082397953, -0.00466043876332, 2555164.4], [2.890871144776878e-9, 0.000008983055095805407, -3.068298e-8, 7.47137025468032, -0.00000353937994, -0.02145144861037, -0.00001234426596, 0.00010322952773, -0.00000323890364, 826088.5]], LL2MC: [[-0.0015702102444, 111320.7020616939, 1704480524535203, -10338987376042340, 26112667856603880, -35149669176653700, 26595700718403920, -10725012454188240, 1800819912950474, 82.5], [0.0008277824516172526, 111320.7020463578, 647795574.6671607, -4082003173.641316, 10774905663.51142, -15171875531.51559, 12053065338.62167, -5124939663.577472, 913311935.9512032, 67.5], [0.00337398766765, 111320.7020202162, 4481351.045890365, -23393751.19931662, 79682215.47186455, -115964993.2797253, 97236711.15602145, -43661946.33752821, 8477230.501135234, 52.5], [0.00220636496208, 111320.7020209128, 51751.86112841131, 3796837.749470245, 992013.7397791013, -1221952.21711287, 1340652.697009075, -620943.6990984312, 144416.9293806241, 37.5], [-0.0003441963504368392, 111320.7020576856, 278.2353980772752, 2485758.690035394, 6070.750963243378, 54821.18345352118, 9540.606633304236, -2710.55326746645, 1405.483844121726, 22.5], [-0.0003218135878613132, 111320.7020701615, 0.00369383431289, 823725.6402795718, 0.46104986909093, 2351.343141331292, 1.58060784298199, 8.77738589078284, 0.37238884252424, 7.45]], getDistanceByMC: function (cG, cE) { if (!cG || !cE) { return 0 } var cC, cF, T, cD; cG = this.convertMC2LL(cG); if (!cG) { return 0 } cC = this.toRadians(cG.lng); cF = this.toRadians(cG.lat); cE = this.convertMC2LL(cE); if (!cE) { return 0 } T = this.toRadians(cE.lng); cD = this.toRadians(cE.lat); return this.getDistance(cC, T, cF, cD) }, getDistanceByLL: function (cG, cE) { if (!cG || !cE) { return 0 } cG.lng = this.getLoop(cG.lng, -180, 180); cG.lat = this.getRange(cG.lat, -74, 74); cE.lng = this.getLoop(cE.lng, -180, 180); cE.lat = this.getRange(cE.lat, -74, 74); var cC, T, cF, cD; cC = this.toRadians(cG.lng); cF = this.toRadians(cG.lat); T = this.toRadians(cE.lng); cD = this.toRadians(cE.lat); return this.getDistance(cC, T, cF, cD) }, convertMC2LL: function (cC) { var cD, cF; cD = new b4(Math.abs(cC.lng), Math.abs(cC.lat)); for (var cE = 0; cE < this.MCBAND.length; cE++) { if (cD.lat >= this.MCBAND[cE]) { cF = this.MC2LL[cE]; break } } var T = this.convertor(cC, cF); var cC = new b4(T.lng.toFixed(6), T.lat.toFixed(6)); return cC }, convertLL2MC: function (T) { var cC, cE; T.lng = this.getLoop(T.lng, -180, 180); T.lat = this.getRange(T.lat, -74, 74); cC = new b4(T.lng, T.lat); for (var cD = 0; cD < this.LLBAND.length; cD++) { if (cC.lat >= this.LLBAND[cD]) { cE = this.LL2MC[cD]; break } } if (!cE) { for (var cD = this.LLBAND.length - 1; cD >= 0; cD--) { if (cC.lat <= -this.LLBAND[cD]) { cE = this.LL2MC[cD]; break } } } var cF = this.convertor(T, cE); var T = new b4(cF.lng.toFixed(2), cF.lat.toFixed(2)); return T }, convertor: function (cD, cE) { if (!cD || !cE) { return } var T = cE[0] + cE[1] * Math.abs(cD.lng); var cC = Math.abs(cD.lat) / cE[9]; var cF = cE[2] + cE[3] * cC + cE[4] * cC * cC + cE[5] * cC * cC * cC + cE[6] * cC * cC * cC * cC + cE[7] * cC * cC * cC * cC * cC + cE[8] * cC * cC * cC * cC * cC * cC; T *= (cD.lng < 0 ? -1 : 1); cF *= (cD.lat < 0 ? -1 : 1); return new b4(T, cF) }, getDistance: function (cC, T, cE, cD) { return this.EARTHRADIUS * Math.acos((Math.sin(cE) * Math.sin(cD) + Math.cos(cE) * Math.cos(cD) * Math.cos(T - cC))) }, toRadians: function (T) { return Math.PI * T / 180 }, toDegrees: function (T) { return (180 * T) / Math.PI }, getRange: function (cD, cC, T) { if (cC != null) { cD = Math.max(cD, cC) } if (T != null) { cD = Math.min(cD, T) } return cD }, getLoop: function (cD, cC, T) { while (cD > T) { cD -= T - cC } while (cD < cC) { cD += T - cC } return cD } }); a1.extend(a3.prototype, { lngLatToMercator: function (T) { return a3.convertLL2MC(T) }, lngLatToPoint: function (T) { var cC = a3.convertLL2MC(T); return new bn(cC.lng, cC.lat) }, mercatorToLngLat: function (T) { return a3.convertMC2LL(T) }, pointToLngLat: function (T) { var cC = new b4(T.x, T.y); return a3.convertMC2LL(cC) }, pointToPixel: function (cC, cG, cF, cE, cH) { if (!cC) { return } cC = this.lngLatToMercator(cC, cH); var cD = this.getZoomUnits(cG); var T = Math.round((cC.lng - cF.lng) / cD + cE.width / 2); var cI = Math.round((cF.lat - cC.lat) / cD + cE.height / 2); return new bn(T, cI) }, pixelToPoint: function (T, cJ, cF, cD, cC) { if (!T) { return } var cI = this.getZoomUnits(cJ); var cG = cF.lng + cI * (T.x - cD.width / 2); var cE = cF.lat - cI * (T.y - cD.height / 2); var cH = new b4(cG, cE); return this.mercatorToLngLat(cH, cC) }, getZoomUnits: function (T) { return Math.pow(2, (18 - T)) } }); function cv() { } cv.prototype = new a3(); a1.extend(cv.prototype, { lngLatToMercator: function (cC, T) { return this._convert2DTo3D(T, a3.convertLL2MC(cC)) }, mercatorToLngLat: function (cC, T) { return a3.convertMC2LL(this._convert3DTo2D(T, cC)) }, lngLatToPoint: function (cD, T) { var cC = this._convert2DTo3D(T, a3.convertLL2MC(cD)); return new bn(cC.lng, cC.lat) }, pointToLngLat: function (cC, T) { var cD = new b4(cC.x, cC.y); return a3.convertMC2LL(this._convert3DTo2D(T, cD)) }, _convert2DTo3D: function (cD, T) { var cC = bX.getOMap_pts(cD || "bj", T); return new b4(cC.x, cC.y) }, _convert3DTo2D: function (cD, T) { var cC = bX.getMapJw_pts(cD || "bj", T); return new b4(cC.lng, cC.lat) }, getZoomUnits: function (T) { return Math.pow(2, (20 - T)) } }); function bz() { this._type = "overlay" } a1.lang.inherits(bz, a1.lang.Class, "Overlay"); bz.getZIndex = function (T) { T = T * 1; if (!T) { return 0 } return (T * -100000) << 1 }; a1.extend(bz.prototype, { _i: function (T) { if (!this.domElement && G(this.initialize)) { this.domElement = this.initialize(T); if (this.domElement) { this.domElement.style.WebkitUserSelect = "none" } } this.draw() }, initialize: function (T) { throw "initialize\u65b9\u6cd5\u672a\u5b9e\u73b0" }, draw: function () { throw "draw\u65b9\u6cd5\u672a\u5b9e\u73b0" }, remove: function () { if (this.domElement && this.domElement.parentNode) { this.domElement.parentNode.removeChild(this.domElement) } this.domElement = null; this.dispatchEvent(new a9("onremove")) }, hide: function () { if (this.domElement) { a1.dom.hide(this.domElement) } }, show: function () { if (this.domElement) { a1.dom.show(this.domElement) } }, isVisible: function () { if (!this.domElement) { return false } if (this.domElement.style.display == "none" || this.domElement.style.visibility == "hidden") { return false } return true } }); BMap.register(function (cD) { var T = cD.temp; T.overlayDiv = cD.overlayDiv = cC(cD.platform, 200); cD._panes.floatPane = cC(T.overlayDiv, 800); cD._panes.markerMouseTarget = cC(T.overlayDiv, 700); cD._panes.floatShadow = cC(T.overlayDiv, 600); cD._panes.labelPane = cC(T.overlayDiv, 500); cD._panes.markerPane = cC(T.overlayDiv, 400); cD._panes.markerShadow = cC(T.overlayDiv, 300); cD._panes.mapPane = cC(T.overlayDiv, 200); function cC(cE, cH) { var cG = W("div"), cF = cG.style; cF.position = "absolute"; cF.top = cF.left = cF.width = cF.height = "0"; cF.zIndex = cH; cE.appendChild(cG); return cG } }); function U() { a1.lang.Class.call(this); bz.call(this); this.map = null; this._visible = true; this.infoWindow = null; this._dblclickTime = 0 } a1.lang.inherits(U, bz, "OverlayInternal"); a1.extend(U.prototype, { initialize: function (T) { this.map = T; a1.lang.Class.call(this, this.guid); return null }, getMap: function () { return this.map }, draw: function () { }, remove: function () { this.map = null; a1.lang.decontrol(this.guid); bz.prototype.remove.call(this) }, hide: function () { if (this._visible == false) { return } this._visible = false }, show: function () { if (this._visible == true) { return } this._visible = true }, isVisible: function () { if (!this.domElement) { return false } return !!this._visible }, getContainer: function () { return this.domElement }, setConfig: function (cC) { cC = cC || {}; for (var T in cC) { this._config[T] = cC[T] } }, setZIndex: function (T) { this.zIndex = T }, enableMassClear: function () { this._config.enableMassClear = true }, disableMassClear: function () { this._config.enableMassClear = false }, addContextMenu: function (T) { this._menu = T }, removeContextMenu: function (T) { this._menu = null } }); function cj() { this.map = null; this._overlays = {}; this._customOverlays = [] } BMap.register(function (cC) { var T = new cj(); T.map = cC; cC._overlays = T._overlays; cC._customOverlays = T._customOverlays; cC.addEventListener("load", function (cD) { T.draw(cD) }); cC.addEventListener("moveend", function (cD) { T.draw(cD) }); if (a1.browser.ie && a1.browser.ie < 8 || document.compatMode == "BackCompat") { cC.addEventListener("zoomend", function (cD) { setTimeout(function () { T.draw(cD) }, 20) }) } else { cC.addEventListener("zoomend", function (cD) { T.draw(cD) }) } cC.addEventListener("maptypechange", function (cD) { T.draw(cD) }); cC.addEventListener("addoverlay", function (cH) { var cE = cH.target; if (cE instanceof U) { if (!T._overlays[cE.guid]) { T._overlays[cE.guid] = cE } } else { var cG = false; for (var cF = 0, cD = T._customOverlays.length; cF < cD; cF++) { if (T._customOverlays[cF] === cE) { cG = true; break } } if (!cG) { T._customOverlays.push(cE) } } }); cC.addEventListener("removeoverlay", function (cG) { var cE = cG.target; if (cE instanceof U) { delete T._overlays[cE.guid] } else { for (var cF = 0, cD = T._customOverlays.length; cF < cD; cF++) { if (T._customOverlays[cF] === cE) { T._customOverlays.splice(cF, 1); break } } } }); cC.addEventListener("clearoverlays", function (cG) { this.closeInfoWindow(); for (var cF in T._overlays) { if (T._overlays[cF]._config.enableMassClear) { T._overlays[cF].remove(); delete T._overlays[cF] } } for (var cE = 0, cD = T._customOverlays.length; cE < cD; cE++) { if (T._customOverlays[cE].enableMassClear != false) { T._customOverlays[cE].remove(); T._customOverlays[cE] = null; T._customOverlays.splice(cE, 1); cE--; cD-- } } }); cC.addEventListener("infowindowopen", function (cE) { var cD = this.infoWindow; if (cD) { a1.dom.hide(cD.popDom); a1.dom.hide(cD.shadowDom) } }); cC.addEventListener("movestart", function () { if (this.getInfoWindow()) { this.getInfoWindow()._setOverflow() } }); cC.addEventListener("moveend", function () { if (this.getInfoWindow()) { this.getInfoWindow()._resetOverflow() } }) }); cj.prototype.draw = function (cD) { for (var cC in this._overlays) { this._overlays[cC].draw() } a1.array.each(this._customOverlays, function (cE) { cE.draw() }); if (this.map.temp.infoWin) { this.map.temp.infoWin.setPosition() } if (BMap.DrawerSelector) { var T = BMap.DrawerSelector.getDrawer(this.map); T.setPalette() } }; function cw(T) { U.call(this); this._config = { strokeColor: "#3a6bdb", strokeWeight: 5, strokeOpacity: 0.65, strokeStyle: "solid", enableMassClear: true, getParseTolerance: null, getParseCacheIndex: null, enableEditing: false, mouseOverTolerance: 15, use3DCoords: false, clickable: true }; T = T || {}; this.setConfig(T); if (this._config.strokeWeight <= 0) { this._config.strokeWeight = 5 } if (this._config.strokeOpacity < 0 || this._config.strokeOpacity > 1) { this._config.strokeOpacity = 0.65 } if (this._config.fillOpacity < 0 || this._config.fillOpacity > 1) { this._config.fillOpacity = 0.65 } if (this._config.strokeStyle != "solid" && this._config.strokeStyle != "dashed") { this._config.strokeStyle = "solid" } if (b8(T.enableClicking)) { this._config.clickable = T.enableClicking } this.domElement = null; this._bounds = new BMap.Bounds(0, 0, 0, 0); this._parseCache = []; this.vertexMarkers = []; this._temp = {} } a1.lang.inherits(cw, U, "Graph"); cw.getGraphPoints = function (cC) { var T = []; if (!cC) { return T } if (bV(cC)) { var cD = cC.split(";"); a1.array.each(cD, function (cF) { var cE = cF.split(","); T.push(new b4(cE[0], cE[1])) }) } if (cC.constructor == Array && cC.length > 0) { T = cC } return T }; cw.parseTolerance = [0.09, 0.005, 0.0001, 0.00001]; a1.extend(cw.prototype, { initialize: function (T) { this.map = T; return null }, draw: function () { return; if (!this.domElement) { return } if (this._drawer) { this._drawer.setPath(this.domElement, this._getDisplayPixels(this.points)) } }, setPath: function (T) { this._parseCache.length = 0; this.points = cw.getGraphPoints(T).slice(0); this._calcBounds() }, _calcBounds: function () { if (!this.points) { return } var T = this; T._bounds = new bF(); a1.array.each(this.points, function (cC) { T._bounds.extend(cC) }) }, getPath: function () { return this.points }, setPositionAt: function (cC, T) { if (!T || !this.points[cC]) { return } this._parseCache.length = 0; this.points[cC] = new b4(T.lng, T.lat); this._calcBounds() }, setStrokeColor: function (T) { this._config.strokeColor = T }, getStrokeColor: function () { return this._config.strokeColor }, setStrokeWeight: function (T) { if (T > 0) { this._config.strokeWeight = T } }, getStrokeWeight: function () { return this._config.strokeWeight }, setStrokeOpacity: function (T) { if (!T || T > 1 || T < 0) { return } this._config.strokeOpacity = T }, getStrokeOpacity: function () { return this._config.strokeOpacity }, setFillOpacity: function (T) { if (T > 1 || T < 0) { return } this._config.fillOpacity = T }, getFillOpacity: function () { return this._config.fillOpacity }, setStrokeStyle: function (T) { if (T != "solid" && T != "dashed") { return } this._config.strokeStyle = T }, getStrokeStyle: function () { return this._config.strokeStyle }, setFillColor: function (T) { this._config.fillColor = T || "" }, getFillColor: function () { return this._config.fillColor }, getBounds: function () { return this._bounds }, remove: function () { if (this.map) { this.map.removeEventListener("onmousemove", this._graphMouseEvent) } U.prototype.remove.call(this); this._parseCache.length = 0 }, enableEditing: function () { this._config.enableEditing = true }, disableEditing: function () { this._config.enableEditing = false } }); function l(T) { U.call(this); this.map = null; this.domElement = null; this._config = { width: 0, height: 0, offset: new aB(0, 0), opacity: 1, background: "transparent", lineStroke: 1, lineColor: "#000", lineStyle: "solid", point: null }; this.setConfig(T); this.point = this._config.point } a1.lang.inherits(l, U, "Division"); a1.extend(l.prototype, { _addDom: function () { var T = this._config; var cD = this.content; var cC = ['
'); cC.push(cD); cC.push("
"); this.domElement = an(this.map.getPanes().markerMouseTarget, cC.join("")) }, initialize: function (T) { this.map = T; this._addDom(); if (this.domElement) { a1.on(this.domElement, "mousedown", function (cC) { aJ(cC) }) } return this.domElement }, draw: function () { var T = this.map.pointToOverlayPixel(this._config.point); this._config.offset = new aB(-Math.round(this._config.width / 2) - Math.round(this._config.lineStroke), -Math.round(this._config.height / 2) - Math.round(this._config.lineStroke)); this.domElement.style.left = T.x + this._config.offset.width + "px"; this.domElement.style.top = T.y + this._config.offset.height + "px" }, getPosition: function () { return this._config.point }, _getPixel: function (T) { return this.map.pointToPixel(this.getPosition()) }, setPosition: function (T) { this._config.point = T; this.draw() }, setDimension: function (T, cC) { this._config.width = Math.round(T); this._config.height = Math.round(cC); if (this.domElement) { this.domElement.style.width = this._config.width + "px"; this.domElement.style.height = this._config.height + "px"; this.draw() } } }); function K(cC, cD, cE) { if (!cC || !cD) { return } this.imageUrl = cC; this.size = cD; var T = new aB(Math.floor(cD.width / 2), Math.floor(cD.height / 2)); var cF = { anchor: T, imageOffset: new aB(0, 0) }; cE = cE || {}; a1.extend(cF, cE); this.anchor = cF.anchor; this.imageOffset = cF.imageOffset; this.infoWindowAnchor = cE.infoWindowAnchor || this.anchor; this.printImageUrl = cE.printImageUrl || "" } var bw = K.prototype; bw.setImageUrl = function (T) { if (!T) { return } this.imageUrl = T }; bw.setPrintImageUrl = function (T) { if (!T) { return } this.printImageUrl = T }; bw.setSize = function (T) { if (!T) { return } this.size = new aB(T.width, T.height) }; bw.setAnchor = function (T) { if (!T) { return } this.anchor = new aB(T.width, T.height) }; bw.setImageOffset = function (T) { if (!T) { return } this.imageOffset = new aB(T.width, T.height) }; bw.setInfoWindowAnchor = function (T) { if (!T) { return } this.infoWindowAnchor = new aB(T.width, T.height) }; bw.toString = function () { return "Icon" }; function bH(cD, cC) { a1.lang.Class.call(this); this.content = cD; this.map = null; this._config = { width: 0, height: 0, maxWidth: 600, offset: new aB(0, 0), title: "", maxContent: "", enableMaximize: false, enableAutoPan: true, enableCloseOnClick: true, margin: [10, 10, 40, 10], collisions: [[10, 10], [10, 10], [10, 10], [10, 10]], ifMaxScene: false, onClosing: function () { return true } }; a1.extend(this._config, cC || {}); if (this._config.width != 0) { if (this._config.width < 220) { this._config.width = 220 } if (this._config.width > 730) { this._config.width = 730 } } if (this._config.height != 0) { if (this._config.height < 60) { this._config.height = 60 } if (this._config.height > 650) { this._config.height = 650 } } if (this._config.maxWidth != 0) { if (this._config.maxWidth < 220) { this._config.maxWidth = 220 } if (this._config.maxWidth > 730) { this._config.maxWidth = 730 } } this.isWinMax = false; this.IMG_PATH = b3.imgPath; this.overlay = null; var T = this; cr.load("infowindow", function () { T._draw() }) } a1.lang.inherits(bH, a1.lang.Class, "InfoWindow"); a1.extend(bH.prototype, { setWidth: function (T) { if (!T && T != 0 || isNaN(T) || T < 0) { return } if (T != 0) { if (T < 220) { T = 220 } if (T > 730) { T = 730 } } this._config.width = T }, setHeight: function (T) { if (!T && T != 0 || isNaN(T) || T < 0) { return } if (T != 0) { if (T < 60) { T = 60 } if (T > 650) { T = 650 } } this._config.height = T }, setMaxWidth: function (T) { if (!T && T != 0 || isNaN(T) || T < 0) { return } if (T != 0) { if (T < 220) { T = 220 } if (T > 730) { T = 730 } } this._config.maxWidth = T }, setTitle: function (T) { this._config.title = T }, getTitle: function () { return this._config.title }, setContent: function (T) { this.content = T }, getContent: function () { return this.content }, setMaxContent: function (T) { this._config.maxContent = T + "" }, redraw: function () { }, enableAutoPan: function () { this._config.enableAutoPan = true }, disableAutoPan: function () { this._config.enableAutoPan = false }, enableCloseOnClick: function () { this._config.enableCloseOnClick = true }, disableCloseOnClick: function () { this._config.enableCloseOnClick = false }, enableMaximize: function () { this._config.enableMaximize = true }, disableMaximize: function () { this._config.enableMaximize = false }, show: function () { this._visible = true }, hide: function () { this._visible = false }, close: function () { this.hide() }, maximize: function () { this.isWinMax = true }, restore: function () { this.isWinMax = false }, isVisible: function () { return this.isOpen() }, isOpen: function () { return false }, getPosition: function () { if (this.overlay && this.overlay.getPosition) { return this.overlay.getPosition() } }, getOffset: function () { return this._config.offset } }); bs.prototype.openInfoWindow = function (cE, T) { if (!(cE instanceof bH) || !(T instanceof b4)) { return } var cC = this.temp; if (!cC.marker) { var cD = new K(b3.imgPath + "blank.gif", { width: 1, height: 1 }); cC.marker = new Z(T, { icon: cD, width: 1, height: 1, offset: new aB(0, 0), infoWindowOffset: new aB(0, 0), clickable: false }); cC.marker._fromMap = 1 } else { cC.marker.setPosition(T) } this.addOverlay(cC.marker); cC.marker.openInfoWindow(cE) }; bs.prototype.closeInfoWindow = function () { var T = this.temp.infoWin || this.temp._infoWin; if (T && T.overlay) { T.overlay.closeInfoWindow() } }; U.prototype.openInfoWindow = function (T) { if (this.map) { this.map.closeInfoWindow(); T._visible = true; this.map.temp._infoWin = T; T.overlay = this; a1.lang.Class.call(T, T.guid) } }; U.prototype.closeInfoWindow = function () { if (this.map && this.map.temp._infoWin) { this.map.temp._infoWin._visible = false; a1.lang.decontrol(this.map.temp._infoWin.guid); this.map.temp._infoWin = null } }; function ac(cD, cC) { U.call(this); this.content = cD; this.map = null; this.domElement = null; this._config = { width: 0, offset: new aB(0, 0), styles: { backgroundColor: "#fff", border: "1px solid #f00", padding: "1px", whiteSpace: "nowrap", font: "12px " + b3.fontFamily, zIndex: "80", MozUserSelect: "none" }, position: null, enableMassClear: true, clickable: true }; cC = cC || {}; this.setConfig(cC); if (this._config.width < 0) { this._config.width = 0 } if (b8(cC.enableClicking)) { this._config.clickable = cC.enableClicking } this.point = this._config.position; var T = this; cr.load("marker", function () { T._draw() }) } a1.lang.inherits(ac, U, "Label"); a1.extend(ac.prototype, { getPosition: function () { if (this._marker) { return this._marker.getPosition() } return this.point }, setPosition: function (T) { if (T instanceof b4 && !this.getMarker()) { this.point = this._config.position = new b4(T.lng, T.lat) } }, setContent: function (T) { this.content = T }, setOpacity: function (T) { if (T >= 0 && T <= 1) { this._config.opacity = T } }, setOffset: function (T) { if (!(T instanceof aB)) { return } this._config.offset = new aB(T.width, T.height) }, getOffset: function () { return this._config.offset }, setStyle: function (T) { T = T || {}; this._config.styles = a1.extend(this._config.styles, T) }, setStyles: function (T) { return this.setStyle(T) }, setTitle: function (T) { this._config.title = T || "" }, getTitle: function () { return this._config.title }, setMarker: function (T) { this._marker = T; if (T) { this.point = this._config.position = T.getPosition() } else { this.point = this._config.position = null } }, getMarker: function () { return this._marker || null } }); window.BMAP_ANIMATION_DROP = 1; window.BMAP_ANIMATION_BOUNCE = 2; var ao = new K(b3.imgPath + "marker_red_sprite.png", new aB(19, 25), { anchor: new aB(10, 25), infoWindowAnchor: new aB(10, 0) }); var am = new K(b3.imgPath + "marker_red_sprite.png", new aB(20, 11), { anchor: new aB(6, 11), imageOffset: new aB(-19, -13) }); function Z(T, cD) { U.call(this); cD = cD || {}; this.point = T; this.map = null; this._animation = null; this._config = { offset: new aB(0, 0), icon: ao, shadow: am, title: "", label: null, baseZIndex: 0, clickable: true, zIndexFixed: false, isTop: false, enableMassClear: true, enableDragging: false, raiseOnDrag: false, restrictDraggingArea: false, draggingCursor: b3.draggingCursor }; this.setConfig(cD); if (cD.icon && !cD.shadow) { this._config.shadow = null } if (b8(cD.enableClicking)) { this._config.clickable = cD.enableClicking } var cC = this; cr.load("marker", function () { cC._draw() }) } Z.TOP_ZINDEX = bz.getZIndex(-90) + 1000000; Z.DRAG_ZINDEX = Z.TOP_ZINDEX + 1000000; a1.lang.inherits(Z, U, "Marker"); a1.extend(Z.prototype, { setIcon: function (T) { if (T instanceof K) { this._config.icon = T } }, getIcon: function () { return this._config.icon }, setShadow: function (T) { if (T instanceof K) { this._config.shadow = T } }, getShadow: function () { return this._config.shadow }, setLabel: function (T) { this._config.label = T || null }, getLabel: function () { return this._config.label }, enableDragging: function () { this._config.enableDragging = true }, disableDragging: function () { this._config.enableDragging = false }, getPosition: function () { return this.point }, setPosition: function (T) { if (T instanceof b4) { this.point = new b4(T.lng, T.lat) } }, setTop: function (cC, T) { this._config.isTop = !!cC; if (cC) { this._addi = T || 0 } }, setTitle: function (T) { this._config.title = T + "" }, getTitle: function () { return this._config.title }, setOffset: function (T) { if (T instanceof aB) { this._config.offset = T } }, getOffset: function () { return this._config.offset }, setAnimation: function (T) { this._animation = T } }); function ce(T, cD) { cw.call(this, cD); cD = cD || {}; this._config.fillOpacity = cD.fillOpacity ? cD.fillOpacity : 0.65; if (cD.fillColor == "") { this._config.fillColor = "" } else { this._config.fillColor = cD.fillColor ? cD.fillColor : "#fff" } this.setPath(T); var cC = this; cr.load("poly", function () { cC._draw() }) } a1.lang.inherits(ce, cw, "Polygon"); a1.extend(ce.prototype, { setPath: function (cC, T) { this._userPoints = cw.getGraphPoints(cC).slice(0); var cD = cw.getGraphPoints(cC).slice(0); if (cD.length > 1 && !cD[0].equals(cD[cD.length - 1])) { cD.push(new b4(cD[0].lng, cD[0].lat)) } cw.prototype.setPath.call(this, cD, T) }, setPositionAt: function (cC, T) { if (!this._userPoints[cC]) { return } this._userPoints[cC] = new b4(T.lng, T.lat); this.points[cC] = new b4(T.lng, T.lat); if (cC == 0 && !this.points[0].equals(this.points[this.points.length - 1])) { this.points[this.points.length - 1] = new b4(T.lng, T.lat) } this._calcBounds() }, getPath: function () { var T = this._userPoints; if (T.length == 0) { T = this.points } return T } }); function f(T, cD) { cw.call(this, cD); this.setPath(T); var cC = this; cr.load("poly", function () { cC._draw() }) } a1.lang.inherits(f, cw, "Polyline"); function a(cC, T, cD) { this.point = cC; this.radius = Math.abs(T); ce.call(this, [], cD) } a.parseTolerance = [0.01, 0.0001, 0.00001, 0.000004]; a1.lang.inherits(a, ce, "Circle"); a1.extend(a.prototype, { initialize: function (T) { this.map = T; this.points = this._getPerimeterPoints(this.point, this.radius); this._calcBounds(); return null }, getCenter: function () { return this.point }, setCenter: function (T, cC) { if (!T) { return } this.point = T }, getRadius: function () { return this.radius }, setRadius: function (T) { this.radius = Math.abs(T) }, _getPerimeterPoints: function (T, cJ) { if (!T || !cJ || !this.map) { return [] } var cC = this.map; var cG = T.lng, cE = T.lat; var cQ = []; var cL = cJ / 6378800, cI = (Math.PI / 180) * cE, cO = (Math.PI / 180) * cG; for (var cH = 0; cH < 360; cH += 9) { var cF = (Math.PI / 180) * cH, cM = Math.asin(Math.sin(cI) * Math.cos(cL) + Math.cos(cI) * Math.sin(cL) * Math.cos(cF)), cK = Math.atan2(Math.sin(cF) * Math.sin(cL) * Math.cos(cI), Math.cos(cL) - Math.sin(cI) * Math.sin(cM)), cN = ((cO - cK + Math.PI) % (2 * Math.PI)) - Math.PI, cP = new b4(cN * (180 / Math.PI), cM * (180 / Math.PI)); cQ.push(cP) } var cD = cQ[0]; cQ.push(new b4(cD.lng, cD.lat)); return cQ } }); function bJ(T) { this.map = T; this.mapTypeLayers = []; this.tileLayers = []; this.bufferNumber = 300; this.realBufferNumber = 0; this.mapTiles = {}; this.bufferTiles = {}; this.numLoading = 0; this._mapTypeLayerContainer = this._createDiv(1); this._normalLayerContainer = this._createDiv(2); T.platform.appendChild(this._mapTypeLayerContainer); T.platform.appendChild(this._normalLayerContainer) } BMap.register(function (cC) { var T = new bJ(cC); T.initialize() }); a1.extend(bJ.prototype, { initialize: function () { var T = this, cC = T.map; cC.addEventListener("loadcode", function () { T.loadTiles() }); cC.addEventListener("addtilelayer", function (cD) { T.addTileLayer(cD) }); cC.addEventListener("removetilelayer", function (cD) { T.removeTileLayer(cD) }); cC.addEventListener("setmaptype", function (cD) { T.setMapType(cD) }); cC.addEventListener("zoomstartcode", function (cD) { T._zoom(cD) }) }, loadTiles: function () { var T = this; if (a1.browser.ie) { try { document.execCommand("BackgroundImageCache", false, true) } catch (cC) { } } if (!this.loaded) { T.initMapTypeTiles() } T.moveGridTiles(); if (!this.loaded) { this.loaded = true; cr.load("tile", function () { T._asyncLoadTiles() }) } }, initMapTypeTiles: function () { var cC = this.map.getMapType(); var cD = cC.getTileLayers(); for (var T = 0; T < cD.length; T++) { var cE = new n(); a1.extend(cE, cD[T]); this.mapTypeLayers.push(cE); cE.initialize(this.map, this._mapTypeLayerContainer) } }, _createDiv: function (cC) { var T = W("div"); T.style.position = "absolute"; T.style.left = T.style.top = "0"; T.style.zIndex = cC; return T }, showTile: function (cG, cF, cJ) { var cM = this; cM.centerPos = cF; var cI = this.map.getMapType(); var cD = cM.getTileName(cG, cJ); var cQ = cI.getTileSize(); var cE = (cG[0] * cQ) + cF[0]; var cP = 0; if (cI === BMAP_PERSPECTIVE_MAP && cM.map.getZoom() == 15) { cP = 0.5 } var cC = (cP - 1 - cG[1]) * cQ + cF[1]; var cK = [cE, cC]; var cL = this.mapTiles[cD]; if (cL && cL.img) { bB(cL.img, cK); if (cL.loaded) { this._checkTilesLoaded() } else { cL._addLoadCbk(function () { cM._checkTilesLoaded() }) } return } cL = this.bufferTiles[cD]; if (cL && cL.img) { cJ.tilesDiv.insertBefore(cL.img, cJ.tilesDiv.lastChild); this.mapTiles[cD] = cL; bB(cL.img, cK); if (cL.loaded) { this._checkTilesLoaded() } else { cL._addLoadCbk(function () { cM._checkTilesLoaded() }) } return } var cO = 256 * Math.pow(2, (cI.getMaxZoom() - cG[2])); var cN = new b4(cG[0] * cO, cG[1] * cO); var cH = new bn(cG[0], cG[1]); var T = cJ.getTilesUrl(cH, cG[2]); cL = new bM(this, T, cK, cG, cJ); cL._addLoadCbk(function () { cM._checkTilesLoaded() }); cL._load(); this.mapTiles[cD] = cL }, _checkTilesLoaded: function () { this.numLoading--; var T = this; if (this.numLoading == 0) { if (this._checkLoadedTimer) { clearTimeout(this._checkLoadedTimer); this._checkLoadedTimer = null } this._checkLoadedTimer = setTimeout(function () { if (T.numLoading == 0) { T.map.dispatchEvent(new a9("ontilesloaded")) } T._checkLoadedTimer = null }, 80) } }, getTileName: function (T, cC) { if (this.map.getMapType() === BMAP_PERSPECTIVE_MAP) { return "TILE-" + cC.guid + "-" + this.map.cityCode + "-" + T[0] + "-" + T[1] + "-" + T[2] } else { return "TILE-" + cC.guid + "-" + T[0] + "-" + T[1] + "-" + T[2] } }, hideTile: function (cC) { var T = cC.img; if (T) { H(T); if (w(T)) { T.parentNode.removeChild(T) } } delete this.mapTiles[cC.name]; if (!cC.loaded) { H(T); T = null; cC._callCbks(); cC.img = null; cC.mgr = null } }, moveGridTiles: function () { var c1 = this.mapTypeLayers; var cN = c1.concat(this.tileLayers); var cT = cN.length; for (var cV = 0; cV < cT; cV++) { var cG = cN[cV]; if (cG.baseLayer) { this.tilesDiv = cG.tilesDiv } var c7 = this.map; var c3 = c7.getMapType(); var c8 = c3.getProjection(); var cU = c7.zoomLevel; var cX = c7.mercatorCenter; this.mapCenterPoint = cX; var cL = c3.getZoomUnits(cU); var cO = c3.getZoomFactor(cU); var cM = Math.ceil(cX.lng / cO); var cH = Math.ceil(cX.lat / cO); var cS = c3.getTileSize(); var cF = [cM, cH, (cX.lng - cM * cO) / cO * cS, (cX.lat - cH * cO) / cO * cS]; var c2 = cF[0] - Math.ceil((c7.width / 2 - cF[2]) / cS); var cE = cF[1] - Math.ceil((c7.height / 2 - cF[3]) / cS); var cY = cF[0] + Math.ceil((c7.width / 2 + cF[2]) / cS); var cQ = 0; if (c3 === BMAP_PERSPECTIVE_MAP && c7.getZoom() == 15) { cQ = 1 } var cP = cF[1] + Math.ceil((c7.height / 2 + cF[3]) / cS) + cQ; this.areaCenter = new b4(cX.lng, cX.lat); var cD = this.mapTiles; var cK = -this.areaCenter.lng / cL; var cJ = this.areaCenter.lat / cL; var c5 = [Math.round(cK), Math.round(cJ)]; var cC = c7.getZoom(); for (var c6 in cD) { var c9 = cD[c6]; var c4 = c9.info; if (c4[2] != cC || (c4[2] == cC && (c2 > c4[0] || cY <= c4[0] || cE > c4[1] || cP <= c4[1]))) { this.hideTile(c9) } } var cI = -c7.offsetX + c7.width / 2; var cR = -c7.offsetY + c7.height / 2; cG.tilesDiv.style.left = Math.round(cK + cI) - c5[0] + "px"; cG.tilesDiv.style.top = Math.round(cJ + cR) - c5[1] + "px"; var T = []; for (var c0 = c2; c0 < cY; c0++) { for (var cZ = cE; cZ < cP; cZ++) { T.push([c0, cZ]) } } T.sort((function (da) { return function (db, dc) { return ((0.4 * Math.abs(db[0] - da[0]) + 0.6 * Math.abs(db[1] - da[1])) - (0.4 * Math.abs(dc[0] - da[0]) + 0.6 * Math.abs(dc[1] - da[1]))) } })([cF[0] - 1, cF[1] - 1])); this.numLoading += T.length; for (var c0 = 0, cW = T.length; c0 < cW; c0++) { this.showTile([T[c0][0], T[c0][1], cC], c5, cG) } } return }, addTileLayer: function (cE) { var cD = this; var T = cE.target; for (var cC = 0; cC < cD.tileLayers.length; cC++) { if (cD.tileLayers[cC] == T) { return } } T.initialize(this.map, this._normalLayerContainer); cD.tileLayers.push(T) }, removeTileLayer: function (cF) { var cE = this; var cC = cF.target; for (var cD = 0, T = cE.tileLayers.length; cD < T; cD++) { if (cC == cE.tileLayers[cD]) { cE.tileLayers.splice(cD, 1) } } cC.remove() }, setMapType: function () { var cD = this; var cE = this.mapTypeLayers; for (var cC = 0, T = cE.length; cC < T; cC++) { cE[cC].remove() } delete this.tilesDiv; this.mapTypeLayers = []; this.bufferTiles = this.mapTiles = {}; this.initMapTypeTiles(); this.moveGridTiles() }, _zoom: function () { var T = this; if (T.zoomsDiv) { a1.dom.hide(T.zoomsDiv) } setTimeout(function () { T.moveGridTiles(); T.map.dispatchEvent(new a9("onzoomend")) }, 10) } }); function bM(cI, T, cF, cC, cE) { this.mgr = cI; this.position = cF; this._cbks = []; this.name = cI.getTileName(cC, cE); this.info = cC; this._transparentPng = cE.isTransparentPng(); var cJ = W("img"); cn(cJ); cJ.galleryImg = false; var cH = cJ.style; var cD = cI.map.getMapType(); cH.position = "absolute"; cH.border = "none"; cH.width = cD.getTileSize() + "px"; cH.height = cD.getTileSize() + "px"; cH.left = cF[0] + "px"; cH.top = cF[1] + "px"; this.img = cJ; this.src = T; if (C) { this.img.style.opacity = 0 } var cG = this; this.img.onload = function (cP) { cG.loaded = true; if (!cG.mgr) { return } var cL = cG.mgr; var cK = cL.bufferTiles; if (!cK[cG.name]) { cL.realBufferNumber++; cK[cG.name] = cG } if (cG.img && !w(cG.img)) { if (cE.tilesDiv) { cE.tilesDiv.appendChild(cG.img); if (a1.browser.ie <= 6 && a1.browser.ie > 0 && cG._transparentPng) { cG.img.style.cssText += ';filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + cG.src + '",sizingMethod=scale);' } } } var cN = cL.realBufferNumber - cL.bufferNumber; for (var cO in cK) { if (cN <= 0) { break } if (!cL.mapTiles[cO]) { cK[cO].mgr = null; var cM = cK[cO].img; if (cM && cM.parentNode) { cM.parentNode.removeChild(cM); H(cM) } cM = null; cK[cO].img = null; delete cK[cO]; cL.realBufferNumber--; cN-- } } if (C) { new g({ fps: 20, duration: 200, render: function (cQ) { if (cG.img && cG.img.style) { cG.img.style.opacity = cQ * 1 } }, finish: function () { if (cG.img && cG.img.style) { delete cG.img.style.opacity } } }) } cG._callCbks() }; this.img.onerror = function () { cG._callCbks(); if (!cG.mgr) { return } var cK = cG.mgr; var cL = cK.map.getMapType(); if (cL.getErrorImageUrl()) { cG.error = true; cG.img.src = cL.getErrorImageUrl(); if (cG.img && !w(cG.img)) { cE.tilesDiv.appendChild(cG.img) } } }; cJ = null } bM.prototype._addLoadCbk = function (T) { this._cbks.push(T) }; bM.prototype._load = function () { if (a1.browser.ie > 0 && a1.browser.ie <= 6 && this._transparentPng) { this.img.src = b3.imgPath + "blank.gif" } else { this.img.src = this.src } }; bM.prototype._callCbks = function () { var cC = this; for (var T = 0; T < cC._cbks.length; T++) { cC._cbks[T]() } cC._cbks.length = 0 }; function H(cE) { if (!cE) { return } cE.onload = cE.onerror = null; var cC = cE.attributes, cD, T, cF; if (cC) { T = cC.length; for (cD = 0; cD < T; cD += 1) { cF = cC[cD].name; if (G(cE[cF])) { cE[cF] = null } } } cC = cE.children; if (cC) { T = cC.length; for (cD = 0; cD < T; cD += 1) { H(cE.children[cD]) } } } var C = (!a1.browser.ie || a1.browser.ie > 8); function n(T) { this.opts = T || {}; this.copyright = this.opts.copyright || null; this.transparentPng = this.opts.transparentPng || false; this.baseLayer = this.opts.baseLayer || false; this.zIndex = this.opts.zIndex || 0; this.guid = n._guid++ } n._guid = 0; a1.lang.inherits(n, a1.lang.Class, "TileLayer"); a1.extend(n.prototype, { initialize: function (cD, T) { if (this.baseLayer) { this.zIndex = -100 } this.map = cD; if (!this.tilesDiv) { var cE = W("div"); var cC = cE.style; cC.position = "absolute"; cC.zIndex = this.zIndex; cC.left = Math.ceil(-cD.offsetX + cD.width / 2) + "px"; cC.top = Math.ceil(-cD.offsetY + cD.height / 2) + "px"; T.appendChild(cE); this.tilesDiv = cE } }, remove: function () { if (this.tilesDiv && this.tilesDiv.parentNode) { this.tilesDiv.innerHTML = ""; this.tilesDiv.parentNode.removeChild(this.tilesDiv) } delete this.tilesDiv }, isTransparentPng: function () { return this.transparentPng }, getTilesUrl: function (cC, cD) { var T = ""; if (this.opts.tileUrlTemplate) { T = this.opts.tileUrlTemplate.replace(/\{X\}/, cC.x); T = T.replace(/\{Y\}/, cC.y); T = T.replace(/\{Z\}/, cD) } return T }, getCopyright: function () { return this.copyright }, getMapType: function () { return this.mapType || BMAP_NORMAL_MAP } }); function ax(T) { n.call(this, T); this._opts = {}; T = T || {}; this._opts = a1.object.extend(this._opts, T); if (this._opts.predictDate) { if (this._opts.predictDate.weekday < 1 || this._opts.predictDate.weekday > 7) { this._opts.predictDate = 1 } if (this._opts.predictDate.hour < 0 || this._opts.predictDate.hour > 23) { this._opts.predictDate.hour = 0 } } this._tileUrl = "http://its.map.baidu.com:8002/traffic/" } ax.prototype = new n(); ax.prototype.initialize = function (cC, T) { n.prototype.initialize.call(this, cC, T); this._map = cC }; ax.prototype.isTransparentPng = function () { return true }; ax.prototype.getTilesUrl = function (cH, cC) { var cI = ""; if (this._opts.predictDate) { cI = "HistoryService?day=" + (this._opts.predictDate.weekday - 1) + "&hour=" + this._opts.predictDate.hour + "&t=" + new Date().getTime() + "&" } else { cI = "TrafficTileService?time=" + new Date().getTime() + "&" } var cD = this._map, cJ = cH.x, cE = cH.y, cG = Math.floor(cJ / 200), cF = Math.floor(cE / 200), T = this._tileUrl + cI + "level=" + cC + "&x=" + cJ + "&y=" + cE; return T.replace(/-(\d+)/gi, "M$1") }; function cl(T, cC, cD) { this._name = T; this._layers = cC instanceof n ? [cC] : cC.slice(0); this._opts = { tips: "", labelText: "", minZoom: 1, maxZoom: 19, tileSize: 256, textColor: "black", errorImageUrl: "", projection: new a3() }; if (this._layers.length == 1) { this._layers[0].baseLayer = true } a1.extend(this._opts, cD || {}) } a1.extend(cl.prototype, { getName: function () { return this._name }, getTips: function () { return this._opts.tips }, getLabelText: function () { return this._opts.labelText }, getTileLayer: function () { return this._layers[0] }, getTileLayers: function () { return this._layers }, getTileSize: function () { return this._opts.tileSize }, getMinZoom: function () { return this._opts.minZoom }, getMaxZoom: function () { return this._opts.maxZoom }, getTextColor: function () { return this._opts.textColor }, getProjection: function () { return this._opts.projection }, getErrorImageUrl: function () { return this._opts.errorImageUrl }, getZoomUnits: function (T) { return Math.pow(2, (18 - T)) }, getZoomFactor: function (T) { return this.getZoomUnits(T) * 256 } }); var bY = ["http://shangetu0.map.bdimg.com/it/", "http://shangetu1.map.bdimg.com/it/", "http://shangetu2.map.bdimg.com/it/", "http://shangetu3.map.bdimg.com/it/", "http://shangetu4.map.bdimg.com/it/"]; var i = ["http://online0.map.bdimg.com/tile/", "http://online1.map.bdimg.com/tile/", "http://online2.map.bdimg.com/tile/", "http://online3.map.bdimg.com/tile/", "http://online4.map.bdimg.com/tile/"]; var aN = new n(); aN.getTilesUrl = function (cD, cG) { var cH = cD.x; var cE = cD.y; var T = "20150518"; var cF = "pl"; if (this.map.highResolutionEnabled()) { cF = "ph" } var cC = i[Math.abs(cH + cE) % i.length] + "?qt=tile&x=" + (cH + "").replace(/-/gi, "M") + "&y=" + (cE + "").replace(/-/gi, "M") + "&z=" + cG + "&styles=" + cF + (a1.browser.ie == 6 ? "&color_dep=32&colors=50" : "") + "&udt=" + T; return cC.replace(/-(\d+)/gi, "M$1") }; window.BMAP_NORMAL_MAP = new cl("\u5730\u56fe", aN, { tips: "\u663e\u793a\u666e\u901a\u5730\u56fe" }); var bl = new n(); bl.tileUrls = ["http://d0.map.baidu.com/resource/mappic/", "http://d1.map.baidu.com/resource/mappic/", "http://d2.map.baidu.com/resource/mappic/", "http://d3.map.baidu.com/resource/mappic/"]; bl.getTilesUrl = function (T, cD) { var cF = T.x; var cC = T.y; var cE = Math.pow(2, (20 - cD)) * 256; cC = Math.round((9998336 - cE * (cC)) / cE) - 1; url = this.tileUrls[Math.abs(cF + cC) % this.tileUrls.length] + this.map.currentCity + "/" + this.map.cityCode + "/3/lv" + (21 - cD) + "/" + cF + "," + cC + ".jpg"; return url }; window.BMAP_PERSPECTIVE_MAP = new cl("\u4e09\u7ef4", bl, { tips: "\u663e\u793a\u4e09\u7ef4\u5730\u56fe", minZoom: 15, maxZoom: 20, textColor: "white", projection: new cv() }); BMAP_PERSPECTIVE_MAP.getZoomUnits = function (T) { return Math.pow(2, (20 - T)) }; BMAP_PERSPECTIVE_MAP.getCityName = function (T) { if (!T) { return "" } var cC = b3.cityNames; for (var cD in cC) { if (T.search(cD) > -1) { return cC[cD] } } return "" }; BMAP_PERSPECTIVE_MAP.getCityCode = function (T) { return ({ bj: 2, gz: 1, sz: 14, sh: 4 })[T] }; var bI = new n({ baseLayer: true }); bI.getTilesUrl = function (cC, cE) { var cF = cC.x; var cD = cC.y; var T = bY[Math.abs(cF + cD) % bY.length] + "u=x=" + cF + ";y=" + cD + ";z=" + cE + ";v=009;type=sate&fm=46&udt=20141015"; return T.replace(/-(\d+)/gi, "M$1") }; window.BMAP_SATELLITE_MAP = new cl("\u536b\u661f", bI, { tips: "\u663e\u793a\u536b\u661f\u5f71\u50cf", minZoom: 1, maxZoom: 19, textColor: "white" }); var m = new n({ transparentPng: true }); m.getTilesUrl = function (cE, cG) { var cH = cE.x; var cF = cE.y; var T = "20141015"; var cC = "015"; var cD = i[Math.abs(cH + cF) % i.length] + "?qt=tile&x=" + (cH + "").replace(/-/gi, "M") + "&y=" + (cF + "").replace(/-/gi, "M") + "&z=" + cG + "&styles=sl" + (a1.browser.ie == 6 ? "&color_dep=32&colors=50" : "") + "&v=" + cC + "&udt=" + T; return cD.replace(/-(\d+)/gi, "M$1") }; window.BMAP_HYBRID_MAP = new cl("\u6df7\u5408", [bI, m], { tips: "\u663e\u793a\u5e26\u6709\u8857\u9053\u7684\u536b\u661f\u5f71\u50cf", labelText: "\u8def\u7f51", minZoom: 1, maxZoom: 19, textColor: "white" }); window.BMAP_POI_TYPE_NORMAL = 0; window.BMAP_POI_TYPE_BUSSTOP = 1; window.BMAP_POI_TYPE_BUSLINE = 2; window.BMAP_POI_TYPE_SUBSTOP = 3; window.BMAP_POI_TYPE_SUBLINE = 4; var F = 0; var ba = 1; var aj = {}; function u(cC, T) { a1.lang.Class.call(this); this._loc = {}; this.setLocation(cC); this._opts = { renderOptions: { panel: null, map: null, autoViewport: true }, onSearchComplete: function () { }, onMarkersSet: function () { }, onInfoHtmlSet: function () { }, onResultsHtmlSet: function () { }, onGetBusListComplete: function () { }, onGetBusLineComplete: function () { }, onBusListHtmlSet: function () { }, onBusLineHtmlSet: function () { }, onPolylinesSet: function () { }, reqFrom: "" }; a1.extend(this._opts, T); if (typeof T != "undefined" && typeof T.renderOptions != "undefined" && typeof T.renderOptions.autoViewport != "undefined") { this._opts.renderOptions.autoViewport = T.renderOptions.autoViewport } else { this._opts.renderOptions.autoViewport = true } this._opts.renderOptions.panel = a1.G(this._opts.renderOptions.panel) } a1.inherits(u, a1.lang.Class); a1.extend(u.prototype, { getResults: function () { if (!this._isMultiKey) { return this._results } else { return this._arrResults } }, enableAutoViewport: function () { this._opts.renderOptions.autoViewport = true }, disableAutoViewport: function () { this._opts.renderOptions.autoViewport = false }, setLocation: function (T) { if (!T) { return } this._loc.src = T }, setSearchCompleteCallback: function (T) { this._opts.onSearchComplete = T || function () { } }, setMarkersSetCallback: function (T) { this._opts.onMarkersSet = T || function () { } }, setPolylinesSetCallback: function (T) { this._opts.onPolylinesSet = T || function () { } }, setInfoHtmlSetCallback: function (T) { this._opts.onInfoHtmlSet = T || function () { } }, setResultsHtmlSetCallback: function (T) { this._opts.onResultsHtmlSet = T || function () { } }, getStatus: function () { return this._status } }); var a4 = { REQ_BASE_URL: "http://api.map.baidu.com/", request: function (cC, cI, T, cH) { var cD = (Math.random() * 100000).toFixed(0); BMap._rd["_cbk" + cD] = function (cJ) { T = T || {}; cC && cC(cJ, T); delete BMap._rd["_cbk" + cD] }; cH = cH || ""; var cF; if (T && T.useEncodeURI) { cF = M(cI, encodeURI) } else { cF = M(cI, encodeURIComponent) } var cG = this, cE = cG.REQ_BASE_URL + cH + "?" + cF + "&ie=utf-8&oue=1&res=api&callback=BMap._rd._cbk" + cD; co.request(cE) } }; BMap._rd = {}; var P = {}; P.removeHtml = function (T) { return T.replace(/<\/?b>/g, "") }; P.parseGeoExtReg1 = function (T) { return T.replace(/([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0|[1-9]\d*),([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0|[1-9]\d*)(,)/g, "$1,$2;") }; P.parseGeoExtReg2 = function (cC, T) { var cD = new RegExp("(((-?\\d+)(\\.\\d+)?),((-?\\d+)(\\.\\d+)?);)(((-?\\d+)(\\.\\d+)?),((-?\\d+)(\\.\\d+)?);){" + T + "}", "ig"); return cC.replace(cD, "$1") }; window.BMAP_STATUS_SUCCESS = 0; window.BMAP_STATUS_CITY_LIST = 1; window.BMAP_STATUS_UNKNOWN_LOCATION = 2; window.BMAP_STATUS_UNKNOWN_ROUTE = 3; window.BMAP_STATUS_INVALID_KEY = 4; window.BMAP_STATUS_INVALID_REQUEST = 5; window.BMAP_STATUS_PERMISSION_DENIED = 6; window.BMAP_STATUS_SERVICE_UNAVAILABLE = 7; window.BMAP_STATUS_TIMEOUT = 8; window.BMAP_ROUTE_TYPE_WALKING = 2; window.BMAP_ROUTE_TYPE_DRIVING = 3; var cm = "cur"; var c = "cen"; var ca = "s"; var N = "con"; var ah = "bd"; var b2 = "nb"; var D = "bt"; var bE = "nav"; var bo = "walk"; var bt = "gc"; var d = "rgc"; var Q = "dec"; var aK = "bse"; var e = "nse"; var E = "bl"; var a8 = "bsl"; var aA = "bda"; var ae = "sa"; var aU = "nba"; var b9 = "drag"; var p = 2; var aY = 4; var bm = 7; var S = 11; var aH = 12; var bb = 14; var aV = 15; var cp = 18; var s = 20; var O = 21; var al = 26; var bx = 28; var x = 31; var bj = 35; var bv = 44; var ar = 45; var aa = 46; var bK = 47; var aT = -1; var X = 0; var ch = 1; var aZ = 2; var z = 3; var cz = "http://map.baidu.com/"; var v = "http://api.map.baidu.com/"; BMap.I = window.Instance = a1.lang.instance; var aX = function (cD, cC) { u.call(this, cD, cC); cC = cC || {}; cC.renderOptions = cC.renderOptions || {}; this.setPageCapacity(cC.pageCapacity); if (typeof cC.renderOptions.selectFirstResult != "undefined" && !cC.renderOptions.selectFirstResult) { this.disableFirstResultSelection() } else { this.enableFirstResultSelection() } this._overlays = []; this._arrPois = []; this._curIndex = -1; this._queryList = []; var T = this; cr.load("local", function () { T._check() }) }; a1.inherits(aX, u, "LocalSearch"); aX.DEFAULT_PAGE_CAPACITY = 10; aX.MIN_PAGE_CAPACITY = 1; aX.MAX_PAGE_CAPACITY = 100; aX.DEFAULT_RADIUS = 2000; aX.MAX_RADIUS = 100000; a1.extend(aX.prototype, { search: function (T) { this._queryList.push({ method: "search", arguments: [T] }) }, searchInBounds: function (T, cC) { this._queryList.push({ method: "searchInBounds", arguments: [T, cC] }) }, searchNearby: function (cD, cC, T) { this._queryList.push({ method: "searchNearby", arguments: [cD, cC, T] }) }, clearResults: function () { delete this._json; delete this._status; delete this._results; delete this._ud; this._curIndex = -1; this._setStatus(); if (this._opts.renderOptions.panel) { this._opts.renderOptions.panel.innerHTML = "" } }, gotoPage: function () { }, enableFirstResultSelection: function () { this._opts.renderOptions.selectFirstResult = true }, disableFirstResultSelection: function () { this._opts.renderOptions.selectFirstResult = false }, setPageCapacity: function (T) { if (typeof T == "number" && !isNaN(T)) { this._opts.pageCapacity = T < 1 ? aX.DEFAULT_PAGE_CAPACITY : (T > aX.MAX_PAGE_CAPACITY ? aX.DEFAULT_PAGE_CAPACITY : T) } else { this._opts.pageCapacity = aX.DEFAULT_PAGE_CAPACITY } }, getPageCapacity: function () { return this._opts.pageCapacity }, toString: function () { return "LocalSearch" } }); var bW = function (cC, T) { u.call(this, cC, T) }; a1.inherits(bW, u, "BaseRoute"); a1.extend(bW.prototype, { clearResults: function () { } }); window.BMAP_TRANSIT_POLICY_LEAST_TIME = 0; window.BMAP_TRANSIT_POLICY_LEAST_TRANSFER = 2; window.BMAP_TRANSIT_POLICY_LEAST_WALKING = 3; window.BMAP_TRANSIT_POLICY_AVOID_SUBWAYS = 4; window.BMAP_LINE_TYPE_BUS = 0; window.BMAP_LINE_TYPE_SUBWAY = 1; window.BMAP_LINE_TYPE_FERRY = 2; function aO(cD, cC) { bW.call(this, cD, cC); cC = cC || {}; this.setPolicy(cC.policy); this.setPageCapacity(cC.pageCapacity); this.QUERY_TYPE = D; this.RETURN_TYPE = bb; this.ROUTE_TYPE = ba; this._overlays = []; this._curIndex = -1; this._queryList = []; var T = this; cr.load("route", function () { T._asyncSearch() }) } aO.MAX_PAGE_CAPACITY = 100; aO.LINE_TYPE_MAPPING = [0, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 1, 1]; a1.inherits(aO, bW, "TransitRoute"); a1.extend(aO.prototype, { setPolicy: function (T) { if (T >= BMAP_TRANSIT_POLICY_LEAST_TIME && T <= BMAP_TRANSIT_POLICY_AVOID_SUBWAYS) { this._opts.policy = T } else { this._opts.policy = BMAP_TRANSIT_POLICY_LEAST_TIME } }, _internalSearch: function (cC, T) { this._queryList.push({ method: "_internalSearch", arguments: [cC, T] }) }, search: function (cC, T) { this._queryList.push({ method: "search", arguments: [cC, T] }) }, setPageCapacity: function (T) { if (typeof T == "string") { T = parseInt(T); if (isNaN(T)) { this._opts.pageCapacity = aO.MAX_PAGE_CAPACITY; return } } if (typeof T != "number") { this._opts.pageCapacity = aO.MAX_PAGE_CAPACITY; return } if (T >= 1 && T <= aO.MAX_PAGE_CAPACITY) { this._opts.pageCapacity = Math.round(T) } else { this._opts.pageCapacity = aO.MAX_PAGE_CAPACITY } }, toString: function () { return "TransitRoute" }, _shortTitle: function (T) { return T.replace(/\(.*\)/, "") } }); window.BMAP_HIGHLIGHT_STEP = 1; window.BMAP_HIGHLIGHT_ROUTE = 2; var be = function (T, cE) { bW.call(this, T, cE); this._overlays = []; this._curIndex = -1; this._queryList = []; var cD = this; var cC = this._opts.renderOptions; if (cC.highlightMode != BMAP_HIGHLIGHT_STEP && cC.highlightMode != BMAP_HIGHLIGHT_ROUTE) { cC.highlightMode = BMAP_HIGHLIGHT_STEP } this._enableDragging = this._opts.renderOptions.enableDragging ? true : false; cr.load("route", function () { cD._asyncSearch() }) }; be.ROAD_TYPE = ["", "\u73af\u5c9b", "\u65e0\u5c5e\u6027\u9053\u8def", "\u4e3b\u8def", "\u9ad8\u901f\u8fde\u63a5\u8def", "\u4ea4\u53c9\u70b9\u5185\u8def\u6bb5", "\u8fde\u63a5\u9053\u8def", "\u505c\u8f66\u573a\u5185\u90e8\u9053\u8def", "\u670d\u52a1\u533a\u5185\u90e8\u9053\u8def", "\u6865", "\u6b65\u884c\u8857", "\u8f85\u8def", "\u531d\u9053", "\u5168\u5c01\u95ed\u9053\u8def", "\u672a\u5b9a\u4e49\u4ea4\u901a\u533a\u57df", "POI\u8fde\u63a5\u8def", "\u96a7\u9053", "\u6b65\u884c\u9053", "\u516c\u4ea4\u4e13\u7528\u9053", "\u63d0\u524d\u53f3\u8f6c\u9053"]; a1.inherits(be, bW, "DWRoute"); a1.extend(be.prototype, { search: function (cC, T) { this._queryList.push({ method: "search", arguments: [cC, T] }) } }); window.BMAP_DRIVING_POLICY_LEAST_TIME = 0; window.BMAP_DRIVING_POLICY_LEAST_DISTANCE = 1; window.BMAP_DRIVING_POLICY_AVOID_HIGHWAYS = 2; function o(T, cC) { be.call(this, T, cC); cC = cC || {}; this.setPolicy(cC.policy); this.QUERY_TYPE = bE; this.RETURN_TYPE = s; this.ROUTE_TYPE = BMAP_ROUTE_TYPE_DRIVING } a1.inherits(o, be, "DrivingRoute"); a1.extend(o.prototype, { setPolicy: function (T) { if (T >= BMAP_DRIVING_POLICY_LEAST_TIME && T <= BMAP_DRIVING_POLICY_AVOID_HIGHWAYS) { this._opts.policy = T } else { this._opts.policy = BMAP_DRIVING_POLICY_LEAST_TIME } } }); function cu(T, cC) { be.call(this, T, cC); this.QUERY_TYPE = bo; this.RETURN_TYPE = x; this.ROUTE_TYPE = BMAP_ROUTE_TYPE_WALKING; this._enableDragging = false } a1.inherits(cu, be, "WalkingRoute"); function aR(cC) { this._opts = {}; a1.extend(this._opts, cC); this._queryList = []; var T = this; cr.load("othersearch", function () { T._asyncSearch() }) } a1.inherits(aR, a1.lang.Class, "Geocoder"); a1.extend(aR.prototype, { getPoint: function (T, cD, cC) { this._queryList.push({ method: "getPoint", arguments: [T, cD, cC] }) }, getLocation: function (T, cD, cC) { this._queryList.push({ method: "getLocation", arguments: [T, cD, cC] }) }, toString: function () { return "Geocoder" } }); function ag(cC) { this._opts = {}; a1.extend(this._opts, cC); this._queryList = []; var T = this; cr.load("othersearch", function () { T._asyncSearch() }) } a1.extend(ag.prototype, { getCurrentPosition: function (cC, T) { this._queryList.push({ method: "getCurrentPosition", arguments: [cC, T] }) }, getStatus: function () { return this._status } }); function b0(cC) { this._opts = { renderOptions: { map: null } }; a1.extend(this._opts, cC); this._queryList = []; var T = this; cr.load("othersearch", function () { T._asyncSearch() }) } a1.inherits(b0, a1.lang.Class, "LocalCity"); a1.extend(b0.prototype, { get: function (T) { this._queryList.push({ method: "get", arguments: [T] }) }, toString: function () { return "LocalCity" } }); function bf(cD, cC) { u.call(this, cD, cC); this.QUERY_TYPE_BUSLIST = E; this.RETURN_TYPE_BUSLIST = aV; this.QUERY_TYPE_BUSLINE = a8; this.RETURN_TYPE_BUSLINE = cp; this._queryList = []; var T = this; cr.load("buslinesearch", function () { T._asyncSearch() }) } bf._iconOpen = b3.imgPath + "iw_plus.gif"; bf._iconClose = b3.imgPath + "iw_minus.gif"; bf._stopUrl = b3.imgPath + "stop_icon.png"; a1.inherits(bf, u); a1.extend(bf.prototype, { getBusList: function (T) { this._queryList.push({ method: "getBusList", arguments: [T] }) }, getBusLine: function (T) { this._queryList.push({ method: "getBusLine", arguments: [T] }) }, setGetBusListCompleteCallback: function (T) { this._opts.onGetBusListComplete = T || function () { } }, setGetBusLineCompleteCallback: function (T) { this._opts.onGetBusLineComplete = T || function () { } }, setBusListHtmlSetCallback: function (T) { this._opts.onBusListHtmlSet = T || function () { } }, setBusLineHtmlSetCallback: function (T) { this._opts.onBusLineHtmlSet = T || function () { } }, setPolylinesSetCallback: function (T) { this._opts.onPolylinesSet = T || function () { } } }); function br(cC) { u.call(this, cC); cC = cC || {}; this._options = { input: null, types: [], onSearchComplete: function () { } }; a1.extend(this._options, cC); this._loc.src = cC.location || "\u5168\u56fd"; this._word = ""; this._show = false; this._suggestion = null; _addStat(5011); var T = this; cr.load("autocomplete", function () { T._asyncSearch() }) } a1.inherits(br, u, "Autocomplete"); a1.extend(br.prototype, { show: function () { this._show = true }, hide: function () { this._show = false }, setTypes: function (T) { this._options.types = T }, setLocation: function (T) { this._loc.src = T }, search: function (T) { this._word = T } }); function af(T, cC) { window.BMap[T] = cC } af("Map", bs); af("Hotspot", cd); af("MapType", cl); af("Point", b4); af("Pixel", bn); af("Size", aB); af("Bounds", bF); af("TileLayer", n); af("Projection", a6); af("MercatorProjection", a3); af("PerspectiveProjection", cv); af("Copyright", ap); af("Overlay", bz); af("Label", ac); af("Marker", Z); af("Icon", K); af("Polyline", f); af("Polygon", ce); af("InfoWindow", bH); af("Circle", a); af("Control", cg); af("NavigationControl", J); af("OverviewMapControl", cB); af("CopyrightControl", ai); af("ScaleControl", bC); af("MapTypeControl", aF); af("TrafficLayer", ax); af("ContextMenu", cq); af("MenuItem", a7); af("LocalSearch", aX); af("TransitRoute", aO); af("DrivingRoute", o); af("WalkingRoute", cu); af("Autocomplete", br); af("Geocoder", aR); af("LocalCity", b0); af("Geolocation", ag); af("BusLineSearch", bf); window.BMap.apiLoad(); })(); ================================================ FILE: BMap.NET.WindowsForm/DrawingObjects/BCircle.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; namespace BMap.NET.WindowsForm.DrawingObjects { /// /// 绘制椭圆类 /// public class BCircle : DrawingObject { /// /// 椭圆中心 /// public LatLngPoint Center { get; set; } /// /// 椭圆矩形任意一角坐标 /// public LatLngPoint RightBottom { get; set; } /// /// 绘制方法 /// /// 画布 /// 地图中心 /// 地图缩放级别 /// 地图大小 public override void Draw(System.Drawing.Graphics g, LatLngPoint center, int zoom, System.Drawing.Size screen_size) { g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; Point theScreenCenter = MapHelper.GetScreenLocationByLatLng(Center, center, zoom, screen_size); //椭圆中心点的屏幕坐标 Point theScreenRightBottom = MapHelper.GetScreenLocationByLatLng(RightBottom, center, zoom, screen_size); //椭圆矩形任意一角的屏幕坐标 int width = Math.Abs(2 * (theScreenRightBottom.X - theScreenCenter.X)); int height = Math.Abs(2 * (theScreenRightBottom.Y - theScreenCenter.Y)); if (new Rectangle(new Point(0,0), screen_size).IntersectsWith(new Rectangle(theScreenCenter.X - width/2, theScreenCenter.Y - height/2, width, height))) //需要绘制 { using (SolidBrush sb = new SolidBrush(Color.FromArgb(30, Color.Blue))) { g.FillEllipse(sb, new Rectangle(theScreenCenter.X - width / 2, theScreenCenter.Y - height / 2, width, height)); } using (Pen pen = new Pen(Color.FromArgb(150,Color.Blue), 4)) { g.DrawEllipse(pen, new Rectangle(theScreenCenter.X - width / 2, theScreenCenter.Y - height / 2, width, height)); } } } } } ================================================ FILE: BMap.NET.WindowsForm/DrawingObjects/BDownloadRectangle.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; namespace BMap.NET.WindowsForm.DrawingObjects { public class BDownloadRectangle : DrawingObject { /// /// 左上角屏幕坐标 /// public Point LeftTop { get; set; } /// /// 矩形宽 像素 /// public int Width { get; set; } /// /// 矩形高 像素 /// public int Height { set; get; } /// /// 表示屏幕区域 /// public Rectangle Rect { get { return new Rectangle(LeftTop, new Size(Width, Height)); } } /// /// 绘制方法 /// /// /// /// /// public override void Draw(Graphics g, LatLngPoint center, int zoom, Size screen_size) { g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; using (SolidBrush sb = new SolidBrush(Color.FromArgb(100, Color.White))) { g.FillRectangle(sb, new Rectangle(LeftTop, new Size(Width, Height))); } using (Pen pen = new Pen(Color.Green)) { g.DrawRectangle(pen, new Rectangle(LeftTop, new Size(Width, Height))); } using (SolidBrush sb = new SolidBrush(Color.Green)) { //移动柄 g.FillRectangle(sb, new Rectangle(new Point(LeftTop.X - 3, LeftTop.Y - 3), new Size(6, 6))); g.FillRectangle(sb, new Rectangle(new Point(LeftTop.X - 3 + Width / 2, LeftTop.Y - 3), new Size(6, 6))); g.FillRectangle(sb, new Rectangle(new Point(LeftTop.X - 3 + Width, LeftTop.Y - 3), new Size(6, 6))); g.FillRectangle(sb, new Rectangle(new Point(LeftTop.X - 3 + Width, LeftTop.Y - 3 + Height / 2), new Size(6, 6))); g.FillRectangle(sb, new Rectangle(new Point(LeftTop.X - 3 + Width, LeftTop.Y - 3 + Height), new Size(6, 6))); g.FillRectangle(sb, new Rectangle(new Point(LeftTop.X - 3 + Width / 2, LeftTop.Y - 3 + Height), new Size(6, 6))); g.FillRectangle(sb, new Rectangle(new Point(LeftTop.X - 3, LeftTop.Y - 3 + Height), new Size(6, 6))); g.FillRectangle(sb, new Rectangle(new Point(LeftTop.X - 3, LeftTop.Y - 3 + Height / 2), new Size(6, 6))); } } } } ================================================ FILE: BMap.NET.WindowsForm/DrawingObjects/BLine.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; namespace BMap.NET.WindowsForm.DrawingObjects { /// /// 绘制直(折)线类 /// public class BLine : DrawingObject { /// /// 点集 /// public List Points { get; set; } /// /// 更新最后一点 /// /// public void UpdateTheEnd(LatLngPoint p) { if (Points != null) { Points[Points.Count - 1] = p; } } /// /// 绘制方法 /// /// 画布 /// 地图中心 /// 地图缩放级别 /// 地图大小 public override void Draw(System.Drawing.Graphics g, LatLngPoint center, int zoom, System.Drawing.Size screen_size) { if (Points != null && Points.Count >= 2) { g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; List l = new List(); foreach (LatLngPoint p in Points) { l.Add(MapHelper.GetScreenLocationByLatLng(p, center, zoom, screen_size)); //屏幕坐标 } using (Pen pen = new Pen(Color.FromArgb(150,Color.Blue), 4)) { for (int i = 0; i < l.Count - 1; ++i) { g.DrawLine(pen, l[i], l[i + 1]); } } } } } } ================================================ FILE: BMap.NET.WindowsForm/DrawingObjects/BPolygon.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; namespace BMap.NET.WindowsForm.DrawingObjects { /// /// 绘制多边形类 /// public class BPolygon : DrawingObject { /// /// 点集 /// public List Points { get; set; } /// /// 更新最后一点 /// /// public void UpdateTheEnd(LatLngPoint p) { if (Points != null) { Points[Points.Count - 1] = p; } } /// /// 绘制方法 /// /// 画布 /// 地图中心点 /// 地图缩放级别 /// 地图大小 public override void Draw(System.Drawing.Graphics g, LatLngPoint center, int zoom, System.Drawing.Size screen_size) { if (Points != null && Points.Count >= 2) { g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; List l = new List(); foreach (LatLngPoint p in Points) { l.Add(MapHelper.GetScreenLocationByLatLng(p, center, zoom, screen_size)); } using (Pen pen = new Pen(Color.FromArgb(150,Color.Blue), 4)) { if (Points.Count == 2) { g.DrawLine(pen, l[0], l[1]); } else { using (SolidBrush sb = new SolidBrush(Color.FromArgb(30, Color.Blue))) { g.FillPolygon(sb, l.ToArray()); } g.DrawPolygon(pen, l.ToArray()); } } } } } } ================================================ FILE: BMap.NET.WindowsForm/DrawingObjects/BRectangle.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; namespace BMap.NET.WindowsForm.DrawingObjects { /// /// 绘制矩形类 /// public class BRectangle : DrawingObject { /// /// 左上角坐标 /// public LatLngPoint LeftTop { get; set; } /// /// 右下角坐标 /// public LatLngPoint RightBottom { get; set; } /// /// 绘制方法 /// /// /// /// /// public override void Draw(System.Drawing.Graphics g, LatLngPoint center, int zoom, System.Drawing.Size screen_size) { g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; Point theScreenLeftTop = MapHelper.GetScreenLocationByLatLng(LeftTop, center, zoom, screen_size); //矩形左上角屏幕坐标 Point theScreenRightBottom = MapHelper.GetScreenLocationByLatLng(RightBottom, center, zoom, screen_size); //矩形右下角屏幕坐标 int width = Math.Abs(theScreenRightBottom.X - theScreenLeftTop.X); int height = Math.Abs(theScreenRightBottom.Y - theScreenLeftTop.Y); Rectangle r = new Rectangle(Math.Min(theScreenLeftTop.X, theScreenRightBottom.X), Math.Min(theScreenLeftTop.Y, theScreenRightBottom.Y), width, height); if (new Rectangle(new Point(0, 0), screen_size).IntersectsWith(r)) { using (SolidBrush sb = new SolidBrush(Color.FromArgb(30, Color.Blue))) { g.FillRectangle(sb, r); } using (Pen pen = new Pen(Color.FromArgb(150,Color.Blue), 4)) { g.DrawRectangle(pen, r); } } } } } ================================================ FILE: BMap.NET.WindowsForm/DrawingObjects/BScreenShotRectangle.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; namespace BMap.NET.WindowsForm.DrawingObjects { /// /// 地图中截图矩形 /// public class BScreenShotRectangle : DrawingObject { /// /// 左上角屏幕坐标 /// public Point LeftTop { get; set; } /// /// 矩形宽 像素 /// public int Width { get; set; } /// /// 矩形高 像素 /// public int Height { set; get; } /// /// 表示屏幕区域 /// public Rectangle Rect { get { return new Rectangle(LeftTop, new Size(Width, Height)); } } /// /// 绘制方法 /// /// /// /// /// public override void Draw(Graphics g, LatLngPoint center, int zoom, Size screen_size) { g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; using (SolidBrush sb = new SolidBrush(Color.FromArgb(100, Color.White))) { g.FillRectangle(sb, new Rectangle(LeftTop, new Size(Width, Height))); } using (Pen pen = new Pen(Color.Black)) { g.DrawRectangle(pen, new Rectangle(LeftTop, new Size(Width, Height))); } using (SolidBrush sb = new SolidBrush(Color.Black)) { //移动柄 g.FillRectangle(sb, new Rectangle(new Point(LeftTop.X - 3, LeftTop.Y - 3), new Size(6, 6))); g.FillRectangle(sb, new Rectangle(new Point(LeftTop.X - 3 + Width / 2, LeftTop.Y - 3), new Size(6, 6))); g.FillRectangle(sb, new Rectangle(new Point(LeftTop.X - 3 + Width, LeftTop.Y - 3), new Size(6, 6))); g.FillRectangle(sb, new Rectangle(new Point(LeftTop.X - 3 + Width, LeftTop.Y - 3 + Height / 2), new Size(6, 6))); g.FillRectangle(sb, new Rectangle(new Point(LeftTop.X - 3 + Width, LeftTop.Y - 3 + Height), new Size(6, 6))); g.FillRectangle(sb, new Rectangle(new Point(LeftTop.X - 3 + Width / 2, LeftTop.Y - 3 + Height), new Size(6, 6))); g.FillRectangle(sb, new Rectangle(new Point(LeftTop.X - 3, LeftTop.Y - 3 + Height), new Size(6, 6))); g.FillRectangle(sb, new Rectangle(new Point(LeftTop.X - 3, LeftTop.Y - 3 + Height / 2), new Size(6, 6))); //高宽 g.FillRectangle(sb, new Rectangle(new Point(LeftTop.X - 2, LeftTop.Y - 23), new Size(60, 18))); using (Font f = new Font("微软雅黑", 9)) { g.DrawString(Width + "×" + Height, f, Brushes.White, new PointF(LeftTop.X - 1, LeftTop.Y - 21)); } } } } } ================================================ FILE: BMap.NET.WindowsForm/DrawingObjects/DrawingObject.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; namespace BMap.NET.WindowsForm.DrawingObjects { /// /// 地图中绘制图形基类 /// public abstract class DrawingObject { /// /// 绘制方法 /// /// 画布 /// 地图中心点坐标 /// 当前地图缩放级别 /// 屏幕大小 public abstract void Draw(Graphics g, LatLngPoint center, int zoom, Size screen_size); } } ================================================ FILE: BMap.NET.WindowsForm/FunctionalControls/BTabControl.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using System.Drawing; namespace BMap.NET.WindowsForm.FunctionalControls { /// /// 选项卡控件,可以用来组织 位置列表控件BPlacesControl、导航控件BDirectionControl /// public class BTabControl:TabControl { int _mouse_over = -1; public BTabControl() { ItemSize = new System.Drawing.Size(70, 70); Alignment = TabAlignment.Left; //自绘 base.SetStyle( ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, true); base.UpdateStyles(); } /// /// 绘制 /// /// protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); using (SolidBrush sb = new SolidBrush(Color.FromArgb(37, 37, 37))) { Rectangle all_back = new Rectangle(1, 1, Width - 2, Height - 2); //整个背景区域 e.Graphics.FillRectangle(sb, all_back); Rectangle back = new Rectangle(ItemSize.Width + 1, 1, Width - ItemSize.Width - 2, Height - 2); //客户区 e.Graphics.FillRectangle(Brushes.White, back); e.Graphics.DrawRectangle(Pens.Gray, back); foreach (TabPage tab in TabPages) //Tab { Rectangle tab_rect = GetTabRect(TabPages.IndexOf(tab)); tab_rect = new Rectangle(tab_rect.X - 1, tab_rect.Y - 1, tab_rect.Width, tab_rect.Height); if (this.SelectedTab == tab || TabPages.IndexOf(tab) == _mouse_over) { using (SolidBrush bsb = new SolidBrush(Color.FromArgb(51,133,255))) { e.Graphics.FillRectangle(bsb, tab_rect); } e.Graphics.DrawString(tab.Text, new Font("微软雅黑", 10), Brushes.White, new PointF(tab_rect.X + 18, tab_rect.Y + 20)); } else { e.Graphics.FillRectangle(sb, tab_rect); e.Graphics.DrawString(tab.Text, new Font("微软雅黑", 10), Brushes.White, new PointF(tab_rect.X + 18, tab_rect.Y + 20)); } } } } /// /// 鼠标进入选项卡 /// /// protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); _mouse_over = -1; foreach (TabPage tab in TabPages) { Rectangle tab_rect = GetTabRect(TabPages.IndexOf(tab)); if (tab_rect.Contains(e.Location)) { _mouse_over = TabPages.IndexOf(tab); break; } } Invalidate(); } /// /// 鼠标移出 /// /// protected override void OnMouseLeave(EventArgs e) { base.OnMouseLeave(e); _mouse_over = -1; Invalidate(); } } } ================================================ FILE: BMap.NET.WindowsForm/FunctionalControls/CityList.Designer.cs ================================================ namespace BMap.NET.WindowsForm.FunctionalControls { partial class CityList { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.flpList = new System.Windows.Forms.FlowLayoutPanel(); this.SuspendLayout(); // // flpList // this.flpList.AutoScroll = true; this.flpList.Dock = System.Windows.Forms.DockStyle.Fill; this.flpList.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.flpList.Location = new System.Drawing.Point(0, 0); this.flpList.Name = "flpList"; this.flpList.Size = new System.Drawing.Size(130, 139); this.flpList.TabIndex = 0; // // CityList // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.flpList); this.Name = "CityList"; this.Size = new System.Drawing.Size(130, 139); this.ResumeLayout(false); } #endregion private System.Windows.Forms.FlowLayoutPanel flpList; } } ================================================ FILE: BMap.NET.WindowsForm/FunctionalControls/CityList.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; namespace BMap.NET.WindowsForm.FunctionalControls { /// /// 可以按拼音顺序、行政组织结构的方式显示城市列表的控件 /// partial class CityList : UserControl { public event SelectedCityChangedEventHandler SelectedCityChanged; /// /// 构造方法 /// public CityList() { InitializeComponent(); } /// /// 城市控件显示方式 /// public CityListMode Mode { get; set; } /// /// 拼音类型数据源 /// public Dictionary> DataByPinyin { get; set; } /// /// 行政组织结构类型数据源 /// public CityNode DataByOrganization { get; set; } /// /// 刷新列表 /// public void RefreshList() { flpList.Controls.Clear(); flpList.BackColor = Color.White; flpList.Padding = new Padding(3); //按照拼音方式显示 if (Mode == CityListMode.Pinyin) { if (DataByPinyin != null) { var c = DataByPinyin.OrderBy((p) => p.Key); foreach (KeyValuePair> p in c) //遍历26个拼音 { Label lbl_title = new Label(); lbl_title.BackColor = Color.LightGray; lbl_title.Width = 150; lbl_title.AutoSize = false; lbl_title.Font = new System.Drawing.Font("微软雅黑", 12, FontStyle.Bold); lbl_title.Height = 30; lbl_title.Text = " " + p.Key; lbl_title.TextAlign = ContentAlignment.MiddleLeft; flpList.Controls.Add(lbl_title); Application.DoEvents(); foreach (string city in p.Value) //遍历拼音中的城市 { Label lbl_item = new Label(); lbl_item.AutoSize = false; lbl_item.BackColor = Color.White; lbl_item.Font = new System.Drawing.Font("微软雅黑", 10); lbl_item.Width = 150; lbl_item.Height = 30; lbl_item.TextAlign = ContentAlignment.MiddleLeft; lbl_item.Text = city; lbl_item.MouseEnter += new EventHandler(lbl_item_MouseEnter); lbl_item.MouseLeave += new EventHandler(lbl_item_MouseLeave); lbl_item.Click += new EventHandler(lbl_item_Click); flpList.Controls.Add(lbl_item); Application.DoEvents(); } } } } //按照组织结构显示 else if(Mode == CityListMode.Organization) { if (DataByOrganization != null) { foreach (CityNode province in DataByOrganization.Nexts) //遍历省份、直辖市 { Label lbl_title = new Label(); lbl_title.Text = " " + province.CityName; lbl_title.BackColor = Color.LightGray; lbl_title.Width = 150; lbl_title.AutoSize = false; lbl_title.Font = new System.Drawing.Font("微软雅黑", 12, FontStyle.Bold); lbl_title.Height = 30; lbl_title.TextAlign = ContentAlignment.MiddleLeft; flpList.Controls.Add(lbl_title); Application.DoEvents(); foreach (CityNode city in province.Nexts) //遍历省份中的市 直辖市中的县 { Label lbl_item = new Label(); lbl_item.BackColor = Color.White; lbl_item.Font = new System.Drawing.Font("微软雅黑", 10); lbl_item.Width = 150; lbl_item.Height = 30; lbl_item.Text = city.CityName; lbl_item.TextAlign = ContentAlignment.MiddleLeft; lbl_item.AutoSize = false; lbl_item.MouseEnter += new EventHandler(lbl_item_MouseEnter); lbl_item.MouseLeave += new EventHandler(lbl_item_MouseLeave); lbl_item.Click += new EventHandler(lbl_item_Click); flpList.Controls.Add(lbl_item); Application.DoEvents(); } } } } } /// /// 鼠标选择项 /// /// /// void lbl_item_Click(object sender, EventArgs e) { if (SelectedCityChanged != null) { SelectedCityChanged((sender as Label).Text); } } /// /// 鼠标离开选项 /// /// /// void lbl_item_MouseLeave(object sender, EventArgs e) { (sender as Label).BackColor = Color.White; } /// /// 鼠标进入选项 /// /// /// void lbl_item_MouseEnter(object sender, EventArgs e) { (sender as Label).BackColor = Color.FromArgb(100, Color.LightGray); } } /// /// 表示处理选择城市发生变化事件的方法 /// /// public delegate void SelectedCityChangedEventHandler(string cityName); /// /// 城市控件显示方式 /// enum CityListMode { Pinyin, Organization } /// /// 城市节点 /// class CityNode { public string CityName { get; set; } public string CityCode { get; set; } public string ParentCode { set; get; } public string CityLevel { set; get; } public List Nexts { set; get; } public CityNode(string cityName, string cityCode, string parentCode, string cityLevel) { CityName = cityName; CityCode = cityCode; parentCode = ParentCode; cityLevel = CityLevel; } } } ================================================ FILE: BMap.NET.WindowsForm/FunctionalControls/CityList.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ================================================ FILE: BMap.NET.WindowsForm/LatLngPoint.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BMap.NET.WindowsForm { /// /// 经纬度坐标 /// public class LatLngPoint { public double Lng { set; get; } public double Lat { set; get; } public LatLngPoint(double _lng, double _lat) { Lng = _lng; Lat = _lat; } } } ================================================ FILE: BMap.NET.WindowsForm/MapDownloadDialog.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class MapDownloadDialog { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.button2 = new System.Windows.Forms.Button(); this.groupBox4 = new System.Windows.Forms.GroupBox(); this.label1 = new System.Windows.Forms.Label(); this.numZoomEnd = new System.Windows.Forms.NumericUpDown(); this.radioButton2 = new System.Windows.Forms.RadioButton(); this.radioButton1 = new System.Windows.Forms.RadioButton(); this.numThread = new System.Windows.Forms.NumericUpDown(); this.label6 = new System.Windows.Forms.Label(); this.numZoom = new System.Windows.Forms.NumericUpDown(); this.label5 = new System.Windows.Forms.Label(); this.rchOuput = new System.Windows.Forms.RichTextBox(); this.groupBox5 = new System.Windows.Forms.GroupBox(); this.button1 = new System.Windows.Forms.Button(); this.txtPath = new System.Windows.Forms.TextBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.linkLabel1 = new System.Windows.Forms.LinkLabel(); this.groupBox4.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numZoomEnd)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numThread)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numZoom)).BeginInit(); this.groupBox5.SuspendLayout(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // // button2 // this.button2.Location = new System.Drawing.Point(485, 156); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(75, 23); this.button2.TabIndex = 7; this.button2.Text = "开始下载"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); // // groupBox4 // this.groupBox4.Controls.Add(this.label1); this.groupBox4.Controls.Add(this.numZoomEnd); this.groupBox4.Controls.Add(this.radioButton2); this.groupBox4.Controls.Add(this.radioButton1); this.groupBox4.Controls.Add(this.numThread); this.groupBox4.Controls.Add(this.label6); this.groupBox4.Controls.Add(this.numZoom); this.groupBox4.Controls.Add(this.label5); this.groupBox4.Location = new System.Drawing.Point(17, 12); this.groupBox4.Name = "groupBox4"; this.groupBox4.Size = new System.Drawing.Size(554, 84); this.groupBox4.TabIndex = 5; this.groupBox4.TabStop = false; this.groupBox4.Text = "范围"; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(142, 51); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(17, 12); this.label1.TabIndex = 9; this.label1.Text = "至"; // // numZoomEnd // this.numZoomEnd.Location = new System.Drawing.Point(163, 48); this.numZoomEnd.Maximum = new decimal(new int[] { 17, 0, 0, 0}); this.numZoomEnd.Name = "numZoomEnd"; this.numZoomEnd.Size = new System.Drawing.Size(50, 21); this.numZoomEnd.TabIndex = 14; this.numZoomEnd.Value = new decimal(new int[] { 13, 0, 0, 0}); // // radioButton2 // this.radioButton2.AutoSize = true; this.radioButton2.Location = new System.Drawing.Point(468, 20); this.radioButton2.Name = "radioButton2"; this.radioButton2.Size = new System.Drawing.Size(71, 16); this.radioButton2.TabIndex = 13; this.radioButton2.TabStop = true; this.radioButton2.Text = "卫星地图"; this.radioButton2.UseVisualStyleBackColor = true; // // radioButton1 // this.radioButton1.AutoSize = true; this.radioButton1.Checked = true; this.radioButton1.Location = new System.Drawing.Point(31, 20); this.radioButton1.Name = "radioButton1"; this.radioButton1.Size = new System.Drawing.Size(71, 16); this.radioButton1.TabIndex = 12; this.radioButton1.TabStop = true; this.radioButton1.Text = "普通地图"; this.radioButton1.UseVisualStyleBackColor = true; // // numThread // this.numThread.Location = new System.Drawing.Point(303, 48); this.numThread.Maximum = new decimal(new int[] { 20, 0, 0, 0}); this.numThread.Minimum = new decimal(new int[] { 1, 0, 0, 0}); this.numThread.Name = "numThread"; this.numThread.Size = new System.Drawing.Size(99, 21); this.numThread.TabIndex = 11; this.numThread.Value = new decimal(new int[] { 2, 0, 0, 0}); // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(244, 52); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(53, 12); this.label6.TabIndex = 10; this.label6.Text = "下载线程"; // // numZoom // this.numZoom.Location = new System.Drawing.Point(86, 48); this.numZoom.Maximum = new decimal(new int[] { 17, 0, 0, 0}); this.numZoom.Name = "numZoom"; this.numZoom.Size = new System.Drawing.Size(50, 21); this.numZoom.TabIndex = 9; this.numZoom.Value = new decimal(new int[] { 13, 0, 0, 0}); // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(29, 52); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(53, 12); this.label5.TabIndex = 8; this.label5.Text = "缩放级别"; // // rchOuput // this.rchOuput.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.rchOuput.BackColor = System.Drawing.Color.PapayaWhip; this.rchOuput.Location = new System.Drawing.Point(8, 21); this.rchOuput.Name = "rchOuput"; this.rchOuput.ReadOnly = true; this.rchOuput.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical; this.rchOuput.Size = new System.Drawing.Size(535, 187); this.rchOuput.TabIndex = 0; this.rchOuput.Text = ""; // // groupBox5 // this.groupBox5.Controls.Add(this.button1); this.groupBox5.Controls.Add(this.txtPath); this.groupBox5.Location = new System.Drawing.Point(17, 102); this.groupBox5.Name = "groupBox5"; this.groupBox5.Size = new System.Drawing.Size(554, 48); this.groupBox5.TabIndex = 6; this.groupBox5.TabStop = false; this.groupBox5.Text = "保存位置"; // // button1 // this.button1.Location = new System.Drawing.Point(468, 17); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 1; this.button1.Text = "浏览"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // // txtPath // this.txtPath.Location = new System.Drawing.Point(9, 19); this.txtPath.Name = "txtPath"; this.txtPath.ReadOnly = true; this.txtPath.Size = new System.Drawing.Size(441, 21); this.txtPath.TabIndex = 0; // // groupBox2 // this.groupBox2.Controls.Add(this.rchOuput); this.groupBox2.Location = new System.Drawing.Point(17, 180); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(554, 216); this.groupBox2.TabIndex = 4; this.groupBox2.TabStop = false; this.groupBox2.Text = "输出"; // // linkLabel1 // this.linkLabel1.AutoSize = true; this.linkLabel1.Location = new System.Drawing.Point(17, 403); this.linkLabel1.Name = "linkLabel1"; this.linkLabel1.Size = new System.Drawing.Size(89, 12); this.linkLabel1.TabIndex = 8; this.linkLabel1.TabStop = true; this.linkLabel1.Text = "合并成大图查看"; this.linkLabel1.Visible = false; this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); // // MapDownloadDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(592, 427); this.Controls.Add(this.linkLabel1); this.Controls.Add(this.button2); this.Controls.Add(this.groupBox4); this.Controls.Add(this.groupBox5); this.Controls.Add(this.groupBox2); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.Name = "MapDownloadDialog"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "下载配置"; this.Load += new System.EventHandler(this.MapDownloadDialog_Load); this.groupBox4.ResumeLayout(false); this.groupBox4.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.numZoomEnd)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numThread)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numZoom)).EndInit(); this.groupBox5.ResumeLayout(false); this.groupBox5.PerformLayout(); this.groupBox2.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Button button2; private System.Windows.Forms.GroupBox groupBox4; private System.Windows.Forms.NumericUpDown numThread; private System.Windows.Forms.Label label6; private System.Windows.Forms.NumericUpDown numZoom; private System.Windows.Forms.Label label5; private System.Windows.Forms.RichTextBox rchOuput; private System.Windows.Forms.GroupBox groupBox5; private System.Windows.Forms.Button button1; private System.Windows.Forms.TextBox txtPath; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.RadioButton radioButton2; private System.Windows.Forms.RadioButton radioButton1; private System.Windows.Forms.LinkLabel linkLabel1; private System.Windows.Forms.Label label1; private System.Windows.Forms.NumericUpDown numZoomEnd; } } ================================================ FILE: BMap.NET.WindowsForm/MapDownloadDialog.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; using System.Net; using System.Threading; using BMap.NET.HTTPService; using System.Collections; namespace BMap.NET.WindowsForm { public partial class MapDownloadDialog : Form { LatLngPoint p1; LatLngPoint p2; ArrayList _waittodownload = new ArrayList(); //待下载图片集合 public MapDownloadDialog(LatLngPoint p1, LatLngPoint p2) { InitializeComponent(); this.p1 = p1; this.p2 = p2; } private void button1_Click(object sender, EventArgs e) { using (FolderBrowserDialog fb = new FolderBrowserDialog()) { if (fb.ShowDialog() == System.Windows.Forms.DialogResult.OK) { txtPath.Text = fb.SelectedPath; } } } private void button2_Click(object sender, EventArgs e) { _path = txtPath.Text; if (_path.Equals("")) { MessageBox.Show("请选择存储路径!"); return; } if (numZoom.Value > numZoomEnd.Value) { MessageBox.Show("地图级别设置不对!"); return; } int zoomStart = (int)numZoom.Value; int zoomEnd = (int)numZoomEnd.Value; int thread = (int)numThread.Value; _waittodownload.Clear(); for (int zoom = zoomStart; zoom <= zoomEnd; ++zoom) { PointF point1 = MapHelper.GetLocationByLatLng(p1, zoom); //将第一个点经纬度转换成平面2D坐标 PointF point2 = MapHelper.GetLocationByLatLng(p2, zoom); //将第二个点经纬度转换成平面2D坐标 int startX = (int)point1.X / 256; //起始列 int endX = (int)point2.X / 256; //结束列 if (endX == Math.Pow(2, zoom)) //结束列超出范围 { endX--; } int startY = (int)point1.Y / 256; //起始行 int endY = (int)point2.Y / 256; //结束行 if (endY == Math.Pow(2, zoom)) //结束行超出范围 { endY--; } _totalwidth = (endX - startX + 1) * 256; //合并图的宽度 _totalheight = (endY - startY + 1) * 256; //合并图的高度 int threadId = 0; for (int y = startY; y <= endY; y++) { for (int x = startX; x <= endX; x++) { RectInfo ri = new RectInfo(); ri.threadId = threadId; //分别由不同的线程下载 ri.x = x; ri.y = y; ri.z = zoom; ri.bComplete = false; _waittodownload.Add(ri); //将每个小方块放入待下载集合 threadId = (threadId + 1) % thread; //由thread个不同线程下载图片 } } } if (MessageBox.Show("共有" + _waittodownload.Count + "张图片需要下载,确定下载吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK) { _thread = thread; _zoom = zoomStart; _zoomEnd = zoomEnd; _downloadnum = 0; _normal = radioButton1.Checked; button2.Enabled = false; rchOuput.Clear(); groupBox2.Text = "输出(" + _waittodownload.Count + "张)"; _startTime = DateTime.Now; for (int i = 1; i <= thread; ++i) { Thread t = new Thread(new ParameterizedThreadStart(DownloadThreadProc)); t.Start(i); //开启下载线程 } } } /// /// 下载线程方法 /// /// public void DownloadThreadProc(object param) { int threadId = (int)param; //当前线程Id MapService mapService = new MapService(); this.Invoke((Action)delegate() //输出 { rchOuput.SelectionColor = Color.Blue; rchOuput.AppendText(DateTime.Now.ToLongTimeString() + " 第" + threadId + "号线程开始执行\r\n"); }); for (int i = 0; i < _waittodownload.Count; i++) { RectInfo ri = (RectInfo)_waittodownload[i]; if ((!ri.bComplete) && (ri.threadId + 1 == threadId)) { try { Bitmap map = mapService.LoadMapTile(ri.x, ri.y, ri.z, _normal ? MapMode.Normal : MapMode.Satellite, LoadMapMode.CacheServer); string file = _path + "\\" + ri.z.ToString() + "\\" + ri.z.ToString() + "_" + ri.x.ToString() + "_" + ri.y.ToString() + ".jpg"; ri.Bitmap = map; //文件保存格式 “缩放级别_列_行.jpg” if (!Directory.Exists(_path + "\\" + ri.z.ToString())) { Directory.CreateDirectory(_path + "\\" + ri.z.ToString()); } map.Save(file, System.Drawing.Imaging.ImageFormat.Jpeg); this.Invoke((Action)delegate() //输出 { rchOuput.SelectionColor = Color.Green; rchOuput.AppendText(DateTime.Now.ToLongTimeString() + " 第" + threadId + "号线程下载图片" + ri.z.ToString() + "_" + ri.x.ToString() + "_" + ri.y.ToString() + ".jpg\r\n"); }); _downloadnum++; ri.bComplete = true; } catch { this.Invoke((Action)delegate() //输出 { rchOuput.SelectionColor = Color.Red; rchOuput.AppendText(DateTime.Now.ToLongTimeString() + " 第" + threadId + "号线程下载图片" + ri.z.ToString() + "_" + ri.x.ToString() + "_" + ri.y.ToString() + ".jpg失败!\r\n"); }); } } } this.Invoke((Action)delegate() //输出 { rchOuput.SelectionColor = Color.Blue; rchOuput.AppendText(DateTime.Now.ToLongTimeString() + " 第" + threadId + "号线程执行完毕\r\n"); }); _thread--; //工作线程数目减一 if (_thread == 0) //所有线程均结束 { this.Invoke((Action)delegate() //输出 { rchOuput.SelectionColor = Color.Blue; rchOuput.AppendText(DateTime.Now.ToLongTimeString() + " 图片下载结束!共下载" + _downloadnum + "张,共耗时" + (DateTime.Now - _startTime).TotalSeconds + "秒"); button2.Enabled = true; }); } } public string _path { get; set; } public int _thread { get; set; } public DateTime _startTime { get; set; } public int _downloadnum { get; set; } public int _zoom { get; set; } public bool _normal { get; set; } private void MapDownloadDialog_Load(object sender, EventArgs e) { } private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (_downloadnum == _waittodownload.Count && _downloadnum != 0) //全部下载完毕 { for (int zoom = _zoom; zoom <= _zoomEnd; ++zoom) { Bitmap b = new Bitmap((int)_totalwidth, (int)_totalheight); Graphics g = Graphics.FromImage(b); int startx = ((RectInfo)(_waittodownload[0])).x; int starty = ((RectInfo)(_waittodownload[0])).y; foreach (RectInfo rf in _waittodownload) { g.DrawImage(rf.Bitmap, new Rectangle(new Point((rf.x - startx) * 256, (int)_totalheight - (rf.y - starty + 1) * 256), new Size(256, 256))); } g.Dispose(); b.Save(_path + "\\" + _zoom + "_total.jpg"); b.Dispose(); System.Diagnostics.Process.Start(_path + "\\" + _zoom + "_total.jpg"); } } } public int _totalwidth { get; set; } public int _totalheight { get; set; } public int _zoomEnd { get; set; } } /// /// 地图中每个256*256尺寸的方块 /// public class RectInfo { public int serverId; //目标服务器 public int threadId; //目标下载线程 public string url; //下载url public int x; //列 public int y; //行 public int z; //缩放级别 public bool bComplete; //是否完成 public Bitmap Bitmap; //图片 } } ================================================ FILE: BMap.NET.WindowsForm/MapDownloadDialog.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ================================================ FILE: BMap.NET.WindowsForm/MapDownloaderControl.Designer.cs ================================================ namespace BMap.NET.WindowsForm { partial class MapDownloaderControl { /// /// 必需的设计器变量。 /// private System.ComponentModel.IContainer components = null; /// /// 清理所有正在使用的资源。 /// /// 如果应释放托管资源,为 true;否则为 false。 protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region 组件设计器生成的代码 /// /// 设计器支持所需的方法 - 不要 /// 使用代码编辑器修改此方法的内容。 /// private void InitializeComponent() { components = new System.ComponentModel.Container(); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; } #endregion } } ================================================ FILE: BMap.NET.WindowsForm/MapDownloaderControl.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using BMap.NET.WindowsForm.BMapElements; using System.Drawing.Drawing2D; using BMap.NET.HTTPService; using Newtonsoft.Json.Linq; using BMap.NET.WindowsForm.FunctionalControls; using BMap.NET.WindowsForm.DrawingObjects; namespace BMap.NET.WindowsForm { /// /// 百度地图显示控件 /// public partial class MapDownloaderControl : UserControl { private const double DISTANCE = 111319.49; //每(经纬)度距离m #region 属性 private LatLngPoint _center = new LatLngPoint(117.217412, 39.142191); //天津 /// /// 地图显示中心经纬度坐标 /// [Description("地图中心点"), Category("BMap.NET")] public LatLngPoint Center { get { return _center; } set { _center = value; } } private int _zoom = 12; /// /// 地图缩放级别(3-18) /// [Description("当前地图缩放级别"), Category("BMap.NET")] public int Zoom { get { return _zoom; } set { _zoom = value; _tiles.Clear(); Invalidate(); } } private MapMode _mode = MapMode.Normal; /// /// 地图模式 /// [Description("当前地图模式"), Category("BMap.NET")] public MapMode Mode { get { return _mode; } set { _mode = value; foreach (KeyValuePair p in _tiles) { p.Value.Mode = _mode; } Invalidate(); } } private LoadMapMode _loadmode = LoadMapMode.Cache; /// /// 地图加载模式 /// [Description("当前地图加载模式"), Category("BMap.NET")] public LoadMapMode LoadMode { get { return _loadmode; } set { _loadmode = value; foreach (KeyValuePair p in _tiles) { p.Value.LoadMode = _loadmode; } Invalidate(); } } #endregion #region 字段 /// /// 当前光标 /// private Cursor _current_cursor_cache = Cursors.Arrow; /// /// 地图中提示 /// private Label _toolTip = new Label(); /// /// 鼠标是否定位 /// private bool _cursor_located = false; /// /// 鼠标移动前一点缓存 /// private Point _previous_point_cache; /// /// 鼠标工作方式 /// private MouseType _mouse_type = MouseType.None; /// /// 当前绘制图形 没有则为null(包括截图矩形) /// private DrawingObject _current_drawing; /// /// 地图中瓦片容器 /// private Dictionary _tiles = new Dictionary(); /// /// 地图中普通信息点(POI)容器 /// private Dictionary _pois = new Dictionary(); /// /// 绘制图形容器 /// private Dictionary _drawingObjects = new Dictionary(); /// /// 地图中用户添加的标记点 /// private Dictionary _markers = new Dictionary(); /// /// POI信息显示控件 /// private BPOITipControl _bPOITipControl = new BPOITipControl(); /// /// 标记点信息编辑控件 /// private BMarkerEditorControl _bMarkerEditorControl = new BMarkerEditorControl(); /// /// 标记点信息显示控件 /// private BMarkerTipControl _bMarkerTipControl = new BMarkerTipControl(); /// /// 位置点信息显示控件 /// private BPointTipControl _bPointTipControl = new BPointTipControl(); #endregion /// /// 构造方法 /// public MapDownloaderControl() { InitializeComponent(); //绘制双缓冲 SetStyle(ControlStyles.OptimizedDoubleBuffer, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); UpdateStyles(); } #region 重写方法 /// /// 控件加载 /// /// protected override void OnLoad(EventArgs e) { base.OnLoad(e); Init(); } /// /// /// /// protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); //拖拽 if (e.Button == System.Windows.Forms.MouseButtons.Left) { // 拖拽地图 _mouse_type = MouseType.DragMap; _current_cursor_cache = Cursor = Cursors.SizeAll; _previous_point_cache = e.Location; //拖拽区域 } //绘制区域 if (e.Button == System.Windows.Forms.MouseButtons.Right) { _current_drawing = new BDownloadRectangle { LeftTop = e.Location, Width = 0, Height = 0 }; _mouse_type = MouseType.DrawDownloadArea; _current_cursor_cache = Cursor = Cursors.Cross; _previous_point_cache = e.Location; } } /// /// /// /// protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (e.Button == System.Windows.Forms.MouseButtons.Left) { if (_mouse_type == MouseType.DragMap) //拖拽地图 { int deltax = e.Location.X - _previous_point_cache.X; int deltay = e.Location.Y - _previous_point_cache.Y; LatLngPoint llp = MapHelper.GetLatLngByScreenLocation(new Point(ClientSize.Width / 2 - deltax, ClientSize.Height / 2 - deltay), _center, _zoom, ClientSize); Center = llp; _previous_point_cache = e.Location; } // } if (e.Button == System.Windows.Forms.MouseButtons.Right) { if (_mouse_type == MouseType.DrawDownloadArea && _current_drawing as BDownloadRectangle != null) //绘制截图矩形 { (_current_drawing as BDownloadRectangle).Width = e.Location.X - (_current_drawing as BDownloadRectangle).LeftTop.X; (_current_drawing as BDownloadRectangle).Height = e.Location.Y - (_current_drawing as BDownloadRectangle).LeftTop.Y; } } Invalidate(); } /// /// /// /// protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); if (_mouse_type == MouseType.DragMap) //拖动地图 鼠标弹起 { } if (_mouse_type == MouseType.DrawDownloadArea) //绘制下载区域 弹起鼠标 { BDownloadRectangle d = _current_drawing as BDownloadRectangle; if (d != null) { LatLngPoint left_down = MapHelper.GetLatLngByScreenLocation(new Point(d.LeftTop.X, d.LeftTop.Y + d.Height), _center, _zoom, ClientSize); LatLngPoint right_up = MapHelper.GetLatLngByScreenLocation(new Point(d.LeftTop.X + d.Width, d.LeftTop.Y), _center, _zoom, ClientSize); using (MapDownloadDialog dlg = new MapDownloadDialog(left_down, right_up)) { if (dlg.ShowDialog() == DialogResult.OK) { } _current_drawing = null; Invalidate(); } } } _current_cursor_cache = Cursor = Cursors.Arrow; _mouse_type = MouseType.None; } /// /// /// /// protected override void OnMouseWheel(MouseEventArgs e) { base.OnMouseWheel(e); //缩放 int z = _zoom + e.Delta / 100; if (z >= 3 && z <= 19) { LatLngPoint p = MapHelper.GetLatLngByScreenLocation(e.Location, _center, _zoom, ClientSize); //鼠标经纬度坐标 PointF pt = MapHelper.GetLocationByLatLng(p, z); //鼠标像素坐标 PointF pt_center = new PointF(pt.X + (ClientSize.Width / 2 - e.Location.X), pt.Y + (e.Location.Y - ClientSize.Height / 2)); //缩放后中心点像素坐标 LatLngPoint p_center = MapHelper.GetLatLngByLocation(pt_center, z); //像素坐标到经纬度坐标 Center = p_center; Zoom = z; Invalidate(); } } /// /// 地图重绘 /// /// protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); if (!DesignMode) //所有绘制工作均在运行时发生 { //瓦片 DrawTiles(e.Graphics); //绘制图形 DrawDrawingObjects(e.Graphics); //地图元素 DrawMapElements(e.Graphics); //地图信息 DrawMapInfo(e.Graphics); } } #endregion #region 功能方法 /// /// 初始化 /// private void Init() { if (!DesignMode) { } } /// /// 初始化瓦片 /// private void InitializeTiles() { PointF center = MapHelper.GetLocationByLatLng(_center, _zoom); //中心点像素坐标 PointF left_down = new PointF(center.X - ClientSize.Width / 2, center.Y - ClientSize.Height / 2); //左下角像素坐标 PointF right_up = new PointF(center.X + ClientSize.Width / 2, center.Y + ClientSize.Height / 2); //右上角像素坐标 int tile_left_down_x = (int)Math.Floor((left_down.X) / 256); //左下角瓦片X坐标 int tile_left_down_y = (int)Math.Floor((left_down.Y) / 256); //左下角瓦片Y坐标 int tile_right_up_x = (int)Math.Floor((right_up.X) / 256); //右上角瓦片X坐标 int tile_right_up_y = (int)Math.Floor((right_up.Y) / 256); //右上角瓦片Y坐标 for (int i = tile_left_down_x; i <= tile_right_up_x; ++i) { for (int j = tile_left_down_y; j <= tile_right_up_y; ++j) { if (!_tiles.ContainsKey(_zoom + "_" + i + "_" + j)) { _tiles.Add(_zoom + "_" + i + "_" + j, new BTile(i, j, _zoom, this, _mode, _loadmode)); } } } } /// /// 绘制瓦片 /// /// private void DrawTiles(Graphics g) { InitializeTiles(); foreach (KeyValuePair p in _tiles) { if (p.Key.StartsWith(_zoom.ToString())) { p.Value.Draw(g, _center, _zoom, this.ClientSize); } } } /// /// 绘制地图左下角的一些附加信息 如当前坐标、地图级别、logo、版权等 /// /// private void DrawMapInfo(Graphics g) { using (GraphicsPath gp = MapHelper.CreateRoundedRectanglePath(new Rectangle(10, Height - 100, 250, 90), 6)) { using (SolidBrush sb = new SolidBrush(Color.FromArgb(180, Color.White))) { g.FillPath(sb, gp); g.DrawPath(Pens.Black, gp); using (Font f = new Font("微软雅黑", 11)) { g.DrawString(MapHelper.GetMapModeTitle(_mode) + "," + _zoom + "级," + MapHelper.GetLoadMapModeTitle(_loadmode), f, Brushes.Teal, new PointF(20, Height - 100 + 10)); Point p = PointToClient(Cursor.Position); if (ClientRectangle.Contains(p)) { LatLngPoint llp = MapHelper.GetLatLngByScreenLocation(p, _center, _zoom, ClientSize); //当前鼠标经纬度 g.DrawString(Math.Round(llp.Lat, 5) + "," + Math.Round(llp.Lng, 5), f, Brushes.Teal, new PointF(20, Height - 100 + 35)); } g.DrawString("BMap.NET 2015 by 周见智", f, Brushes.Teal, new PointF(20, Height - 100 + 60)); } } } } /// /// 绘制鼠标效果 /// /// private void DrawCursor(Graphics g) { Point p = PointToClient(Cursor.Position); if (ClientRectangle.Contains(p)) { if (_cursor_located) //鼠标定位效果 { using (Pen pen = new Pen(Color.FromArgb(200, _mode == MapMode.Normal ? Color.Blue : Color.White), 2)) { pen.DashStyle = DashStyle.Dash; g.DrawLine(pen, new Point(0, p.Y), new Point(ClientSize.Width, p.Y)); g.DrawLine(pen, new Point(p.X, 0), new Point(p.X, ClientSize.Height)); } } if (_mouse_type == MouseType.DrawMarker) //鼠标绘制标记效果 { Bitmap b = Properties.BMap.ico_marker; g.DrawImage(b, new Rectangle(p.X - b.Width / 2, p.Y - b.Height, b.Width, b.Height)); } } } /// /// 绘制图形 /// /// private void DrawDrawingObjects(Graphics g) { if (_current_drawing != null) { _current_drawing.Draw(g, _center, _zoom, ClientSize); } foreach (KeyValuePair p in _drawingObjects) { p.Value.Draw(g, _center, _zoom, ClientSize); } } /// /// 绘制地图元素 /// /// private void DrawMapElements(Graphics g) { } #endregion #region 公开方法 /// /// 向地图中增加POI /// /// internal void AddPlaces(List places) { _pois.Clear(); _bPointTipControl.Visible = false; _bPOITipControl.Visible = false; _bMarkerEditorControl.Visible = false; _bMarkerTipControl.Visible = false; foreach (BPOI poi in places) { _pois.Add(poi.Index.ToString(), poi); } Invalidate(); } /// /// 清空地图中所有的POI /// internal void ClearPlaces() { _pois.Clear(); _bPointTipControl.Visible = false; _bPOITipControl.Visible = false; _bMarkerEditorControl.Visible = false; _bMarkerTipControl.Visible = false; Invalidate(); } /// /// 刷新瓦片,该方法会删除瓦片缓存 /// public void RefreshTitles() { HTTPService.MapService mapService = new HTTPService.MapService(); mapService.ClearTileCache(); _tiles.Clear(); Invalidate(); } #endregion #region 事件处理方法 #endregion } } ================================================ FILE: BMap.NET.WindowsForm/PointType.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BMap.NET.WindowsForm { /// /// 地图中BPoint位置点类型 /// public enum PointType { /// /// 路线起点 /// RouteStart, /// /// 路线终点 /// RouteEnd, /// /// 未知点 /// Strange } } ================================================ FILE: BMap.NET.WindowsForm/Properties/AssemblyInfo.cs ================================================ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("BMap.NET.WindowsForm")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BMap.NET.WindowsForm")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("2543976c-f392-488b-aeb4-f736107f5d81")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] ================================================ FILE: BMap.NET.WindowsForm/Properties/BMap.Designer.cs ================================================ //------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.18444 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace BMap.NET.WindowsForm.Properties { using System; /// /// A strongly-typed resource class, for looking up localized strings, etc. /// // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class BMap { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal BMap() { } /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BMap.NET.WindowsForm.Properties.BMap", typeof(BMap).Assembly); resourceMan = temp; } return resourceMan; } } /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } /// /// Looks up a localized string similar to 中国|1||0 ///黑龙江省|2|1|1 ///大兴安岭地区|38|2|2 ///黑河市|39|2|2 ///伊春市|40|2|2 ///齐齐哈尔市|41|2|2 ///佳木斯市|42|2|2 ///鹤岗市|43|2|2 ///绥化市|44|2|2 ///双鸭山市|45|2|2 ///鸡西市|46|2|2 ///七台河市|47|2|2 ///哈尔滨市|48|2|2 ///牡丹江市|49|2|2 ///大庆市|50|2|2 ///甘肃省|6|1|1 ///嘉峪关市|33|6|2 ///金昌市|34|6|2 ///白银市|35|6|2 ///兰州市|36|6|2 ///酒泉市|37|6|2 ///张掖市|117|6|2 ///武威市|118|6|2 ///庆阳市|135|6|2 ///定西市|136|6|2 ///临夏回族自治州|182|6|2 ///天水市|196|6|2 ///甘南藏族自治州|247|6|2 ///陇南市|256|6|2 ///平凉市|359|6|2 ///广东省|7|1|1 ///东莞市|119|7|2 ///东沙群岛|120|7|2 ///韶关市|137|7|2 ///佛山市|138|7|2 ///茂名市|139|7|2 ///珠海市|140|7|2 ///梅州市|141|7|2 ///中山市|187|7|2 ///清远市|197|7|2 /// [rest of string was truncated]";. /// internal static string baidu_citys { get { return ResourceManager.GetString("baidu_citys", resourceCulture); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_blue_point_big { get { object obj = ResourceManager.GetObject("ico_blue_point_big", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_blue_point_small { get { object obj = ResourceManager.GetObject("ico_blue_point_small", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_bybus { get { object obj = ResourceManager.GetObject("ico_bybus", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_bysubway { get { object obj = ResourceManager.GetObject("ico_bysubway", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_bytransit { get { object obj = ResourceManager.GetObject("ico_bytransit", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_bywalk { get { object obj = ResourceManager.GetObject("ico_bywalk", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_cache { get { object obj = ResourceManager.GetObject("ico_cache", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_cachefirst { get { object obj = ResourceManager.GetObject("ico_cachefirst", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_center_menu { get { object obj = ResourceManager.GetObject("ico_center_menu", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_circle { get { object obj = ResourceManager.GetObject("ico_circle", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_close { get { object obj = ResourceManager.GetObject("ico_close", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_cursor_locate { get { object obj = ResourceManager.GetObject("ico_cursor_locate", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_delete_marker { get { object obj = ResourceManager.GetObject("ico_delete_marker", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_destination { get { object obj = ResourceManager.GetObject("ico_destination", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_distance { get { object obj = ResourceManager.GetObject("ico_distance", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_driving_blue { get { object obj = ResourceManager.GetObject("ico_driving_blue", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_driving_gray { get { object obj = ResourceManager.GetObject("ico_driving_gray", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_eat { get { object obj = ResourceManager.GetObject("ico_eat", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_edit_marker { get { object obj = ResourceManager.GetObject("ico_edit_marker", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_end_menu { get { object obj = ResourceManager.GetObject("ico_end_menu", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_enlarge_menu { get { object obj = ResourceManager.GetObject("ico_enlarge_menu", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_exchange { get { object obj = ResourceManager.GetObject("ico_exchange", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_happy { get { object obj = ResourceManager.GetObject("ico_happy", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_hotel { get { object obj = ResourceManager.GetObject("ico_hotel", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_leisure { get { object obj = ResourceManager.GetObject("ico_leisure", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_life { get { object obj = ResourceManager.GetObject("ico_life", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_line { get { object obj = ResourceManager.GetObject("ico_line", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_location { get { object obj = ResourceManager.GetObject("ico_location", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_mapshot { get { object obj = ResourceManager.GetObject("ico_mapshot", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_marker { get { object obj = ResourceManager.GetObject("ico_marker", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_narrow_menu { get { object obj = ResourceManager.GetObject("ico_narrow_menu", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_poi_logo { get { object obj = ResourceManager.GetObject("ico_poi_logo", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_polygon { get { object obj = ResourceManager.GetObject("ico_polygon", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_rectangle { get { object obj = ResourceManager.GetObject("ico_rectangle", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_red_point_big { get { object obj = ResourceManager.GetObject("ico_red_point_big", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_red_point_small { get { object obj = ResourceManager.GetObject("ico_red_point_small", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_removedrawing_menu { get { object obj = ResourceManager.GetObject("ico_removedrawing_menu", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_removemark_menu { get { object obj = ResourceManager.GetObject("ico_removemark_menu", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_route_end { get { object obj = ResourceManager.GetObject("ico_route_end", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_route_start { get { object obj = ResourceManager.GetObject("ico_route_start", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_sateshot { get { object obj = ResourceManager.GetObject("ico_sateshot", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_screenshot { get { object obj = ResourceManager.GetObject("ico_screenshot", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_search { get { object obj = ResourceManager.GetObject("ico_search", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_search_cinema { get { object obj = ResourceManager.GetObject("ico_search_cinema", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_search_eat { get { object obj = ResourceManager.GetObject("ico_search_eat", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_search_hotel { get { object obj = ResourceManager.GetObject("ico_search_hotel", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_search_in_bound { get { object obj = ResourceManager.GetObject("ico_search_in_bound", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_select { get { object obj = ResourceManager.GetObject("ico_select", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_server { get { object obj = ResourceManager.GetObject("ico_server", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_service { get { object obj = ResourceManager.GetObject("ico_service", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_setmarker { get { object obj = ResourceManager.GetObject("ico_setmarker", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_source { get { object obj = ResourceManager.GetObject("ico_source", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_start_menu { get { object obj = ResourceManager.GetObject("ico_start_menu", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_strange_point { get { object obj = ResourceManager.GetObject("ico_strange_point", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_transit_blue { get { object obj = ResourceManager.GetObject("ico_transit_blue", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_transit_gray { get { object obj = ResourceManager.GetObject("ico_transit_gray", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_travel { get { object obj = ResourceManager.GetObject("ico_travel", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_walking_blue { get { object obj = ResourceManager.GetObject("ico_walking_blue", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_walking_gray { get { object obj = ResourceManager.GetObject("ico_walking_gray", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ico_where_menu { get { object obj = ResourceManager.GetObject("ico_where_menu", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } } } ================================================ FILE: BMap.NET.WindowsForm/Properties/BMap.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ..\Resources\baidu_citys.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 ..\Resources\ico_blue_point_big.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_blue_point_small.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_bybus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_bysubway.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_bytransit.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_bywalk.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_cache.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_cachefirst.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_center_menu.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_circle.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_close.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_cursor_locate.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_delete_marker.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_destination.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_distance.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_driving_blue.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_driving_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_eat.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_edit_marker.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_end_menu.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_enlarge_menu.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_exchange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_happy.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_hotel.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_leisure.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_life.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_location.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_mapshot.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_marker.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_narrow_menu.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_poi_logo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_polygon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_rectangle.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_red_point_big.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_red_point_small.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_removedrawing_menu.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_removemark_menu.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_route_end.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_route_start.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_sateshot.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_screenshot.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_search.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_search_cinema.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_search_eat.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_search_hotel.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_search_in_bound.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_select.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_server.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_service.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_setmarker.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_source.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_start_menu.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_strange_point.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_transit_blue.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_transit_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_travel.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_walking_blue.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_walking_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\ico_where_menu.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ================================================ FILE: BMap.NET.WindowsForm/Properties/Resources.Designer.cs ================================================ //------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.18444 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace BMap.NET.WindowsForm.Properties { using System; /// /// A strongly-typed resource class, for looking up localized strings, etc. /// // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BMap.NET.WindowsForm.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } } ================================================ FILE: BMap.NET.WindowsForm/Properties/Resources.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ================================================ FILE: BMap.NET.WindowsForm/Resources/baidu_citys.txt ================================================ 中国|1||0 黑龙江省|2|1|1 大兴安岭地区|38|2|2 黑河市|39|2|2 伊春市|40|2|2 齐齐哈尔市|41|2|2 佳木斯市|42|2|2 鹤岗市|43|2|2 绥化市|44|2|2 双鸭山市|45|2|2 鸡西市|46|2|2 七台河市|47|2|2 哈尔滨市|48|2|2 牡丹江市|49|2|2 大庆市|50|2|2 甘肃省|6|1|1 嘉峪关市|33|6|2 金昌市|34|6|2 白银市|35|6|2 兰州市|36|6|2 酒泉市|37|6|2 张掖市|117|6|2 武威市|118|6|2 庆阳市|135|6|2 定西市|136|6|2 临夏回族自治州|182|6|2 天水市|196|6|2 甘南藏族自治州|247|6|2 陇南市|256|6|2 平凉市|359|6|2 广东省|7|1|1 东莞市|119|7|2 东沙群岛|120|7|2 韶关市|137|7|2 佛山市|138|7|2 茂名市|139|7|2 珠海市|140|7|2 梅州市|141|7|2 中山市|187|7|2 清远市|197|7|2 湛江市|198|7|2 阳江市|199|7|2 河源市|200|7|2 潮州市|201|7|2 广州市|257|7|2 云浮市|258|7|2 揭阳市|259|7|2 惠州市|301|7|2 江门市|302|7|2 汕头市|303|7|2 肇庆市|338|7|2 汕尾市|339|7|2 深圳市|340|7|2 山东省|8|1|1 莱芜市|124|8|2 枣庄市|172|8|2 日照市|173|8|2 东营市|174|8|2 威海市|175|8|2 临沂市|234|8|2 滨州市|235|8|2 青岛市|236|8|2 济宁市|286|8|2 潍坊市|287|8|2 济南市|288|8|2 泰安市|325|8|2 烟台市|326|8|2 菏泽市|353|8|2 淄博市|354|8|2 聊城市|366|8|2 德州市|372|8|2 吉林省|9|1|1 白城市|51|9|2 松原市|52|9|2 长春市|53|9|2 延边朝鲜族自治州|54|9|2 吉林市|55|9|2 四平市|56|9|2 白山市|57|9|2 通化市|165|9|2 辽源市|183|9|2 山西省|10|1|1 太原市|176|10|2 朔州市|237|10|2 晋中市|238|10|2 晋城市|290|10|2 吕梁市|327|10|2 运城市|328|10|2 大同市|355|10|2 长治市|356|10|2 阳泉市|357|10|2 忻州市|367|10|2 临汾市|368|10|2 青海省|11|1|1 海西蒙古族藏族自治州|65|11|2 西宁市|66|11|2 海北藏族自治州|67|11|2 海南藏族自治州|68|11|2 海东地区|69|11|2 黄南藏族自治州|70|11|2 玉树藏族自治州|71|11|2 果洛藏族自治州|72|11|2 新疆维吾尔自治区|12|1|1 和田地区|82|12|2 喀什地区|83|12|2 克孜勒苏柯尔克孜自治州|84|12|2 阿克苏地区|85|12|2 巴音郭楞蒙古自治州|86|12|2 博尔塔拉蒙古自治州|88|12|2 吐鲁番地区|89|12|2 伊犁哈萨克自治州|90|12|2 哈密地区|91|12|2 乌鲁木齐市|92|12|2 昌吉回族自治州|93|12|2 塔城地区|94|12|2 克拉玛依市|95|12|2 阿勒泰地区|96|12|2 阿拉尔市|731|12|2 石河子市|770|12|2 五家渠市|789|12|2 图木舒克市|792|12|2 西藏自治区|13|1|1 山南地区|97|13|2 林芝地区|98|13|2 昌都地区|99|13|2 拉萨市|100|13|2 那曲地区|101|13|2 日喀则地区|102|13|2 阿里地区|103|13|2 湖北省|15|1|1 鄂州市|122|15|2 襄阳市|156|15|2 荆州市|157|15|2 十堰市|216|15|2 荆门市|217|15|2 武汉市|218|15|2 宜昌市|270|15|2 黄冈市|271|15|2 孝感市|310|15|2 黄石市|311|15|2 咸宁市|362|15|2 随州市|371|15|2 恩施土家族苗族自治州|373|15|2 潜江市|1293|15|2 仙桃市|1713|15|2 天门市|2654|15|2 神农架林区|2734|15|2 福建省|16|1|1 南平市|133|16|2 泉州市|134|16|2 宁德市|192|16|2 龙岩市|193|16|2 厦门市|194|16|2 莆田市|195|16|2 三明市|254|16|2 漳州市|255|16|2 福州市|300|16|2 广西壮族自治区|17|1|1 桂林市|142|17|2 河池市|143|17|2 崇左市|144|17|2 钦州市|145|17|2 来宾市|202|17|2 百色市|203|17|2 防城港市|204|17|2 贺州市|260|17|2 南宁市|261|17|2 北海市|295|17|2 梧州市|304|17|2 柳州市|305|17|2 贵港市|341|17|2 玉林市|361|17|2 江苏省|18|1|1 镇江市|160|18|2 南通市|161|18|2 淮安市|162|18|2 盐城市|223|18|2 苏州市|224|18|2 泰州市|276|18|2 宿迁市|277|18|2 南京市|315|18|2 徐州市|316|18|2 无锡市|317|18|2 扬州市|346|18|2 连云港市|347|18|2 常州市|348|18|2 辽宁省|19|1|1 沈阳市|58|19|2 阜新市|59|19|2 铁岭市|60|19|2 锦州市|166|19|2 大连市|167|19|2 抚顺市|184|19|2 本溪市|227|19|2 盘锦市|228|19|2 朝阳市|280|19|2 营口市|281|19|2 丹东市|282|19|2 葫芦岛市|319|19|2 鞍山市|320|19|2 辽阳市|351|19|2 宁夏回族自治区|20|1|1 中卫市|181|20|2 固原市|246|20|2 吴忠市|322|20|2 石嘴山市|335|20|2 银川市|360|20|2 海南省|21|1|1 三亚市|121|21|2 海口市|125|21|2 定安县|1214|21|2 儋州市|1215|21|2 万宁市|1216|21|2 保亭黎族苗族自治县|1217|21|2 西沙群岛|1218|21|2 中沙群岛|1498|21|2 南沙群岛|1515|21|2 屯昌县|1641|21|2 昌江黎族自治县|1642|21|2 陵水黎族自治县|1643|21|2 五指山市|1644|21|2 琼中黎族苗族自治县|2031|21|2 乐东黎族自治县|2032|21|2 临高县|2033|21|2 琼海市|2358|21|2 白沙黎族自治县|2359|21|2 东方市|2634|21|2 澄迈县|2757|21|2 文昌市|2758|21|2 内蒙古自治区|22|1|1 呼伦贝尔市|61|22|2 兴安盟|62|22|2 锡林郭勒盟|63|22|2 通辽市|64|22|2 乌海市|123|22|2 乌兰察布市|168|22|2 巴彦淖尔市|169|22|2 包头市|229|22|2 阿拉善盟|230|22|2 鄂尔多斯市|283|22|2 赤峰市|297|22|2 呼和浩特市|321|22|2 安徽省|23|1|1 蚌埠市|126|23|2 合肥市|127|23|2 阜阳市|128|23|2 芜湖市|129|23|2 安庆市|130|23|2 亳州市|188|23|2 滁州市|189|23|2 宣城市|190|23|2 淮南市|250|23|2 巢湖市|251|23|2 黄山市|252|23|2 淮北市|253|23|2 六安市|298|23|2 池州市|299|23|2 铜陵市|337|23|2 马鞍山市|358|23|2 宿州市|370|23|2 贵州省|24|1|1 贵阳市|146|24|2 六盘水市|147|24|2 铜仁地区|205|24|2 毕节地区|206|24|2 遵义市|262|24|2 安顺市|263|24|2 黔南布依族苗族自治州|306|24|2 黔东南苗族侗族自治州|342|24|2 黔西南布依族苗族自治州|343|24|2 河北省|25|1|1 秦皇岛市|148|25|2 沧州市|149|25|2 石家庄市|150|25|2 邯郸市|151|25|2 廊坊市|191|25|2 承德市|207|25|2 衡水市|208|25|2 张家口市|264|25|2 唐山市|265|25|2 邢台市|266|25|2 保定市|307|25|2 湖南省|26|1|1 长沙市|158|26|2 衡阳市|159|26|2 常德市|219|26|2 岳阳市|220|26|2 娄底市|221|26|2 株洲市|222|26|2 益阳市|272|26|2 邵阳市|273|26|2 湘西土家族苗族自治州|274|26|2 郴州市|275|26|2 张家界市|312|26|2 湘潭市|313|26|2 永州市|314|26|2 怀化市|363|26|2 陕西省|27|1|1 渭南市|170|27|2 宝鸡市|171|27|2 榆林市|231|27|2 铜川市|232|27|2 西安市|233|27|2 延安市|284|27|2 商洛市|285|27|2 咸阳市|323|27|2 安康市|324|27|2 汉中市|352|27|2 云南省|28|1|1 昆明市|104|28|2 楚雄彝族自治州|105|28|2 玉溪市|106|28|2 红河哈尼族彝族自治州|107|28|2 普洱市|108|28|2 西双版纳傣族自治州|109|28|2 临沧市|110|28|2 大理白族自治州|111|28|2 保山市|112|28|2 怒江傈僳族自治州|113|28|2 丽江市|114|28|2 迪庆藏族自治州|115|28|2 德宏傣族景颇族自治州|116|28|2 文山壮族苗族自治州|177|28|2 曲靖市|249|28|2 昭通市|336|28|2 浙江省|29|1|1 温州市|178|29|2 杭州市|179|29|2 宁波市|180|29|2 衢州市|243|29|2 台州市|244|29|2 舟山市|245|29|2 丽水市|292|29|2 绍兴市|293|29|2 湖州市|294|29|2 金华市|333|29|2 嘉兴市|334|29|2 河南省|30|1|1 新乡市|152|30|2 洛阳市|153|30|2 商丘市|154|30|2 许昌市|155|30|2 濮阳市|209|30|2 开封市|210|30|2 焦作市|211|30|2 三门峡市|212|30|2 平顶山市|213|30|2 信阳市|214|30|2 鹤壁市|215|30|2 安阳市|267|30|2 郑州市|268|30|2 驻马店市|269|30|2 周口市|308|30|2 南阳市|309|30|2 漯河市|344|30|2 济源市|1277|30|2 江西省|31|1|1 南昌市|163|31|2 新余市|164|31|2 景德镇市|225|31|2 抚州市|226|31|2 宜春市|278|31|2 鹰潭市|279|31|2 吉安市|318|31|2 九江市|349|31|2 萍乡市|350|31|2 上饶市|364|31|2 赣州市|365|31|2 四川省|32|1|1 甘孜藏族自治州|73|32|2 德阳市|74|32|2 成都市|75|32|2 雅安市|76|32|2 眉山市|77|32|2 自贡市|78|32|2 乐山市|79|32|2 凉山彝族自治州|80|32|2 攀枝花市|81|32|2 阿坝藏族羌族自治州|185|32|2 宜宾市|186|32|2 巴中市|239|32|2 绵阳市|240|32|2 广安市|241|32|2 资阳市|242|32|2 内江市|248|32|2 南充市|291|32|2 广元市|329|32|2 遂宁市|330|32|2 泸州市|331|32|2 达州市|369|32|2 北京市|131|1|2 怀柔区|1115|131|3 通州区|1116|131|3 门头沟区|1117|131|3 西城区|1118|131|3 延庆县|1548|131|3 石景山区|1550|131|3 东城区|1551|131|3 大兴区|1552|131|3 密云县|1898|131|3 顺义区|1959|131|3 海淀区|1960|131|3 昌平区|2304|131|3 丰台区|2305|131|3 平谷区|2507|131|3 房山区|2603|131|3 朝阳区|2898|131|3 重庆市|132|1|2 奉节县|1119|132|3 开县|1120|132|3 忠县|1121|132|3 潼南县|1122|132|3 彭水苗族土家族自治县|1123|132|3 涪陵区|1124|132|3 北碚区|1125|132|3 永川区|1126|132|3 万盛区|1127|132|3 秀山土家族苗族自治县|1128|132|3 九龙坡区|1129|132|3 云阳县|1553|132|3 梁平县|1554|132|3 合川区|1555|132|3 丰都县|1556|132|3 长寿区|1557|132|3 沙坪坝区|1558|132|3 荣昌县|1559|132|3 酉阳土家族苗族自治县|1560|132|3 南川区|1561|132|3 江津区|1562|132|3 南岸区|1563|132|3 城口县|1900|132|3 万州区|1961|132|3 渝北区|1962|132|3 璧山县|1963|132|3 大足县|1964|132|3 黔江区|1965|132|3 武隆县|1966|132|3 綦江县|1967|132|3 垫江县|1968|132|3 巫溪县|1969|132|3 渝中区|1970|132|3 大渡口区|1971|132|3 石柱土家族自治县|2306|132|3 铜梁县|2307|132|3 巴南区|2308|132|3 巫山县|2523|132|3 江北区|2605|132|3 双桥区|2606|132|3 上海市|289|1|2 宝山区|1422|289|3 闵行区|1423|289|3 金山区|1514|289|3 杨浦区|1839|289|3 普陀区|1840|289|3 松江区|1841|289|3 卢湾区|1842|289|3 浦东新区|2183|289|3 长宁区|2184|289|3 奉贤区|2294|289|3 虹口区|2466|289|3 徐汇区|2467|289|3 闸北区|2694|289|3 嘉定区|2793|289|3 静安区|2826|289|3 青浦区|2892|289|3 黄浦区|2896|289|3 崇明县|2908|289|3 天津市|332|1|2 北辰区|1454|332|3 河西区|1455|332|3 蓟县|1481|332|3 宁河县|1867|332|3 红桥区|1868|332|3 和平区|1869|332|3 静海县|1870|332|3 西青区|2206|332|3 宝坻区|2207|332|3 东丽区|2481|332|3 南开区|2482|332|3 河北区|2700|332|3 津南区|2701|332|3 河东区|2827|332|3 武清区|2899|332|3 滨海新区|8336|332|3 澳门特别行政区|2911|1|2 氹仔岛|2915|2911|3 澳门半岛|2916|2911|3 路氹城|2917|2911|3 路环岛|2918|2911|3 香港特别行政区|2912|1|2 西贡区|2913|2912|3 离岛区|2914|2912|3 屯门区|2919|2912|3 元朗区|2920|2912|3 荃湾区|2921|2912|3 北区|2922|2912|3 大埔区|2923|2912|3 沙田区|2924|2912|3 葵青区|2925|2912|3 九龙城区|2926|2912|3 深水埗区|2927|2912|3 黄大仙区|2928|2912|3 南区|2929|2912|3 中西区|2930|2912|3 湾仔区|2931|2912|3 东区|2932|2912|3 观塘区|2933|2912|3 油尖旺区|2934|2912|3 台湾省|9000|1|1 桃园市|9001|9000|2 台北市|9002|9000|2 南投县|9003|9000|2 嘉义市|9004|9000|2 彰化县|9005|9000|2 新竹县|9006|9000|2 澎湖县|9007|9000|2 台东县|9008|9000|2 宜兰县|9009|9000|2 新北市|9010|9000|2 基隆市|9011|9000|2 屏东县|9012|9000|2 嘉义县|9013|9000|2 云林县|9014|9000|2 花莲县|9015|9000|2 台南市|9016|9000|2 台中市|9017|9000|2 新竹市|9018|9000|2 高雄市|9019|9000|2 苗栗县|9020|9000|2 ================================================ FILE: BMap.NET.WindowsForm/RouteType.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BMap.NET.WindowsForm { /// /// 地图中导航路线类型 /// public enum RouteType { /// /// 公交 /// Transit, /// /// 驾车 /// Driving, /// /// 步行 /// Walking } } ================================================ FILE: BMap.NET.WinformDemo/BMap.NET.WinformDemo.csproj ================================================  Debug x86 8.0.30703 2.0 {46DF801A-B0F3-4050-947E-90EB0649A31D} WinExe Properties BMap.NET.WinformDemo BMap.NET.WinformDemo v4.0 512 x86 true full false bin\Debug\ DEBUG;TRACE prompt 4 x86 pdbonly true bin\Release\ TRACE prompt 4 ..\BMap.NET\libs\Newtonsoft.Json.dll Form MainForm.cs MainForm.cs ResXFileCodeGenerator Resources.Designer.cs Designer True Resources.resx True SettingsSingleFileGenerator Settings.Designer.cs True Settings.settings True {1B32D6FD-3C74-40DC-9D43-102B19D40785} BMap.NET.WindowsForm {AFFEB71C-54B6-4A9B-A445-BB287EDBAC19} BMap.NET ================================================ FILE: BMap.NET.WinformDemo/MainForm.Designer.cs ================================================ namespace BMap.NET.WinformDemo { partial class MainForm { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.bTabControl1 = new BMap.NET.WindowsForm.FunctionalControls.BTabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabPage2 = new System.Windows.Forms.TabPage(); this.bMapControl1 = new BMap.NET.WindowsForm.BMapControl(); this.bPlacesBoard1 = new BMap.NET.WindowsForm.BPlacesBoard(); this.bDirectionBoard1 = new BMap.NET.WindowsForm.BDirectionBoard(); this.bPlaceBox1 = new BMap.NET.WindowsForm.BPlaceBox(); this.button1 = new System.Windows.Forms.Button(); this.bTabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); this.tabPage2.SuspendLayout(); this.SuspendLayout(); // // bTabControl1 // this.bTabControl1.Alignment = System.Windows.Forms.TabAlignment.Left; this.bTabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.bTabControl1.Controls.Add(this.tabPage1); this.bTabControl1.Controls.Add(this.tabPage2); this.bTabControl1.ItemSize = new System.Drawing.Size(70, 70); this.bTabControl1.Location = new System.Drawing.Point(0, 82); this.bTabControl1.Multiline = true; this.bTabControl1.Name = "bTabControl1"; this.bTabControl1.SelectedIndex = 0; this.bTabControl1.Size = new System.Drawing.Size(389, 601); this.bTabControl1.TabIndex = 0; // // tabPage1 // this.tabPage1.Controls.Add(this.bPlacesBoard1); this.tabPage1.Location = new System.Drawing.Point(74, 4); this.tabPage1.Name = "tabPage1"; this.tabPage1.Padding = new System.Windows.Forms.Padding(3); this.tabPage1.Size = new System.Drawing.Size(311, 593); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "搜索"; this.tabPage1.UseVisualStyleBackColor = true; // // tabPage2 // this.tabPage2.Controls.Add(this.bDirectionBoard1); this.tabPage2.Location = new System.Drawing.Point(74, 4); this.tabPage2.Name = "tabPage2"; this.tabPage2.Padding = new System.Windows.Forms.Padding(3); this.tabPage2.Size = new System.Drawing.Size(311, 593); this.tabPage2.TabIndex = 1; this.tabPage2.Text = "路线"; this.tabPage2.UseVisualStyleBackColor = true; // // bMapControl1 // this.bMapControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.bMapControl1.BDirectionBoard = this.bDirectionBoard1; this.bMapControl1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.bMapControl1.BPlaceBox = this.bPlaceBox1; this.bMapControl1.BPlacesBoard = this.bPlacesBoard1; this.bMapControl1.LoadMode = BMap.NET.LoadMapMode.CacheServer; this.bMapControl1.Location = new System.Drawing.Point(388, 83); this.bMapControl1.Mode = BMap.NET.MapMode.Normal; this.bMapControl1.Name = "bMapControl1"; this.bMapControl1.Size = new System.Drawing.Size(632, 599); this.bMapControl1.TabIndex = 1; this.bMapControl1.Zoom = 12; // // bPlacesBoard1 // this.bPlacesBoard1.BDirectionBoard = this.bDirectionBoard1; this.bPlacesBoard1.BMapControl = this.bMapControl1; this.bPlacesBoard1.CurrentCity = null; this.bPlacesBoard1.Dock = System.Windows.Forms.DockStyle.Fill; this.bPlacesBoard1.Location = new System.Drawing.Point(3, 3); this.bPlacesBoard1.Name = "bPlacesBoard1"; this.bPlacesBoard1.Size = new System.Drawing.Size(305, 587); this.bPlacesBoard1.TabIndex = 0; // // bDirectionBoard1 // this.bDirectionBoard1.BackColor = System.Drawing.Color.White; this.bDirectionBoard1.BMapControl = this.bMapControl1; this.bDirectionBoard1.BPlacesBoard = this.bPlacesBoard1; this.bDirectionBoard1.CurrentCity = null; this.bDirectionBoard1.Dock = System.Windows.Forms.DockStyle.Fill; this.bDirectionBoard1.Location = new System.Drawing.Point(3, 3); this.bDirectionBoard1.Name = "bDirectionBoard1"; this.bDirectionBoard1.Size = new System.Drawing.Size(305, 587); this.bDirectionBoard1.TabIndex = 0; // // bPlaceBox1 // this.bPlaceBox1.BPlacesBoard = this.bPlacesBoard1; this.bPlaceBox1.CurrentCity = null; this.bPlaceBox1.Enter2Search = true; this.bPlaceBox1.InputFont = new System.Drawing.Font("Microsoft YaHei", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.bPlaceBox1.Location = new System.Drawing.Point(12, 26); this.bPlaceBox1.Name = "bPlaceBox1"; this.bPlaceBox1.QueryText = ""; this.bPlaceBox1.Size = new System.Drawing.Size(318, 28); this.bPlaceBox1.TabIndex = 2; // // button1 // this.button1.Location = new System.Drawing.Point(336, 25); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 30); this.button1.TabIndex = 3; this.button1.Text = "搜索"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1021, 683); this.Controls.Add(this.button1); this.Controls.Add(this.bPlaceBox1); this.Controls.Add(this.bMapControl1); this.Controls.Add(this.bTabControl1); this.Name = "MainForm"; this.Text = "BMap.NET Demo"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.bTabControl1.ResumeLayout(false); this.tabPage1.ResumeLayout(false); this.tabPage2.ResumeLayout(false); this.ResumeLayout(false); } #endregion private WindowsForm.FunctionalControls.BTabControl bTabControl1; private System.Windows.Forms.TabPage tabPage1; private WindowsForm.BPlacesBoard bPlacesBoard1; private System.Windows.Forms.TabPage tabPage2; private WindowsForm.BDirectionBoard bDirectionBoard1; private WindowsForm.BMapControl bMapControl1; private WindowsForm.BPlaceBox bPlaceBox1; private System.Windows.Forms.Button button1; } } ================================================ FILE: BMap.NET.WinformDemo/MainForm.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace BMap.NET.WinformDemo { public partial class MainForm : Form { public MainForm() { InitializeComponent(); } /// /// 点击搜索 /// /// /// private void button1_Click(object sender, EventArgs e) { bPlaceBox1.StartSearch(); } } } ================================================ FILE: BMap.NET.WinformDemo/MainForm.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ================================================ FILE: BMap.NET.WinformDemo/Program.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; namespace BMap.NET.WinformDemo { static class Program { /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); } } } ================================================ FILE: BMap.NET.WinformDemo/Properties/AssemblyInfo.cs ================================================ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("BMap.NET.WinformDemo")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BMap.NET.WinformDemo")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("7bcd7660-e140-43a9-a71c-997c2444f135")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] ================================================ FILE: BMap.NET.WinformDemo/Properties/Resources.Designer.cs ================================================ //------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.18444 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace BMap.NET.WinformDemo.Properties { using System; /// /// A strongly-typed resource class, for looking up localized strings, etc. /// // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BMap.NET.WinformDemo.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } } ================================================ FILE: BMap.NET.WinformDemo/Properties/Resources.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ================================================ FILE: BMap.NET.WinformDemo/Properties/Settings.Designer.cs ================================================ //------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.18444 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace BMap.NET.WinformDemo.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); public static Settings Default { get { return defaultInstance; } } } } ================================================ FILE: BMap.NET.WinformDemo/Properties/Settings.settings ================================================  ================================================ FILE: BMap.NET.WinformDemo/app.config ================================================ ================================================ FILE: BMap.NET.sln ================================================  Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMap.NET", "BMap.NET\BMap.NET.csproj", "{AFFEB71C-54B6-4A9B-A445-BB287EDBAC19}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMap.NET.WindowsForm", "BMap.NET.WindowsForm\BMap.NET.WindowsForm.csproj", "{1B32D6FD-3C74-40DC-9D43-102B19D40785}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMap.NET.WinformDemo", "BMap.NET.WinformDemo\BMap.NET.WinformDemo.csproj", "{46DF801A-B0F3-4050-947E-90EB0649A31D}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMap.NET.DownloadDemo", "BMap.NET.DownloadDemo\BMap.NET.DownloadDemo.csproj", "{7341A85E-0A31-479A-B79E-A8A166DFD649}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|Mixed Platforms = Debug|Mixed Platforms Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU Release|Mixed Platforms = Release|Mixed Platforms Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {AFFEB71C-54B6-4A9B-A445-BB287EDBAC19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AFFEB71C-54B6-4A9B-A445-BB287EDBAC19}.Debug|Any CPU.Build.0 = Debug|Any CPU {AFFEB71C-54B6-4A9B-A445-BB287EDBAC19}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {AFFEB71C-54B6-4A9B-A445-BB287EDBAC19}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {AFFEB71C-54B6-4A9B-A445-BB287EDBAC19}.Debug|x86.ActiveCfg = Debug|Any CPU {AFFEB71C-54B6-4A9B-A445-BB287EDBAC19}.Release|Any CPU.ActiveCfg = Release|Any CPU {AFFEB71C-54B6-4A9B-A445-BB287EDBAC19}.Release|Any CPU.Build.0 = Release|Any CPU {AFFEB71C-54B6-4A9B-A445-BB287EDBAC19}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {AFFEB71C-54B6-4A9B-A445-BB287EDBAC19}.Release|Mixed Platforms.Build.0 = Release|Any CPU {AFFEB71C-54B6-4A9B-A445-BB287EDBAC19}.Release|x86.ActiveCfg = Release|Any CPU {1B32D6FD-3C74-40DC-9D43-102B19D40785}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1B32D6FD-3C74-40DC-9D43-102B19D40785}.Debug|Any CPU.Build.0 = Debug|Any CPU {1B32D6FD-3C74-40DC-9D43-102B19D40785}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {1B32D6FD-3C74-40DC-9D43-102B19D40785}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {1B32D6FD-3C74-40DC-9D43-102B19D40785}.Debug|x86.ActiveCfg = Debug|Any CPU {1B32D6FD-3C74-40DC-9D43-102B19D40785}.Release|Any CPU.ActiveCfg = Release|Any CPU {1B32D6FD-3C74-40DC-9D43-102B19D40785}.Release|Any CPU.Build.0 = Release|Any CPU {1B32D6FD-3C74-40DC-9D43-102B19D40785}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {1B32D6FD-3C74-40DC-9D43-102B19D40785}.Release|Mixed Platforms.Build.0 = Release|Any CPU {1B32D6FD-3C74-40DC-9D43-102B19D40785}.Release|x86.ActiveCfg = Release|Any CPU {46DF801A-B0F3-4050-947E-90EB0649A31D}.Debug|Any CPU.ActiveCfg = Debug|x86 {46DF801A-B0F3-4050-947E-90EB0649A31D}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 {46DF801A-B0F3-4050-947E-90EB0649A31D}.Debug|Mixed Platforms.Build.0 = Debug|x86 {46DF801A-B0F3-4050-947E-90EB0649A31D}.Debug|x86.ActiveCfg = Debug|x86 {46DF801A-B0F3-4050-947E-90EB0649A31D}.Debug|x86.Build.0 = Debug|x86 {46DF801A-B0F3-4050-947E-90EB0649A31D}.Release|Any CPU.ActiveCfg = Release|x86 {46DF801A-B0F3-4050-947E-90EB0649A31D}.Release|Mixed Platforms.ActiveCfg = Release|x86 {46DF801A-B0F3-4050-947E-90EB0649A31D}.Release|Mixed Platforms.Build.0 = Release|x86 {46DF801A-B0F3-4050-947E-90EB0649A31D}.Release|x86.ActiveCfg = Release|x86 {46DF801A-B0F3-4050-947E-90EB0649A31D}.Release|x86.Build.0 = Release|x86 {7341A85E-0A31-479A-B79E-A8A166DFD649}.Debug|Any CPU.ActiveCfg = Debug|x86 {7341A85E-0A31-479A-B79E-A8A166DFD649}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 {7341A85E-0A31-479A-B79E-A8A166DFD649}.Debug|Mixed Platforms.Build.0 = Debug|x86 {7341A85E-0A31-479A-B79E-A8A166DFD649}.Debug|x86.ActiveCfg = Debug|x86 {7341A85E-0A31-479A-B79E-A8A166DFD649}.Debug|x86.Build.0 = Debug|x86 {7341A85E-0A31-479A-B79E-A8A166DFD649}.Release|Any CPU.ActiveCfg = Release|x86 {7341A85E-0A31-479A-B79E-A8A166DFD649}.Release|Mixed Platforms.ActiveCfg = Release|x86 {7341A85E-0A31-479A-B79E-A8A166DFD649}.Release|Mixed Platforms.Build.0 = Release|x86 {7341A85E-0A31-479A-B79E-A8A166DFD649}.Release|x86.ActiveCfg = Release|x86 {7341A85E-0A31-479A-B79E-A8A166DFD649}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal ================================================ FILE: README.md ================================================ # BMap.NET a library for operating baidu maps,encapsulating Web Service API with C# language,also contains a list of controls which can be used in winform. see more here(chinese blog): [my cnblogs][0] --- ## overview the source code contains 3 projects: `BMap.NET`,`BMap.NET.WindowsForm` and `BMap.NET.WinformDemo`. - BMap.NET encapsulates web service api, which return JObject(json.net) object. - BMap.NET.WindowsForm contains some controls which can be used in winform.for example: `BMapControl` which can display baidu map, `BDirectionBoard` is responsible for navigation, etc. - BMap.NET.WinformDemo a demo showing how to use controls in BMap.NET.WindowsForm. some screenshots below: 1. autocomplete search box ![][2] 2. POIs search ![][3] 3. direction ![][4] 4. add markers and drawing ![][5] 5. search in bounds ![][6] 6. select city ![][7] ## can do and cant do can do in **BMap.NET**: - Search places by city, bounds, circle(nearby); - Place suggestion; - Geocoding; - Direction(transit, driving, walking); - Located by IP; - Coordinates transofrm; can do in **BMap.NET.WindowsForm**: - Display Baidu Map(drag, move, zoom etc); - Select map mode(normal, satellite, roadnet); - Set map load mode(cache, cache_first, server); - Drawing shapes in map; - Measturing distance; - Add Markers in map; - Save map to image (screenshot by selectting a region); - Autocomplete search box; - Direction control; - Places list control; cant do: - ~~3D map~~; - ~~Street view~~; - ~~Direction according to real-time traffic conditions~~; In addition, this project is used only for Baidu map, so the `Extension ability` is so so. you can modify the source code to meet your needs. ## how to use `BMap.NET` is very simple to use(just some interfaces to get json data from baidu map server). `BMap.NET.WindowsForm` only opens 5 controls: `BPlaceBox`, `BMapControl`, `BPlacesBoard`, `BDirectionBoard` and the `BTabControl`. you can drag them into form desinger and set few properties to let them build associations like this: 1. BPlaceBox ![][8] 2. BPlacesBoard ![][9] 3. BMapControl ![][10] 4. BDirectionBoard ![][11] **press F5 without any other writed codes.** `BTabControl` is only used as a container which contains `BPlacesBoard` and `BDirectionBoard`. ## thanks my thanks below: 1. baidu map api documents(http://developer.baidu.com/map/index.php?title=webapi) 2. json.net(https://json.codeplex.com/) 3. json visualization(http://www.bejson.com/) **all source code follow the [MIT][1] license.** [0]: http://www.cnblogs.com/xiaozhi_5638/ [1]: https://zh.wikipedia.org/wiki/MIT%E8%A8%B1%E5%8F%AF%E8%AD%89 [2]: https://github.com/sherlockchou86/BMap.NET/blob/master/Asserts/B3.png [3]: https://github.com/sherlockchou86/BMap.NET/blob/master/Asserts/B1.jpg [4]: https://github.com/sherlockchou86/BMap.NET/blob/master/Asserts/B2.jpg [5]: https://github.com/sherlockchou86/BMap.NET/blob/master/Asserts/B4.jpg [6]: https://github.com/sherlockchou86/BMap.NET/blob/master/Asserts/B5.jpg [7]: https://github.com/sherlockchou86/BMap.NET/blob/master/Asserts/B6.jpg [8]: https://github.com/sherlockchou86/BMap.NET/blob/master/Asserts/b14.png [9]: https://github.com/sherlockchou86/BMap.NET/blob/master/Asserts/b12.png [10]: https://github.com/sherlockchou86/BMap.NET/blob/master/Asserts/b13.png [11]: https://github.com/sherlockchou86/BMap.NET/blob/master/Asserts/b15.png ================================================ FILE: licences.txt ================================================ The MIT License (MIT) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. MITԴЭ ȨȨ ȨȨʹáơ޸ġϲ淢ɢȨ/ĸ 豻ӦͬȨΩ Ȩ ижϰȨͱ https://github.com/sherlockchou86