zoukankan      html  css  js  c++  java
  • 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;
    }
    复制代码
  • 相关阅读:
    冒泡排序(C#实现)
    CLR 学习笔记:程序集加载和反射(3)
    CLR 学习笔记:程序集加载和反射(2)
    CLR 学习笔记:程序集加载和反射(1)
    Effective C#:使用Conditional特性而不是#if条件编译
    Effective C#:推荐使用is或as操作符而不是强制类型转换
    基于线性探测法的散列表
    红黑树-算法四 实现
    二叉树的中序遍历的思想
    二叉树的删除操作-java
  • 原文地址:https://www.cnblogs.com/telwanggs/p/4881678.html
Copyright © 2011-2022 走看看