#include "MapWidget.h"
#include "UAS_types.h"
#include <QCheckBox>
#include <QFileDialog>
#include <QHeaderView>
#include <QInputDialog>
#include <QMenu>
#include <QtCore>
#include <QtGui>
using namespace mapcontrol;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
struct MapType_Data {
char name[256];
int typeID;
};
#define MAPTYPE_STRUCT(n) \
{ \
#n, core::MapType::n \
}
static MapType_Data g_arrMapType[] = {
MAPTYPE_STRUCT(GoogleMap),
MAPTYPE_STRUCT(GoogleSatellite),
MAPTYPE_STRUCT(GoogleLabels),
MAPTYPE_STRUCT(GoogleTerrain),
MAPTYPE_STRUCT(GoogleHybrid),
MAPTYPE_STRUCT(GoogleMapChina),
MAPTYPE_STRUCT(GoogleSatelliteChina),
MAPTYPE_STRUCT(GoogleLabelsChina),
MAPTYPE_STRUCT(GoogleTerrainChina),
MAPTYPE_STRUCT(GoogleHybridChina),
MAPTYPE_STRUCT(OpenStreetMap),
MAPTYPE_STRUCT(OpenStreetOsm),
MAPTYPE_STRUCT(OpenStreetMapSurfer),
MAPTYPE_STRUCT(OpenStreetMapSurferTerrain),
MAPTYPE_STRUCT(YahooMap),
MAPTYPE_STRUCT(YahooSatellite),
MAPTYPE_STRUCT(YahooLabels),
MAPTYPE_STRUCT(YahooHybrid),
MAPTYPE_STRUCT(BingMap),
MAPTYPE_STRUCT(BingSatellite),
MAPTYPE_STRUCT(BingHybrid),
MAPTYPE_STRUCT(ArcGIS_Map),
MAPTYPE_STRUCT(ArcGIS_Satellite),
MAPTYPE_STRUCT(ArcGIS_ShadedRelief),
MAPTYPE_STRUCT(ArcGIS_Terrain),
MAPTYPE_STRUCT(ArcGIS_MapsLT_Map),
MAPTYPE_STRUCT(ArcGIS_MapsLT_OrtoFoto),
MAPTYPE_STRUCT(ArcGIS_MapsLT_Map_Labels),
MAPTYPE_STRUCT(ArcGIS_MapsLT_Map_Hybrid),
MAPTYPE_STRUCT(PergoTurkeyMap),
MAPTYPE_STRUCT(SigPacSpainMap),
MAPTYPE_STRUCT(GoogleMapKorea),
MAPTYPE_STRUCT(GoogleSatelliteKorea),
MAPTYPE_STRUCT(GoogleLabelsKorea),
MAPTYPE_STRUCT(GoogleHybridKorea),
MAPTYPE_STRUCT(YandexMapRu),
{ "NULL", -1 }
};
char* getMapName_fromID(core::MapType::Types t)
{
int i = 0;
while (1) {
if (g_arrMapType[i].typeID == t)
return g_arrMapType[i].name;
if (g_arrMapType[i].typeID < 0)
return NULL;
i++;
}
return NULL;
}
MapType_Dialog::MapType_Dialog(QWidget* parent)
: QDialog(parent)
{
this->setWindowTitle(u8"选择地图类型");
this->setStyleSheet("QDialog{background-color: rgb(34,34,34);}");
setupUi();
setupMapType_list();
setMapType(core::MapType::BingHybrid);
}
void MapType_Dialog::setupUi(void)
{
if (this->objectName().isEmpty()) {
this->setObjectName(QString::fromUtf8("MapWidget_MapTypeDiag"));
}
this->setFixedSize(374, 122);
buttonBox = new QDialogButtonBox(this);
buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
buttonBox->setGeometry(QRect(20, 80, 341, 32));
buttonBox->setOrientation(Qt::Horizontal);
buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
labMapType = new QLabel(this);
labMapType->setObjectName(QString::fromUtf8("labMapType"));
labMapType->setGeometry(QRect(32, 34, 61, 15));
labMapType->setText(u8"地图类型:");
cbMapType = new QComboBox(this);
cbMapType->setObjectName(QString::fromUtf8("cbMapType"));
cbMapType->setGeometry(QRect(100, 30, 251, 25));
QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
QObject::connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
QMetaObject::connectSlotsByName(this);
}
void MapType_Dialog::setupMapType_list(void)
{
int i;
i = 0;
while (1) {
if (g_arrMapType[i].typeID >= 0)
cbMapType->addItem(g_arrMapType[i].name);
else
break;
i++;
}
}
void MapType_Dialog::setMapType(core::MapType::Types t)
{
int i = 0;
while (1) {
if (g_arrMapType[i].typeID == t) {
cbMapType->setCurrentIndex(i);
return;
}
if (g_arrMapType[i].typeID == -1)
break;
i++;
}
// set default map
cbMapType->setCurrentIndex(0);
}
core::MapType::Types MapType_Dialog::getMapType(void)
{
int idx, typeID;
idx = cbMapType->currentIndex();
typeID = g_arrMapType[idx].typeID;
return (core::MapType::Types)typeID;
}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
WaypointEdit_Dialog::WaypointEdit_Dialog(QWidget* parent)
: QDialog(parent)
{
this->setWindowTitle(u8"航点编辑");
this->setStyleSheet("QDialog{background-color: rgb(34,34,34);}");
m_wpMap = NULL;
m_wpIdx = 0;
clCL1 = QColor(0x00, 0x00, 0xFF);
clCL2 = QColor(0x00, 0x00, 0x00);
clB1 = QColor(0xFF, 0xFF, 0xFF);
clB2 = QColor(0xE8, 0xE8, 0xE8);
fontSize = 10;
rowHeight = 24;
m_bHeightAltitude = 1;
m_referenceAltitude = 440.0;
setupUi();
}
int WaypointEdit_Dialog::setWaypoints(int idx, QMap<int, mapcontrol::WayPointItem*>* wpMap,
int heightAltitude)
{
m_wpIdx = idx;
m_wpMap = wpMap;
m_bHeightAltitude = heightAltitude;
// set height/altitude checkbox
if (heightAltitude) {
cbHeightAltitude->setCheckState(Qt::Checked);
} else {
cbHeightAltitude->setCheckState(Qt::Unchecked);
}
// if edit all waypoints then disable checkbox of all waypoints
if (m_wpIdx < 0)
cbAllWaypoints->setDisabled(true);
// set table items
setWaypoints_(idx, wpMap, heightAltitude);
return 0;
}
int WaypointEdit_Dialog::setWaypoints_(int idx,
QMap<int, mapcontrol::WayPointItem*>* wpMap,
int heightAltitude)
{
if (heightAltitude) {
tableWaypoints->horizontalHeaderItem(1)->setText(u8"高度");
} else {
tableWaypoints->horizontalHeaderItem(1)->setText(u8"海拔");
}
// clear old contents
tableWaypoints->clearContents();
// insert items
double h;
if (idx >= 0) {
cbAllWaypoints->setCheckState(Qt::Unchecked);
tableWaypoints->setRowCount(1);
mapcontrol::WayPointItem* item;
item = wpMap->value(idx);
if (heightAltitude)
h = item->Altitude() - m_referenceAltitude;
else
h = item->Altitude();
// set index、altitude、 heading
setTableItem(0, 0, QString("%1").arg(item->Number()));
setTableItem(0, 1, QString("%1").arg(h));
setTableItem(0, 2, QString("%1").arg(item->Heading()));
setTableItem(0, 3, QString("%1").arg(item->Coord().Lat()));
setTableItem(0, 4, QString("%1").arg(item->Coord().Lng()));
tableWaypoints->item(0, 0)->setFlags(Qt::ItemIsSelectable);
tableWaypoints->item(0, 2)->setToolTip("0:North, 90:East, 180:South, 270:West");
for (int col = 0; col < tableWaypoints->columnCount(); col++) {
tableWaypoints->item(0, col)->setTextAlignment(Qt::AlignCenter);
}
tableWaypoints->setRowHeight(0, 50);
} else {
cbAllWaypoints->setCheckState(Qt::Checked);
QList<int> ids = wpMap->keys();
int ri = 0;
tableWaypoints->setRowCount(ids.size());
foreach (int i, ids) {
mapcontrol::WayPointItem* item;
item = wpMap->value(i);
if (heightAltitude)
h = item->Altitude() - m_referenceAltitude;
else
h = item->Altitude();
setTableItem(ri, 0, QString("%1").arg(item->Number()));
setTableItem(ri, 1, QString("%1").arg(h));
setTableItem(ri, 2, QString("%1").arg(item->Heading()));
setTableItem(ri, 3, QString("%1")
没有合适的资源?快使用搜索试试~ 我知道了~
Qt5 互动地图,实现无人机地面站效果
共179个文件
h:60个
cpp:52个
png:42个
需积分: 5 5 下载量 23 浏览量
2024-05-10
16:53:53
上传
评论 1
收藏 1.01MB RAR 举报
温馨提示
一、本文主要通过Qt5+opmapcontrol实现一个简单的无人机地面站效果。可选择谷歌地图,必应地图, 雅虎地图,GIS等。 二、环境 Qt:5.15.2 编译器: Qt 5.15.2 MinGW 64-bit 系统:windows 10 三、 功能特点 (1) 支持缓存地图 (2)支持选择各厂商地图,以及切换街道地图 (3)支持地图互动:拖动、放大缩小 (4)支持添加航点,以及航点的编辑、删除、保存、加载、航点信息显示 (5)支持设置home,以及安全区域 (6)支持显示运动轨迹
资源推荐
资源详情
资源评论
收起资源包目录
Qt5 互动地图,实现无人机地面站效果 (179个子文件)
libopmapwidget.a 754KB
libcore.a 240KB
libinternals.a 176KB
qt.conf 46B
MapWidget.cpp 30KB
urlfactory.cpp 29KB
core.cpp 21KB
lks94projection.cpp 21KB
opmapwidget.cpp 20KB
mapgraphicitem.cpp 19KB
waypointitem.cpp 18KB
uavitem.cpp 16KB
UAS_types.cpp 15KB
pureimagecache.cpp 12KB
opmaps.cpp 9KB
pureprojection.cpp 8KB
uavmanagerwidget.cpp 6KB
cache.cpp 6KB
gpsitem.cpp 6KB
mapripper.cpp 5KB
waypointline.cpp 5KB
waypointcircle.cpp 5KB
homeitem.cpp 5KB
tilematrix.cpp 4KB
tilecachequeue.cpp 4KB
mercatorprojectionyandex.cpp 4KB
providerstrings.cpp 3KB
mercatorprojection.cpp 3KB
platecarreeprojectionpergo.cpp 3KB
platecarreeprojection.cpp 3KB
mapsetmiddleform.cpp 3KB
rectangle.cpp 3KB
alllayersoftype.cpp 2KB
custommapwidget.cpp 2KB
kibertilecache.cpp 2KB
languagetype.cpp 2KB
trailitem.cpp 2KB
configuration.cpp 2KB
rawtile.cpp 2KB
cacheitemqueue.cpp 2KB
memorycache.cpp 2KB
point.cpp 2KB
mapripform.cpp 2KB
sizelatlng.cpp 2KB
rectlatlng.cpp 2KB
traillineitem.cpp 2KB
pointlatlng.cpp 2KB
tile.cpp 2KB
pureimage.cpp 1KB
loadtask.cpp 1KB
diagnostics.cpp 1KB
size.cpp 1KB
MouseWheelZoomType.cpp 1KB
placemark.cpp 1KB
main.cpp 767B
mainwindow.cpp 600B
opmapwidget.dll 783KB
opmapwidget.h 21KB
opmapwidget.h 21KB
uavitem.h 9KB
core.h 9KB
waypointitem.h 8KB
gpsitem.h 8KB
rectlatlng.h 8KB
mapgraphicitem.h 7KB
UAS_types.h 6KB
geodecoderstatus.h 5KB
configuration.h 5KB
rectangle.h 5KB
MapWidget.h 5KB
pureprojection.h 4KB
maptype.h 4KB
sizelatlng.h 4KB
languagetype.h 3KB
homeitem.h 3KB
urlfactory.h 3KB
pointlatlng.h 3KB
mousewheelzoomtype.h 3KB
opmaps.h 3KB
uavtrailtype.h 3KB
uavmapfollowtype.h 3KB
accessmode.h 3KB
lks94projection.h 3KB
providerstrings.h 3KB
waypointcircle.h 2KB
waypointline.h 2KB
size.h 2KB
point.h 2KB
mercatorprojectionyandex.h 2KB
cacheitemqueue.h 2KB
pureimagecache.h 2KB
platecarreeprojectionpergo.h 2KB
platecarreeprojection.h 2KB
mercatorprojection.h 2KB
mapripper.h 2KB
cache.h 2KB
tile.h 2KB
copyrightstrings.h 2KB
trailitem.h 2KB
traillineitem.h 2KB
共 179 条
- 1
- 2
资源评论
taciturn丶
- 粉丝: 220
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- (完整)数据库课程设计餐厅点餐说明书-21ab6d3c8beb172ded630b1c59eef8c75ebf952c.doc
- 2023-04-06-项目笔记 - 第一百五十四阶段 - 4.4.2.152全局变量的作用域-152 -2024.06.04
- 松哥解协议松哥解协议松哥解协议松哥解协议松哥解协议
- 618节日618节日618节日
- tensorflow-gpu-2.9.1-cp37-cp37m-win-amd64.whl
- tensorflow-gpu-2.9.0-cp37-cp37m-win-amd64.whl
- tensorflow-gpu-2.9.0-cp39-cp39-win-amd64.whl
- lcd daimalcd daima
- 电影领域-推荐算法-个性化内容-观影决策-电影推荐小程序.zip
- 电气控制PLC考试题库
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功