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# Socket
    异步上传文件并获得返回值(完全跨域)
    ASP.NET MVC的Model元数据与Model模板:模板的获取与执行策略
    数值压缩存储方法Varint
    JavaIO知识总结2
    ASP.NET MVC URL重写与优化
    检测是否为HTML5新标签
    Context+ContextScope——这是否可以看作一种设计模式?
    体验vs11 Beta
    选择实现—简单工厂
  • 原文地址:https://www.cnblogs.com/telwanggs/p/4881678.html
Copyright © 2011-2022 走看看