From af95cccf82f17241509a23c8d80aa2b99b8015d7 Mon Sep 17 00:00:00 2001 From: hm Date: Wed, 18 May 2022 18:04:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9C=B0=E5=9B=BE=E4=B8=8A?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E5=9B=B4=E6=A0=8F=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/MissionUI/MissionUI.cpp | 157 ++++++++++++++++++++++++++++- App/MissionUI/MissionUI.h | 3 +- App/MissionUI/propertyui.cpp | 8 ++ App/MissionUI/propertyui.h | 3 + App/mainwindow.cpp | 13 +++ MavLinkNode/Terminal.cpp | 3 + opmap/mapwidget/geoFencecircle.cpp | 127 ++++++++++++++++++++--- opmap/mapwidget/geoFencecircle.h | 18 +++- opmap/mapwidget/geoFenceitem.cpp | 77 +++++++++++--- opmap/mapwidget/geoFenceitem.h | 8 +- opmap/mapwidget/opmapwidget.cpp | 25 +++++ opmap/mapwidget/opmapwidget.h | 5 + 12 files changed, 418 insertions(+), 29 deletions(-) diff --git a/App/MissionUI/MissionUI.cpp b/App/MissionUI/MissionUI.cpp index 2507845..f0d3422 100644 --- a/App/MissionUI/MissionUI.cpp +++ b/App/MissionUI/MissionUI.cpp @@ -618,6 +618,161 @@ void MissionUI::createFencePolygon(int group,qreal vertex, bool inclusion, QList } } +void MissionUI::updateFenceCircle(int group,qreal radius, bool inclusion, qreal lat, qreal lng) +{ + QTableWidget *tableWidget = tablelist.value(1); + if(!tableWidget) + { + qDebug() << "UNFIND TABLE"; + return; + } + + //找第一个index + int row_id = -1; + for(int i = 0;i< tableWidget->rowCount();i++) + { + int gv = tableWidget->item(i,0)->data(Qt::DisplayRole).toInt();//得到group + + if(gv == group) + { + row_id = i; + break; + } + } + + if(row_id == -1) + { + return; + } + + tableWidget->removeCellWidget(row_id,2); + tableWidget->setItem(row_id,2,new QTableWidgetItem(QString::number(radius))); + + + QString inclusionName; + switch (inclusion) { + case 1: + inclusionName = tr("inclusion"); + break; + case 0: + inclusionName = tr("exclusion"); + break; + default: + break; + } + + QTableWidgetItem *item3 = new QTableWidgetItem(inclusionName); + item3->setCheckState((inclusion)?(Qt::Checked):(Qt::Unchecked)); + + tableWidget->removeCellWidget(row_id,3); + tableWidget->setItem(row_id,3,item3); + + tableWidget->removeCellWidget(row_id,4); + tableWidget->setItem(row_id,4,new QTableWidgetItem(QString::number(lat ,'f',7))); + + tableWidget->removeCellWidget(row_id,5); + tableWidget->setItem(row_id,5,new QTableWidgetItem(QString::number(lng ,'f',7))); +} + +void MissionUI::updateFencePolygon(int group,qreal vertex,bool inclusion,QList latlng) +{ + QTableWidget *tableWidget = tablelist.value(1); + if(!tableWidget) + { + qDebug() << "UNFIND TABLE"; + return; + } + + //找第一个index + int startIndex = -1; + bool isGetStart = false; + int endIndex = -1; + for(int i = 0;i< tableWidget->rowCount();i++) + { + int gv = tableWidget->item(i,0)->data(Qt::DisplayRole).toInt();//得到group + + if(isGetStart == false)//还没得到开头 + { + if(gv == group) + { + startIndex = i; + isGetStart = true; + } + } + else//已经得到开头,寻找结束项 + { + if(gv != group) + { + endIndex = i; + } + } + } + + if((startIndex == -1)&&(endIndex == -1)) + { + return; + } + + if(vertex > (endIndex - startIndex)) + { + //tableWidget->insertRow(endIndex);//增肌行 + } + else if(vertex < (endIndex - startIndex))//说明减少了点 + { + //tableWidget->insertRow(endIndex);//减少行 + } + + int idx = startIndex; + for(QPointF p:latlng) + { + qreal lat = p.x(); + qreal lng = p.y(); + + tableWidget->removeCellWidget(idx,2); + tableWidget->setItem(idx,2,new QTableWidgetItem(QString::number(vertex))); + + + QString inclusionName; + switch (inclusion) { + case 1: + inclusionName = tr("inclusion"); + break; + case 0: + inclusionName = tr("exclusion"); + break; + default: + break; + } + + QTableWidgetItem *item3 = new QTableWidgetItem(inclusionName); + item3->setCheckState((inclusion)?(Qt::Checked):(Qt::Unchecked)); + + tableWidget->removeCellWidget(idx,3); + tableWidget->setItem(idx,3,item3); + + tableWidget->removeCellWidget(idx,4); + tableWidget->setItem(idx,4,new QTableWidgetItem(QString::number(lat ,'f',7))); + + tableWidget->removeCellWidget(idx,5); + tableWidget->setItem(idx,5,new QTableWidgetItem(QString::number(lng ,'f',7))); + + idx++; + } + + + //tableWidget->setSpan(startIndex,0,endIndex - startIndex,1); + //tableWidget->setSpan(startIndex,1,endIndex - startIndex,1); + //tableWidget->setSpan(startIndex,2,endIndex - startIndex,1); + //tableWidget->setSpan(startIndex,3,endIndex - startIndex,1); + +} + + + + + + + void MissionUI::pointCreate(float param1,float param2,float param3,float param4, int32_t x,int32_t y,float z, uint16_t seq, @@ -1347,5 +1502,3 @@ void MissionUI::itemDoubleClicked(QTableWidgetItem *item) - - diff --git a/App/MissionUI/MissionUI.h b/App/MissionUI/MissionUI.h index c5f58d4..b7a3574 100644 --- a/App/MissionUI/MissionUI.h +++ b/App/MissionUI/MissionUI.h @@ -48,7 +48,8 @@ public slots: void createFenceCircle(int group,qreal radius, bool inclusion, qreal lat, qreal lng); void createFencePolygon(int group,qreal vertex,bool inclusion,QList latlng); - + void updateFenceCircle(int group,qreal radius, bool inclusion, qreal lat, qreal lng); + void updateFencePolygon(int group,qreal vertex,bool inclusion,QList latlng); protected slots: diff --git a/App/MissionUI/propertyui.cpp b/App/MissionUI/propertyui.cpp index 21e18b6..6ca001b 100644 --- a/App/MissionUI/propertyui.cpp +++ b/App/MissionUI/propertyui.cpp @@ -190,6 +190,14 @@ propertyui::propertyui(QWidget *parent) : connect(table,&MissionUI::delFence, this,&propertyui::delFence); + + connect(this,&propertyui::updateFenceCircle, + table,&MissionUI::updateFenceCircle); + + connect(this,&propertyui::updateFencePolygon, + table,&MissionUI::updateFencePolygon); + + //初始化参数 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 f0c324b..dc62920 100644 --- a/App/MissionUI/propertyui.h +++ b/App/MissionUI/propertyui.h @@ -269,6 +269,9 @@ Q_SIGNALS: void setFenceCircle(int group,qreal radius, bool inclusion, qreal lat, qreal lng); void setFencePolygon(int group,qreal vertex,bool inclusion,QList latlng); + void updateFenceCircle(int group,qreal radius, bool inclusion, qreal lat, qreal lng); + void updateFencePolygon(int group,qreal vertex,bool inclusion,QList latlng); + void addCircle(); void addPolygon(); void delFence(int group); diff --git a/App/mainwindow.cpp b/App/mainwindow.cpp index 6f9b505..9d84c9d 100644 --- a/App/mainwindow.cpp +++ b/App/mainwindow.cpp @@ -449,6 +449,15 @@ MainWindow::MainWindow(QWidget *parent) connect(missionUI,SIGNAL(delFence(int)), map,SLOT(delFence(int))); + + connect(map,SIGNAL(updateFenceCircle(int,qreal,bool,qreal,qreal)), + missionUI,SIGNAL(updateFenceCircle(int,qreal,bool,qreal,qreal))); + + connect(map,SIGNAL(updateFencePolygon(int,qreal,bool,QList)), + missionUI,SIGNAL(updateFencePolygon(int,qreal,bool,QList))); + + + //dlink ----- map connect(map,SIGNAL(signal_WPDownload(uint8_t,uint8_t,int)), dlink->mavlinknode->Mission,SLOT(ReadCmd(uint8_t,uint8_t,int)),Qt::DirectConnection); @@ -457,6 +466,10 @@ MainWindow::MainWindow(QWidget *parent) dlink->mavlinknode->Mission,SLOT(WriteCmd(uint8_t,uint8_t,uint32_t,int)),Qt::DirectConnection); + + + + //生成航线必须在map线程完成,因此不能直接连接 //停下来让ui、运行一下 connect(dlink->mavlinknode->Mission,SIGNAL(receivedPoint(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)), diff --git a/MavLinkNode/Terminal.cpp b/MavLinkNode/Terminal.cpp index 1a327aa..2960129 100644 --- a/MavLinkNode/Terminal.cpp +++ b/MavLinkNode/Terminal.cpp @@ -45,6 +45,7 @@ void terminal::Transmit(QString msg) SerialData.append(msg); status.transmit.type = 0; status.m_Mode = TransmitMode;//发送模式 + } } @@ -104,6 +105,8 @@ void terminal::serial_control(void) mavlink_msg_serial_control_encode(GCS_SysID,GCS_CompID, &msg,&serial_control); Send(msg); + + } diff --git a/opmap/mapwidget/geoFencecircle.cpp b/opmap/mapwidget/geoFencecircle.cpp index a959e6a..e5007c5 100644 --- a/opmap/mapwidget/geoFencecircle.cpp +++ b/opmap/mapwidget/geoFencecircle.cpp @@ -10,9 +10,13 @@ geoFencecircle::geoFencecircle(int group, bool inclusion, int version, internals QGraphicsEllipseItem(map),m_center(center), coord(center), m_brush(color), m_map(map),dashed(dashed),lineWidth(width) { - + this->setAcceptHoverEvents(true); this->setZValue(3); + this->setFlag(QGraphicsItem::ItemIsMovable, true); + this->setFlag(QGraphicsItem::ItemIgnoresTransformations, true); + //this->setFlag(QGraphicsItem::ItemIsSelectable, true);//这个有bug + m_version = version; m_inclusion = inclusion; m_radius = radius; @@ -21,6 +25,9 @@ geoFencecircle::geoFencecircle(int group, bool inclusion, int version, internals m_longitide = coord.Lng();//6 connect(map, SIGNAL(childRefreshPosition()), this, SLOT(refreshLocations())); + + + refreshLocations(); } @@ -54,16 +61,21 @@ void geoFencecircle::paint(QPainter *painter, const QStyleOptionGraphicsItem *op } - //painter->translate(-line.length(), -line.length()); - - - if(m_inclusion) + if(enter) { - painter->setBrush(Qt::NoBrush); + painter->setOpacity(0.3); + painter->setBrush(QColor("#FFFFFF")); } else { - painter->setBrush(m_brush); + if(m_inclusion) + { + painter->setBrush(Qt::NoBrush); + } + else + { + painter->setBrush(m_brush); + } } @@ -86,8 +98,11 @@ void geoFencecircle::paint(QPainter *painter, const QStyleOptionGraphicsItem *op void geoFencecircle::refreshLocations() { - QPointF p(m_map->FromLatLngToLocal(this->coord).X(), - m_map->FromLatLngToLocal(this->coord).Y()); + + QPointF p(m_map->FromLatLngToLocal(coord).X(), + m_map->FromLatLngToLocal(coord).Y()); + + internals::PointLatLng C; C = coord; @@ -95,11 +110,17 @@ void geoFencecircle::refreshLocations() line = QLineF(p.x(),p.y(),p.x(),m_map->FromLatLngToLocal(C).Y()); - rectangle.setRect(-line.length(),-line.length(), 2 * line.length(), 2 * line.length()); - //qDebug() << line << rectangle << C.Lat() << C.Lng() << m_radius; + //rectangle.setRect(p.x() -line.length(),p.y() -line.length(), 2 * line.length(), 2 * line.length()); + rectangle.setRect(p.x(),p.y(), 2 * line.length(), 2 * line.length()); - setPos(p); + setRect(rectangle); + +/* + qDebug() << p; + + setRect(p.x() - line.length(),p.y() - line.length(), 2 * line.length(), 2 * line.length()); + */ update(); } @@ -113,7 +134,89 @@ void geoFencecircle::setOpacitySlot(qreal opacity) setOpacity(opacity); } +void geoFencecircle::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) +{ + if (event->button() == Qt::LeftButton) { + } +} + +void geoFencecircle::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + if (event->button() == Qt::LeftButton) { + isDragging = true; + + qDebug() << "circle press"; + + } + QGraphicsItem::mousePressEvent(event); + update(); +} +void geoFencecircle::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +{ + if (event->button() == Qt::LeftButton) { + isDragging = false; + + qDebug() << "circle release"; + } + QGraphicsItem::mouseReleaseEvent(event); + update(); +} +void geoFencecircle::mouseMoveEvent(QGraphicsSceneMouseEvent *event) +{ + if (isDragging) { + emit localPositionChanged(this->pos(), this); + + + + + //更新一下points + QPointF p = mapToScene(rectangle.center()); + + m_latitude = m_map->FromLocalToLatLng(p.x(),p.y()).Lat(); + m_longitide = m_map->FromLocalToLatLng(p.x(),p.y()).Lng(); + + /* + coord.SetLat(m_latitude); + coord.SetLng(m_longitide); + + m_center = coord; + */ + + emit updateFenceCircle(m_group,m_radius,m_inclusion,m_latitude,m_longitide); + + // qDebug() << rectangle << pos() << p << m_center.Lat() << m_center.Lng(); + + + //refreshLocations(); + + } + QGraphicsItem::mouseMoveEvent(event); + update(); +} + + +void geoFencecircle::hoverEnterEvent(QGraphicsSceneHoverEvent *event) +{ + Q_UNUSED(event) + + qDebug() << "circle enter"; + + enter = true; + + update(); +} + +void geoFencecircle::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) +{ + Q_UNUSED(event) + + qDebug() << "circle leave"; + + enter = false; + + update(); +} } diff --git a/opmap/mapwidget/geoFencecircle.h b/opmap/mapwidget/geoFencecircle.h index d8faaae..5244e20 100644 --- a/opmap/mapwidget/geoFencecircle.h +++ b/opmap/mapwidget/geoFencecircle.h @@ -8,6 +8,8 @@ #include #include "mapgraphicitem.h" #include "geoFenceitem.h" +#include + namespace mapcontrol { @@ -121,16 +123,30 @@ private: QRectF rectangle; - + bool isDragging = false; + bool enter = false; protected: void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + + void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); + void mousePressEvent(QGraphicsSceneMouseEvent *event); + void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + void hoverEnterEvent(QGraphicsSceneHoverEvent *event); + void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); public slots: void refreshLocations(); void waypointdeleted(); void setOpacitySlot(qreal opacity); + +signals: + + void updateFenceCircle(int group,qreal radius, bool inclusion, qreal lat, qreal lng); + void localPositionChanged(QPointF point, geoFencecircle *p); + }; } #endif // GEOFENCECIRCLE_H diff --git a/opmap/mapwidget/geoFenceitem.cpp b/opmap/mapwidget/geoFenceitem.cpp index 62c1e52..6d01f74 100644 --- a/opmap/mapwidget/geoFenceitem.cpp +++ b/opmap/mapwidget/geoFenceitem.cpp @@ -1,13 +1,20 @@ #include "geoFenceitem.h" #include -#include + namespace mapcontrol { geoFenceitem::geoFenceitem(int group, bool inclusion, int version, internals::PointLatLng const & coord, QBrush color, MapGraphicItem *map, bool dashed, int width) : QGraphicsPolygonItem(map), number(0) , coord(coord), m_brush(color), m_map(map), dashed(dashed), lineWidth(width) { + this->setAcceptHoverEvents(true); this->setZValue(3); + + this->setFlag(QGraphicsItem::ItemIsMovable, true); + this->setFlag(QGraphicsItem::ItemIgnoresTransformations, true); + //this->setFlag(QGraphicsItem::ItemIsSelectable, true);//这个有bug + + connect(map, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos())); @@ -41,13 +48,22 @@ void geoFenceitem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti myPen.setDashPattern(dashes); } - if(m_inclusion) + + if(enter) { - painter->setBrush(Qt::NoBrush); + painter->setOpacity(0.3); + painter->setBrush(QColor("#FFFFFF")); } else { - painter->setBrush(m_brush); + if(m_inclusion) + { + painter->setBrush(Qt::NoBrush); + } + else + { + painter->setBrush(m_brush); + } } painter->drawPoint(0, 0); @@ -98,8 +114,50 @@ void geoFenceitem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void geoFenceitem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { if (isDragging) { - //ElevationTrig(); emit localPositionChanged(this->pos(), this); + + + //更新一下points + QPolygonF poly = mapToScene(polygon()); + + QList latlng; + QList pointlist; + + latlng.clear(); + pointlist.clear(); + + + qreal lat_sum = 0; + qreal lng_sum = 0; + + for(QPointF p:poly) + { + + latlng.push_back(m_map->FromLocalToLatLng(p.x(),p.y())); + + pointlist.push_back(QPointF(m_map->FromLocalToLatLng(p.x(),p.y()).Lat(),m_map->FromLocalToLatLng(p.x(),p.y()).Lng())); + + lat_sum += m_map->FromLocalToLatLng(p.x(),p.y()).Lat(); + lng_sum += m_map->FromLocalToLatLng(p.x(),p.y()).Lng(); + + } + + if(latlng.size() > 0) + { + + m_latitude = lat_sum/latlng.size(); + m_longitide = lng_sum/latlng.size(); + + coord.SetLat(m_latitude); + coord.SetLng(m_longitide); + + setPoints(latlng); + + emit updateFencePolygon(m_group,m_Vertex,m_inclusion,pointlist); + + qDebug() << polygon() << pointlist; + } + } QGraphicsItem::mouseMoveEvent(event); update(); @@ -109,20 +167,20 @@ void geoFenceitem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) void geoFenceitem::hoverEnterEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event) + enter = true; update(); } void geoFenceitem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event) + enter = false; update(); } void geoFenceitem::setPosSLOT() { - //qDebug() << "virtual set pos"; - QPolygonF polygon; for(internals::PointLatLng LatLng:points) { @@ -134,8 +192,6 @@ void geoFenceitem::setPosSLOT() } setPolygon(polygon); - - setPos(m_map->FromLatLngToLocal(this->coord).X(), m_map->FromLatLngToLocal(this->coord).Y()); emit localPositionChanged(this->pos(),this); update(); @@ -152,9 +208,6 @@ void geoFenceitem::setPoints(QList p) m_Vertex = p.size(); RefreshPos(); } - - - } diff --git a/opmap/mapwidget/geoFenceitem.h b/opmap/mapwidget/geoFenceitem.h index 1ba2e2e..e791015 100644 --- a/opmap/mapwidget/geoFenceitem.h +++ b/opmap/mapwidget/geoFenceitem.h @@ -7,6 +7,7 @@ #include "pointlatlng.h" #include #include "mapgraphicitem.h" +#include namespace mapcontrol { @@ -21,7 +22,7 @@ class geoFenceitem : public QObject, public QGraphicsPolygonItem { public: enum { Type = UserType + 5 }; geoFenceitem(int group,bool inclusion,int version,internals::PointLatLng const & coord, QBrush color, MapGraphicItem *map, bool dashed = false, int width = 3); - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,QWidget *widget); + int type() const; internals::PointLatLng coord; int number; @@ -94,6 +95,7 @@ public: } protected: + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,QWidget *widget); void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); void mousePressEvent(QGraphicsSceneMouseEvent *event); @@ -122,12 +124,16 @@ private: bool isDragging = false; + + bool enter = false; + public slots: void setPosSLOT(); void RefreshPos(); signals: + void updateFencePolygon(int group,qreal vertex,bool inclusion,QList latlng); void localPositionChanged(QPointF point, geoFenceitem *p); void aboutToBeDeleted(geoFenceitem *); diff --git a/opmap/mapwidget/opmapwidget.cpp b/opmap/mapwidget/opmapwidget.cpp index 5ae076b..b3d4d87 100644 --- a/opmap/mapwidget/opmapwidget.cpp +++ b/opmap/mapwidget/opmapwidget.cpp @@ -2090,6 +2090,9 @@ void OPMapWidget::addCircle() //生成一个⚪ geoFencecircle *c = new geoFencecircle(fenceCount,inclusion,version,internals::PointLatLng(lat,lng),radius,QColor("#FF8000"),map); emit createFenceCircle(fenceCount++,radius,inclusion,lat,lng); + + connect(c,SIGNAL(updateFenceCircle(int,qreal,bool,qreal,qreal)), + this,SIGNAL(updateFenceCircle(int,qreal,bool,qreal,qreal))); } void OPMapWidget::addPolygon() @@ -2126,10 +2129,15 @@ void OPMapWidget::addPolygon() geoFenceitem *polyitem = new geoFenceitem(fenceCount,inclusion,version,center,QColor("#FF8000"),map); + + polyitem->setPoints(points); emit createFencePolygon(fenceCount++,latlng.size(),inclusion,latlng); + connect(polyitem,SIGNAL(updateFencePolygon(int,qreal,bool,QList)), + this,SIGNAL(updateFencePolygon(int,qreal,bool,QList))); + } void OPMapWidget::delFence(int group) @@ -2226,6 +2234,9 @@ void OPMapWidget::WPLoad(QString path)//带文件目录参数 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(); @@ -2246,6 +2257,9 @@ void OPMapWidget::WPLoad(QString path)//带文件目录参数 geoFencecircle *c = new geoFencecircle(fenceCount,inclusion,version,internals::PointLatLng(lat,lng),radius,QColor("#FF8000"),map); emit createFenceCircle(fenceCount++,radius,inclusion,lat,lng); + connect(c,SIGNAL(updateFenceCircle(int,qreal,bool,qreal,qreal)), + this,SIGNAL(updateFenceCircle(int,qreal,bool,qreal,qreal))); + } @@ -2941,6 +2955,9 @@ void OPMapWidget::receivedPoint(float param1,float param2,float param3,float par emit createFencePolygon(fenceCount++,PolygonPoints.size(),inclusion,latlng); + connect(polyitem,SIGNAL(updateFencePolygon(int,qreal,bool,QList)), + this,SIGNAL(updateFencePolygon(int,qreal,bool,QList))); + PolygonCount = 0; PolygonPoints.clear(); } @@ -2985,6 +3002,9 @@ void OPMapWidget::receivedPoint(float param1,float param2,float param3,float par emit createFencePolygon(fenceCount++,PolygonPoints.size(),inclusion,latlng); + connect(polyitem,SIGNAL(updateFencePolygon(int,qreal,bool,QList)), + this,SIGNAL(updateFencePolygon(int,qreal,bool,QList))); + PolygonCount = 0; PolygonPoints.clear(); } @@ -2997,6 +3017,8 @@ void OPMapWidget::receivedPoint(float param1,float param2,float param3,float par geoFencecircle *c = new geoFencecircle(fenceCount++,inclusion,0,internals::PointLatLng(x * 10e-8,y * 10e-8),radius,QColor("#FF8000"),map); emit createFenceCircle(0,radius,inclusion,x * 10e-8,y * 10e-8); + connect(c,SIGNAL(updateFenceCircle(int,qreal,bool,qreal,qreal)), + this,SIGNAL(updateFenceCircle(int,qreal,bool,qreal,qreal))); } else if(command == MAV_CMD_NAV_FENCE_CIRCLE_EXCLUSION ) { @@ -3005,6 +3027,9 @@ void OPMapWidget::receivedPoint(float param1,float param2,float param3,float par geoFencecircle *c = new geoFencecircle(fenceCount++,inclusion,0,internals::PointLatLng(x * 10e-8,y * 10e-8),radius,QColor("#FF8000"),map); emit createFenceCircle(0,radius,inclusion,x * 10e-8,y * 10e-8); + + connect(c,SIGNAL(updateFenceCircle(int,qreal,bool,qreal,qreal)), + this,SIGNAL(updateFenceCircle(int,qreal,bool,qreal,qreal))); } else if(command == MAV_CMD_NAV_RALLY_POINT ) { diff --git a/opmap/mapwidget/opmapwidget.h b/opmap/mapwidget/opmapwidget.h index f6a7130..80c9789 100644 --- a/opmap/mapwidget/opmapwidget.h +++ b/opmap/mapwidget/opmapwidget.h @@ -651,6 +651,9 @@ signals: void createFenceCircle(int group,qreal radius,bool inclusion,qreal lat,qreal lng); void createFencePolygon(int group,qreal vertex,bool inclusion,QList latlng); + void updateFenceCircle(int group,qreal radius, bool inclusion, qreal lat, qreal lng); + void updateFencePolygon(int group,qreal vertex,bool inclusion,QList latlng); + void sendFence(qreal Vertex, qreal group, qreal Lat, @@ -750,6 +753,8 @@ public slots: void setFenceCircle(int group,qreal radius, bool inclusion, qreal lat, qreal lng); void setFencePolygon(int group,qreal vertex,bool inclusion,QList latlng); + + void addCircle(); void addPolygon(); void delFence(int group);