zoukankan      html  css  js  c++  java
  • 用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及其二次开发,一起进步!
  • 相关阅读:
    if 语句运用
    c#语言基础
    关于条件运算符的应用
    Could not open Hibernate Session for transaction;
    node to traverse cannot be null!
    Struts2文件下载中文名乱码
    Spring MVC框架下的第一个Hello World程序
    strtus2中的defaultactionref无效的解决方法
    c 笔记
    工具系列1
  • 原文地址:https://www.cnblogs.com/tuncaysanli/p/1419225.html
Copyright © 2011-2022 走看看