数据保持加码

This commit is contained in:
hm
2022-05-26 14:03:37 +08:00
parent 98bf5c5b70
commit 2d6f76c18d
32 changed files with 1649 additions and 790 deletions
+2
View File
@@ -38,6 +38,8 @@ public:
void setGroup(int value)
{
m_group = value;
//emit updateFenceCircle(m_group,m_radius,m_inclusion,m_latitude,m_longitide);
update();
}
+2
View File
@@ -208,6 +208,8 @@ void geoFenceitem::setPoints(QList<internals::PointLatLng> p)
m_Vertex = p.size();
RefreshPos();
}
}
+11
View File
@@ -45,6 +45,17 @@ public:
void setGroup(int value)
{
m_group = value;
QList<QPointF> latlng;
for(internals::PointLatLng p:points)
{
latlng.push_back(QPointF(p.Lat(),p.Lng()));
}
//emit updateFencePolygon(m_group,m_Vertex,m_inclusion,latlng);
RefreshPos();
}
+81 -11
View File
@@ -147,6 +147,8 @@ OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config) : QGraphicsView
//missiontable->hide();
point_begin.SetLat(0);
point_begin.SetLng(0);
@@ -571,9 +573,25 @@ void OPMapWidget::setUAVHeading(int sysid,int compid,float Heading)
}
}
}
}
void OPMapWidget::setUAVSpeed(int sysid,int compid,qreal Ma,qreal Speed)
{
Q_UNUSED(compid)
foreach(QGraphicsItem * i, map->childItems()) {
UAVItem *u = qgraphicsitem_cast<UAVItem *>(i);
if (u) {
if(u->SysID() == sysid)
{
u->setMa(Ma);
u->setSpeed(Speed);
}
}
}
}
int OPMapWidget::getUAVCurrent(void)
{
int num = -1;
@@ -1221,17 +1239,27 @@ void OPMapWidget::WPInsert()
{
WPLineCreate(item,w_next,Qt::green,false,2);
}
}
//设置跟随
/*
//
foreach(QGraphicsItem * i, map->childItems()) {
WayPointItem *w = qgraphicsitem_cast<WayPointItem *>(i);
if (w) {
WPFollowPrevious(w->FollowPrevious(),w);
if(w->isSelected())
{
w->emitWPProperty();
}
}
}
*/
}
void OPMapWidget::WPInsert(WayPointItem *item, const int &position)
@@ -1653,6 +1681,9 @@ void OPMapWidget::setSelectedWP(int number)
if(!wp->FollowPrevious())
altitudeitem->setCurrentPoint(wp->Number());
}
emit currentPointSeleted(wp->MissionType(),wp->Number());
}
}
@@ -2163,6 +2194,29 @@ void OPMapWidget::delFence(int group)
}
}
}
//重新整理一下fenceCount
/*
fenceCount = 0;
foreach(QGraphicsItem * i, map->childItems()) {
geoFenceitem *w = qgraphicsitem_cast<geoFenceitem *>(i);
if (w) {
w->setGroup(fenceCount++);
}
}
foreach(QGraphicsItem * i, map->childItems()) {
geoFencecircle *w = qgraphicsitem_cast<geoFencecircle *>(i);
if (w) {
w->setGroup(fenceCount++);
}
}
*/
}
@@ -2519,7 +2573,7 @@ void OPMapWidget::WPDownload(void)
if(currentGroup == 1)
{
//fenceCount = 0;
fenceCount = 0;
}
int sysid = 0;
@@ -3014,8 +3068,8 @@ void OPMapWidget::receivedPoint(float param1,float param2,float param3,float par
bool inclusion = true;
qreal radius = param1;
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);
geoFencecircle *c = new geoFencecircle(fenceCount,inclusion,0,internals::PointLatLng(x * 10e-8,y * 10e-8),radius,QColor("#FF8000"),map);
emit createFenceCircle(fenceCount++,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)));
@@ -3025,8 +3079,8 @@ void OPMapWidget::receivedPoint(float param1,float param2,float param3,float par
bool inclusion = false;
qreal radius = param1;
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);
geoFencecircle *c = new geoFencecircle(fenceCount,inclusion,0,internals::PointLatLng(x * 10e-8,y * 10e-8),radius,QColor("#FF8000"),map);
emit createFenceCircle(fenceCount++,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)));
@@ -3190,13 +3244,29 @@ void OPMapWidget::AltitudeChanged(int seq,double value)
void OPMapWidget::setCurrentPoint(int value)
{
//qDebug() << "current point" << value;
if(altitudeitem)
{
altitudeitem->setCurrentPoint(value);
}
}
void OPMapWidget::getCurrentPoint(int group)
{
foreach(QGraphicsItem * i, map->childItems()) {
WayPointItem *w = qgraphicsitem_cast<WayPointItem *>(i);
if (w)
{
if(w->MissionType() == group)
{
if(w->isSelected())
{
w->emitWPProperty();
}
}
}
}
}
void OPMapWidget::updateMessage(void)
+4 -3
View File
@@ -397,7 +397,6 @@ public:
WayPointSetting *waypointsetting;
MeasureLine *measureline = nullptr;
int currentGroup = 3;//编辑情况
@@ -457,6 +456,7 @@ public:
void setUAVPos(int sysid,int compid,double x,double y,double z);
void setUAVHeading(int sysid,int compid,float Heading);
void setUAVSpeed(int sysid,int compid,qreal Ma,qreal Speed);
void DeleteTrail(void);
@@ -664,7 +664,7 @@ signals:
uint16_t compid,
uint16_t currentGroup);
void currentPointSeleted(int group,int point);
public slots:
@@ -681,6 +681,7 @@ public slots:
void getMapTypes(void);
void setMapTypes(QVariant value);
@@ -759,7 +760,7 @@ public slots:
void addPolygon();
void delFence(int group);
void getCurrentPoint(int group);
};
}
-1
View File
@@ -14,7 +14,6 @@ RuleDialog::RuleDialog(QWidget *parent) :
RuleDialog::~RuleDialog()
{
emit isWindowClose(ID);
delete ui;
}
+2 -5
View File
@@ -13,11 +13,11 @@ class RuleDialog;
#ifdef QtopmapWidget
#include <mapwidgetglobal.h>
class OPMAPWIDGETSHARED_EXPORT RuleDialog : public QDialog
class OPMAPWIDGETSHARED_EXPORT RuleDialog : public QDialog {
#else
class RuleDialog : public QDialog
#endif
{
#endif
Q_OBJECT
public:
@@ -26,9 +26,6 @@ public:
explicit RuleDialog(QWidget *parent = 0);
~RuleDialog();
signals:
void isWindowClose(char);
void GetPoint(quint8);
+53 -1
View File
@@ -127,6 +127,12 @@ void UAVItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, Q
painter->restore();
painter->save();
// Rotate the text back to vertical
@@ -148,6 +154,49 @@ void UAVItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, Q
painter->restore();
if(isShowTip)
{
painter->save();
qreal rot = this->rotation();
painter->rotate(-1 * rot);
QRectF rect = QRectF(-50,-80,100,50);
//画一块底色#58ACFA
painter->setBrush(QColor("#BEF781"));
//painter->setBrush(Qt::NoBrush);
painter->setOpacity(TipOpacity);
pen.setColor(QColor("#58ACFA"));
pen.setWidth(2);
painter->setPen(pen);
painter->drawRoundedRect(rect,5,5);
//画字
QFont font;
font.setWeight(QFont::ExtraLight);
font.setFamily("Arial");//非衬线
font.setPixelSize(12);
painter->setFont(font);
pen.setColor(QColor("#000000"));
painter->setPen(pen);
QString _h;
QString _v;
_v = tr("Speed: %1m/s\nMa:%2").arg(QString::number(Vc,'f',0)).arg(QString::number(Ma,'f',2));
_h.append(tr("Height: %1m\n%2").arg(QString::number(altitude,'f',0)).arg(_v));
painter->drawText(QRectF(rect.x() + 2,rect.y()+2,rect.width() - 4,rect.height() - 4),Qt::AlignLeft | Qt::AlignVCenter,_h);
painter->restore();
}
}
@@ -185,6 +234,9 @@ void UAVItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
}
qDebug() << "emit select" << sysid << compid;
emit selected(sysid,compid);
isShowTip = (isShowTip)?(false):(true);
update();
}
@@ -288,7 +340,7 @@ QRectF UAVItem::boundingRect() const
return QRectF(-boundingRectSize, -boundingRectSize, 2 * boundingRectSize, 2 * boundingRectSize);
}
} else {
return QRectF(-pic.width() / 2, -pic.height() / 2, pic.width(), pic.height());
return QRectF(-pic.width() * 2, -pic.height() * 2, pic.width() * 4, pic.height() * 4);
}
}
+21
View File
@@ -239,6 +239,13 @@ private:
bool isEdit = false;
qreal TipOpacity = 1;
bool isShowTip = false;
qreal Ma = 0;
qreal Vc = 0;
protected:
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
void mousePressEvent(QGraphicsSceneMouseEvent *event);
@@ -254,6 +261,20 @@ public slots:
void RefreshPos();
void setOpacitySlot(qreal opacity);
void zoomChangedSlot();
void setMa(qreal value)
{
Ma = value;
update();
}
void setSpeed(qreal value)
{
Vc = value;
update();
}
signals:
void selected(int sys,int comp);
+2
View File
@@ -492,6 +492,7 @@ void WayPointItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
ElevationTrig();
//发送航点的属性
emit WPProperty(property.param1,property.param2,property.param3,property.param4,
property.x,property.y,property.z,
property.seq,
@@ -504,6 +505,7 @@ void WayPointItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
property.autocontinue,
property.mission_type);
emit setCurrentPoint(this->Number());
}
else//这时候是在飞行界面