//前台函数
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();
}