修复航点下载bug
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#include "MissionUI.h"
|
||||
#include "MissionUI.h"
|
||||
#include "ui_MissionUI.h"
|
||||
|
||||
MissionUI::MissionUI(QWidget *parent) :
|
||||
@@ -535,6 +535,33 @@ MissionUI::~MissionUI()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MissionUI::deleteGroupAllPoint(int group)
|
||||
{
|
||||
QTableWidget *table;
|
||||
switch(group)
|
||||
{
|
||||
case 1: table = ui->tableWidget_1; break;
|
||||
// case 2: group = 5; break;
|
||||
case 3: table = ui->tableWidget_3; break;
|
||||
case 4: table = ui->tableWidget_4; break;
|
||||
case 5: table = ui->tableWidget_5; break;
|
||||
case 6: table = ui->tableWidget_6; break;
|
||||
}
|
||||
qDebug() << u8"组:" << group;
|
||||
// QTableWidget *table = qobject_cast<QTableWidget *>(ui->tabWidget->widget(group) );
|
||||
if(table)
|
||||
{
|
||||
qDebug() << u8"删除所有航点";
|
||||
int rowCount = table->rowCount();
|
||||
for(int i = 0; i < rowCount; ++i) //删除组中所有的数据
|
||||
{
|
||||
qDebug() << u8"Mission: 删除航点";
|
||||
table->removeRow(0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MissionUI::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
event->ignore();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#ifndef MISSIONUI_H
|
||||
#ifndef MISSIONUI_H
|
||||
#define MISSIONUI_H
|
||||
|
||||
#include <QWidget>
|
||||
@@ -27,6 +27,11 @@ public:
|
||||
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* @brief 删除指定组中所有的航点
|
||||
* @param group 需要删除航点的组
|
||||
*/
|
||||
void deleteGroupAllPoint(int group);
|
||||
void pointCreate(float param1,float param2,float param3,float param4,
|
||||
int32_t x,int32_t y,float z,
|
||||
uint16_t seq,
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<item row="0" column="1">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>5</number>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#ifndef PROPERTYUI_H
|
||||
#ifndef PROPERTYUI_H
|
||||
#define PROPERTYUI_H
|
||||
|
||||
#include <QWidget>
|
||||
@@ -175,6 +175,8 @@ public:
|
||||
explicit propertyui(QWidget *parent = nullptr);
|
||||
~propertyui();
|
||||
|
||||
MissionUI *table = nullptr;
|
||||
|
||||
|
||||
Q_PROPERTY(QString category READ category CONSTANT)
|
||||
Q_PROPERTY(QString description READ description CONSTANT)
|
||||
@@ -417,7 +419,7 @@ private:
|
||||
|
||||
Ui::propertyui *ui;
|
||||
|
||||
MissionUI *table = nullptr;
|
||||
|
||||
RuleDialog *ruler = nullptr;
|
||||
|
||||
|
||||
|
||||
+3
-3
@@ -366,7 +366,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
connect(missionUI,SIGNAL(WayPointPropertyChanged(float,float,float,float,int32_t,int32_t,float,uint16_t,uint16_t,uint16_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t)),
|
||||
map,SIGNAL(setWPProperty(float,float,float,float,int32_t,int32_t,float,uint16_t,uint16_t,uint16_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t)));
|
||||
|
||||
|
||||
connect(map, SIGNAL(deleteGroupAllPoint(int) ), missionUI->table, SLOT(deleteGroupAllPoint(int) ) );
|
||||
connect(missionUI,SIGNAL(WPnearPoint(int)),
|
||||
map,SLOT(WPnearPoint(int)));
|
||||
|
||||
@@ -508,8 +508,8 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
connect(map,SIGNAL(WPProperty(float,float,float,float,int32_t,int32_t,float,uint16_t,uint16_t,uint16_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t)),
|
||||
dlink->mavlinknode->Mission,SLOT(transmitPoint(float,float,float,float,int32_t,int32_t,float,uint16_t,uint16_t,uint16_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t)),Qt::DirectConnection);
|
||||
|
||||
connect(dlink->mavlinknode->Mission,SIGNAL(clearWaypoint()),
|
||||
map,SLOT(WPDeleteAll()));
|
||||
// connect(dlink->mavlinknode->Mission,SIGNAL(clearWaypoint()),
|
||||
// map,SLOT(WPDeleteAll()));
|
||||
|
||||
|
||||
connect(dlink->mavlinknode,SIGNAL(addVehicles(int,int)),
|
||||
|
||||
+1
-1
Submodule VehicleManage updated: 400d726bd6...a49692303b
@@ -517,6 +517,26 @@ void OPMapWidget::DeleteTrail(void)
|
||||
}
|
||||
}
|
||||
|
||||
void OPMapWidget::cleanGroupWayPoint(int group)
|
||||
{
|
||||
QList<QGraphicsItem *> lists = map->childItems();
|
||||
emit deleteGroupAllPoint(group);
|
||||
foreach(QGraphicsItem * i, lists)
|
||||
{
|
||||
WayPointItem *w = qgraphicsitem_cast<WayPointItem *>(i);
|
||||
|
||||
if (w)
|
||||
{
|
||||
if(w->MissionType() == group)
|
||||
{
|
||||
emit WPDeleted(w->Number(), w);
|
||||
delete w;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3280,14 +3300,94 @@ void OPMapWidget::receivedPoint(float param1,float param2,float param3,float par
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
emit showMessage(tr("recieve way point group:%1 seq:%2").arg(mission_type - 2).arg(seq + 1));
|
||||
|
||||
|
||||
qDebug() << "数据更新";
|
||||
qDebug() << u8"seq的值: " << seq;
|
||||
qDebug() << u8"需要更新的组:" << mission_type;
|
||||
|
||||
|
||||
if(seq == 0)
|
||||
{
|
||||
cleanGroupWayPoint(mission_type); //清空需要更新组中所有的航点
|
||||
}
|
||||
|
||||
|
||||
|
||||
internals::PointLatLng LatLng;
|
||||
|
||||
LatLng.SetLat(x * 10e-8);
|
||||
LatLng.SetLng(y * 10e-8);
|
||||
|
||||
//获取当前组下面的seq最大值
|
||||
WayPointItem *Item = new WayPointItem(LatLng, z,seq+1,mission_type, map);
|
||||
|
||||
if(mission_type != currentGroup)
|
||||
{
|
||||
Item->setisActive(false);
|
||||
Item->update();
|
||||
}
|
||||
|
||||
|
||||
ConnectWP(Item);
|
||||
Item->setParentItem(map);
|
||||
Item->SetMissionType(mission_type);
|
||||
int position = Item->Number();
|
||||
emit WPCreated(position, Item);
|
||||
setOverlayOpacity(overlayOpacity);
|
||||
|
||||
|
||||
emit setWPProperty(param1,param2,param3,param4,
|
||||
x,y,z,
|
||||
seq+1,
|
||||
group,
|
||||
command,
|
||||
target_system,
|
||||
target_component,
|
||||
frame,
|
||||
current,
|
||||
autocontinue,
|
||||
mission_type);
|
||||
|
||||
|
||||
Item->emitWPProperty();
|
||||
Item->setisShowTip(isShowTip);
|
||||
|
||||
qDebug() << "waypoint not exist:" << Item->Number() << seq+1 <<currentGroup << mission_type;
|
||||
|
||||
//===========连线
|
||||
|
||||
|
||||
WayPointItem *w_last = WPFind(Item->MissionType(),Item->Number() - 1);
|
||||
|
||||
if(w_last)
|
||||
{
|
||||
if(currentGroup == mission_type)
|
||||
{
|
||||
WPLineCreate(w_last,Item,Qt::green,false,2);
|
||||
}
|
||||
else
|
||||
{
|
||||
WPLineCreate(w_last,Item,Qt::gray,false,2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
mission_type -= 2;
|
||||
|
||||
bool isExist = false;
|
||||
foreach(QGraphicsItem * i, map->childItems()) {
|
||||
WayPointItem *w = qgraphicsitem_cast<WayPointItem *>(i);
|
||||
if (w) {
|
||||
if (w)
|
||||
{
|
||||
|
||||
if(w->MissionType() == mission_type)//如果组别一样,那么就赋值
|
||||
{
|
||||
qDebug() << u8"航点的组: " << w->MissionType();
|
||||
if(w->Number() == (seq+1))
|
||||
{
|
||||
qDebug() << "waypoint exist:" << w->Number() << seq+1;
|
||||
@@ -3373,8 +3473,15 @@ void OPMapWidget::receivedPoint(float param1,float param2,float param3,float par
|
||||
}
|
||||
|
||||
qDebug() << "Exist" << isExist;
|
||||
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -489,6 +489,12 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief 删除指定组中的所有航点
|
||||
* @param group 需要删除航点的组
|
||||
*/
|
||||
void cleanGroupWayPoint(int group);
|
||||
|
||||
internals::Core *core;
|
||||
MapGraphicItem *map;
|
||||
QGraphicsScene mscene;
|
||||
@@ -555,6 +561,11 @@ protected:
|
||||
|
||||
// private slots:
|
||||
signals:
|
||||
/**
|
||||
* @brief 删除指定组的所有航点
|
||||
* @param group 指定组
|
||||
*/
|
||||
void deleteGroupAllPoint(int group);
|
||||
void cmd_long( float param1,float param2,float param3,float param4,float param5,float param6,float param7,uint16_t command,uint8_t confirmation);
|
||||
void cancelRequest();
|
||||
void percentageChanged(int const & perc);
|
||||
|
||||
Reference in New Issue
Block a user