• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

Qt Quick-QML地图引擎:v4版本(新增3D模型/抗锯齿任意多边形下载)

武飞扬头像
诺谦
帮助1

B站视频: Qt Quick-QML地图引擎之v4版本(新增3D模型/抗锯齿下载优化)_哔哩哔哩_bilibili

GIF如下所示: 

学新通

1.新增ArcGIS街道(蓝黑)-在线和离线下载

学新通

2.多边形下载-抗锯齿

V3旧版本裁剪后的如下图所示:

学新通

V4版本裁剪后的如下图所示:

学新通

增加抗锯齿后,裁剪明显没有锯齿了。

3.3D模型

但是由于Qt地图常常用于嵌入式系统,或者就是无人机系统,需要实时展示物体/飞行器实时姿态和经纬度,由于市面上QT的大部分都是2D物体模拟,比如:

学新通

所以V4增加3D模型实现,这样就可以显示具体的姿态信息,这样更加地直观,欧拉角姿态如下图所示:

学新通

截图如下所示:

学新通

支持各种倾斜、旋转、纠正视角:

学新通

 支持跨平台、Linux/嵌入式/mac一键编译:

学新通

也可以支持显示四轴无人机、雷达等等各种3D模型、

由于本人没有实际设备获取,所以数据通过轨迹线模拟生成的,模拟代码如下所示:

  1.  
    // 启动导航 list<coordinate>
  2.  
    function startNavigator(pathData) {
  3.  
    editEnable = false
  4.  
    navigationLine.path = []
  5.  
    navigationTimer.path = pathData
  6.  
    navigationTimer.currentIdx = 0
  7.  
    navigationTimer.initializedData(true);
  8.  
    navigationTimer.restart()
  9.  
    navigatorHintPopup.open(); // 提示
  10.  
    }
  11.  
     
  12.  
    Timer {
  13.  
    id: navigationTimer
  14.  
    interval: 200
  15.  
    running: false
  16.  
    repeat: true
  17.  
     
  18.  
    property var path // 路径
  19.  
    property int currentIdx // 当前到哪个路径
  20.  
    property real arc // 弧点
  21.  
    property var end // 结束点
  22.  
    property var begin // 起始点
  23.  
    property var current // 当前点
  24.  
    property int currentStepCnt: 0
  25.  
     
  26.  
    property real longStep // 步数
  27.  
    property real latStep
  28.  
     
  29.  
    property bool longAdd // 增减关系
  30.  
    property bool latAdd
  31.  
     
  32.  
    onTriggered: {
  33.  
     
  34.  
    currentStepCnt =1
  35.  
     
  36.  
    current.latitude = currentStepCnt*latStep navigationTimer.begin.latitude
  37.  
    current.longitude = currentStepCnt*longStep navigationTimer.begin.longitude
  38.  
     
  39.  
     
  40.  
    let intervalY = latAdd ? current.latitude - end.latitude : end.latitude - current.latitude;
  41.  
    let intervalX = longAdd ? current.longitude - end.longitude : end.longitude - current.longitude;
  42.  
     
  43.  
    if(intervalX>0 || intervalY>0) {
  44.  
    target.center = end
  45.  
    current = end
  46.  
     
  47.  
    navigation3DModel.nextCoordinate(current)
  48.  
    navigationLine.replaceCoordinate(currentIdx,current)
  49.  
     
  50.  
    if((currentIdx 1) >= navigationTimer.path.length) {
  51.  
    navigationTimer.stop();
  52.  
    navigatorHintPopup.close();
  53.  
    editEnable = true
  54.  
    } else {
  55.  
    initializedData();
  56.  
    let less = Math.sqrt(Math.pow(intervalY,2) Math.pow(intervalX,2))
  57.  
     
  58.  
    navigationTimer.begin.longitude = less * Math.cos(navigationTimer.arc)
  59.  
    navigationTimer.begin.latitude = less * Math.sin(navigationTimer.arc)
  60.  
    navigation3DModel.nextCoordinate(navigationTimer.begin)
  61.  
     
  62.  
    }
  63.  
     
  64.  
    } else {
  65.  
    target.center = current
  66.  
    navigation3DModel.nextCoordinate(current)
  67.  
     
  68.  
    if(navigation3DModel.visible)
  69.  
    navigationLine.replaceCoordinate(currentIdx, navigation3DModel.coordinate)
  70.  
    }
  71.  
    }
  72.  
     
  73.  
    // 初始化数据
  74.  
    function initializedData(first = false) {
  75.  
     
  76.  
    navigationTimer.begin = navigationTimer.path[currentIdx];
  77.  
    let end = navigationTimer.path[currentIdx 1];
  78.  
     
  79.  
    let arc = Math.atan2((end.latitude - navigationTimer.begin.latitude), (end.longitude - navigationTimer.begin.longitude));
  80.  
     
  81.  
    navigationTimer.longStep = navigatorSpeed * Math.cos(arc)
  82.  
    navigationTimer.latStep = navigatorSpeed * Math.sin(arc)
  83.  
     
  84.  
    navigationTimer.longAdd = navigationTimer.longStep > 0 ? true : false
  85.  
    navigationTimer.latAdd = navigationTimer.latStep > 0 ? true : false
  86.  
     
  87.  
    navigationTimer.currentStepCnt = 0
  88.  
     
  89.  
    console.log("开始导航", currentIdx, end.longitude , end.latitude , begin.longitude, begin.latitude)
  90.  
     
  91.  
    navigationTimer.current = navigationTimer.begin
  92.  
    navigationTimer.end = end
  93.  
    navigationTimer.arc = arc
  94.  
    if(currentIdx == 0) navigationLine.addCoordinate(navigationTimer.begin)
  95.  
    navigationLine.addCoordinate(navigationTimer.begin)
  96.  
     
  97.  
    navigation3DModel.initCoordinate(navigationTimer.begin, end, first)
  98.  
     
  99.  
    currentIdx = 1
  100.  
    navigatorHintPopup.label = `路径点${currentIdx}->路径点${currentIdx 1} 正在导航中...`; // 提示
  101.  
     
  102.  
    }
  103.  
    }
学新通

2023/06/06 - 离线地图加载- 增加支持多个离线地图厂家

学新通

 支持加密和非加密,并且加密和非加密加载速度一样的,如下图所示,使用加密后的离线文件数据:

学新通

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhghbikg
系列文章
更多 icon
同类精品
更多 icon
继续加载