上传,下载功能完成
This commit is contained in:
@@ -1190,7 +1190,6 @@ void OPMapWidget::WPSetVisibleAll(bool value)
|
||||
void OPMapWidget::WPDeleteAll()
|
||||
{
|
||||
//删除一个组
|
||||
|
||||
foreach(QGraphicsItem * i, map->childItems()) {
|
||||
WayPointItem *w = qgraphicsitem_cast<WayPointItem *>(i);
|
||||
|
||||
@@ -1272,9 +1271,10 @@ void OPMapWidget::ConnectWP(WayPointItem *item)
|
||||
connect(item, 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)),
|
||||
this, SLOT(find_PointNumber()),Qt::DirectConnection);
|
||||
|
||||
|
||||
/*
|
||||
connect(item, SIGNAL(WPFollowPrevious(bool,WayPointItem*)),
|
||||
this, SLOT(WPFollowPrevious(bool,WayPointItem*)),Qt::DirectConnection);
|
||||
*/
|
||||
|
||||
connect(item, SIGNAL(localPositionChanged(QPointF, WayPointItem *)),
|
||||
this, SLOT(WPLocalChanged(QPointF, WayPointItem *)), Qt::DirectConnection);
|
||||
@@ -1518,7 +1518,6 @@ void OPMapWidget::WPSetCurrent(int seq)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1859,10 +1858,6 @@ void OPMapWidget::WPLoad(QString path)//带文件目录参数
|
||||
Item->emitWPProperty();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void OPMapWidget::WPSave(QString path)//带文件目录参数
|
||||
@@ -1877,7 +1872,7 @@ void OPMapWidget::WPSave(QString path)//带文件目录参数
|
||||
QJsonObject rallyPoints;
|
||||
|
||||
|
||||
//geoFence节点写入
|
||||
//geoFence节点写入 (mission type == 1,2)
|
||||
{
|
||||
QJsonArray circles;
|
||||
QJsonArray polygons;
|
||||
@@ -1887,7 +1882,7 @@ void OPMapWidget::WPSave(QString path)//带文件目录参数
|
||||
geoFence.insert("version",2);
|
||||
}
|
||||
|
||||
//mission节点写入
|
||||
//mission节点写入 (mission type == 3...)
|
||||
{
|
||||
QJsonArray items;
|
||||
|
||||
@@ -2068,34 +2063,70 @@ void OPMapWidget::WPUpload(void)
|
||||
//飞行界面收到的当前航点的消息
|
||||
void OPMapWidget::groupchanged(int value)
|
||||
{
|
||||
currentMissionType = value;
|
||||
//如果当前是在飞行界面,那么就下载,否则不动
|
||||
|
||||
if(isWPCreate == true)//编辑界面
|
||||
{
|
||||
|
||||
}
|
||||
else//飞行界面
|
||||
{
|
||||
/*
|
||||
WPDeleteAll();
|
||||
|
||||
int sysid = 0;
|
||||
int compid = 0;
|
||||
|
||||
qDebug() << "show current group" << currentMissionType;
|
||||
//将不是当前的全部变成灰色,当前的显示
|
||||
foreach(QGraphicsItem * i, map->childItems()) {
|
||||
UAVItem *u = qgraphicsitem_cast<UAVItem *>(i);
|
||||
if (u) {
|
||||
if(u->Select() == true)
|
||||
WayPointItem *w = qgraphicsitem_cast<WayPointItem *>(i);
|
||||
if (w) {
|
||||
qDebug() << "missiontype" << w->MissionType();
|
||||
if(w->MissionType() == currentMissionType)
|
||||
{
|
||||
sysid = u->SysID();
|
||||
compid = u->CompID();
|
||||
|
||||
emit signal_WPDownload(sysid,compid,value);
|
||||
w->setisActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
w->setisActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//将不是当前的先全部变成灰色,当前的显示
|
||||
foreach(QGraphicsItem * i, map->childItems()) {
|
||||
WayPointLine *l = qgraphicsitem_cast<WayPointLine *>(i);
|
||||
if (l) {
|
||||
|
||||
WayPointItem *from = qgraphicsitem_cast<WayPointItem *>(l->WPLineFrom());
|
||||
WayPointItem *to = qgraphicsitem_cast<WayPointItem *>(l->WPLineTo());
|
||||
|
||||
if((from)||(to))
|
||||
{
|
||||
if(from)
|
||||
{
|
||||
if(from->MissionType() == currentMissionType)
|
||||
{
|
||||
l->setisActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
l->setisActive(false);
|
||||
}
|
||||
}
|
||||
else if(to)
|
||||
{
|
||||
if(from->MissionType() == currentMissionType)
|
||||
{
|
||||
l->setisActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
l->setisActive(false);
|
||||
}
|
||||
}
|
||||
else//不知道这句对不对
|
||||
{
|
||||
l->setisActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2167,22 +2198,7 @@ void OPMapWidget::WPGroup(int value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//按照当前的组生成新的航点和航线
|
||||
/*
|
||||
WPDeleteAll();
|
||||
|
||||
QMap<int,WayPointItem *> group;
|
||||
|
||||
group = waypointgroups.value(currentGroup);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
update();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2222,12 +2238,14 @@ void OPMapWidget::receivedPoint(float param1,float param2,float param3,float par
|
||||
|
||||
|
||||
//emit showMessage(tr("recieve way point %1").arg(seq + 1));
|
||||
emit showMessage(tr("收到航点 %1").arg(seq + 1));
|
||||
emit showMessage(tr("recieve way point group:%1 seq:%2").arg(mission_type).arg(seq + 1));
|
||||
|
||||
|
||||
//qDebug() << "receivers Point" << x * 10e-8 << y * 10e-8 << 10e-8;
|
||||
|
||||
bool isExist = false;
|
||||
|
||||
|
||||
foreach(QGraphicsItem * i, map->childItems()) {
|
||||
WayPointItem *w = qgraphicsitem_cast<WayPointItem *>(i);
|
||||
if (w) {
|
||||
@@ -2269,26 +2287,24 @@ void OPMapWidget::receivedPoint(float param1,float param2,float param3,float par
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!isExist)
|
||||
{
|
||||
|
||||
|
||||
|
||||
internals::PointLatLng LatLng;
|
||||
|
||||
LatLng.SetLat(x * 10e-8);
|
||||
LatLng.SetLng(y * 10e-8);
|
||||
|
||||
//设置好当前的航线
|
||||
currentGroup = mission_type;
|
||||
//获取当前组下面的seq最大值
|
||||
WayPointItem *Item = new WayPointItem(LatLng, z,seq+1,mission_type, map);
|
||||
|
||||
ConnectWP(Item);
|
||||
Item->setParentItem(map);
|
||||
Item->SetMissionType(mission_type);
|
||||
int position = Item->Number();
|
||||
emit WPCreated(position, Item);
|
||||
setOverlayOpacity(overlayOpacity);
|
||||
|
||||
//生成的时候默认设定不对,导致下载时切换过去
|
||||
WayPointItem *Item = WPCreate(LatLng,z);
|
||||
|
||||
Item->SetNumber(seq+1);
|
||||
|
||||
qDebug() << "waypoint not exist:" << Item->Number() << seq+1 <<currentGroup << mission_type;
|
||||
|
||||
emit setWPProperty(param1,param2,param3,param4,
|
||||
x,y,z,
|
||||
@@ -2305,23 +2321,17 @@ void OPMapWidget::receivedPoint(float param1,float param2,float param3,float par
|
||||
|
||||
Item->emitWPProperty();
|
||||
|
||||
qDebug() << "waypoint not exist:" << Item->Number() << seq+1 <<currentGroup << mission_type;
|
||||
|
||||
//===========连线
|
||||
/*
|
||||
WayPointItem *w_last = WPFind(mission_type,Item->Number() - 1);
|
||||
if(w_last)
|
||||
{
|
||||
WPLineCreate(w_last,Item,Qt::green,false,2);
|
||||
}
|
||||
|
||||
|
||||
WayPointItem *w_next = WPFind(group,Item->Number() + 1);
|
||||
if(w_next)
|
||||
{
|
||||
WPLineCreate(item,w_next,Qt::green,false,2);
|
||||
}
|
||||
*/
|
||||
WayPointItem *w_last = WPFind(Item->MissionType(),Item->Number() - 1);
|
||||
|
||||
if(w_last)
|
||||
{
|
||||
WPLineCreate(w_last,Item,Qt::green,false,2);
|
||||
}
|
||||
}
|
||||
|
||||
qDebug() << "Exist" << isExist;
|
||||
|
||||
Reference in New Issue
Block a user