/// <summary> /// 加载地图服务 /// </summary> /// <param name="RestURL"></param> public void LoadMapService(string RestURL) { try { IMapServerRESTLayer pRestLayer; pRestLayer = new MapServerRESTLayer(); pRestLayer.Connect(RestURL); mapControl.AddLayer(pRestLayer as ILayer); mapControl.Refresh(); } catch (Exception ex) { throw (ex); } }
/// <summary> /// Adds the specified base map. /// </summary> /// <param name="baseMap">The base map.</param> public static void Add(BaseMapLayer baseMap) { string url = ""; string name = ""; try { switch (baseMap) { case BaseMapLayer.Imagery: url = "http://services.arcgisonline.com/arcgis/rest/services/ESRI_Imagery_World_2D/MapServer"; name = "影像图"; break; default: url = "http://cache1.arcgisonline.cn/arcgis/rest/services/ChinaOnlineCommunity/MapServer"; name = "街区图"; break; } if (BaseMap.IsExists(name)) { return; } MapServerRESTLayer restLayer = new MapServerRESTLayer(); restLayer.Connect(url); //Add the layer to the map. ILayer layer = restLayer as ILayer; layer.Name = name; EnviVars.instance.MapControl.AddLayer(layer, EnviVars.instance.MapControl.LayerCount); Zom2China(); } catch (Exception ex) { throw ex; } }