161 lines
3.6 KiB
C++
161 lines
3.6 KiB
C++
#ifndef MISSIONUI_H
|
|
#define MISSIONUI_H
|
|
|
|
#include <QWidget>
|
|
|
|
#include "Inputter.h"
|
|
#include "Selector.h"
|
|
#include "QComboBox"
|
|
#include "QLineEdit"
|
|
#include "QTableWidget"
|
|
#include "QFileDialog"
|
|
|
|
#include "CustomButton.h"
|
|
#include "QSpacerItem"
|
|
|
|
namespace Ui {
|
|
class MissionUI;
|
|
}
|
|
|
|
class MissionUI : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
QMap<int,QString> commandtext = {
|
|
{16,tr("waypoint")},
|
|
{20,tr("return")},
|
|
{21,tr("landing")},
|
|
{22,tr("takeoff")},
|
|
};
|
|
|
|
QMap<int,QString> waypointtext = {
|
|
{-2,tr("hold")},
|
|
{-1,tr("hold")},
|
|
{0,tr("hold")},
|
|
{1,tr("ias")},
|
|
{2,tr("qclimb")},
|
|
};
|
|
|
|
|
|
|
|
|
|
explicit MissionUI(QWidget *parent = nullptr);
|
|
~MissionUI();
|
|
|
|
|
|
public slots:
|
|
void pointCreate(float param1,float param2,float param3,float param4,
|
|
int32_t x,int32_t y,float z,
|
|
uint16_t seq,
|
|
uint16_t group,
|
|
uint16_t command,
|
|
uint8_t target_system,
|
|
uint8_t target_component,
|
|
uint8_t frame,
|
|
uint8_t current,
|
|
uint8_t autocontinue,
|
|
uint8_t mission_type);
|
|
void pointDelete(int idx);
|
|
|
|
|
|
void setCurrent(int group,int idx);
|
|
|
|
void settableGroup(int group);
|
|
|
|
void createFenceCircle(int group,qreal radius, bool inclusion, qreal lat, qreal lng);
|
|
void createFencePolygon(int group,qreal vertex,bool inclusion,QList<QPointF> latlng);
|
|
|
|
void updateFenceCircle(int group,qreal radius, bool inclusion, qreal lat, qreal lng);
|
|
void updateFencePolygon(int group,qreal vertex,bool inclusion,QList<QPointF> latlng);
|
|
|
|
void currentPointSeleted(int group,int point);
|
|
|
|
void FenceGroupChanged(int old,int cur);
|
|
|
|
void clearTable();
|
|
/**
|
|
* @brief 删除指定航线中的所有航点信息
|
|
* @param air_route 指定航线
|
|
*/
|
|
void clearAirRouteInfo(int air_route);
|
|
|
|
|
|
protected slots:
|
|
void closeEvent(QCloseEvent *event);
|
|
void resizeEvent(QResizeEvent *event);
|
|
/**
|
|
* @brief 事件过滤器,用来处理航点参数cmmand的combobox失去焦点后自动删除
|
|
* @param obj
|
|
* @param event
|
|
* @return
|
|
*/
|
|
bool eventFilter(QObject *obj, QEvent *event) override;
|
|
|
|
|
|
private slots:
|
|
void itemSelectionChanged();
|
|
|
|
void itemClicked(QTableWidgetItem *item);
|
|
void itemDoubleClicked(QTableWidgetItem *item);
|
|
|
|
signals:
|
|
/**
|
|
* @brief 表格中QComboBox失去焦点,发出信号
|
|
*/
|
|
void comboBoxFocusOut();
|
|
|
|
void setCommand(QVariant value);
|
|
void setParam1(QVariant value);
|
|
void setParam2(QVariant value);
|
|
void setParam3(QVariant value);
|
|
void setParam4(QVariant value);
|
|
void setParam5(QVariant value);
|
|
void setParam6(QVariant value);
|
|
void setParam7(QVariant value);
|
|
|
|
|
|
void WPnearPoint(int dir);
|
|
void WPotherPoint(int seq);
|
|
|
|
|
|
void WPSave(QString path);
|
|
void WPLoad(QString path);
|
|
void WPUpload(void);
|
|
void WPDownload(void);
|
|
void WPInsert(void);
|
|
void WPDelete(void);
|
|
void WPDeleteAll(void);
|
|
void WPAdd(void);
|
|
|
|
void groupChanged(int);
|
|
|
|
void waypointSelect(int group,int idx);
|
|
|
|
|
|
void getAllPoints(int group);//读取一下所有的航点
|
|
|
|
void setFenceCircle(int group,qreal radius, bool inclusion, qreal lat, qreal lng);
|
|
void setFencePolygon(int group,qreal vertex,bool inclusion,QList<QPointF> latlng);
|
|
|
|
|
|
void addCircle();
|
|
void addPolygon();
|
|
void delFence(int group);
|
|
|
|
void getCurrentPoint(int group);
|
|
|
|
private:
|
|
Ui::MissionUI *ui;
|
|
|
|
QMap<int,QTableWidget *> tablelist;
|
|
|
|
|
|
QTableWidget *opwidget;
|
|
QTableWidgetItem *opitem;
|
|
|
|
};
|
|
|
|
#endif // MISSIONUI_H
|