ASP.NET AJAX在MapXtreme2005中的应用实战(1)

来源:互联网 发布:数据库性能 编辑:程序博客网 时间:2024/06/10 18:49

    在ASP.NET AJAX框架中,要实现表格、文本等内容的Ajax局部刷新,可以将GridViewLabel等控件放入到UpdatePanel后,指定触发的事件即可实现局部刷新。

然而,MapXtreme2005中的控件例如:MapControlLayerControlLegendControlZoomBarControl等是不应该放入UpdatePanel中的,MapInfo用其他的方法在这些XtremeMap控件内置了局部刷新的Ajax功能。要实现局部刷新的Ajax功能,你只需要触发事件的按钮放入UpdatePanel中(或制定其触发的事件)即可。

 

    在现在的Web2.0时代,Ajax是不可或缺的,WebGis的开发,Ajax显然也要扮演一个重要的角色。

        MapXtreme2005中的例子程序都是遵循最佳开发实践模式的,因此如果你要开发一个基于MapXtremeAjax WebGis,完全可以借鉴MapXtreme2005自带的实例:MapXtreme.Net AJAXDemo Sample Web Application

    下面的例子就是基于mapxtreme2005Ajax WebGis。实现了某个图元的定时旋转:让小日本在中国的脚下不停的旋转吧。 

 

protected void Timer1_Tick(object sender, EventArgs e)

    {

        Map myMap = GetMapObj();

        if (myMap == null) return;

        MapInfo.Data.Table t = MapInfo.Engine.Session.Current.Catalog.GetTable("world");

        if (t == null)

            return;

        Feature f = MapInfo.Engine.Session.Current.Catalog.SearchForFeature(t, MapInfo.Data.SearchInfoFactory.SearchWhere("Country='Japan'"));

        DPoint dp = new DPoint(f.Geometry.GeometricCentroid.x, f.Geometry.GeometricCentroid.y);

        f.Geometry.GetGeometryEditor().Rotate(dp, 90.0);

        f.Geometry.EditingComplete();

        t.UpdateFeature(f);

        myMap.SetView(f);

    }

 

 

 

原创粉丝点击