外场测试2

This commit is contained in:
hm
2020-08-07 17:15:58 +08:00
parent 898ca8f7a5
commit bc56a3f1ec
14 changed files with 375 additions and 64 deletions
+40 -19
View File
@@ -90,6 +90,10 @@ OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config) : QGraphicsView
altitudeitem->hide();
NoOperationTimer = new QTimer();
connect(NoOperationTimer,SIGNAL(timeout()),
this,SLOT(NOPTimeout()));
NoOperationTimer->start(20000);//20s不操作
}
void OPMapWidget::SetShowDiagnostics(bool const & value)
@@ -177,6 +181,15 @@ void OPMapWidget::addUAV(int sysid,int compid)
}
void OPMapWidget::NOPTimeout()
{
qDebug() << "NOPTimeout";
if(isWPCreate == false)
{
isLNOP = true;
}
}
void OPMapWidget::setUAVPos(int sysid,int compid,double x,double y,double z)
{
//qDebug() << sysid << compid;
@@ -190,16 +203,24 @@ void OPMapWidget::setUAVPos(int sysid,int compid,double x,double y,double z)
LatLng.SetLng(y);
u->SetUAVPos(LatLng,z);
/*
//==========================
编辑界面不拉回
飞行界面 20s不操作才会拉回一次
//===========================*/
if(u->Select())//当前选中,那么检查如果超出了屏幕范围,就将位置拉回中点
if(isWPCreate == false)
{
if((u->pos().x() <= 0)||
(u->pos().x() >= this->size().width())||
(u->pos().y() < 0)||
(u->pos().y() >= this->size().height()))
{
this->SetCurrentPosition(LatLng);
}
if(u->Select())//当前选中,那么检查如果超出了屏幕范围,就将位置拉回中点
{
if(((u->pos().x() <= 0)||
(u->pos().x() >= this->size().width())||
(u->pos().y() < 0)||
(u->pos().y() >= this->size().height()))&&(isLNOP == true))
{
this->SetCurrentPosition(LatLng);//缓慢拉回来
}
}
}
}
}
@@ -376,6 +397,9 @@ void OPMapWidget::mouseMoveEvent(QMouseEvent *event)
p = map->mapFromParent(p);
currentmouseposition = map->FromLocalToLatLng(p.x(), p.y());
isLNOP = false;
emit EmitCurrentMousePosition(currentmouseposition);
}
@@ -386,11 +410,15 @@ void OPMapWidget::mousePressEvent(QMouseEvent *event)
//qDebug() << "mousePressEvent";
isLNOP = false;
emit MousePressEvent(event);
}
void OPMapWidget::mouseReleaseEvent(QMouseEvent *event)
{
isLNOP = false;
QGraphicsView::mouseReleaseEvent(event);
emit MouseReleaseEvent(event);
}
@@ -399,6 +427,8 @@ void OPMapWidget::mouseDoubleClickEvent(QMouseEvent *event)
{
QGraphicsView::mouseDoubleClickEvent(event);
isLNOP = false;
//生成一个列表
if(isWPCreate == true)
{
@@ -413,16 +443,6 @@ void OPMapWidget::mouseDoubleClickEvent(QMouseEvent *event)
WPLineCreate(WPFind(Item->Number() - 1),Item,Qt::green,false,2);
/*
AltitudeItem *AltItem = new AltitudeItem(map,Qt::red);
AltItem->setParentItem(map);
AltItem->setNumber(Item->Number());
AltItem->setPos(Item->Number() * 20,this->height() - AltItem->boundingRect().height());
*/
qDebug() << "WPCreate Point"
<< QThread::currentThreadId();
}
@@ -1417,7 +1437,8 @@ void OPMapWidget::WPSave(QString path)//带文件目录参数
//这里有问题
items.append(item);
}
else
if(w->Number() == 1)
{
plannedHomePosition.append(w->Coord().Lat());
plannedHomePosition.append(w->Coord().Lng());