Qt Quick-QML地图引擎:v4版本(新增3D模型/抗锯齿任意多边形下载)
B站视频: Qt Quick-QML地图引擎之v4版本(新增3D模型/抗锯齿下载优化)_哔哩哔哩_bilibili
GIF如下所示:
1.新增ArcGIS街道(蓝黑)-在线和离线下载
2.多边形下载-抗锯齿
V3旧版本裁剪后的如下图所示:
V4版本裁剪后的如下图所示:
增加抗锯齿后,裁剪明显没有锯齿了。
3.3D模型
但是由于Qt地图常常用于嵌入式系统,或者就是无人机系统,需要实时展示物体/飞行器实时姿态和经纬度,由于市面上QT的大部分都是2D物体模拟,比如:
所以V4增加3D模型实现,这样就可以显示具体的姿态信息,这样更加地直观,欧拉角姿态如下图所示:
截图如下所示:
支持各种倾斜、旋转、纠正视角:
支持跨平台、Linux/嵌入式/mac一键编译:
也可以支持显示四轴无人机、雷达等等各种3D模型、
由于本人没有实际设备获取,所以数据通过轨迹线模拟生成的,模拟代码如下所示:
-
// 启动导航 list<coordinate>
-
function startNavigator(pathData) {
-
editEnable = false
-
navigationLine.path = []
-
navigationTimer.path = pathData
-
navigationTimer.currentIdx = 0
-
navigationTimer.initializedData(true);
-
navigationTimer.restart()
-
navigatorHintPopup.open(); // 提示
-
}
-
-
Timer {
-
id: navigationTimer
-
interval: 200
-
running: false
-
repeat: true
-
-
property var path // 路径
-
property int currentIdx // 当前到哪个路径
-
property real arc // 弧点
-
property var end // 结束点
-
property var begin // 起始点
-
property var current // 当前点
-
property int currentStepCnt: 0
-
-
property real longStep // 步数
-
property real latStep
-
-
property bool longAdd // 增减关系
-
property bool latAdd
-
-
onTriggered: {
-
-
currentStepCnt =1
-
-
current.latitude = currentStepCnt*latStep navigationTimer.begin.latitude
-
current.longitude = currentStepCnt*longStep navigationTimer.begin.longitude
-
-
-
let intervalY = latAdd ? current.latitude - end.latitude : end.latitude - current.latitude;
-
let intervalX = longAdd ? current.longitude - end.longitude : end.longitude - current.longitude;
-
-
if(intervalX>0 || intervalY>0) {
-
target.center = end
-
current = end
-
-
navigation3DModel.nextCoordinate(current)
-
navigationLine.replaceCoordinate(currentIdx,current)
-
-
if((currentIdx 1) >= navigationTimer.path.length) {
-
navigationTimer.stop();
-
navigatorHintPopup.close();
-
editEnable = true
-
} else {
-
initializedData();
-
let less = Math.sqrt(Math.pow(intervalY,2) Math.pow(intervalX,2))
-
-
navigationTimer.begin.longitude = less * Math.cos(navigationTimer.arc)
-
navigationTimer.begin.latitude = less * Math.sin(navigationTimer.arc)
-
navigation3DModel.nextCoordinate(navigationTimer.begin)
-
-
}
-
-
} else {
-
target.center = current
-
navigation3DModel.nextCoordinate(current)
-
-
if(navigation3DModel.visible)
-
navigationLine.replaceCoordinate(currentIdx, navigation3DModel.coordinate)
-
}
-
}
-
-
// 初始化数据
-
function initializedData(first = false) {
-
-
navigationTimer.begin = navigationTimer.path[currentIdx];
-
let end = navigationTimer.path[currentIdx 1];
-
-
let arc = Math.atan2((end.latitude - navigationTimer.begin.latitude), (end.longitude - navigationTimer.begin.longitude));
-
-
navigationTimer.longStep = navigatorSpeed * Math.cos(arc)
-
navigationTimer.latStep = navigatorSpeed * Math.sin(arc)
-
-
navigationTimer.longAdd = navigationTimer.longStep > 0 ? true : false
-
navigationTimer.latAdd = navigationTimer.latStep > 0 ? true : false
-
-
navigationTimer.currentStepCnt = 0
-
-
console.log("开始导航", currentIdx, end.longitude , end.latitude , begin.longitude, begin.latitude)
-
-
navigationTimer.current = navigationTimer.begin
-
navigationTimer.end = end
-
navigationTimer.arc = arc
-
if(currentIdx == 0) navigationLine.addCoordinate(navigationTimer.begin)
-
navigationLine.addCoordinate(navigationTimer.begin)
-
-
navigation3DModel.initCoordinate(navigationTimer.begin, end, first)
-
-
currentIdx = 1
-
navigatorHintPopup.label = `路径点${currentIdx}->路径点${currentIdx 1} 正在导航中...`; // 提示
-
-
}
-
}
2023/06/06 - 离线地图加载- 增加支持多个离线地图厂家
支持加密和非加密,并且加密和非加密加载速度一样的,如下图所示,使用加密后的离线文件数据:
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /boutique/detail/tanhghbikg
系列文章
更多
同类精品
更多
-
photoshop保存的图片太大微信发不了怎么办
PHP中文网 06-15 -
《学习通》视频自动暂停处理方法
HelloWorld317 07-05 -
word里面弄一个表格后上面的标题会跑到下面怎么办
PHP中文网 06-20 -
Android 11 保存文件到外部存储,并分享文件
Luke 10-12 -
photoshop扩展功能面板显示灰色怎么办
PHP中文网 06-14 -
微信公众号没有声音提示怎么办
PHP中文网 03-31 -
excel下划线不显示怎么办
PHP中文网 06-23 -
excel打印预览压线压字怎么办
PHP中文网 06-22 -
TikTok加速器哪个好免费的TK加速器推荐
TK小达人 10-01 -
怎样阻止微信小程序自动打开
PHP中文网 06-13