• ArcEngine中加载ArcGIS Server地图服务


    代码如下:

    复制代码
    private void addMapServerLayer(object sender, EventArgs e)

     {
                IActiveView pActiveView = m_mapControl.Map as IActiveView;
                IAGSServerObjectName3 pAGSServerObjectName3 = GetAGSServerConnectionName();
                IName name = (IName)pAGSServerObjectName3;
                IMapServer  pMapServer = (IMapServer)name.Open();
                IMapServerLayer pMapServerLayer = new MapServerLayerClass();
                pMapServerLayer.ServerConnect(pAGSServerObjectName3, pMapServer.DefaultMapName);
                ILayer pLayer = pMapServerLayer as ILayer;
                m_mapControl.AddLayer(pLayer, 0);
                pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography , null, null);
    }

    private IAGSServerObjectName3 GetAGSServerConnectionName()
    {
                IAGSServerConnectionName2 agsServerConnectionName = new AGSServerConnectionName() as IAGSServerConnectionName2 ;
                IPropertySet props = new PropertySetClass();
                props.SetProperty("machine", machine_name);
                agsServerConnectionName.ConnectionProperties = props;

                IAGSSer verObjectName3 agsServerObjectName = new AGSServerObjectNameClass();
                agsServerObjectName.Name = server_name;
                agsServerObjectName.Type = "MapServer";
                agsServerObjectName.AGSServerConnectionName = agsServerConnectionName;
                return agsServerObjectName;
    }
    复制代码
  • 相关阅读:
    区间更新+单点查询
    第15题 三个数的和为确定值
    第12题 数字转为罗马数字
    第11题 容器装水问题
    第22章 软件安装:源码与Tarball
    第18章 认识系统服务(daemons)
    第10题 正则表达式匹配(动态规划)
    动态规划
    第6题 ZigZag转换
    第17章 程序管理与SELinux初探
  • 原文地址:https://www.cnblogs.com/telwanggs/p/4881678.html
Copyright © 2020-2023  润新知