文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Mapxtreme2008 Asp.net实现小车移动(轨迹回放)

Mapxtreme2008 Asp.net实现小车移动(轨迹回放)

时间:2011-01-20  来源:北冥子

 protected void Timer1_Tick(object sender, EventArgs e)
    {        /*下面代码可实现点的动态移动,在原来点的基础上经度每次偏移0.5
        Catalog cat = MapInfo.Engine.Session.Current.Catalog;

        MapInfo.Data.Table tbl = MapInfo.Engine.Session.Current.Catalog.GetTable("Animation");
        if (tbl != null)
        {
            //更新点的位置
            tbl.BeginAccess(MapInfo.Data.TableAccessMode.Write);
            foreach (Feature fcar in tbl)
            {
                fcar.Geometry.GetGeometryEditor().OffsetByXY(0.5, 0, MapInfo.Geometry.DistanceUnit.Degree, MapInfo.Geometry.DistanceType.Spherical);               
                fcar.Geometry.EditingComplete();
                fcar.Update();
            }
            tbl.EndAccess();
          */

//将图元移动到指定位置,即实现轨迹回放

//首先在界面设计是在ListBox1与ListBox2中添加8个点的坐标,在定时器中实现动态移动到这八个点的位置
        Catalog cat = MapInfo.Engine.Session.Current.Catalog;

        MapInfo.Data.Table tbl = MapInfo.Engine.Session.Current.Catalog.GetTable("Animation");
        if (tbl != null)
        {
            int i = int.Parse(Label3.Text);
            double dbLon = double.Parse(ListBox1.Items[i].Text);
            double dbLat = double.Parse(ListBox2.Items[i].Text);
            double dbLonOff, dbLatOff;
            DPoint dpt = new DPoint(dbLon,dbLat);

            if (i == 0)
            {
                dbLonOff = dbLon - 118.2377;
                dbLatOff = dbLat - 36.785;
            }
            else
            {
                dbLonOff = dbLon - double.Parse(ListBox1.Items[i-1].Text);
                dbLatOff = dbLat - double.Parse(ListBox2.Items[i-1].Text);
            }            //更新点的位置
            tbl.BeginAccess(MapInfo.Data.TableAccessMode.Write);
            Feature fcar = MapInfo.Engine.Session.Current.Catalog.SearchForFeature(tbl, MapInfo.Data.SearchInfoFactory.SearchWhere("Name='aaaa'"));
            //fcar.Geometry.GetGeometryEditor().OffsetByXY(0.5, 0, MapInfo.Geometry.DistanceUnit.Degree, MapInfo.Geometry.DistanceType.Spherical);
            fcar.Geometry.GetGeometryEditor().OffsetByXY(dbLonOff, dbLatOff, MapInfo.Geometry.DistanceUnit.Degree, MapInfo.Geometry.DistanceType.Spherical);
            fcar.Geometry.EditingComplete();
            fcar.Update();
            tbl.EndAccess();
            i++;
            Label3.Text = i.ToString();
            if (i >= 8)
            {
                Timer1.Enabled = false;
            }
        }

相关阅读 更多 +
排行榜 更多 +
找茬脑洞的世界安卓版

找茬脑洞的世界安卓版

休闲益智 下载
滑板英雄跑酷2手游

滑板英雄跑酷2手游

休闲益智 下载
披萨对对看下载

披萨对对看下载

休闲益智 下载