AE操作Server(3):加载服务
来源:互联网 发布:ui和美工的区别 编辑:程序博客网 时间:2024/04/29 09:54
1.引言
上一篇中介绍的是AE获取Server下的所有服务和服务信息,本篇中将介绍使用AE加载Server服务
2.代码
/// <summary> /// 加载地图服务数据 /// </summary> /// <param name="host">URL</param> /// <param name="model">用户名</param> /// <param name="mapCtrl">地图控件</param> public bool LoadServerToMap(string host, string serviceName, IMapControl3 mapCtrl) { List<IAGSServerObjectName> SGSList = GetUserConnectAGS(host); string name = SGSList[0].Name; string type = SGSList[0].Type; string url = SGSList[0].URL; if (SGSList == null || SGSList.Count <= 0) return false; IMapServerLayer pMapServerLayer = new MapServerLayerClass(); foreach(IAGSServerObjectName objName in SGSList) { if (objName.Name.ToLower().Equals(serviceName.ToLower()) && objName.Type.Equals(ConstHelper.ServiceType)) { IName pName = (IName)objName; IAGSServerObject pServerObject = (IAGSServerObject)pName.Open(); IMapServer pMapServer = (IMapServer)pServerObject; pMapServerLayer.ServerConnect(objName, pMapServer.DefaultMapName); mapCtrl.AddLayer(pMapServerLayer as ILayer); mapCtrl.Refresh(); return true; } } return false; } /// <summary> /// 获取用户连接AGS对象 /// </summary> /// <param name="host"></param> /// <param name="model"></param> /// <returns></returns> public List<IAGSServerObjectName> GetUserConnectAGS(string host) { List<IAGSServerObjectName> AGSList = new List<IAGSServerObjectName>(); IPropertySet propertySet = new PropertySetClass(); propertySet.SetProperty("URL", host); propertySet.SetProperty("USER", string.Empty); propertySet.SetProperty("PASSWORD", string.Empty); propertySet.SetProperty("CONNECTIONMODE", esriAGSConnectionMode.esriAGSConnectionModeConsumer); IAGSServerConnectionName3 pConnectName = new AGSServerConnectionNameClass() as IAGSServerConnectionName3; pConnectName.ConnectionProperties = propertySet; IAGSServerConnection pConnection = ((IName)pConnectName).Open() as IAGSServerConnection; IAGSEnumServerObjectName pServerObjectNames = pConnection.ServerObjectNames; pServerObjectNames.Reset(); IAGSServerObjectName agsServerObjectName = pServerObjectNames.Next(); while (agsServerObjectName != null) { string name = agsServerObjectName.Name; string type = agsServerObjectName.Type; string url = agsServerObjectName.URL; AGSList.Add(agsServerObjectName); agsServerObjectName = pServerObjectNames.Next(); } return AGSList; }
//调用:URL,服务名string host = ServiceHelper.RemoveMapServer(serviceModel.T_URL); bool result = serviceManagerHelper.LoadServerToMap(host, serviceModel.T_Name, (m_Application as IFramework).MapControl);
0 0
- AE操作Server(3):加载服务
- AE操作Server(2):获取Server下的服务
- AE操作Server(4):服务的启停
- AE操作Server(1):连接
- AE调用影像服务
- AE数据加载
- AE数据加载
- AE加载SHP
- AE山歌数据加载
- AE加载各种数据
- AE数据加载
- AE数据加载
- AE加载数据
- AE加载切片【1】
- AE加载切片【1】
- AE加载切片
- AE——要素操作(一) 加载已存在shp文件,并进行增删操作
- AE操作常见问题
- Android日志服务
- redis.exceptions.ResponseError: MOVED 6918
- ROC曲线与AUC计算
- Android实用命令汇总——pm
- java.util —Arrays
- AE操作Server(3):加载服务
- Ubuntu14.04上配置caffe经验总结(含GPU)
- mysql中 now() sysdate() curdate() 的区别
- 快速定位问题——查阅文档
- ubuntu 16 anaconda 下安装 pytgame
- unique_ptr and shared_ptr
- Android实用命令汇总——am
- IAR编译duplicate definitions for IAR报错解决办法
- js判断请求的url是否可访问,支持跨域判断的实现方法