ae显示arcserver的地图服务
acmap可以直接显示arcserver上的地图服务,那ae也应该是可以的。
方法就是创建一个IAGSServerConnection,该接口的ServerObjectNames能获取serverobject的名称,其中就包括Service的名称。可以将IName转换为IMapServer对象,最后创建一个IMapServerLayer来显示。
IAGSServerConnectionFactory connFac = new AGSServerConnectionFactoryClass(); IPropertySet propertySet = new PropertySetClass(); propertySet.SetProperty("machine", serverName); //propertySet.SetProperty("url", serverName); IAGSServerConnection conn = connFac.Open(propertySet, 0); IAGSEnumServerObjectName names = conn.ServerObjectNames; IAGSServerObjectName serviceObjName = null; IAGSServerObjectName temObjName = null; names.Reset(); while ((temObjName = names.Next()) != null) { if (temObjName.Name == serviceName) { serviceObjName = temObjName; break; } } IMapServer mapServer = ((IName)serviceObjName).Open() as IMapServer; IMapServerLayer layer = new MapServerLayerClass(); layer.ServerConnect(serviceObjName, mapServer.DefaultMapName);