电子沙盘数字沙盘M3D GIS虚拟三维大数据人工智能无人机倾斜摄影三维全景建模课程第47课

电子沙盘数字沙盘M3D GIS虚拟三维大数据人工智能无人机倾斜摄影三维全景建模课程第47课

设置system.ini 如下内容
Server=122.112.229.220
user=GisTest
Password=chinamtouch.com

该数据库中只提供 成都市火车南站附近的数据请注意,104.0648,30.61658

SDK中自带了一套 导航系统,用的是比较详细的导航数据,你们懂的,修正了一下在使用互联网服务器时候的一个BUG,请在使用这部分功能时务必下载上面地址中的核心更新包覆盖。 截图如下:

该导航图为切片导航图。年份嘛,你们懂的,另外导航系统为线程异步工作。因需要数据库支持,所以如果你是用的互联网服务器

导航算法得到路径的时间会有所增长,建议是把数据库下载到本地才可以看到真实的导航算法速度。

  导航算法在单独的ShortRoad.dll中(可独立使用,担需要相关数据文件。)导航算法可根据权值进行微调,目前有高速优先和,最短路径两种。

ShortRoad.ShortPath.MyPareant = this.Dispatcher;  //因为导航算法为异步委托+多线程方式完成,需要一个异步委托主对象(静态)。

            ShortRoad.ShortPath.chuslhi(); //初始化数据(静态)

          MyShort = new ShortRoad.ShortPath();

//初始化导航类

            MyShort.OnShortPath += new ShortRoad.ShortPath.PathOver(ShortPath_OnShortPath);

//导航数据回调事件

            MyShort.OnPro += new ShortRoad.ShortPath.ChuLiPro(ShortPath_OnPro);

//导航算法信息事件。

   MyShort.GetShortPath(BeginPoint.X, BeginPoint.Y, EndPoint.X, EndPoint.Y,false);

//获取最短路径:

参数起点经度,纬度,终点经度,纬度,是否启用高速优先。

路径回调事件:

     void ShortPath_OnShortPath(System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<System.Drawing.PointF>> value,System.Windows.Point bx,System.Windows.Point ey)

        {            double Totolength = 0;

            Pareant.PlayPath.Add(new Point3D(BeginPoint.X, BeginPoint.Y, 0));

            foreach (string key in value.Keys)

            {

                Totolength += Convert.ToDouble(key.Split('#')[1].Split(',')[12]);

                foreach (System.Drawing.PointF y1 in value[key])

                {

                    Pareant.PlayPath.Add(new Point3D(y1.X, y1.Y, 0));

                }

            }

}

 

事件参数1:System.Collections.Generic.Dictionary<string,System.Collections.Generic.List<System.Drawing.PointF>>

存放有所有的路径数据 KEY为路径详细信息内容如下(Value中为经纬度数据):

"清江东路#464400 , 49559714 , 1 , 0302 , 130 , 3 , 2 , 1 ,  , 47106369 , 5880354 , 3 , 0.012 , 1 , 1 ,  , 0 , 1 , 0 , 510105 , 510105 , 1 ,  ,  , 5 ,  , 4 , 3 , 11110001110000000000000000000000 , 0 , 0 ,  ,  ,  , 600 ,  , 1 , 1 ,  , 清江东路"

该KEY描述了这条路的所有信息。可参看下表:

 

字段设置

取值范围

注释

含义

名称

类型

1

图幅号

MapID

Char(8)

 

 

 

2

号码

ID

Char(13)

 

Link 号码

 

3

种别代码数

Kind_num

Char(2)

1—4

种别个数

 

4

种别代码(M)

Kind

Char(23)

 

道路等级属性,多个之间用"|"分隔

(1)

 

 

5

 

 

幅宽

 

 

Width

 

 

Char(3)

15

<=3.0m

 

 

(2)

30

(3.0m, 5.5m]

55

(5.5m, 13.0m]

130

>13m

 

 

 

6

 

 

 

通行方向

 

 

 

Direction

 

 

 

Char(1)

0

未调查:默认为双方向都可以通行

 

1

双向:双方向可以通行

 

2

顺方向:单向通行,通行方向为起点到终点

方向

 

3

逆方向:单向通行,通行方向为终点到起点

方向

 

 

 

7

 

 

收费设置

 

 

Toll

 

 

Char(1)

