From eba4a2c339cbddbc097131d9123316abb1ac63d2 Mon Sep 17 00:00:00 2001 From: hm Date: Tue, 7 Jun 2022 17:48:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A0=87=E7=AD=BE=E6=8C=89?= =?UTF-8?q?=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/GCS_zh_CN.qm | Bin 20172 -> 20587 bytes App/GCS_zh_CN.ts | 863 ++++++++++---------- App/MenuBarUI/MenuBarUI.cpp | 2 +- App/MenuBarUI/MenuBarUI.h | 12 + App/MenuBarUI/MenuBarUI.ui | 2 +- App/MissionUI/MissionUI.cpp | 53 +- App/MissionUI/MissionUI.h | 3 + App/MissionUI/propertyui.cpp | 6 + App/MissionUI/propertyui.h | 2 + App/Setting/Index0/Global/GlobalSetting.cpp | 9 +- App/Setting/Index0/Global/GlobalSetting.ui | 129 +-- App/mainwindow.cpp | 15 +- MavLinkNode/mavlinknode.cpp | 92 ++- MavLinkNode/mavlinknode.h | 4 +- opmap/MAP_zh_CN.qm | Bin 1788 -> 3790 bytes opmap/MAP_zh_CN.ts | 105 ++- opmap/core/tilecachequeue.cpp | 4 + opmap/mapwidget/AltitudeItem.cpp | 4 +- opmap/mapwidget/geoFenceitem.cpp | 23 +- opmap/mapwidget/mapripper.cpp | 4 +- opmap/mapwidget/opmapwidget.cpp | 670 +++++++-------- opmap/mapwidget/opmapwidget.h | 5 +- opmap/mapwidget/uavitem.h | 7 + opmap/mapwidget/waypointitem.cpp | 3 + opmap/mapwidget/waypointsetting.cpp | 40 +- opmap/mapwidget/waypointsetting.h | 114 +++ 26 files changed, 1226 insertions(+), 945 deletions(-) diff --git a/App/GCS_zh_CN.qm b/App/GCS_zh_CN.qm index a1f097e2789812aaf5632905604384d167daa7ac..abe637d70686a08ff00678b2a0d3847da34d5748 100644 GIT binary patch delta 3285 zcmZvf2~<;88pl79yyWE(hziQCK@EmQF$=N?2!i4UqEHc}T9$xd2oM5_3u!A@w-Gee zYO59wq1LUUwzbyUdR&XlKU~F`bB1&7`Q3N#ec%4w7fx++ zy4~p1;BLE0L?baAf1pP*I12m%9E~xY(QOB#$4$oJ+ZabbV$`)T8oC+7lNclKf?AA8 zj4qyxo>EXpWFr%scm{xaj0Q%}iJ$?ajnT6J48!<0qvr~648|Xfp3Pu5k&}wi^ONe5YfL%mGVi~^@d0l~PFf+D4QCbExDTp%G5P4%S6Rr$6&*J}Hi~@yV&pQm z5w)H%TE`gMPMiw9#=J+|=&7hH191j5QNKgPg;`N*cy@4H7;%%3-hQ_jea%=sAq>^~8Pf8us@Pci2ee^OP}kJINdh zgMvsle+IY+oC!99X?N?Fy2)Oa<`DL`YWuTl2$14OyT#+5-6xW7U^ILrPOKY^{TOk!=5wONf#Q7$BBXSKc;6|= z>DR#My;QvakQxy)ivQ8_HEJf?ChoXWgk~EhJ|9a&ZZ{-CqbowClOzT~0l%72|5r(B zXBbhye#tBGzYz@%l;o^ji)QkZ6gX1kXOdKJwGt^(CF`ot>_a*wnz7 z&$)|HXN!<*Z`p%TKan)9hGhY~q$Q*Yxt_on+aNjD4MT=^Nv_XEjy;??ZtL5yT*2|v zabt|(Ie8uwMznB)B9SW9A6(c^xkLlMc3lvszZ~lnd z8l1tcod|~pBr|%S;MO|2B4RH0?xqmj-a2<~YvvIw)N&tuhe$Yga)%bdL*Lun#Y>1t zxDWSa+AAm`H>ul~m8gX*X~cObi0P7MKk7oL^P~%F40x|Xy4?I2#XLj0$y-OsWkyAz?fgHivJ?3m-82;Rq-IEj}X zLl;Ga@{xz(SZp|NZm}U`fhYJS2i6gVO8L5`HWXn6zd{oTL!$XL-x*;*2mj}*_)ta7 z=9@!qqgXk<<P zBl+_5*gT}BRi183tVQ*9%QG|_k!*;(*cZ8pQOS$*zQ@OHqP(Q=86tC9zHGxmc;3Yr z|Dk-{*&E35b@|Et9_W@j#xeKh*YCms`2a@47{P5sJle8ci2ijj9IX_h??XU1)UIqKRgK25`C1XtaRWzzW#!BJ9?u!)~?kmq8ox+%6oP zyd5>D-YY!5@)1&cSa|Y!6nMv3_WLggKr>@>t@EpSuj1k|Io~f3%$D0W%>+o$mKl#Bf!4DhXYY1BdBaHGo=Jt8EZ z$!J*QD)L7}Lua@KZT=k@tFx<}{cUYKQC=hRU5`Be7G)Le`fUapNP5oo@=&agPj>C{ z!;g}Xp-TB7WGVO?r6LIX!=jXK^_^HRQF?F350a3{%8>H+!SzbrXRsxtTN$4RCqfP= zCu@ViPGz0ojxwxf^uDLu-JSzIjcPXWO=k@4R(4NngZB>^^=?JDs>@rycU~|sZScIb znaMV{IkQuudb~+Z+8)J{$u+xEqDX}&9goYIka7x2sI*v&W~-@MWhp8vD>4_V3M{21 zQEII!$EwOIEiF-*j8#UHO0BbBRe8jEr#ROyoAu0+^g`-uV~u6K^OrKc5=$4FO{F>c z4r$gRlTig}r3KGL_z4a}dd<-GnZZ9-qID=4%+I6DlMdti_MI!NIToubFDGxl(Q(9& zPt9JC`#(p73TtWE%M-21{ySapD+{jI9Cf%{*4`)0Rjp03lvb9hb*ZIAW~;qC)Xn}N zYJj~mv|nrg&?eD%-?Dai#b|E_(GZ8w}a`+rWD3tybbvA=JSwk|U` zJGsrvwS3rTI#)42r_AUuvUP7*ncUtG$F*J=_f$4PRnxKfuJNsu2c)4O{NG_EBUz|~ qipWek_}3t?PlUJCXelW&=a^IljudNxM!i@Fw3jD&v|dcQC;bnLkwNYN delta 2938 zcmZXW2~ZSQ8ppqx>7Jf$28MGGP~<*lK!&*(HG&3eb9qHBnTiW*nlKRin-wO#e<_qt!d_uXIj zofg^2_hk*f&f`QBk1=?G+8l5cSP2?1A{c#I8MXC{;UZ&#C!^sgqsfoa8pLS(JD7+u zkc+_ilGT&W*SUDb6sKP~abIsF^4sv7&lvqbXB_r~F?<rm%bK#vwW>sh>Tty~3DW#+agHOfwQ65(oeJ5^tCUMb8m$jwJFtOuWTG z6gQbMZ9nl75q{5GjDb~*aVv6Gj zAqttK81r<1NZiV3>{Ddb8L*zFD2h3TQrM(8FjkIG?^PT)iT$1pPBsY$QM4b12U0I7 z{<7~Yxaup#@yqj2OMQwn=|tpngOgf3P&7NZEFA=>>KPMzxV-ZgqR8Rgbo+f2*D0=e z-3FqdBi!7O5{!HJU{5Dy}IT#jLJo)Hv6&i9Y!`KVvlHaV_;wD8j+* zi)%wn$1$dfT;CHY5T3_5_gYean;;`rv7 zJb<&}RPM7vTv@KmYUO>FCtAl(sWCICZwN=;3v^R8TIhHRJsy z%En<1geHqIak+BH)&Bj;ArD4fRGwBHMN+=6ykP>P`9Y%o?GELQxp)xLAq=@PdY|BZ zu>b-ygd!Uhipdg6o+9>I$Skl#v0XkRdvYrB5}e> zU&LG`7NnOT2MWc4thES5t5_Jr6A2^5N@vM6xHM2)Q2rF27%#5cdI*+2X3R_wH=Vu# z#oiIWX!l3b-D9*I7r*U?;-WXBaf;*kSyZnH~fqcM59-97Ok zTv(yz-W!Jy^{ZpLz>JG({T>Jm?^Rp0H=)QU>Zwfw_{d*VJMLXVa>lFQ?foY#?`6zr zS3k^0NW<*y?s<)9Am+X9^>;?VqTTNG_x}bia(5kqz#x727FbXh`3Nl`rC;o4&Mb=8_%d9JZ^rq&f@$>q6xzCiC3o_>AT%U$yqmJjWUwdQ(r`8{QeUM?*vu5#IpzOJ2CzGJ1;P3E<7MdA7v%bcTT zk?X2i+i@W2*J7ZAKS~RJJ1vy;;tk$xF - + 保存 @@ -1463,7 +1463,7 @@ - + 读取 @@ -1518,6 +1518,11 @@ 显示值 = 方向 * RAW / 32767 * 极值 / 比例 - 零偏 + + + 地图信息 + + ID设置 @@ -1529,161 +1534,177 @@ - + 地图设置 - + 右下坐标 - + 地图等级 - + 左上坐标 - + + + start cache + 开始缓存 + + + 选择地图 - + 纬度 - - 开始缓存 - - - - + %v - + 经度 - + 地图缓存信息 - + 上传心跳 - + 频率 - + 状态 - + level %1 - + 等级 %1 - + 250 250 - + 251 251 - + 252 252 - + 253 253 - + 254 254 - + 255 255 - + 1.0Hz - + 2.0Hz - + 5.0Hz - + 10Hz - + 发送心跳包 - + 关闭心跳包 - - + + 设置本机ID成功,ID:%1 - + 舵面偏差读取成功 - + 舵面偏差设置成功 - + 心跳读取成功 - + 心跳设置成功 + + + stop cache + 停止缓存 + + + + Currently ripping from:%1 at Zoom level %2 + 当前缓存为:%1,等级为 %2 + + + + Downloading tile %1 of %2 + 下载图片:%1,总数:%2 + HealthUI @@ -1738,12 +1759,6 @@ 油压 - - - 健康状态 -< 绿色:正常,黄色:解码错误,红色:通讯错误 >- - 健康状态(绿色正常,黄色解码错误,红色通讯错误) - - 开气囊 @@ -2142,36 +2157,36 @@ 参数 - - + + Communication Lost 通讯丢失 - - + + Communication Regain 通讯已恢复 - + R:%1 / T:%2 收:%1/发:%2 - - - + + + 未定位 - + %1D[%2颗] %1D[%2颗] - + fix[%1颗] %1D Fix 差分[%1颗] @@ -2189,256 +2204,256 @@ 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 滚转控制航向 - - - + + + @@ -2447,156 +2462,156 @@ 未定位 - - + + 未初始化 - - + + 垂直陀螺 - - + + AHRS - - + + 速度导航 - - + + 位置导航 - - - - - - - - + + + + + + + + 正常 - - - - - - - - - - + + + + + + + + + + 无效 - - + + 解算正常 - - + + 卫星数不足 - - + + 内部错误 - - + + 速度超限 - - - - + + + + 未知 - - + + 多普勒 - - - - 微分 - - - - - - 单点 - - - - - - 伪距差分 - - - - - - SBAS广域差分 - - - - - - 广域差分 - - - - - - RTK_FLOAT - - - - - - RTK_INT - - + 微分 + + + + + + 单点 + + + + + + 伪距差分 + + + + + + SBAS广域差分 + + + + + + 广域差分 + + + + + + RTK_FLOAT + + + + + + RTK_INT + + + + + PPP_FLOAT - - + + PPP_INT - - + + FIXED @@ -2605,17 +2620,17 @@ 未支持 - + flight mode 飞行模式 - + 连接内置惯导 - + 连接SBG @@ -2685,7 +2700,7 @@ 0 - 0 + 0 @@ -2694,7 +2709,8 @@ - INS2时间 + UTC时间 + INS2时间 @@ -2752,6 +2768,11 @@ 开始... + + + %1Group%2Point + %1组%2点 + MissionUI @@ -2761,38 +2782,38 @@ 界面 - + save 保存 - + insert 插入 - + upload 上传 - + add 增加 - + download downlload 下载 - + load 打开 - + delete 删除 @@ -2802,7 +2823,7 @@ 围栏 - + clean 清空 @@ -2882,10 +2903,8 @@ 参数4 - - lat - 纬度 + 纬度 addCircle @@ -2904,10 +2923,8 @@ 删除多边形 - - lng - 经度 + 经度 @@ -2920,35 +2937,32 @@ - - - + + + inclusion - 包含 + 安控区 - par - 参数 + 参数 - type - 类型 + 类型 - alt - 海拔 + 海拔 - - - - - + + + + + Circle 圆形 @@ -2957,87 +2971,120 @@ - - - + + + exclusion - 除外 + 禁飞区 - - - - - - + + + + + + Polygon 多边形 - - + + shape + 形状 + + + num/radius + 点数(个)/半径(米) + + + + + lat(deg) + 纬度(度) + + + + + lng(deg) + 经度(度) + + + + Polygon(num) +Circle(radius) + 点数(多边形) +半径(圆形) + + + + alt(m) + 海拔(米) + + + + 航点 - - + + 返航 - - + + 降落 - - + + 起飞 - - + + 保持 - - + + 表速 - - + + 快升 - - + + 开加力 - - + + 关加力 - - + + Selete Way Point File... 选择载入文件... - - + + plan file (*.plan) 任务文件 (*.plan) @@ -3477,38 +3524,38 @@ - + 正常档位 - + 加速档 - + 期望 - + 压比 - + Wf测 - + 物理 期望物理转速 - + 马赫 @@ -3872,97 +3919,97 @@ 伺服界面 - + 舵机 - - - - - + + + + + 上电自检 - + 左副翼 - - - - - - - - + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + 0 0 - - - - - + + + + + 指令位 - - - - - + + + + + 地面自检 - - - - - + + + + + 当前位 - - - - - + + + + + 找零 - + 右升降 - + 右副翼 - + 左升降 @@ -4230,7 +4277,7 @@ - + 方向舵 @@ -4280,53 +4327,53 @@ - + 500瓦开 - + 版本信息 - + 飞控固件版本号: - + HIL模式状态: - + 电源 - + 28V剩余电量(%) - + 56V模块温度(℃) - + 机载28V电压(V) 机载28V电压 - + 56V剩余电量(%) - + 28V模块温度(℃) @@ -4336,58 +4383,54 @@ - + 28V电源 - 5525D - 5525D + 5525D - 4525D - 4525D + 4525D - 5607A - 5607A + 5607A - 5803A - 5803A + 5803A - + 机载电源 - + 机载56V电压(V) - + 机载56V电流(A) - + 机载28V电流(A) - + 56V电源 - + 空速管加热 @@ -4397,127 +4440,127 @@ 伺服系统 - + 飞控软件版本信息:%1 - + %1,%2 accepted and executed %1,%2 发送成功 - + %1,%2 rejected %1,%2 拒绝执行 - + %1,%2 permanently denied %1,%2 永久拒绝 - + %1,%2 unsupported %1,%2 不支持 - + %1,%2 failed %1,%2 发送失败 - + %1,%2 being executed %1,%2 正在执行 - + %1,%2 time out %1,%2 发送超时 - + Please do not operate too fast, the last instruction has not been sent 请不要操作过快,上一个指令未发送完成 - + please set command first ,command :%1 请设置指令,当前指令号为 %1 - + 发送指令 - + 修改参数 - - - - - - - - + + + + + + + + 警告 - - + + 请选择测试项和测试点 - + 请设定给定转速 - - - - + + + + 请设定目标 - + 设定舵机 %1 %2 - + 请设定 - + 设定舵机归零 %1 - + %1 %2kg - - - - - - - - - - + + + + + + + + + + 设定 %1 @@ -5014,7 +5057,7 @@ p, li { white-space: pre-wrap; } terminal file (*.terminal) - + 终端文件(*.terminal) @@ -5140,87 +5183,87 @@ 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 点击清除所有航点 - + Measuring 测量中 @@ -5276,7 +5319,7 @@ p, li { white-space: pre-wrap; } - + Measure 测量 @@ -5290,8 +5333,8 @@ p, li { white-space: pre-wrap; } 组别 - - + + Selete Way Point File... Select Loading File... 选择载入文件... diff --git a/App/MenuBarUI/MenuBarUI.cpp b/App/MenuBarUI/MenuBarUI.cpp index c0437cb..a2d0aa7 100644 --- a/App/MenuBarUI/MenuBarUI.cpp +++ b/App/MenuBarUI/MenuBarUI.cpp @@ -264,7 +264,7 @@ void MenuBarUI::MessageTimeOut(void) void MenuBarUI::setTargetPoint(int Value) { - ui->label_TargetPoint->setText(QString::number(Value,'f',0)); + ui->label_TargetPoint->setText(tr("%1Group%2Point").arg(QString::number(missionGroup)).arg(QString::number(Value,'f',0))); } void MenuBarUI::setTargetAlt(QVariant Value) diff --git a/App/MenuBarUI/MenuBarUI.h b/App/MenuBarUI/MenuBarUI.h index a28df01..28d9b32 100644 --- a/App/MenuBarUI/MenuBarUI.h +++ b/App/MenuBarUI/MenuBarUI.h @@ -52,6 +52,15 @@ public slots: void setFlightTime(QTime Value); + void setMissionGroup(int value) + { + missionGroup = value; + } + + int MissionGroup(void) + { + return missionGroup; + } signals: @@ -92,6 +101,9 @@ private: int CurrentIndex = 0; + int missionGroup = 3; + + }; #endif // MENUBARUI_H diff --git a/App/MenuBarUI/MenuBarUI.ui b/App/MenuBarUI/MenuBarUI.ui index 87c24fd..fc7ddaf 100644 --- a/App/MenuBarUI/MenuBarUI.ui +++ b/App/MenuBarUI/MenuBarUI.ui @@ -328,7 +328,7 @@ - INS2时间 + UTC时间 diff --git a/App/MissionUI/MissionUI.cpp b/App/MissionUI/MissionUI.cpp index 1b24a49..bea7dd5 100644 --- a/App/MissionUI/MissionUI.cpp +++ b/App/MissionUI/MissionUI.cpp @@ -43,9 +43,6 @@ MissionUI::MissionUI(QWidget *parent) : - - - //航线编辑 CustomButton *btn_load = new CustomButton(this); CustomButton *btn_save = new CustomButton(this); @@ -195,8 +192,7 @@ MissionUI::MissionUI(QWidget *parent) : if(row_id >= 0) { int group = widget->item(row_id,0)->data(Qt::DisplayRole).toInt();//得到group - qDebug() << "group" << group << row_id; - emit delFence(group); + for(int row = 0;row < widget->rowCount();row++) @@ -210,6 +206,9 @@ MissionUI::MissionUI(QWidget *parent) : if(group == widget->item(row,0)->data(Qt::DisplayRole).toInt()) widget->removeRow(row); } + + qDebug() << "group" << group << row_id; + emit delFence(group); } } else @@ -238,6 +237,7 @@ MissionUI::MissionUI(QWidget *parent) : emit WPDelete(); //删除完成后,刷新一次所有航点 emit getAllPoints(tablelist.key(widget)); + emit getCurrentPoint(tablelist.key(widget)); } }); @@ -338,13 +338,13 @@ MissionUI::MissionUI(QWidget *parent) : table->setColumnWidth(0,45); //设置第1列的列宽(group) table->setColumnWidth(1,80); //设置第1列的列宽(type) - table->setColumnWidth(2,80); //设置第2列的列宽(par1) + table->setColumnWidth(2,180); //设置第2列的列宽(par1) table->setColumnWidth(3,80); //设置第3列的列宽(inclusion) table->setColumnWidth(4,150); //设置第4列的列宽(lat) table->setColumnWidth(5,150); //设置第5列的列宽(lng) - table->setHorizontalHeaderLabels(QStringList() <setHorizontalHeaderLabels(QStringList() <verticalHeader(); V_headerView->setHidden(true); //行名隐藏 @@ -387,7 +387,7 @@ MissionUI::MissionUI(QWidget *parent) : table->setColumnWidth(8,80); //设置第九列的列宽(alt) - table->setHorizontalHeaderLabels(QStringList() <setHorizontalHeaderLabels(QStringList() <verticalHeader(); V_headerView->setHidden(true); //行名隐藏 @@ -438,8 +438,8 @@ MissionUI::MissionUI(QWidget *parent) : btn_addCircle->show(); btn_addPolygon->show(); - btn_load->hide(); - btn_save->hide(); + //btn_load->hide(); + //btn_save->hide(); //btn_upload->hide(); //btn_download->hide(); btn_insert->hide(); @@ -452,8 +452,8 @@ MissionUI::MissionUI(QWidget *parent) : btn_addCircle->hide(); btn_addPolygon->hide(); - btn_load->show(); - btn_save->show(); + //btn_load->show(); + //btn_save->show(); //btn_upload->show(); //btn_download->show(); btn_insert->show(); @@ -773,6 +773,35 @@ void MissionUI::updateFencePolygon(int group,qreal vertex,bool inclusion,QListrowCount();idx++) + { + int group = tableWidget->item(idx,0)->data(Qt::DisplayRole).toInt(); + + qDebug() << "group changed" << old << cur << group; + + if(group == old) + { + tableWidget->removeCellWidget(idx,0); + tableWidget->setItem(idx,0,new QTableWidgetItem(QString::number(cur))); //第一列的内容设置为index + } + } + +} + + void MissionUI::pointCreate(float param1,float param2,float param3,float param4, int32_t x,int32_t y,float z, diff --git a/App/MissionUI/MissionUI.h b/App/MissionUI/MissionUI.h index 8cc6cd7..dab6c47 100644 --- a/App/MissionUI/MissionUI.h +++ b/App/MissionUI/MissionUI.h @@ -52,6 +52,9 @@ public slots: void updateFencePolygon(int group,qreal vertex,bool inclusion,QList latlng); void currentPointSeleted(int group,int point); + + void FenceGroupChanged(int old,int cur); + protected slots: void closeEvent(QCloseEvent *event); void resizeEvent(QResizeEvent *event); diff --git a/App/MissionUI/propertyui.cpp b/App/MissionUI/propertyui.cpp index 1544b9f..50077d3 100644 --- a/App/MissionUI/propertyui.cpp +++ b/App/MissionUI/propertyui.cpp @@ -204,6 +204,12 @@ propertyui::propertyui(QWidget *parent) : connect(table,&MissionUI::getCurrentPoint, this,&propertyui::getCurrentPoint); + + connect(this,&propertyui::FenceGroupChanged, + table,&MissionUI::FenceGroupChanged); + + + //初始化参数 setWayPointProperty(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3); diff --git a/App/MissionUI/propertyui.h b/App/MissionUI/propertyui.h index 42f7c8f..8a63185 100644 --- a/App/MissionUI/propertyui.h +++ b/App/MissionUI/propertyui.h @@ -279,6 +279,8 @@ Q_SIGNALS: void currentPointSeleted(int group,int point); void getCurrentPoint(int group); + void FenceGroupChanged(int old,int cur); + private slots: void GroupChanged(int value); diff --git a/App/Setting/Index0/Global/GlobalSetting.cpp b/App/Setting/Index0/Global/GlobalSetting.cpp index 7633344..d8daac0 100644 --- a/App/Setting/Index0/Global/GlobalSetting.cpp +++ b/App/Setting/Index0/Global/GlobalSetting.cpp @@ -14,6 +14,7 @@ GlobalSetting::GlobalSetting(QWidget *parent) : ui->label_mapcache_info->hide(); ui->progressBar_mapcache->hide(); + ui->label_Map_Provider->hide(); for(int i = 1;i <= 20;i++) { @@ -527,6 +528,8 @@ void GlobalSetting::on_pushButton_map_cache_clicked() //显示隐藏的进度条 ui->progressBar_mapcache->show(); + ui->label_mapcache_info->show(); + ui->label_Map_Provider->show(); ui->doubleSpinBox_left_lat->setEnabled(false); ui->doubleSpinBox_left_lng->setEnabled(false); @@ -554,6 +557,8 @@ void GlobalSetting::setripfinished() ui->progressBar_mapcache->hide(); + ui->label_mapcache_info->hide(); + ui->label_Map_Provider->hide(); ui->doubleSpinBox_left_lat->setEnabled(true); ui->doubleSpinBox_left_lng->setEnabled(true); @@ -576,11 +581,11 @@ void GlobalSetting::SetPercentage(const int &perc) } void GlobalSetting::SetProvider(const QString &prov, const int &zoom) { - //ui->mainlabel->setText(QString(tr("Currently ripping from:%1 at Zoom level %2")).arg(prov).arg(zoom)); + ui->label_Map_Provider->setText(QString(tr("Currently ripping from:%1 at Zoom level %2")).arg(prov).arg(zoom)); } void GlobalSetting::SetNumberOfTiles(const int &total, const int &actual) { - //ui->statuslabel->setText(QString(tr("Downloading tile %1 of %2")).arg(actual).arg(total)); + ui->label_mapcache_info->setText(QString(tr("Downloading tile %1 of %2")).arg(actual).arg(total)); } diff --git a/App/Setting/Index0/Global/GlobalSetting.ui b/App/Setting/Index0/Global/GlobalSetting.ui index b960e23..d1a0fc6 100644 --- a/App/Setting/Index0/Global/GlobalSetting.ui +++ b/App/Setting/Index0/Global/GlobalSetting.ui @@ -433,6 +433,16 @@ 地图设置 + + + + 0 + + + %v + + + @@ -440,6 +450,34 @@ + + + + 地图等级 + + + + + + + 经度 + + + + + + + 纬度 + + + + + + + 右下坐标 + + + @@ -453,64 +491,6 @@ - - - - 地图等级 - - - - - - - 地图缓存信息 - - - - - - - 经度 - - - - - - - 0 - - - %v - - - - - - - 纬度 - - - - - - - 选择地图 - - - - - - - 8 - - - -180.000000000000000 - - - 180.000000000000000 - - - @@ -534,10 +514,10 @@ - - + + - 右下坐标 + 选择地图 @@ -554,6 +534,33 @@ + + + + 地图缓存信息 + + + + + + + 8 + + + -180.000000000000000 + + + 180.000000000000000 + + + + + + + 地图信息 + + + diff --git a/App/mainwindow.cpp b/App/mainwindow.cpp index a763f57..b02a3bd 100644 --- a/App/mainwindow.cpp +++ b/App/mainwindow.cpp @@ -482,6 +482,12 @@ MainWindow::MainWindow(QWidget *parent) map,SLOT(getCurrentPoint(int)),Qt::DirectConnection); + connect(map,SIGNAL(FenceGroupChanged(int,int)), + missionUI,SIGNAL(FenceGroupChanged(int,int)),Qt::DirectConnection); + + + + //dlink ----- map connect(map,SIGNAL(signal_WPDownload(uint8_t,uint8_t,int)), dlink->mavlinknode->Mission,SLOT(ReadCmd(uint8_t,uint8_t,int)),Qt::DirectConnection); @@ -534,10 +540,10 @@ MainWindow::MainWindow(QWidget *parent) connect(dlink->mavlinknode->Mission,SIGNAL(currentPoint(int)), map,SLOT(WPSetCurrent(int))); -/* + connect(dlink->mavlinknode->Mission,SIGNAL(currentPoint(int)), menuBarUI,SLOT(setTargetPoint(int))); - */ + /* connect(dlink->mavlinknode->Mission,SIGNAL(currentPoint(int)), toolsui->diagram,SLOT(setTargetPoint(int))); @@ -1589,9 +1595,6 @@ void MainWindow::updateUI()//事件驱动式更新数据 //舵机反馈是有符号16b/ - //qDebug() << getBit(health,16); - - uint16_t servoHealt = dlink->mavlinknode->vehicle.servo_output_raw.servo10_raw; healthui->setState(11,getBit(health,16)?(getBit(servoHealt,3)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//LA @@ -1744,7 +1747,7 @@ void MainWindow::updateUI()//事件驱动式更新数据 group_old = group; - // menuBarUI->setTargetPoint(); + menuBarUI->setMissionGroup(group); } diff --git a/MavLinkNode/mavlinknode.cpp b/MavLinkNode/mavlinknode.cpp index 01ae2eb..737ceb7 100644 --- a/MavLinkNode/mavlinknode.cpp +++ b/MavLinkNode/mavlinknode.cpp @@ -942,7 +942,19 @@ void MavLinkNode::StatusParse(mavlink_message_t msg) vehicle.sysid = msg.sysid; vehicle.compid = msg.compid; - //qDebug() << LocationTime.date() << LocationTime.time(); +/* + if(LocationTime) + { + + gpsTimer.ms = LocationTime->msec(); + + qDebug() << LocationTime->hour() << LocationTime->minute() << LocationTime->msec(); + } + */ + + + gpsTimer.ms = QDateTime::currentDateTime().currentMSecsSinceEpoch() % 1000; + switch (msg.msgid) { case MAVLINK_MSG_ID_AUTOPILOT_VERSION: { @@ -1128,6 +1140,47 @@ void MavLinkNode::StatusParse(mavlink_message_t msg) emit signal_ins1(vehicle.ins1); + uint64_t time = ((uint64_t)vehicle.ins1.time)% 1000000; + uint64_t date = ((uint64_t)vehicle.ins1.time)/ 1000000; + + //qDebug() << "date" << date; + + uint16_t year = date / 10000; + uint8_t mon = (date % 10000)/100; + uint8_t day = date % 100; + + uint8_t hour = time / 10000; + + if(hour >= 24){ + hour -= 24; + } + + uint8_t min = (time % 10000)/100; + uint8_t sec = time % 100; + + gpsTimer.year = year; + gpsTimer.mon = mon; + gpsTimer.day = day; + + gpsTimer.hour = hour; + gpsTimer.min = min; + gpsTimer.sec = sec; + + /* + if(vehicle.ins1.satellites_visible >= 7) + { + if(!LocationTime) + { + LocationTime = new QTime(); + LocationTime->setHMS(hour,min,sec); + LocationTime->start(); + } + } + */ + + + + }break; case MAVLINK_MSG_ID_INS2: { mavlink_msg_ins2_decode(&msg,&vehicle.ins2); @@ -1172,43 +1225,6 @@ void MavLinkNode::StatusParse(mavlink_message_t msg) emit signal_ins2(vehicle.ins2); - - uint64_t time = ((uint64_t)vehicle.ins2.time)% 1000000; - uint64_t date = ((uint64_t)vehicle.ins2.time)/ 1000000; - - - - uint16_t year = date / 10000; - uint8_t mon = (date % 10000)/100; - uint8_t day = date % 100; - - - - uint8_t hour = time / 10000; - - if(hour >= 24){ - hour -= 24; - } - - uint8_t min = (time % 10000)/100; - uint8_t sec = time % 100; - - gpsTimer.year = year; - gpsTimer.mon = mon; - gpsTimer.day = day; - - gpsTimer.hour = hour; - gpsTimer.min = min; - gpsTimer.sec = sec; - - - LocationTime.addYears(year); - LocationTime.addMonths(mon); - LocationTime.addDays(day); - //LocationTime.setTime(QTime(hour,min,sec)); - - - }break; case MAVLINK_MSG_ID_GPS_RAW_INT: { mavlink_msg_gps_raw_int_decode(&msg,&vehicle.gps_raw_int); diff --git a/MavLinkNode/mavlinknode.h b/MavLinkNode/mavlinknode.h index 1a4a5bc..998cb32 100644 --- a/MavLinkNode/mavlinknode.h +++ b/MavLinkNode/mavlinknode.h @@ -22,7 +22,7 @@ #include "ThreadTemplet.h" #include "ParsePack.h" - +#include "QTime" #ifdef QtMavlinkNode #include @@ -267,7 +267,7 @@ protected: QDateTime startuptime; - QDateTime LocationTime; + QTime *LocationTime; QTimer *gdt_timer = nullptr; diff --git a/opmap/MAP_zh_CN.qm b/opmap/MAP_zh_CN.qm index 2e3fa9fdfd6b451e898ef85be46014fc4932c529..57cb591bec1d1fcc1982caf9410bfa2638441165 100644 GIT binary patch literal 3790 zcmbVOZEO=|9DhpRuLa45FvgGvOd~eaG2%b-17uSt;tiX_RZJ(}}UGL88b)y@U zuwVem*nB}J`T;aRqL@JVAgF|dU<@Fd7%+ZtgAWpXiJB0E1P$~5T-)1~Z0pSr&C|Pk ze!u_k|MvW!C8uH)7ytTT|K<5rXEz@@GqemL(-wpfgOJmXP#gT6YDMUkkKy?;vJLv+ zlNoKuco1@bgWAlmBjk7riIG+C-iJCpURZxYH(e%#ro3l55(6x{I3<&K8zD>BeCpU$ zz?EB=gHM8;*DQl8zl86|I`@-DVE&V65%gTFhScP=#pu8(0(cEkREm~DIB zg#9O&3%mA#o-;1jtvdSKx_hbtj~<_z#lUOxa}ew$W_V)>{*c`5fIrAafAy>oB|M}9F^#Mg;H2fE zoHWsmOgI>5++NrG_=tFE%KmRmBrn& zGJ6!B7He$Yao9Yym{srwQA}cj8*y)bo=8R7WwW5_CdHYHrbOhiG+27Q*|XYSdy-3~ zI8mTGE0U}f6$M2Wd7rP2S2!gdBP$h>%ZVklC>$BZDMXf8&H!#k_Gb2vqAb*+r5ewI zdN9ZdX@VjDYEmKm-MaACE~U~Q)=SgeQ)|URu9Fo5&d9GCXPIBboh;AAaEkCGs^s09 zfTOJK-!-K5cH$wj%YSF2lIBHYoAojz6*mwOFDFp1csb-2`#iN&)-1iOre+Wp;$rPY zQH5bjN`svv?Wv};+4JMC^!L*rhTvZ~h0oU0<*OYV zBdmxXCeH*Gg>2zSX2;-g(1-8?#j!vpQ4Y?Dyv`^mN1-~%mMEX5UFCxemXxit(zYjh z)UXv!n2eRmoGQ)FlyhsH59IghGnZhF1a>5dG3mO5AhgW?D`fFwwt-s`FnlSA#?Ytg6A?BnMR#tFY z8m-uBMO0YcNV8QI$Z65i6GAgEI;?P!fkF+#;hsK*VeUas;hP<2IgrzH7JFc1AJeH z`ermeWkHFMm`Yfaf~!ovrp9HRf*36UCWf95MUywgW}0c8YAPn_&BSEW2j=NQ11@P& z+ssLF}HRb@WnJS(U- zw9@`L)}#Ul1MlmM+QfLgZkYkAjxc%vY83@TNL&AvUawBCT_#Fe7I0~~w!W^xVI9(; zupI;h8-OzH-mV)_yZ>jMulBUiA&6ZDoK?|VdqR74#`9C~#YBSMOIg3iUssft@)pe5TPV33tR_%=i-ao~%Y-4<^K}7EUq*FTO@w TTi8hM%3sp1rO2k)h`s*+T>s*H delta 303 zcmX>n`-ivQW=D#|srPfHo>i3DpRjQ6T_*+xh7&-{#lXP$lz|}{$Yg!Yz!1BNfq`i? z1KSKMApMXbs!|mwzKS85xeKUHfFb9|RG>lzhWsQi1_ovchB8$xAbpH^$C|4Q3@jhn zW0r#W-5fH}3P8RUhd1*EAU}X(P5s^PK!bERPM<6QN-%I%=`R8r=nA2kL^=D83Ii=n z;{0|x0H`jTi)(Wg(3Uz1kKkWkY=kWxEaRK$00_g`pdNXgG0#Kg8G?RgW zO^O-FVhQ__!OsC?Ft7nJYg%evaw?BplxnUf MapRipper - + 地图缓存 Currently ripping from: - + 当前缓存: Downloading tile - + 下载图片 Cancel - + 取消 Currently ripping from:%1 at Zoom level %2 - + 正在从%1缓存,等级%2 Downloading tile %1 of %2 - + 正在下载图片 %1,总数%2 mapcontrol::AltitudeItem - 航线 - + mission + 航线 - 地形 - + terrain + 地形 @@ -53,7 +53,7 @@ No valid selection - + 无效选择 @@ -70,40 +70,89 @@ Please first select the area of the map to rip with <CTRL>+Left mouse clic - + Continue Ripping at zoom level %1? - + 继续缓存,等级%1? mapcontrol::OPMapWidget - + .plan - - 开始上传围栏,总数%1 - + + Load Geo Fence File :%1 + 导入围栏文件:%1 - - 开始上传航点,总数%1 - + + Load Mission File:Group %1,%2 + 导入航线文件:第%1组航线,%2 - - 上传失败%1 - + + Save Fence File:%1 + 保存围栏文件:%1 + + + + Save Mission File:Group %1,%2 + 保存航线文件:第%1组航线,%2 + + + + please load fence first + 请先导入围栏 + + + + start upload fence,total:%1 + 开始上传围栏,总数%1 + + + + please load mission first + 请先导入航线 + + + + start upload mission %1,total %2 + 开始上传航线%1,总数%2 + + + + upload fail %1 + 上传失败 %1 + + + + recieve fence polygon inclusion: %1 + 接收到多边形安控区 :%1 + + + + recieve fence polygon exclusion: %1 + 接收到多边形禁飞区 :%1 + + + + recieve fence circle inclusion: %1 + 接收到圆形安控区 :%1 + + + + recieve fence circle exclusion: %1 + 接收到圆形禁飞区 :%1 - fence - 围栏 + 围栏 - + recieve way point group:%1 seq:%2 收到航点:第%1组,第%2点 @@ -132,8 +181,8 @@ Please first select the area of the map to rip with <CTRL>+Left mouse clic Speed: %1m/s Ma:%2 - 表速:%1m/s -马赫数:%2 + 表速:%1m/s +马赫:%2 diff --git a/opmap/core/tilecachequeue.cpp b/opmap/core/tilecachequeue.cpp index c3100e0..5e9bdd6 100644 --- a/opmap/core/tilecachequeue.cpp +++ b/opmap/core/tilecachequeue.cpp @@ -87,7 +87,9 @@ void TileCacheQueue::run() usleep(44); delete task; } else { +#ifdef DEBUG_TILECACHEQUEUE qDebug() << "Cache engine BEGIN WAIT"; +#endif // DEBUG_TILECACHEQUEUE waitmutex.lock(); int tout = 4000; if (!waitc.wait(&waitmutex, tout)) { @@ -102,7 +104,9 @@ void TileCacheQueue::run() } mutex.unlock(); } +#ifdef DEBUG_TILECACHEQUEUE qDebug() << "Cache Engine DID NOT TimeOut"; +#endif // DEBUG_TILECACHEQUEUE waitmutex.unlock(); } } diff --git a/opmap/mapwidget/AltitudeItem.cpp b/opmap/mapwidget/AltitudeItem.cpp index 4509d1c..5fbce07 100644 --- a/opmap/mapwidget/AltitudeItem.cpp +++ b/opmap/mapwidget/AltitudeItem.cpp @@ -136,12 +136,12 @@ void AltitudeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti ePen.setColor(AltColor); painter->setPen(ePen); painter->drawLine(220,-170,250,-170); - painter->drawText(QRect(260,-180,40,20),Qt::AlignVCenter|Qt::AlignLeft, tr("航线")); + painter->drawText(QRect(260,-180,40,20),Qt::AlignVCenter|Qt::AlignLeft, tr("mission")); ePen.setColor(EleColor); painter->setPen(ePen); painter->drawLine(300,-170,330,-170); - painter->drawText(QRect(340,-180,40,20),Qt::AlignVCenter|Qt::AlignLeft, tr("地形")); + painter->drawText(QRect(340,-180,40,20),Qt::AlignVCenter|Qt::AlignLeft, tr("terrain")); painter->restore(); diff --git a/opmap/mapwidget/geoFenceitem.cpp b/opmap/mapwidget/geoFenceitem.cpp index 8dec006..ab55a97 100644 --- a/opmap/mapwidget/geoFenceitem.cpp +++ b/opmap/mapwidget/geoFenceitem.cpp @@ -36,6 +36,7 @@ void geoFenceitem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti painter->setOpacity(0.5); + QFont font; QPen myPen = painter->pen(); myPen.setWidth(lineWidth); myPen.setColor(m_brush.color()); @@ -69,8 +70,28 @@ void geoFenceitem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti painter->drawPoint(0, 0); painter->drawPolygon(polygon()); + QPolygonF poly = polygon(); + + int count = 0; + for(QPointF p:poly) + { + painter->save(); + + font.setWeight(QFont::ExtraBold); + font.setFamily("Arial");//非衬线 + font.setPixelSize(15); + painter->setFont(font); + + myPen.setWidth(1); + myPen.setColor(QColor("#FFFFFF")); + painter->setPen(myPen); + painter->drawText(QRect(p.x() - 20,p.y()-5,40,10),Qt::AlignCenter,QString::number(count++)); + + painter->restore(); + } + + - QFont font; font.setWeight(QFont::ExtraBold); font.setFamily("Arial");//非衬线 font.setPixelSize(40); diff --git a/opmap/mapwidget/mapripper.cpp b/opmap/mapwidget/mapripper.cpp index f1f8830..3157766 100644 --- a/opmap/mapwidget/mapripper.cpp +++ b/opmap/mapwidget/mapripper.cpp @@ -26,7 +26,7 @@ */ #include "mapripper.h" namespace mapcontrol { -MapRipper::MapRipper(internals::Core *core, const internals::RectLatLng & rect,int const & maxz) : sleep(100), cancel(false), core(core), yesToAll(true) +MapRipper::MapRipper(internals::Core *core, const internals::RectLatLng & rect,int const & maxz) : sleep(1), cancel(false), core(core), yesToAll(true) { if (!rect.IsEmpty()) { type = core->GetMapType(); @@ -134,7 +134,7 @@ void MapRipper::run() countOk++; } else { i--; - QThread::msleep(1000); + QThread::msleep(1); continue; } } diff --git a/opmap/mapwidget/opmapwidget.cpp b/opmap/mapwidget/opmapwidget.cpp index 3bc716e..cfd34d5 100644 --- a/opmap/mapwidget/opmapwidget.cpp +++ b/opmap/mapwidget/opmapwidget.cpp @@ -98,6 +98,10 @@ OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config) : QGraphicsView // WPnearPoint + + connect(waypointsetting,SIGNAL(showMessage(QString,int)), + this,SIGNAL(showMessage(QString,int))); + connect(waypointsetting,SIGNAL(WPnearPoint(int)), this,SLOT(WPnearPoint(int))); @@ -129,6 +133,12 @@ OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config) : QGraphicsView this,SLOT(WPsearchall())); */ + + + + connect(waypointsetting,SIGNAL(UAVShowTip(bool)), + this,SLOT(UAVTip_clicked(bool))); + connect(waypointsetting,SIGNAL(WPRuler()), this,SLOT(ruler_clicked())); @@ -152,8 +162,8 @@ OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config) : QGraphicsView point_begin.SetLat(0); point_begin.SetLng(0); - point_end.SetLat(0); - point_end.SetLng(0); + point_end.SetLat(1); + point_end.SetLng(1); measureline = new MeasureLine(point_begin, point_end, map, QColor("#FFFF00")); mscene.addItem(measureline); @@ -197,6 +207,19 @@ void OPMapWidget::dropEvent(QDropEvent *event) } } +void OPMapWidget::UAVTip_clicked(bool flag) +{ + foreach(QGraphicsItem * i, map->childItems()) { + UAVItem *u = qgraphicsitem_cast(i); + if (u) { + + u->setShowTip(flag); + + } + } +} + + void OPMapWidget::ruler_clicked(void) { if(isMeasure) @@ -208,6 +231,19 @@ void OPMapWidget::ruler_clicked(void) measureline->hide(); } + + if(map) + { + map->setAcceptDrops(true); + } + + foreach(QGraphicsItem * i, map->childItems()) { + WayPointItem *w = qgraphicsitem_cast(i); + if (w) { + w->setAcceptDrops(true); + w->setAcceptedMouseButtons(Qt::AllButtons); + } + } } else { @@ -219,8 +255,21 @@ void OPMapWidget::ruler_clicked(void) measureline->show(); } - //QPixmap pix(":/markers/images/ruler.png"); - //this->setCursor(QCursor(pix.scaled(QSize(50,50), Qt::KeepAspectRatio))); + if(map) + { + map->setAcceptDrops(false); + } + + + foreach(QGraphicsItem * i, map->childItems()) { + WayPointItem *w = qgraphicsitem_cast(i); + if (w) { + w->setAcceptDrops(false); + w->setAcceptedMouseButtons(Qt::NoButton); + } + } + + } emit measureState(isMeasure); @@ -244,178 +293,6 @@ void OPMapWidget::table_clicked(void) } */ } -/* -void OPMapWidget::AddgeoPolygon(int type,int index,double lat,double lng,double alt,QColor color) -{ - qDebug() << "AddVirtualMargin" << type << index; - - internals::PointLatLng LatLng; - LatLng.SetLat(lat); - LatLng.SetLng(lng); - - QMap virtualmarginmap = VirtualMarginPoints.value(type); - QMap virtualmarginlinemap = VirtualMarginlinemapLines.value(type); - - - VirtualMargin *vm = new VirtualMargin(index,LatLng,alt,color,map); - virtualmarginmap.insert(index,vm); - - foreach (VirtualMarginLine *l, virtualmarginlinemap) { - if(l){ - disconnect(l,nullptr,nullptr,nullptr); - delete l; - } - } - - virtualmarginlinemap.clear(); - - - for(QMap::iterator i = virtualmarginmap.begin();i != virtualmarginmap.end();++i) - { - VirtualMargin *v = i.value(); - if(v) - { - if(v->number > 0) - { - VirtualMarginLine *l = new VirtualMarginLine(virtualmarginmap.value(v->number - 1),v,map,color); - l->setOpacity(overlayOpacity); - l->show(); - - virtualmarginlinemap.insert(virtualmarginlinemap.size(),l); - } - } - } - - if(virtualmarginmap.size() >= 2) - { - VirtualMargin *vm_first = virtualmarginmap.first(); - VirtualMargin *vm_last = virtualmarginmap.last(); - - if((vm_first)&&(vm_last)) - { - VirtualMarginLine *l = new VirtualMarginLine(vm_first,vm_last,map,color); - l->setOpacity(overlayOpacity); - l->show(); - - virtualmarginlinemap.insert(virtualmarginlinemap.size(),l); - } - } - - VirtualMarginPoints.insert(type,virtualmarginmap); - VirtualMarginlinemapLines.insert(type,virtualmarginlinemap); - - //FlushVirtualMargin(type); - - - foreach (VirtualMargin *v, virtualmarginmap) { - qDebug() << "create a virtual point" << v->number; - } - -} - -void OPMapWidget::ClosegeoPolygon(int type) -{ - if(type == 0) - { - if(virtualmarginmap_red.size() >= 2) - { - VirtualMargin *vm_first = virtualmarginmap_red.first(); - VirtualMargin *vm_last = virtualmarginmap_red.last(); - - if((vm_first)&&(vm_last)) - { - VirtualMarginLine *l = new VirtualMarginLine(vm_first,vm_last,map,WarningColor); - l->setOpacity(overlayOpacity); - l->show(); - - virtualmarginlinemap_red.insert(virtualmarginlinemap_red.size(),l); - } - } - } - else if(type == 1) - { - if(virtualmarginmap_orange.size() >= 2) - { - VirtualMargin *vm_first = virtualmarginmap_orange.first(); - VirtualMargin *vm_last = virtualmarginmap_orange.last(); - - if((vm_first)&&(vm_last)) - { - VirtualMarginLine *l = new VirtualMarginLine(vm_first,vm_last,map,NoticeColor); - l->setOpacity(overlayOpacity); - l->show(); - - virtualmarginlinemap_orange.insert(virtualmarginlinemap_orange.size(),l); - } - } - } - -} - -void OPMapWidget::RemovegeoPolygon(int type) -{ - - QMap virtualmarginmap = VirtualMarginPoints.value(type); - QMap virtualmarginlinemap = VirtualMarginlinemapLines.value(type); - - //移除虚拟边界 - foreach (VirtualMargin *vm, virtualmarginmap) { - if(vm) - { - qDebug() << "del vm" << vm->number << vm->coord.Lat() << vm->coord.Lng(); - disconnect(vm,nullptr,nullptr,nullptr); - delete vm; - } - } - //从列表删除所有 - virtualmarginmap.clear(); - - //移除虚拟边界 - foreach (VirtualMarginLine *l, virtualmarginlinemap) { - if(l) - { - disconnect(l,nullptr,nullptr,nullptr); - delete l; - } - } - //从列表删除所有 - virtualmarginlinemap.clear(); - - VirtualMarginPoints.remove(type); - VirtualMarginlinemapLines.remove(type); - -} - -void OPMapWidget::FlushgeoPolygon(int type) -{ - - - - if(type == 0) - { - for(QMap::iterator i = virtualmarginmap_red.begin();i != virtualmarginmap_red.end();++i) - { - VirtualMargin *vm = i.value(); - if(vm) - { - qDebug() << "vm" << vm->number << vm->coord.Lat() << vm->coord.Lng(); - } - } - } - else if(type == 1) - { - for(QMap::iterator i = virtualmarginmap_orange.begin();i != virtualmarginmap_orange.end();++i) - { - VirtualMargin *vm = i.value(); - if(vm) - { - qDebug() << "vm" << vm->number << vm->coord.Lat() << vm->coord.Lng(); - } - } - } -} -*/ - void OPMapWidget::SetShowDiagnostics(bool const & value) @@ -929,13 +806,15 @@ void OPMapWidget::mouseReleaseEvent(QMouseEvent *event) QGraphicsView::mouseReleaseEvent(event); emit MouseReleaseEvent(event); - if(isMeasure) - { - //QPixmap pix(":/markers/images/ruler.png"); - //this->setCursor(QCursor(pix.scaled(QSize(50,50), Qt::KeepAspectRatio))); - } - //qDebug() << "relea"; + + if(event->button() == Qt::RightButton) + { + if(isMeasure) + { + ruler_clicked(); + } + } } void OPMapWidget::mouseDoubleClickEvent(QMouseEvent *event) @@ -1684,10 +1563,13 @@ void OPMapWidget::userRipMap(bool start, qreal lat_l, qreal lng_l, qreal lat_r, connect(mapRipper,SIGNAL(ripfinished()), this,SIGNAL(ripfinished())); + emit showMessage(tr("start rip map")); + } else { emit cancelRequest(); + emit showMessage(tr("stop rip map")); } } @@ -1937,11 +1819,13 @@ void OPMapWidget::setWPCreate(bool const & value) { if(value) { - waypointsetting->show(); + //waypointsetting->show(); + waypointsetting->setMode(0); } else { - waypointsetting->hide(); + //waypointsetting->hide(); + waypointsetting->setMode(1); } } @@ -2240,24 +2124,40 @@ void OPMapWidget::delFence(int group) //重新整理一下fenceCount - /* - fenceCount = 0; + + foreach(QGraphicsItem * i, map->childItems()) { geoFenceitem *w = qgraphicsitem_cast(i); if (w) { - w->setGroup(fenceCount++); + if(w->Group() > group) + { + + int old = w->Group(); + w->setGroup(w->Group() - 1); + int cur = w->Group(); + + emit FenceGroupChanged(old,cur); + } } } foreach(QGraphicsItem * i, map->childItems()) { geoFencecircle *w = qgraphicsitem_cast(i); if (w) { - w->setGroup(fenceCount++); + if(w->Group() > group) + { + int old = w->Group(); + w->setGroup(w->Group() - 1); + int cur = w->Group(); + + emit FenceGroupChanged(old,cur); + } } } - */ + fenceCount --; + } @@ -2268,8 +2168,6 @@ void OPMapWidget::delFence(int group) //先清除再读取 void OPMapWidget::WPLoad(QString path)//带文件目录参数 { - //清除所有 - WPDeleteAll();//清除当前航线 //fenceCount = 0; qDebug() << "WPLoad" << path; //读取 @@ -2291,53 +2189,73 @@ void OPMapWidget::WPLoad(QString path)//带文件目录参数 QJsonObject json = doc.object(); - //栅栏解码 - QJsonArray polygonsArray = json.value("geoFence").toObject().value("polygons").toArray(); - for(QJsonValue item: polygonsArray) { - - //每个item是一个组 - QList points; - QList latlng; - //获得边界 - bool inclusion = item.toObject().value("inclusion").toBool(); - QJsonArray polygon = item.toObject().value("polygon").toArray(); - int version = item.toObject().value("version").toInt(); - - qreal lat_sum = 0; - qreal lng_sum = 0; - - for (QJsonValue point: polygon) { - qreal lat = point.toArray().at(0).toDouble(); - qreal lng = point.toArray().at(1).toDouble(); - - //生成一个多边形 - points.push_back(internals::PointLatLng(lat,lng)); - - lat_sum += lat; - lng_sum += lng; - - - latlng.push_back(QPointF(lat,lng)); + if(currentGroup == 1) + { + emit showMessage(tr("Load Geo Fence File :%1").arg(path)); + foreach(QGraphicsItem * i, map->childItems()) { + geoFencecircle *w = qgraphicsitem_cast(i); + if (w) { + delete w; + } } - internals::PointLatLng center; + foreach(QGraphicsItem * i, map->childItems()) { + geoFenceitem *w = qgraphicsitem_cast(i); + if (w) { + delete w; + } + } - center.SetLat(lat_sum/polygon.size()); - center.SetLng(lng_sum/polygon.size()); + fenceCount = 1; - geoFenceitem *polyitem = new geoFenceitem(fenceCount,inclusion,version,center,QColor("#FF8000"),map); + //栅栏解码 + QJsonArray polygonsArray = json.value("geoFence").toObject().value("polygons").toArray(); + for(QJsonValue item: polygonsArray) { - polyitem->setPoints(points); + //每个item是一个组 + QList points; + QList latlng; + //获得边界 + bool inclusion = item.toObject().value("inclusion").toBool(); + QJsonArray polygon = item.toObject().value("polygon").toArray(); + int version = item.toObject().value("version").toInt(); - emit createFencePolygon(fenceCount++,points.size(),inclusion,latlng); + qreal lat_sum = 0; + qreal lng_sum = 0; - connect(polyitem,SIGNAL(updateFencePolygon(int,qreal,bool,QList)), - this,SIGNAL(updateFencePolygon(int,qreal,bool,QList))); - } + for (QJsonValue point: polygon) { + qreal lat = point.toArray().at(0).toDouble(); + qreal lng = point.toArray().at(1).toDouble(); - QJsonArray circlesArray = json.value("geoFence").toObject().value("circles").toArray(); - for(QJsonValue item: circlesArray) { + //生成一个多边形 + points.push_back(internals::PointLatLng(lat,lng)); + + lat_sum += lat; + lng_sum += lng; + + + latlng.push_back(QPointF(lat,lng)); + + } + + internals::PointLatLng center; + + center.SetLat(lat_sum/polygon.size()); + center.SetLng(lng_sum/polygon.size()); + + geoFenceitem *polyitem = new geoFenceitem(fenceCount,inclusion,version,center,QColor("#FF8000"),map); + + polyitem->setPoints(points); + + emit createFencePolygon(fenceCount++,points.size(),inclusion,latlng); + + connect(polyitem,SIGNAL(updateFencePolygon(int,qreal,bool,QList)), + this,SIGNAL(updateFencePolygon(int,qreal,bool,QList))); + } + + QJsonArray circlesArray = json.value("geoFence").toObject().value("circles").toArray(); + for(QJsonValue item: circlesArray) { bool inclusion = item.toObject().value("inclusion").toBool(); QJsonObject circle = item.toObject().value("circle").toObject(); @@ -2357,71 +2275,88 @@ void OPMapWidget::WPLoad(QString path)//带文件目录参数 connect(c,SIGNAL(updateFenceCircle(int,qreal,bool,qreal,qreal)), this,SIGNAL(updateFenceCircle(int,qreal,bool,qreal,qreal))); + } + } + else if(currentGroup >= 3) + { + emit showMessage(tr("Load Mission File:Group %1,%2").arg(QString::number(currentGroup)).arg(path)); + //清除所有 + //删除一个组 + foreach(QGraphicsItem * i, map->childItems()) { + WayPointItem *w = qgraphicsitem_cast(i); - - //任务解码 - QJsonArray itemsArray = json.value("mission").toObject().value("items").toArray(); - - for(QJsonValue item: itemsArray) { - if (!item.isObject()) { - return; + if (w) { + if(w->MissionType() == currentGroup) + { + emit WPDeleted(w->Number(), w); + delete w; + } + } } - uint8_t AMSLAltAboveTerrain = item.toObject().find("AMSLAltAboveTerrain").value().toInt(); - uint8_t Altitude = item.toObject().find("Altitude").value().toDouble(); - uint8_t AltitudeMode = item.toObject().find("AltitudeMode").value().toInt(); - uint8_t autocontinue = item.toObject().find("autoContinue").value().toBool()?(1):(0);//bool - uint16_t command = item.toObject().find("command").value().toInt(); - uint16_t seq = item.toObject().find("doJumpId").value().toInt(); - uint8_t frame = item.toObject().find("frame").value().toInt(); - QJsonArray params = item.toObject().find("params").value().toArray();//array - //uint8_t mission_type = item.toObject().find("type").value().toInt(); - uint8_t mission_type = currentGroup; + //任务解码 + QJsonArray itemsArray = json.value("mission").toObject().value("items").toArray(); - float param1 = params.at(0).toDouble(); - float param2 = params.at(1).toDouble(); - float param3 = params.at(2).toDouble(); - float param4 = params.at(3).toDouble(); - int32_t x = params.at(4).toDouble() * 10e6; - int32_t y = params.at(5).toDouble() * 10e6; - float z = params.at(6).toDouble(); + for(QJsonValue item: itemsArray) { + if (!item.isObject()) { + return; + } - internals::PointLatLng LatLng; - LatLng.SetLat(x * 10e-8); - LatLng.SetLng(y * 10e-8); + uint8_t AMSLAltAboveTerrain = item.toObject().find("AMSLAltAboveTerrain").value().toInt(); + uint8_t Altitude = item.toObject().find("Altitude").value().toDouble(); + uint8_t AltitudeMode = item.toObject().find("AltitudeMode").value().toInt(); + uint8_t autocontinue = item.toObject().find("autoContinue").value().toBool()?(1):(0);//bool + uint16_t command = item.toObject().find("command").value().toInt(); + uint16_t seq = item.toObject().find("doJumpId").value().toInt(); + uint8_t frame = item.toObject().find("frame").value().toInt(); + QJsonArray params = item.toObject().find("params").value().toArray();//array + //uint8_t mission_type = item.toObject().find("type").value().toInt(); + uint8_t mission_type = currentGroup; - qDebug() << "LatLng" << LatLng.Lat() << LatLng.Lng(); + float param1 = params.at(0).toDouble(); + float param2 = params.at(1).toDouble(); + float param3 = params.at(2).toDouble(); + float param4 = params.at(3).toDouble(); + int32_t x = params.at(4).toDouble() * 10e6; + int32_t y = params.at(5).toDouble() * 10e6; + float z = params.at(6).toDouble(); - WayPointItem *Item = WPCreate(LatLng,z); + internals::PointLatLng LatLng; + LatLng.SetLat(x * 10e-8); + LatLng.SetLng(y * 10e-8); - Item->SetNumber(seq); + qDebug() << "LatLng" << LatLng.Lat() << LatLng.Lng(); - emit setWPProperty(param1,param2,param3,param4, - x,y,z, - seq, - mission_type,//当前组 - command, - 0, - 0, - frame, - 0, - autocontinue, - mission_type); + WayPointItem *Item = WPCreate(LatLng,z); + + Item->SetNumber(seq); + + emit setWPProperty(param1,param2,param3,param4, + x,y,z, + seq, + mission_type,//当前组 + command, + 0, + 0, + frame, + 0, + autocontinue, + mission_type); - Item->emitWPProperty(); + Item->emitWPProperty(); - WayPointItem *w_last = WPFind(Item->MissionType(),Item->Number() - 1); + WayPointItem *w_last = WPFind(Item->MissionType(),Item->Number() - 1); - if(w_last) - { - WPLineCreate(w_last,Item,Qt::green,false,2); + if(w_last) + { + WPLineCreate(w_last,Item,Qt::green,false,2); + } } - } } @@ -2437,72 +2372,89 @@ void OPMapWidget::WPSave(QString path)//带文件目录参数 QJsonObject rallyPoints; - //geoFence节点写入 (mission type == 1,2) - //判断围栏数量大于0时写入,否则不写 - - QJsonArray circles; - QJsonArray polygons; + if(currentGroup == 1) { - foreach(QGraphicsItem * i, map->childItems()) { - geoFenceitem *w = qgraphicsitem_cast(i); - if (w) { + //geoFence节点写入 (mission type == 1,2) + //判断围栏数量大于0时写入,否则不写 - QJsonArray polygon; - QJsonObject polygonObj; + emit showMessage(tr("Save Fence File:%1").arg(path)); - QList points = w->points; + QJsonArray circles; + QJsonArray polygons; + { + foreach(QGraphicsItem * i, map->childItems()) { + geoFenceitem *w = qgraphicsitem_cast(i); + if (w) { - for(internals::PointLatLng ll:points) - { + QJsonArray polygon; + QJsonObject polygonObj; - QJsonArray latlng; - latlng.append(ll.Lat()); - latlng.append(ll.Lng()); + QList points = w->points; - polygon.push_back(latlng); + for(internals::PointLatLng ll:points) + { + + QJsonArray latlng; + latlng.append(ll.Lat()); + latlng.append(ll.Lng()); + + polygon.push_back(latlng); + } + + polygonObj["inclusion"] = w->Inclusion(); + polygonObj["polygon"] = polygon; + polygonObj["version"] = 1; + + + polygons.push_back(polygonObj); } + } - polygonObj["inclusion"] = w->Inclusion(); - polygonObj["polygon"] = polygon; - polygonObj["version"] = 1; + foreach(QGraphicsItem * i, map->childItems()) { + geoFencecircle *w = qgraphicsitem_cast(i); + if (w) { + QJsonObject circle; + QJsonObject circleObj; - polygons.push_back(polygonObj); + QJsonArray center; + center.append(w->Latitude()); + center.append(w->Longitude()); + + double radius = w->Radius(); + + circle["center"] = center; + circle["radius"] = radius; + + + circleObj["inclusion"] = w->Inclusion(); + circleObj["circle"] = circle; + circleObj["version"] = 1; + + + circles.push_back(circleObj); + } } } + geoFence.insert("circles",circles); + geoFence.insert("polygons",polygons); + geoFence.insert("version",2); - foreach(QGraphicsItem * i, map->childItems()) { - geoFencecircle *w = qgraphicsitem_cast(i); - if (w) { - QJsonObject circle; - QJsonObject circleObj; - - - QJsonArray center; - center.append(w->Latitude()); - center.append(w->Longitude()); - - double radius = w->Radius(); - - circle["center"] = center; - circle["radius"] = radius; - - - circleObj["inclusion"] = w->Inclusion(); - circleObj["circle"] = circle; - circleObj["version"] = 1; - - - circles.push_back(circleObj); - } - } } - geoFence.insert("circles",circles); - geoFence.insert("polygons",polygons); - geoFence.insert("version",2); - - //mission节点写入 (mission type == 3...) + else if(currentGroup == 2) { + //rallyPoints节点写入 + + QJsonArray points; + rallyPoints.insert("points",points); + rallyPoints.insert("version",2); + + } + else if(currentGroup >= 3) + { + emit showMessage(tr("Save Mission File:Group %1,%2").arg(QString::number(currentGroup)).arg(path)); + + QJsonArray items; QJsonArray plannedHomePosition; @@ -2574,12 +2526,7 @@ void OPMapWidget::WPSave(QString path)//带文件目录参数 mission.insert("version",2); } - //rallyPoints节点写入 - { - QJsonArray points; - rallyPoints.insert("points",points); - rallyPoints.insert("version",2); - } + //根节点写入 root.insert("fileType","Plan"); @@ -2616,7 +2563,7 @@ void OPMapWidget::WPDownload(void) if(currentGroup == 1) { - fenceCount = 0; + fenceCount = 1; } int sysid = 0; @@ -2711,12 +2658,12 @@ void OPMapWidget::WPUpload(void) if(FenceItemExit == false) { - emit showMessage("请先载入围栏"); + emit showMessage(tr("please load fence first")); return; } - emit showMessage(tr("开始上传围栏,总数%1").arg(FecneSeq)); + emit showMessage(tr("start upload fence,total:%1").arg(FecneSeq)); //选择当前ID号 foreach(QGraphicsItem * i, map->childItems()) { @@ -2754,12 +2701,12 @@ void OPMapWidget::WPUpload(void) if(list.size() <= 0) { - emit showMessage("请先载入任务航线"); + emit showMessage(tr("please load mission first")); return; } - emit showMessage(tr("开始上传航点,总数%1").arg(list.size())); + emit showMessage(tr("start upload mission %1,total %2").arg(currentGroup).arg(list.size())); //选择当前ID号 @@ -2879,8 +2826,6 @@ void OPMapWidget::WPGroup(int value) { currentGroup = value; - - qDebug() << "group checkout" << value; //切换当前航线,其他都隐藏,或者高亮当前 @@ -2957,17 +2902,6 @@ void OPMapWidget::WPGroup(int value) find_PointNumber(currentGroup); - /* - if(currentGroup == 1) - { - isWPCreate = false; - } - else - { - isWPCreate = true; - } - */ - update(); } @@ -2978,14 +2912,14 @@ void OPMapWidget::WPGroup(int value) if(flag == true) { QString str; - str.append("上传航点"); + str.append("upload Mission"); str.append(QString::number(seq)); emit showMessage(str); } else { QString str; - str.append(tr("上传失败%1").arg(seq)); + str.append(tr("upload fail %1").arg(seq)); emit showMessage(str); } @@ -3007,27 +2941,14 @@ void OPMapWidget::receivedPoint(float param1,float param2,float param3,float par qDebug() << "receivers Point"; - QString typestr; - - switch (mission_type - 2) { - case -1: - { - typestr = tr("fence"); - }break; - default: - { - typestr = QString::number(mission_type - 2); - }break; - } - - emit showMessage(tr("recieve way point group:%1 seq:%2").arg(typestr).arg(seq + 1)); - if((mission_type - 2) == -1) { qDebug() << command << seq << param1 << param2 << param3 << param4 << x << y; if(command == MAV_CMD_NAV_FENCE_POLYGON_VERTEX_INCLUSION ) { + emit showMessage(tr("recieve fence polygon inclusion: %1").arg(seq + 1)); + static int PolygonCount = 0; static QList PolygonPoints; @@ -3073,6 +2994,8 @@ void OPMapWidget::receivedPoint(float param1,float param2,float param3,float par } else if(command == MAV_CMD_NAV_FENCE_POLYGON_VERTEX_EXCLUSION ) { + emit showMessage(tr("recieve fence polygon exclusion: %1").arg(seq + 1)); + static int PolygonCount = 0; static QList PolygonPoints; @@ -3120,6 +3043,8 @@ void OPMapWidget::receivedPoint(float param1,float param2,float param3,float par } else if(command == MAV_CMD_NAV_FENCE_CIRCLE_INCLUSION ) { + emit showMessage(tr("recieve fence circle inclusion: %1").arg(seq + 1)); + bool inclusion = true; qreal radius = param1; @@ -3131,6 +3056,8 @@ void OPMapWidget::receivedPoint(float param1,float param2,float param3,float par } else if(command == MAV_CMD_NAV_FENCE_CIRCLE_EXCLUSION ) { + emit showMessage(tr("recieve fence circle exclusion: %1").arg(seq + 1)); + bool inclusion = false; qreal radius = param1; @@ -3147,6 +3074,8 @@ 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)); + bool isExist = false; foreach(QGraphicsItem * i, map->childItems()) { WayPointItem *w = qgraphicsitem_cast(i); @@ -3242,8 +3171,6 @@ void OPMapWidget::receivedPoint(float param1,float param2,float param3,float par } - - void OPMapWidget::getMapTypes(void) { emit MapTypes(Helper::MapTypes()); @@ -3254,9 +3181,6 @@ void OPMapWidget::setMapTypes(QVariant value) this->SetMapType(Helper::MapTypeFromString(value.toString())); } - - - void OPMapWidget::ElevationChanged(int seq,double value) { QMap Info; diff --git a/opmap/mapwidget/opmapwidget.h b/opmap/mapwidget/opmapwidget.h index 246082e..b128f4c 100644 --- a/opmap/mapwidget/opmapwidget.h +++ b/opmap/mapwidget/opmapwidget.h @@ -513,7 +513,7 @@ private: bool isShowTip = false; - int fenceCount = 0; + int fenceCount = 1; private slots: void diagRefresh(); @@ -672,6 +672,8 @@ signals: void currentPointSeleted(int group,int point); + void FenceGroupChanged(int old,int cur); + public slots: @@ -740,6 +742,7 @@ public slots: void WPGroup(int value); + void UAVTip_clicked(bool flag); void ruler_clicked(void); void table_clicked(void); diff --git a/opmap/mapwidget/uavitem.h b/opmap/mapwidget/uavitem.h index 4915639..d450d25 100644 --- a/opmap/mapwidget/uavitem.h +++ b/opmap/mapwidget/uavitem.h @@ -188,6 +188,13 @@ public: void setSelect(bool select); + void setShowTip(bool flag) + { + isShowTip = flag; + update(); + } + + private: void generateArrowhead(); MapGraphicItem *map; diff --git a/opmap/mapwidget/waypointitem.cpp b/opmap/mapwidget/waypointitem.cpp index e3e7bbd..7cedc31 100644 --- a/opmap/mapwidget/waypointitem.cpp +++ b/opmap/mapwidget/waypointitem.cpp @@ -464,6 +464,7 @@ void WayPointItem::mousePressEvent(QGraphicsSceneMouseEvent *event) } QGraphicsItem::mousePressEvent(event); + update(); } void WayPointItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { @@ -519,6 +520,7 @@ void WayPointItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) } } QGraphicsItem::mouseReleaseEvent(event); + update(); } void WayPointItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { @@ -534,6 +536,7 @@ void WayPointItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) } } QGraphicsItem::mouseMoveEvent(event); + update(); } diff --git a/opmap/mapwidget/waypointsetting.cpp b/opmap/mapwidget/waypointsetting.cpp index 0a6d678..3e97c4f 100644 --- a/opmap/mapwidget/waypointsetting.cpp +++ b/opmap/mapwidget/waypointsetting.cpp @@ -16,6 +16,14 @@ WayPointSetting::WayPointSetting(MapGraphicItem *map, QColor background) : myMap opacity = 0.6; + showMode = 0; + + rect.setX(0); + rect.setY(0); + rect.setWidth(100); + rect.setHeight(370); + + connect(map, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos())); connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal))); @@ -122,9 +130,30 @@ WayPointSetting::WayPointSetting(MapGraphicItem *map, QColor background) : myMap }); */ + btn_aircraft = new WayPointButton(map); + btn_aircraft->setParentItem(this); + btn_aircraft->setGeometry(10,10,80,80); + btn_aircraft->setText(tr("AirCraft")); + connect(btn_aircraft,&WayPointButton::clicked,[=]() + { + if(btn_aircraft->Text() == tr("AirCraft")) + { + btn_aircraft->setText(tr("ShowAirCraft")); + emit UAVShowTip(true); + emit showMessage(tr("show UAV Tip")); + } + else + { + btn_aircraft->setText(tr("AirCraft")); + emit UAVShowTip(false); + emit showMessage(tr("hide UAV Tip")); + } + }); + + btn_tip = new WayPointButton(map); btn_tip->setParentItem(this); - btn_tip->setGeometry(10,10,80,80); + btn_tip->setGeometry(10,100,80,80); btn_tip->setText(tr("Tip")); connect(btn_tip,&WayPointButton::clicked,[=]() { @@ -132,17 +161,19 @@ WayPointSetting::WayPointSetting(MapGraphicItem *map, QColor background) : myMap { btn_tip->setText(tr("ShowTip")); emit WPShowTip(true); + emit showMessage(tr("show mission Tip")); } else { btn_tip->setText(tr("Tip")); emit WPShowTip(false); + emit showMessage(tr("hide mission Tip")); } }); btn_ruler = new WayPointButton(map); btn_ruler->setParentItem(this); - btn_ruler->setGeometry(10,100,80,80); + btn_ruler->setGeometry(10,190,80,80); btn_ruler->setText(tr("Measure")); connect(btn_ruler,&WayPointButton::clicked,[=](){ @@ -153,7 +184,7 @@ WayPointSetting::WayPointSetting(MapGraphicItem *map, QColor background) : myMap btn_table = new WayPointButton(map); btn_table->setParentItem(this); - btn_table->setGeometry(10,190,80,80); + btn_table->setGeometry(10,280,80,80); btn_table->setText(tr("Table")); connect(btn_table,&WayPointButton::clicked,[=](){ @@ -166,7 +197,7 @@ WayPointSetting::WayPointSetting(MapGraphicItem *map, QColor background) : myMap QRectF WayPointSetting::boundingRect() const //鼠标可以操作的大小 { - return QRectF(0,0,100,280); + return rect; } void WayPointSetting::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) @@ -194,7 +225,6 @@ void WayPointSetting::paint(QPainter *painter, const QStyleOptionGraphicsItem *o painter->drawRect(0,0,this->boundingRect().width(),this->boundingRect().height()); painter->restore(); - } diff --git a/opmap/mapwidget/waypointsetting.h b/opmap/mapwidget/waypointsetting.h index 8ef9aaf..cd0e632 100644 --- a/opmap/mapwidget/waypointsetting.h +++ b/opmap/mapwidget/waypointsetting.h @@ -132,6 +132,10 @@ private: QMap> allPoint;//所有航点 + QRectF rect = QRectF(0,0,100,370); + + int showMode = 0; + WayPointButton *btn_load; WayPointButton *btn_save; @@ -147,6 +151,8 @@ private: WayPointButton *btn_group; + + WayPointButton *btn_aircraft; WayPointButton *btn_tip; @@ -155,6 +161,8 @@ private: signals: + void showMessage(const QString &message,int TimeOut = 0); + void WayPointPropertyChanged(float param1,float param2,float param3,float param4, int32_t x,int32_t y,float z, uint16_t seq, @@ -183,6 +191,7 @@ signals: void WPTable(void); void WPShowTip(bool flag); + void UAVShowTip(bool flag); protected: @@ -212,6 +221,111 @@ public slots: void setOpacitySlot(qreal opacity); void measureState(bool flag); + + + + void setMode(int mode) + { + showMode = mode; + + switch (showMode) { + case 0: + rect.setX(0); + rect.setY(0); + rect.setWidth(100); + rect.setHeight(370); + + + if(btn_aircraft) + { + btn_aircraft->show(); + } + + if(btn_tip) + { + btn_tip->show(); + } + + if(btn_ruler) + { + btn_ruler->show(); + } + + if(btn_table) + { + btn_table->show(); + } + + + break; + case 1: + rect.setX(0); + rect.setY(0); + rect.setWidth(100); + rect.setHeight(190); + + + if(btn_aircraft) + { + btn_aircraft->show(); + } + + if(btn_tip) + { + btn_tip->show(); + } + + if(btn_ruler) + { + btn_ruler->hide(); + } + + if(btn_table) + { + btn_table->hide(); + } + + break; + case 2: + rect.setX(0); + rect.setY(0); + rect.setWidth(100); + rect.setHeight(100); + + if(btn_aircraft) + { + btn_aircraft->show(); + } + + if(btn_tip) + { + btn_tip->hide(); + } + + if(btn_ruler) + { + btn_ruler->hide(); + } + + if(btn_table) + { + btn_table->hide(); + } + + break; + default: + break; + } + + + + + + update(); + } + + + };