利用WPF建立自己的3d gis软件(非axhost方式)(十二)SDK中的导航系统
原文:利用WPF建立自己的3d gis软件(非axhost方式)(十二)SDK中的导航系统
先下载SDK:https://pan.baidu.com/s/1M9kBS6ouUwLfrt0zV0bPew密码:1te1
地图数据包(sqlserver2008R2版本,也可以不下载): https://pan.baidu.com/s/1PjcNamad7OVpCrsVJ7dwFQ 密码:uw9r
下载 核心SDK升级包:https://pan.baidu.com/s/1Q3dlM-Va-RmlEYbnmi8Xuw 并覆盖到SDK目录中。里面有也每一篇的例子代码
完整的视频演示:http://v.youku.com/v_show/id_XMTU4MTI5NTE4NA==.html 再三强调一下,用互联网的服务器使用速度上会卡顿,建议最好的效果一定要下载sql数据库,本地建服务。
下载完成以后,解压出来,将30-1.exe 拖动到 把授权拖到我上面install.bat上完成授权安装。。。
设置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
ShortRoad.ShortPath.MyPareant = this.Dispatcher; //因为导航算法为异步委托+多线程方式完成,需要一个异步委托主对象(静态)。
ShortRoad.ShortPath.chuslhi(); //初始化数据(静态)
MyShort = new ShortRoad.ShortPath();
//初始化导航类
MyShort.OnShortPath += this.MyShort_OnShortPath;
//导航数据回调事件
MyShort.OnPro += MyShort_OnPro;
//导航算法信息事件。
#region 导航系统
System.Windows.Point FirstJW= new System.Windows.Point();
System.Windows.Point secJW = new System.Windows.Point();
private void Button_Click_15(object sender, RoutedEventArgs e)
{
gis3d.State = GisLib.WindowsMT.GisState.获取经纬度;
gis3d.GetJWEvent += Gis3d_GetJWEvent2;
}
private void Gis3d_GetJWEvent2(System.Windows.Media.Media3D.Point3D value)
{
gis3d.GetJWEvent -= Gis3d_GetJWEvent2;
FirstJW = new System.Windows.Point(value.X, value.Y);
gis3d.State = GisLib.WindowsMT.GisState.漫游;
}
private void Button_Click_16(object sender, RoutedEventArgs e)
{
gis3d.State = GisLib.WindowsMT.GisState.获取经纬度;
gis3d.GetJWEvent += Gis3d_GetJWEvent3;
}
private void Gis3d_GetJWEvent3(System.Windows.Media.Media3D.Point3D value)
{
gis3d.GetJWEvent -= Gis3d_GetJWEvent2;
secJW = new System.Windows.Point(value.X, value.Y);
MyShort.GetShortPath(FirstJW.X, FirstJW.Y, secJW.X, secJW.Y, true);
gis3d.State = GisLib.WindowsMT.GisState.漫游;
}
private void MyShort_OnPro(string value)
{
FirstShort.Content = value;
}
private void MyShort_OnShortPath(Dictionary<string, List<PointF>> value, System.Windows.Point mbegin, System.Windows.Point mend)
{
if (value == null)
return;
if (value.Count == 0)
return;
List<Point3D> PlayPath = new List<Point3D>();
double Totolength = 0;
// Pareant.PlayPath.Add(new Point3D(BeginPoint.X, BeginPoint.Y, 0));
foreach (string key in value.Keys)
{
if (key.Length > 12)
{
if (key.Split('#').Length >= 2)
Totolength += Convert.ToDouble(key.Split('#')[1].Split(',')[12]);
}
foreach (System.Drawing.PointF y1 in value[key])
{
PlayPath.Add(new Point3D(y1.X, y1.Y, 0));
}
}
PlayPath.Add(new Point3D(secJW.X, secJW.Y, 0));
Random t1 = new System.Random();
System.Windows.Media.Color pp = new System.Windows.Media.Color();
pp = Colors.Red;
//调用SDK提供的画路方法把路画出来
gis3d.RemoveShotPath("导航路径");
gis3d.DrawShortPath(PlayPath, "导航路径", pp, true);
}
#endregion
效果如下:再三强调数据库配合,所以用互联网服务器的时候。在计算时会比较慢,担因为使用的是线程模式,所以不影响主进程做其它事。SDK自带的drashortpath方法支持自动抽稀,可以显示很长的导航路线。
,
http://www.chinamtouch.com QQ:40140203 微信公众号:m3dgis2001
利用WPF建立自己的3d gis软件(非axhost方式)(十二)SDK中的导航系统的更多相关文章
- 利用WPF建立自己的3d gis软件(非axhost方式)(十三)万能的用户层接口,(强大的WPF)
原文:利用WPF建立自己的3d gis软件(非axhost方式)(十三)万能的用户层接口,(强大的WPF) 先下载SDK:https://pan.baidu.com/s/1M9kBS6ouUwLfrt ...
- 利用WPF建立自己的3d gis软件(非axhost方式)(十一)SDK中的动画系统
原文:利用WPF建立自己的3d gis软件(非axhost方式)(十一)SDK中的动画系统 先下载SDK:https://pan.baidu.com/s/1M9kBS6ouUwLfrt0zV0bPew ...
- 利用WPF建立自己的3d gis软件(非axhost方式)(十)SDK中一些自带的展示面板应用
原文:利用WPF建立自己的3d gis软件(非axhost方式)(十)SDK中一些自带的展示面板应用 先下载SDK:https://pan.baidu.com/s/1M9kBS6ouUwLfrt0zV ...
- 利用WPF建立自己的3d gis软件(非axhost方式)(七)实现简单的粒子效果
原文:利用WPF建立自己的3d gis软件(非axhost方式)(七)实现简单的粒子效果 先下载SDK:https://pan.baidu.com/s/1M9kBS6ouUwLfrt0zV0bPew密 ...
- 利用WPF建立自己的3d gis软件(非axhost方式)(八)拖动一个UI到地球上
原文:利用WPF建立自己的3d gis软件(非axhost方式)(八)拖动一个UI到地球上 先下载SDK:https://pan.baidu.com/s/1M9kBS6ouUwLfrt0zV0bPew ...
- 利用WPF建立自己的3d gis软件(非axhost方式)(九)SDK自带部分面板的调用
原文:利用WPF建立自己的3d gis软件(非axhost方式)(九)SDK自带部分面板的调用 先下载SDK:https://pan.baidu.com/s/1M9kBS6ouUwLfrt0zV0bP ...
- 利用WPF建立自己的3d gis软件(非axhost方式)(六)跳转,增加外部三维模型
原文:利用WPF建立自己的3d gis软件(非axhost方式)(六)跳转,增加外部三维模型 先下载SDK:https://pan.baidu.com/s/1M9kBS6ouUwLfrt0zV0bPe ...
- 利用WPF建立自己的3d gis软件(非axhost方式)(五)在鼠标点击的位置增加UI
原文:利用WPF建立自己的3d gis软件(非axhost方式)(五)在鼠标点击的位置增加UI 先下载SDK:https://pan.baidu.com/s/1M9kBS6ouUwLfrt0zV0bP ...
- 利用WPF建立自己的3d gis软件(非axhost方式)(四)在地图上添加FrameworkElement
原文:利用WPF建立自己的3d gis软件(非axhost方式)(四)在地图上添加FrameworkElement 先下载SDK:https://pan.baidu.com/s/1M9kBS6ouUw ...
随机推荐
- 2.JPA学习总结
转自:https://shmilyaw-hotmail-com.iteye.com/blog/1969190 前言 最近在做一个项目的时候因为牵涉到要对数据库的操作,在最开始实现的时候采用了直接的JD ...
- Altium Designer如何统一改变pcb状态下的原件标号位置
原创 我用的是Altium Designer16版本 变成 步骤如下: 选中标号 右击 下边一步很重要: 点击应用和确定 在之后弹出的对话框中选则你要改变的位置,我这里是把标号改变到原件的右侧: 等待 ...
- Log4net.confager配置官方文档
http://logging.apache.org/log4net/release/config-examples.html
- 如何启用“锁定内存页”选项 (Windows)
默认情况下,禁用 Windows 策略"锁定内存页"选项.必须启用此权限才能配置地址窗口化扩展插件 (AWE).此策略将确定哪些帐户可以使用进程将数据保留在物理内存中,从而阻止系统 ...
- bow lsa plsa
Bag-of-Words (BoW) 模型是NLP和IR领域中的一个基本假设.在这个模型中,一个文档(document)被表示为一组单词(word/term)的无序组合,而忽略了语法或者词序的部分.B ...
- 10进制TO16进制
string DecToHex(int Dec_Num){ int num; string str_num; num = Dec_Num; while(num / 16 != 0) { int a = ...
- oracle数据库未打开解决的方法
Microsoft Windows [版本号 6.1.7601] 版权全部 (c) 2009 Microsoft Corporation.保留全部权利. C:\Users\Administrator& ...
- css3-11 如何让html中的不规则单词折行
css3-11 如何让html中的不规则单词折行 一.总结 一句话总结:用word-wrap属性:word-wrap:break-word; 1.word-break和word-wrap的区别? 推荐 ...
- 【50.00%】【codeforces 602C】The Two Routes
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- Windows10终端优化方案:Ubuntu子系统+cmder+oh-my-zsh
原问地址:https://zhuanlan.zhihu.com/p/34152045 最近从MacBook换到了种草已久的Surface Book 2,而我的工作环境也自然要从macOS换到Windo ...