0

未调查

 

 

(3)

 

 

下面上代码,先要引用shortroad.dll

 
  1. ShortRoad.ShortPath.MyPareant = this.Dispatcher; //因为导航算法为异步委托+多线程方式完成,需要一个异步委托主对象(静态)。

  2. ShortRoad.ShortPath.chuslhi(); //初始化数据(静态)

  3. MyShort = new ShortRoad.ShortPath();

  4. //初始化导航类

  5. MyShort.OnShortPath += this.MyShort_OnShortPath;

  6. //导航数据回调事件

  7.  
  8.  
  9. MyShort.OnPro += MyShort_OnPro;

  10. //导航算法信息事件。

 

 
  1. #region 导航系统

  2. System.Windows.Point FirstJW= new System.Windows.Point();

  3. System.Windows.Point secJW = new System.Windows.Point();

  4. private void Button_Click_15(object sender, RoutedEventArgs e)

  5. {

  6. gis3d.State = GisLib.WindowsMT.GisState.获取经纬度;

  7. gis3d.GetJWEvent += Gis3d_GetJWEvent2;

  8.  
  9. }

  10.  
  11. private void Gis3d_GetJWEvent2(System.Windows.Media.Media3D.Point3D value)

  12. {

  13. gis3d.GetJWEvent -= Gis3d_GetJWEvent2;

  14. FirstJW = new System.Windows.Point(value.X, value.Y);

  15. gis3d.State = GisLib.WindowsMT.GisState.漫游;

  16. }

  17.  
  18. private void Button_Click_16(object sender, RoutedEventArgs e)

  19. {

  20. gis3d.State = GisLib.WindowsMT.GisState.获取经纬度;

  21. gis3d.GetJWEvent += Gis3d_GetJWEvent3;

  22. }

  23.  
  24. private void Gis3d_GetJWEvent3(System.Windows.Media.Media3D.Point3D value)

  25. {

  26. gis3d.GetJWEvent -= Gis3d_GetJWEvent2;

  27. secJW = new System.Windows.Point(value.X, value.Y);

  28. MyShort.GetShortPath(FirstJW.X, FirstJW.Y, secJW.X, secJW.Y, true);

  29. gis3d.State = GisLib.WindowsMT.GisState.漫游;

  30. }

  31.  
  32. private void MyShort_OnPro(string value)

  33. {

  34. FirstShort.Content = value;

  35. }

  36.  
  37. private void MyShort_OnShortPath(Dictionary<string, List<PointF>> value, System.Windows.Point mbegin, System.Windows.Point mend)

  38. {

  39. if (value == null)

  40. return;

  41. if (value.Count == 0)

  42. return;

  43.  
  44.  
  45.  
  46. List<Point3D> PlayPath = new List<Point3D>();

  47.  
  48. double Totolength = 0;

  49.  
  50. // Pareant.PlayPath.Add(new Point3D(BeginPoint.X, BeginPoint.Y, 0));

  51. foreach (string key in value.Keys)

  52. {

  53. if (key.Length > 12)

  54. {

  55. if (key.Split('#').Length >= 2)

  56. Totolength += Convert.ToDouble(key.Split('#')[1].Split(',')[12]);

  57. }

  58.  
  59. foreach (System.Drawing.PointF y1 in value[key])

  60. {

  61. PlayPath.Add(new Point3D(y1.X, y1.Y, 0));

  62. }

  63.  
  64. }

  65. PlayPath.Add(new Point3D(secJW.X, secJW.Y, 0));

  66. Random t1 = new System.Random();

  67.  
  68. System.Windows.Media.Color pp = new System.Windows.Media.Color();

  69.  
  70. pp = Colors.Red;

  71.  
  72. //调用SDK提供的画路方法把路画出来

  73. gis3d.RemoveShotPath("导航路径");

  74. gis3d.DrawShortPath(PlayPath, "导航路径", pp, true);

  75.  
  76.  
  77.  
  78. }

  79. #endregion

 

 

 效果如下:再三强调数据库配合,所以用互联网服务器的时候。在计算时会比较慢,担因为使用的是线程模式,所以不影响主进程做其它事。SDK自带的drashortpath方法支持自动抽稀,可以显示很长的导航路线。

  ,

 

 

http://www.chinamtouch.com QQ:40140203  微信公众号:m3dgis2001

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值