diff --git a/App/GCS_zh_CN.qm b/App/GCS_zh_CN.qm index 935b486..d055500 100644 Binary files a/App/GCS_zh_CN.qm and b/App/GCS_zh_CN.qm differ diff --git a/App/GCS_zh_CN.ts b/App/GCS_zh_CN.ts index 1398b2c..fb1928e 100644 --- a/App/GCS_zh_CN.ts +++ b/App/GCS_zh_CN.ts @@ -2127,36 +2127,36 @@ 参数 - - + + Communication Lost 通讯丢失 - - + + Communication Regain 通讯已恢复 - + R:%1 / T:%2 收:%1/发:%2 - - - + + + 未定位 - + %1D[%2颗] %1D[%2颗] - + fix[%1颗] %1D Fix 差分[%1颗] @@ -2174,435 +2174,414 @@ GPS错误 - + float[%1颗] 浮点[%1颗] - + err[%1颗] 错误[%1颗] - + ARM 解锁 - + DISARM 上锁 - + MANUAL 手动 - + ALTCTL 定高 - + POSCTL 定点 - + AUTO 自主 - + ACRO - + OFFBOARD - + STABILIZED 增稳 - + RATTITUDE 速率 - + STANDBY 待机 - + BIT 测试 - + AUTO_READY 就绪 - + AUTO_TAKEOFF 起飞 - + AUTO_LOITER 盘旋 - + AUTO_MISSION 任务 - + AUTO_RTL 返航 - + AUTO_LAND 着陆 - + AUTO_RTGS RTGS - + AUTO_FOLLOW_TARGET 目标跟随 - + 开加力 - + 半加力 - + 全加力 - - + + 关加力 - + 伞舱开 - + 伞舱关 - + INS解算正常 - + INS星数不足 - + INS内部错误 - + INS速度超限 - + SBG解算正常 - + SBG星数不足 - + SBG内部错误 - + SBG速度超限 - + 安控区内 - + 安控区外 - + mission group has changed, current group is %1 航线切换,当前航线为 %1 - + VERT_OFF OFF 纵向制导关闭 - + VNAV2THT 消除纵向偏差 - + HDOT2THT 控制升降速率 - + GAMMA2THT 控制航迹角 - + AS2THT 俯仰控制速度 - + H2THT 控制绝对高度 - + AGL2THT 控制相对高度 - + LAT_OFF 横向制导关闭 - + LNAV2PHI 滚转消除侧偏 - + PSI2PHI 滚转控制航向 - - - + + + - GPS Unlocated - 未定位 + 未定位 - - %1D - - - - - fixed - - - - - float - - - - - %1 - - - - - + + 未初始化 - - + + 垂直陀螺 - - + + AHRS - - + + 速度导航 - - + + 位置导航 - - - - - - - - + + + + + + + + 正常 - - - - - - - - - - + + + + + + + + + + 无效 - - + + 解算正常 - - + + 卫星数不足 - - + + 内部错误 - - + + 速度超限 - - - - + + + + 未知 - - + + 多普勒 - - - - 微分 - - - - - - 单点 - - - - - - 伪距差分 - - - - - - SBAS广域差分 - - - - - - 广域差分 - - - - - - RTK_FLOAT - - + 微分 + + + + + + 单点 + + + + + + 伪距差分 + + + + + + SBAS广域差分 + + + + + + 广域差分 + + + + + + RTK_FLOAT + + + + + RTK_INT - - + + PPP_FLOAT - - + + PPP_INT - - + + FIXED @@ -2611,17 +2590,17 @@ 未支持 - + flight mode 飞行模式 - + 连接内置惯导 - + 连接SBG @@ -2766,6 +2745,141 @@ Form 界面 + + + add + + + + + Rectangle + + + + + Round + + + + + Mission 1 + + + + + Mssion 2 + + + + + Mssion 3 + + + + + Mission 4 + + + + + del + 删除 + + + + Mission Table + 航线表 + + + + waypoint + 航点 + + + + return + 返航 + + + + landing + 降落 + + + + takeoff + 起飞 + + + + number + 航点 + + + + command + 类型 + + + + par1 + 参数1 + + + + par2 + 参数2 + + + + par3 + 参数3 + + + + par4 + 参数4 + + + + lat + 纬度 + + + + lng + 经度 + + + + alt + 海拔 + + + + 保持 + + + + + 表速 + + + + + 快升 + + + + + 开加力 + + + + + 关加力 + + MultiSelector @@ -3859,7 +3973,6 @@ - 500瓦打开 @@ -4005,6 +4118,11 @@ 取消 + + + 500瓦开 + + 版本信息 @@ -4783,6 +4901,11 @@ p, li { white-space: pre-wrap; } upload 上传 + + + Table + 列表 + Alt @@ -4819,12 +4942,10 @@ p, li { white-space: pre-wrap; } - Previous 上一个 - Next 下一个 @@ -4858,82 +4979,82 @@ p, li { white-space: pre-wrap; } - - - + + + Relative 相对 - - - + + + Absolutely 绝对 - + param1 - + param2 - + param3 - + param4 - + param5 - + param6 - + param7 - + set 设置 - + Altitude 海拔 - + setLatitude 设置纬度 - + setLongitude 设置经度 - - + + plan file (*.plan) 任务文件 (*.plan) - + click to clear all points 点击清除所有航点 @@ -4988,13 +5109,18 @@ p, li { white-space: pre-wrap; } 参数6 - - Group - + + Ruler + 测量 - - + + Group + 组别 + + + + Selete Way Point File... Select Loading File... 选择载入文件... diff --git a/App/MissionUI/MissionUI.cpp b/App/MissionUI/MissionUI.cpp index 9c95b18..8ddb0df 100644 --- a/App/MissionUI/MissionUI.cpp +++ b/App/MissionUI/MissionUI.cpp @@ -8,47 +8,51 @@ MissionUI::MissionUI(QWidget *parent) : ui->setupUi(this); setWindowTitle(tr("Mission Table")); + tablelist.insert(1,ui->tableWidget_1); + tablelist.insert(3,ui->tableWidget_3); + tablelist.insert(4,ui->tableWidget_4); + tablelist.insert(5,ui->tableWidget_5); + tablelist.insert(6,ui->tableWidget_6); - ui->tableWidget->setRowCount(10); //设置行数 - ui->tableWidget->setColumnCount(7); //设置列数为7 - ui->tableWidget->setGeometry(QRect(10,455,740,95)); //设置tableWidget的大小 - ui->tableWidget->setItem(0,0,new QTableWidgetItem("0")); //第一行第一列的内容设置为0 - ui->tableWidget->setItem(1,0,new QTableWidgetItem("1")); //第一行第一列的内容设置为1 - ui->tableWidget->setItem(2,0,new QTableWidgetItem("2")); //第一行第一列的内容设置为2 - ui->tableWidget->setItem(3,0,new QTableWidgetItem("3")); //第一行第一列的内容设置为3 + ui->tabWidget->setCurrentIndex(1); + + foreach (QTableWidget *table, tablelist) { + if(table) + { + table->setColumnCount(9); //设置列数为7 + table->setGeometry(QRect(10,455,740,95)); //设置tableWidget的大小 + + table->setSelectionBehavior(QAbstractItemView::SelectRows);//设置选中模式为选中行 + + table->setColumnWidth(0,45); //设置第一列的列宽(num) + table->setColumnWidth(1,80); //设置第二列的列宽(cmd) + table->setColumnWidth(2,80); //设置第三列的列宽(par1) + table->setColumnWidth(3,80); //设置第四列的列宽(par2) + table->setColumnWidth(4,80); //设置第五列的列宽(par3) + table->setColumnWidth(5,80); //设置第六列的列宽(par4) + table->setColumnWidth(6,150); //设置第七列的列宽(lat) + table->setColumnWidth(7,150); //设置第八列的列宽(lng) + table->setColumnWidth(8,100); //设置第九列的列宽(alt) - QComboBox *classBox = new QComboBox; - classBox->addItem("一年级"); - classBox->addItem("二年级"); - classBox->addItem("三年级"); - classBox->addItem("四年级"); - classBox->addItem("五年级"); - classBox->setCurrentText("一年级"); - ui->tableWidget->setCellWidget(0,1,classBox); + table->setHorizontalHeaderLabels(QStringList() <setFont(QFont("黑体",12,3)); //设置字体 + QHeaderView* V_headerView = table->verticalHeader(); + V_headerView->setHidden(true); //行名隐藏 + + QHeaderView* H_headerView = table->horizontalHeader(); + H_headerView->setStretchLastSection(true); + H_headerView->setDefaultAlignment(Qt::AlignLeft); //表头信息显示居中靠左 - ui->tableWidget->setRowHeight(0,18); //设置第一行的行高 - ui->tableWidget->setRowHeight(1,18); //设置第二行的行高 - ui->tableWidget->setRowHeight(2,18); //设置第三行的行高 - ui->tableWidget->setRowHeight(3,18); //设置第三行的行高 - ui->tableWidget->setColumnWidth(0,45); //设置第一列的列宽 - ui->tableWidget->setColumnWidth(1,55); //设置第二列的列宽 - ui->tableWidget->setColumnWidth(2,160); //设置第三列的列宽 - ui->tableWidget->setColumnWidth(3,160); //设置第四列的列宽 - ui->tableWidget->setColumnWidth(4,100); //设置第五列的列宽 - ui->tableWidget->setColumnWidth(5,100); //设置第六列的列宽 - ui->tableWidget->setColumnWidth(6,100); //设置第七列的列宽 - ui->tableWidget->setHorizontalHeaderLabels(QStringList() <tableWidget->setFont(QFont("黑体",12,3));//设置字体 - QHeaderView* V_headerView = ui->tableWidget->verticalHeader(); - V_headerView->setHidden(true); //行名隐藏 - QHeaderView* H_headerView = ui->tableWidget->horizontalHeader(); - H_headerView->setStretchLastSection(true); - H_headerView->setDefaultAlignment(Qt::AlignLeft); //表头信息显示居中靠左 + connect(table,&QTableWidget::itemSelectionChanged, + this,&MissionUI::itemSelectionChanged); + } + } + } MissionUI::~MissionUI() @@ -67,6 +71,233 @@ void MissionUI::resizeEvent(QResizeEvent *event) } +void MissionUI::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) +{ + QTableWidget *tableWidget; + + + + foreach (QTableWidget *table, tablelist) { + if(table) + { + if(tablelist.value(mission_type) == table) + { + tableWidget = table; + break; + } + } + } + + + qDebug() << "find QTableWidget" << mission_type << tablelist.value(mission_type); + + int idx = seq -1; + + tableWidget->setRowCount(tableWidget->rowCount()+1); //设置行数+1 + + + tableWidget->setItem(idx,0,new QTableWidgetItem(QString::number(seq))); //第一列的内容设置为index + + qDebug() << "pointCreate seq" << seq; + + QComboBox *cmdBox = new QComboBox; + cmdBox->addItem(tr("waypoint"),16); + cmdBox->addItem(tr("return"),20); + cmdBox->addItem(tr("landing"),21); + cmdBox->addItem(tr("takeoff"),22); + cmdBox->setCurrentIndex(cmdBox->findData(command)); + tableWidget->setCellWidget(idx,1,cmdBox); + + if(command == 16) + { + QComboBox *par1Box = new QComboBox; + par1Box->addItem(tr("保持"),0); + par1Box->addItem(tr("表速"),-1); + par1Box->addItem(tr("快升"),-2); + par1Box->addItem(tr("开加力"),-3); + par1Box->addItem(tr("关加力"),-4); + par1Box->setCurrentIndex(par1Box->findData(param1)); + tableWidget->setCellWidget(idx,2,par1Box); + } + else if(command == 20) + { + tableWidget->removeCellWidget(idx,2); + tableWidget->setItem(idx,2,new QTableWidgetItem(QString::number(param1))); + } + else if(command == 21) + { + tableWidget->removeCellWidget(idx,2); + tableWidget->setItem(idx,2,new QTableWidgetItem(QString::number(param1))); + } + else if(command == 22) + { + tableWidget->removeCellWidget(idx,2); + tableWidget->setItem(idx,2,new QTableWidgetItem(QString::number(param1))); + } + + tableWidget->setItem(idx,3,new QTableWidgetItem(QString::number(param2))); + tableWidget->setItem(idx,4,new QTableWidgetItem(QString::number(param3))); + tableWidget->setItem(idx,5,new QTableWidgetItem(QString::number(param4))); + + + + + tableWidget->setItem(idx,6,new QTableWidgetItem(QString::number(x * 10e-8,'f',7))); + tableWidget->setItem(idx,7,new QTableWidgetItem(QString::number(y * 10e-8,'f',7))); + tableWidget->setItem(idx,8,new QTableWidgetItem(QString::number(z))); + + + for (int i = 0;irowCount();i++) + { + if(tableWidget->item(i,0)==NULL|| //判断指向该cell的指针是否为空 + (tableWidget->item(i,0)&& + tableWidget->item(i,0)->text()==tr(""))) //判断该cell的text是否为空 + { + tableWidget->removeRow(i); + } + } + + for (int i = 0;irowCount();i++) + { + QTableWidgetItem* pItem = tableWidget->item(i, 0); + if(pItem) + pItem->setFlags(pItem->flags() & (~Qt::ItemIsEditable)); + } + +} + +void MissionUI::pointDelete(int idx) +{ + /* + if(tableWidget->rowAt(idx) != -1) + { + tableWidget->removeRow(idx); //删除掉了表格信息 + } + */ +} + +void MissionUI::on_tableWidget_3_itemChanged(QTableWidgetItem *item) +{ + qDebug() << item->data(Qt::DisplayRole); + + QTableWidget *widget = qobject_cast(sender()); + + int group = tablelist.key(widget); + + + + +} + +void MissionUI::on_tabWidget_currentChanged(int index) +{ + int group = 3; + + switch (index) { + case 0: + group = 1; + break; + case 1: + group = 3; + break; + case 2: + group = 4; + break; + case 3: + group = 5; + break; + case 4: + group = 6; + break; + default: + break; + } + + emit groupChanged(group); + +} + +void MissionUI::on_pushButton_load_clicked() +{ + QFileDialog *dlg = new QFileDialog(); + QString fileName = dlg->getOpenFileName(this, tr("Selete Way Point File..."), + "./plan/", + tr("plan file (*.plan)")); + if(!fileName.isEmpty()) + { + emit WPLoad(fileName); + } +} + +void MissionUI::on_pushButton_save_clicked() +{ + QFileDialog *dlg = new QFileDialog(); + + QString fileName = dlg->getSaveFileName(this, tr("Selete Way Point File..."), + "./plan/", + tr("plan file (*.plan)")); + if(!fileName.isEmpty()) + { + emit WPSave(fileName); + } +} + +void MissionUI::on_pushButton_upload_clicked() +{ + emit WPUpload(); +} + +void MissionUI::on_pushButton_download_clicked() +{ + emit WPDownload(); +} + +void MissionUI::on_pushButton_insert_clicked() +{ + emit WPInsert(); +} + +void MissionUI::on_pushButton_delete_clicked() +{ + emit WPDelete(); +} + +void MissionUI::on_pushButton_add_clicked() +{ + emit WPAdd(); +} + +void MissionUI::on_pushButton_clean_clicked() +{ + emit WPDeleteAll(); +} + + +void MissionUI::itemSelectionChanged() +{ + QTableWidget *widget = qobject_cast(sender()); + + int group = tablelist.key(widget); + + int idx = widget->currentRow() + 1; + + qDebug() << "group" << "index" << group << idx; + + + emit waypointSelect(group,idx); + +} + diff --git a/App/MissionUI/MissionUI.h b/App/MissionUI/MissionUI.h index 4df7072..742bbcd 100644 --- a/App/MissionUI/MissionUI.h +++ b/App/MissionUI/MissionUI.h @@ -6,8 +6,8 @@ #include "Inputter.h" #include "Selector.h" #include "QComboBox" - - +#include "QTableWidget" +#include "QFileDialog" namespace Ui { class MissionUI; } @@ -21,15 +21,66 @@ public: ~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); + protected slots: void closeEvent(QCloseEvent *event); void resizeEvent(QResizeEvent *event); +private slots: + void itemSelectionChanged(); + + void on_tableWidget_3_itemChanged(QTableWidgetItem *item); + + void on_tabWidget_currentChanged(int index); + + void on_pushButton_load_clicked(); + void on_pushButton_save_clicked(); + void on_pushButton_upload_clicked(); + void on_pushButton_download_clicked(); + void on_pushButton_insert_clicked(); + void on_pushButton_delete_clicked(); + void on_pushButton_add_clicked(); + + void on_pushButton_clean_clicked(); + +signals: + + 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); + + private: Ui::MissionUI *ui; - + QMap tablelist; diff --git a/App/MissionUI/MissionUI.ui b/App/MissionUI/MissionUI.ui index 213c1b9..bca8947 100644 --- a/App/MissionUI/MissionUI.ui +++ b/App/MissionUI/MissionUI.ui @@ -6,70 +6,193 @@ 0 0 - 736 - 445 + 1033 + 482 Form + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + save + + + + + + + insert + + + + + + + upload + + + + + + + add + + + + + + + downlload + + + - - - QFrame::Plain + + + load - - 2 + + + + + + delete - - 2 + + + + + + 1 - - QAbstractItemView::DoubleClicked + + + Rectangle + + + + + + QFrame::Plain + + + 2 + + + 2 + + + QAbstractItemView::DoubleClicked + + + false + + + false + + + QAbstractItemView::ScrollPerPixel + + + true + + + Qt::SolidLine + + + false + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + + + + + + Mission 1 + + + + + + + + + + Mssion 2 + + + + + + + + + + Mssion 3 + + + + + + + + + + Mission 4 + + + + + + + + + + + + + clean - - false - - - false - - - QAbstractItemView::ScrollPerPixel - - - true - - - Qt::SolidLine - - - false - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - diff --git a/App/MissionUI/propertyui.cpp b/App/MissionUI/propertyui.cpp index 27c3c3d..2fcde89 100644 --- a/App/MissionUI/propertyui.cpp +++ b/App/MissionUI/propertyui.cpp @@ -149,7 +149,40 @@ propertyui::propertyui(QWidget *parent) : table = new MissionUI(); - //table->hide(); + + connect(table,&MissionUI::WPLoad, + this,&propertyui::WPLoad); + + connect(table,&MissionUI::WPSave, + this,&propertyui::WPSave); + + connect(table,&MissionUI::WPUpload, + this,&propertyui::WPUpload); + + connect(table,&MissionUI::WPDownload, + this,&propertyui::WPDownload); + + connect(table,&MissionUI::WPInsert, + this,&propertyui::WPInsert); + + connect(table,&MissionUI::WPDelete, + this,&propertyui::WPDelete); + + + connect(table,&MissionUI::WPDeleteAll, + this,&propertyui::WPDeleteAll); + + connect(table,&MissionUI::WPAdd, + this,&propertyui::WPAdd); + + + connect(table,&MissionUI::groupChanged, + this,&propertyui::GroupChanged); + + + connect(table,&MissionUI::waypointSelect, + this,&propertyui::waypointSelect); + } @@ -583,6 +616,15 @@ void propertyui::rebuildUI(QString CMD) } + if(table) + { + table->pointCreate(m_param1,m_param2,m_param3,m_param4, + m_x,m_y,m_z, + m_seq,m_group,m_command, + m_target_system,m_target_component, + m_frame,m_current,m_autocontinue,m_mission_type); + } + update(); } @@ -784,6 +826,15 @@ void propertyui::WayPointPropertyUpdate(bool flag) m_target_system,m_target_component, m_frame,m_current,m_autocontinue,m_mission_type); + if(table) + { + table->pointCreate(m_param1,m_param2,m_param3,m_param4, + m_x,m_y,m_z, + m_seq,m_group,m_command, + m_target_system,m_target_component, + m_frame,m_current,m_autocontinue,m_mission_type); + } + /* emit WayPointPropertyChanged(m_param1,m_param2,m_param3,m_param4, m_x,m_y,m_z, @@ -838,6 +889,24 @@ void propertyui::setWayPointProperty(float param1,float param2,float param3,floa } } + //如果表格存在,那么开始设置参数 + if(table) + { + table->pointCreate(param1,param2,param3,param4, + x,y,z, + seq, + group, + command, + target_system, + target_component, + frame, + current, + autocontinue, + mission_type); + } + + + qDebug() << "propertyUI set:" << m_param1 << m_param2 @@ -1314,6 +1383,9 @@ void propertyui::setallPoint(QMap list) } + + + void propertyui::setSeqNav(QVariant value) { //读取这个值得航点 @@ -1957,25 +2029,23 @@ void propertyui::on_pushButton_Save_clicked() void propertyui::on_pushButton_Upload_clicked() { - //emit WPGroup(missionGroups); emit WPUpload(); } void propertyui::on_pushButton_Download_clicked() { - //emit WPGroup(missionGroups); emit WPDownload(); } void propertyui::on_pushButton_Previous_clicked() { if(m_seq > 0) - emit WPotherPoint(-1); + emit WPnearPoint(-1); } void propertyui::on_pushButton_Next_clicked() { - emit WPotherPoint(+1); + emit WPnearPoint(+1); } @@ -1989,7 +2059,23 @@ void propertyui::on_pushButton_Delete_clicked() emit WPDelete(); } +void propertyui::waypointSelect(int group,int idx) +{ + //读取这个值得航点 + GroupChanged(group); + emit WPotherPoint(idx); +} + +void propertyui::GroupChanged(int value) +{ + ui->pushButton_Group->setText(QString::number(value - 2)); + + missionGroups = value; + + emit WPGroup(missionGroups); + +} void propertyui::setGroup(QVariant value) { diff --git a/App/MissionUI/propertyui.h b/App/MissionUI/propertyui.h index 7d8a81b..a932113 100644 --- a/App/MissionUI/propertyui.h +++ b/App/MissionUI/propertyui.h @@ -239,9 +239,12 @@ Q_SIGNALS: + void WPnearPoint(int dir); void WPotherPoint(int seq); void WPInsert(); void WPDelete(); + void WPDeleteAll(void); + void WPAdd(void); void WPSave(QString path); @@ -253,9 +256,11 @@ Q_SIGNALS: void WPGroup(int group); - private slots: + void GroupChanged(int value); + void waypointSelect(int group,int idx); + void setSeqNav(QVariant value); void setFriendlyName(QVariant value); void setAltType(QVariant value); diff --git a/App/mainwindow.cpp b/App/mainwindow.cpp index 05c069d..1806393 100644 --- a/App/mainwindow.cpp +++ b/App/mainwindow.cpp @@ -368,10 +368,12 @@ MainWindow::MainWindow(QWidget *parent) 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(missionUI,SIGNAL(WPnearPoint(int)), + map,SLOT(WPnearPoint(int))); + connect(missionUI,SIGNAL(WPotherPoint(int)), map,SLOT(WPotherPoint(int))); - connect(missionUI,SIGNAL(WPDelete()), map,SLOT(WPDelete())); @@ -393,8 +395,11 @@ MainWindow::MainWindow(QWidget *parent) connect(missionUI,SIGNAL(WPGroup(int)), map,SLOT(WPGroup(int))); + connect(missionUI,SIGNAL(WPDeleteAll()), + map,SLOT(WPDeleteAll())); - + connect(missionUI,SIGNAL(WPAdd()), + map,SLOT(WPAdd())); connect(map,SIGNAL(allPoint(QMap)), diff --git a/opmap/MAP_zh_CN.ts b/opmap/MAP_zh_CN.ts index 7ea7742..6b10e34 100644 --- a/opmap/MAP_zh_CN.ts +++ b/opmap/MAP_zh_CN.ts @@ -78,23 +78,23 @@ Please first select the area of the map to rip with <CTRL>+Left mouse clic mapcontrol::OPMapWidget - + .plan - + 开始上传航点,总数%1 - + 上传失败%1 - - 收到航点 %1 + + recieve way point group:%1 seq:%2 diff --git a/opmap/mapwidget/opmapwidget.cpp b/opmap/mapwidget/opmapwidget.cpp index 4946e15..74ff906 100644 --- a/opmap/mapwidget/opmapwidget.cpp +++ b/opmap/mapwidget/opmapwidget.cpp @@ -96,10 +96,17 @@ OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config) : QGraphicsView mscene.addItem(waypointsetting); waypointsetting->hide(); + // WPnearPoint + + connect(waypointsetting,SIGNAL(WPnearPoint(int)), + this,SLOT(WPnearPoint(int))); + connect(waypointsetting,SIGNAL(WPotherPoint(int)), this,SLOT(WPotherPoint(int))); + + connect(waypointsetting,SIGNAL(WPDelete()), this,SLOT(WPDelete())); @@ -1186,6 +1193,28 @@ void OPMapWidget::WPSetVisibleAll(bool value) } } +void OPMapWidget::WPAdd(void) +{ + internals::PointLatLng LatLng; + LatLng.SetLat(0); + LatLng.SetLng(0); + WayPointItem *Item = WPCreate(LatLng,50); + + + foreach(QGraphicsItem * i, map->childItems()) { + WayPointItem *w = qgraphicsitem_cast(i); + + if (w) { + if (w->MissionType() == Item->MissionType()) { + if(w->Number() == (Item->Number() - 1)) + { + WPLineCreate(w,Item,Qt::green,false,2); + } + } + } + } +} + //清除当前航线才能下载 void OPMapWidget::WPDeleteAll() { @@ -1424,8 +1453,7 @@ void OPMapWidget::OnSelectionChanged() } } - -void OPMapWidget::WPotherPoint(int number) +void OPMapWidget::WPnearPoint(int number) { int position = 0; int group = 3; @@ -1442,13 +1470,32 @@ void OPMapWidget::WPotherPoint(int number) } } - if(1 != qAbs(number)) + WayPointItem *wp = WPFind(group,position); + + if(wp) { - position = number; + setSelectedWP(position); + wp->emitWPProperty(); + } +} + +void OPMapWidget::WPotherPoint(int number) +{ + int position = 0; + int group = 3; + + + foreach(QGraphicsItem * i, map->childItems()) { + WayPointItem *w = qgraphicsitem_cast(i); + + if (w) { + if (w->isSelected()) { + group = w->MissionType(); + } + } } - - //position = number; + position = number; WayPointItem *wp = WPFind(group,position); diff --git a/opmap/mapwidget/opmapwidget.h b/opmap/mapwidget/opmapwidget.h index b8ec69d..fb8d1eb 100644 --- a/opmap/mapwidget/opmapwidget.h +++ b/opmap/mapwidget/opmapwidget.h @@ -675,6 +675,7 @@ public slots: void WPDelete(WayPointItem *item); void WPDelete(void); void WPDeleteAll(); + void WPAdd(void); void WPInsert(); void WPInsert(WayPointItem *item, int const & position); @@ -700,6 +701,7 @@ public slots: void ruler_clicked(void); void table_clicked(void); + void WPnearPoint(int dir); void WPotherPoint(int number); void WPsearchall(void); diff --git a/opmap/mapwidget/waypointsetting.cpp b/opmap/mapwidget/waypointsetting.cpp index eb54560..5710075 100644 --- a/opmap/mapwidget/waypointsetting.cpp +++ b/opmap/mapwidget/waypointsetting.cpp @@ -251,12 +251,12 @@ void WayPointSetting::delete_clicked(void) void WayPointSetting::last_clicked(void) { - emit WPotherPoint(-1);//选中减一 + emit WPnearPoint(-1);//选中减一 } void WayPointSetting::next_clicked(void) { - emit WPotherPoint(+1);//选中点加一 + emit WPnearPoint(+1);//选中点加一 } void WayPointSetting::ruler_clicked(void) diff --git a/opmap/mapwidget/waypointsetting.h b/opmap/mapwidget/waypointsetting.h index 60937c6..1612b43 100644 --- a/opmap/mapwidget/waypointsetting.h +++ b/opmap/mapwidget/waypointsetting.h @@ -163,7 +163,7 @@ signals: uint8_t mission_type); - + void WPnearPoint(int dir); void WPotherPoint(int seq); void WPInsert(); void WPDelete();