• 用AjaxMethod 方法实现动态加载地图


     

    //前台函数

    function BasicMap() {
        Coolite.AjaxMethods.ShowBasicMap({            //ShowBasicMap为后台地图处理AjaxMethod
        success: function(result) {
            var context='Map1';
            processCallbackResult(result, context);    

          //processCallbackResult是安装目录下ESRI.ADF.System.debug文件中的ESRI自带函数。处理后台返回的结果字符串,并将其展示在页面(包括地图)上。
        });

    }


     

    //后台函数主要实现动态加载地图

    private static int i = 0;

     [AjaxMethod]
        public string ShowBasicMap()
        {
            MapResourceManager1.ResourceItems.Clear();
            MapResourceItem mapResourceItem = new MapResourceItem();

            GISResourceItemDefinition definition = new GISResourceItemDefinition();
            definition.DataSourceDefinition = "http://10.150.38.34/arcgis/services/";
            definition.DataSourceType = "ArcGIS Server Internet";
            definition.ResourceDefinition = "Layers@BaseMap";
            mapResourceItem.Definition = definition;

            ESRI.ArcGIS.ADF.Web.DisplaySettings displaysettings =
                new ESRI.ArcGIS.ADF.Web.DisplaySettings();
            displaysettings.Transparency = 0;
            displaysettings.Visible = true;
            mapResourceItem.Name = "basicmap"+i;
            mapResourceItem.DisplaySettings = displaysettings;
            int n = MapResourceManager1.ResourceItems.Count;
            MapResourceManager1.ResourceItems.Insert(n, mapResourceItem);
            mapResourceItem.InitializeResource();
             Map1.Refresh();
            i++;
            return Map1.CallbackResults.ToString();
            }

     

    一起学习GIS及其二次开发,一起进步!
  • 相关阅读:
    ASIHTTPRequest详解
    UIViewController之间的相互跳转
    IOS延时加载网络图片
    ASI 实现注册方法的小例子(get和post方式)
    NSRange
    NSScanner
    序列化 NSKeyedArchiver,NSPropertyListSerialization
    自定义UITableViewCell
    UITableView去掉分隔符
    ASIHTTPRequest类库简介和使用说明(转)
  • 原文地址:https://www.cnblogs.com/tuncaysanli/p/1419225.html
Copyright © 2020-2023  润新知