This commit is contained in:
hm
2020-05-06 08:17:24 +08:00
parent 0cb30d668b
commit e1d0e2cb16
19 changed files with 3056 additions and 2937 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
#include "MenuBarUI.h"
#include "MenuBarUI.h"
#include "ui_MenuBarUI.h"
MenuBarUI::MenuBarUI(QWidget *parent) :
+1 -1
View File
@@ -1,4 +1,4 @@
#ifndef MENUBARUI_H
#ifndef MENUBARUI_H
#define MENUBARUI_H
#include <QWidget>
+104 -66
View File
@@ -9,78 +9,116 @@
<rect>
<x>0</x>
<y>0</y>
<width>605</width>
<width>720</width>
<height>100</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QPushButton" name="pushButton_Setting">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>80</width>
<height>80</height>
</rect>
</property>
<property name="text">
<string>Setting</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_SelfTest">
<property name="geometry">
<rect>
<x>100</x>
<y>10</y>
<width>80</width>
<height>80</height>
</rect>
</property>
<property name="text">
<string>SelfTest</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_Mission">
<property name="geometry">
<rect>
<x>190</x>
<y>10</y>
<width>80</width>
<height>80</height>
</rect>
</property>
<property name="text">
<string>Mission</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_Flight">
<property name="geometry">
<rect>
<x>280</x>
<y>10</y>
<width>80</width>
<height>80</height>
</rect>
</property>
<property name="text">
<string>Flight</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_Info">
<property name="geometry">
<rect>
<x>370</x>
<y>10</y>
<width>80</width>
<height>80</height>
</rect>
</property>
<property name="text">
<string>Info</string>
</property>
</widget>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="2">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>24</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QPushButton" name="pushButton_Setting">
<property name="minimumSize">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
<property name="text">
<string>Setting</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pushButton_SelfTest">
<property name="minimumSize">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
<property name="text">
<string>SelfTest</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButton_Mission">
<property name="minimumSize">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
<property name="text">
<string>Mission</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="pushButton_Flight">
<property name="minimumSize">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
<property name="text">
<string>Flight</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="pushButton_Info">
<property name="minimumSize">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
<property name="text">
<string>Info</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
+1 -1
View File
@@ -1,4 +1,4 @@
/****************************************************************************
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
+1 -1
View File
@@ -1,4 +1,4 @@
/****************************************************************************
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
+1 -1
View File
@@ -1,4 +1,4 @@
#include "propertyui.h"
#include "propertyui.h"
#include "ui_propertyui.h"
#include <iterator>
#include <QMetaObject>
+1 -1
View File
@@ -1,4 +1,4 @@
#ifndef PROPERTYUI_H
#ifndef PROPERTYUI_H
#define PROPERTYUI_H
#include <QWidget>
+5 -2
View File
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>356</width>
<height>410</height>
<width>340</width>
<height>448</height>
</rect>
</property>
<property name="windowTitle">
@@ -258,6 +258,9 @@
<property name="text">
<string>Seq</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
+25 -4
View File
@@ -123,7 +123,10 @@ MainWindow::MainWindow(QWidget *parent)
missionUI = new propertyui(this);
missionUI->hide();
//missionUI->setGeometry(this->width() - copk->width(),copk->height(),300,340);
commandUI = new CommandUI(this);
@@ -363,8 +366,16 @@ void MainWindow::onTabIndexChanged(const int &index)//界面选择管理
if(index == 2) missionUI->show();
else missionUI->hide();
if(index == 2)
{
missionUI->show();
map->setWPLock(false);
}
else
{
missionUI->hide();
map->setWPLock(true);
}
if((index == 2)||(index == 3)) map->show();
@@ -443,9 +454,19 @@ void MainWindow::updateUI()//事件驱动式更新数据
dlink->mavlinknode->vehicle.attitude.roll * 57.3,
dlink->mavlinknode->vehicle.attitude.yaw * 57.3);
copk->setAltitude(dlink->mavlinknode->vehicle.gps_raw_int.alt * 10e-3 );
copk->setAltitude(dlink->mavlinknode->vehicle.gps_raw_int.alt * 10e-4 );
copk->setAirSpeed(dlink->mavlinknode->vehicle.airspeed_autocal.vx);
internals::PointLatLng LatLng;
LatLng.SetLat((double)(dlink->mavlinknode->vehicle.gps_raw_int.lat * 10e-8));
LatLng.SetLng((double)(dlink->mavlinknode->vehicle.gps_raw_int.lon * 10e-8));
map->UAV->SetUAVPos(LatLng,dlink->mavlinknode->vehicle.gps_raw_int.alt * 10e-4);
//qDebug() << LatLng.Lat()
// << LatLng.Lng();
update();
}
+2
View File
@@ -390,6 +390,8 @@ void MavLinkNode::StatusParse(mavlink_message_t msg)
}break;
case MAVLINK_MSG_ID_GPS_RAW_INT: {
mavlink_msg_gps_raw_int_decode(&msg,&vehicle.gps_raw_int);
//qDebug() << vehicle.gps_raw_int.lon
// << vehicle.gps_raw_int.lat;
}break;
case MAVLINK_MSG_ID_GLOBAL_POSITION_INT: {
mavlink_msg_global_position_int_decode(&msg,&vehicle.global_position_int);
+1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,4 +1,4 @@
/**
/**
******************************************************************************
*
* @file homeitem.cpp
+9 -11
View File
@@ -4,9 +4,9 @@ QT += opengl
QT += network
QT += sql
QT += svg
QT += quickwidgets
QT += quick
QT += qml
#QT += quickwidgets
#QT += quick
#QT += qml
#CONFIG+=qtquickcompiler
@@ -21,6 +21,7 @@ DEFINES += QtopmapWidget
#VS的补丁 使用 自定义的数学常数
DEFINES += _USE_MATH_DEFINES
#目标生成路径
DESTDIR = $$PWD/../../thirdpart/lib
@@ -44,10 +45,6 @@ SOURCES += $$PWD/mapgraphicitem.cpp \
$$PWD/waypointline.cpp \
$$PWD/waypointcircle.cpp \
HEADERS += $$PWD/mapgraphicitem.h \
$$PWD/opmapwidget.h \
$$PWD/configuration.h \
@@ -109,10 +106,11 @@ win32|win64 {
system(xcopy $$qml_src_dir $$qml_dst_dir /y /s)
}
DISTFILES += \
Triangle.qml \
test.qml \
waypointui.qml
#DISTFILES += \
# Triangle.qml \
# test.qml \
# waypointui.qml
+14 -21
View File
@@ -1,4 +1,4 @@
/**
/**
******************************************************************************
*
* @file opmapwidget.cpp
@@ -298,27 +298,20 @@ void OPMapWidget::mouseDoubleClickEvent(QMouseEvent *event)
{
QGraphicsView::mouseDoubleClickEvent(event);
QPointF p = event->pos();
p = map->mapFromParent(p);
internals::PointLatLng LatLng;
LatLng = map->FromLocalToLatLng(p.x(), p.y());
//生成一个列表
WayPointItem *Item = WPCreate(LatLng,0);
WPLineCreate(WPFind(Item->Number() - 1),Item,Qt::green,false,2);
qDebug() << "OPMapWidget" << Item->Number() <<QString::number(LatLng.Lat(),'f',8) << QString::number(LatLng.Lng(),'f',8);
if(isWPLock == false)
{
if(event->button() == Qt::LeftButton)
{
QPointF p = event->pos();
p = map->mapFromParent(p);
internals::PointLatLng LatLng;
LatLng = map->FromLocalToLatLng(p.x(), p.y());
WayPointItem *Item = WPCreate(LatLng,0);
WPLineCreate(WPFind(Item->Number() - 1),Item,Qt::green,false,2);
qDebug() << "OPMapWidget" << Item->Number() <<QString::number(LatLng.Lat(),'f',8) << QString::number(LatLng.Lng(),'f',8);
}
}
emit MouseDoubleClickEvent(event);
}
+13
View File
@@ -422,11 +422,21 @@ public:
void setSelectedWP(QList<WayPointItem *> list);
bool WPLock() const
{
return isWPLock;
}
void setWPLock(bool const & lock)
{
isWPLock = lock;
}
//propertyui *p_ui = nullptr;
private:
internals::Core *core;
MapGraphicItem *map;
@@ -445,6 +455,9 @@ private:
QGraphicsTextItem *diagGraphItem;
bool showDiag;
qreal overlayOpacity;
bool isWPLock;
private slots:
void diagRefresh();
// WayPointItem* item;//apagar
+1 -1
View File
@@ -1,4 +1,4 @@
/**
/**
******************************************************************************
*
* @file uavitem.cpp
+69 -22
View File
@@ -1,4 +1,4 @@
/**
/**
******************************************************************************
*
* @file waypointitem.cpp
@@ -62,6 +62,9 @@ WayPointItem::WayPointItem(const internals::PointLatLng &coord, int const & alti
emit manualCoordChange(this);
connect(map, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos()));
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
this->setZValue(3);
}
WayPointItem::WayPointItem(MapGraphicItem *map, bool magicwaypoint) : reached(false), description(""), shownumber(true), isDragging(false), altitude(0), map(map)
@@ -106,6 +109,8 @@ WayPointItem::WayPointItem(MapGraphicItem *map, bool magicwaypoint) : reached(fa
emit manualCoordChange(this);
connect(map, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos()));
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
this->setZValue(3);
}
WayPointItem::WayPointItem(const internals::PointLatLng &coord, int const & altitude, const QString &description, MapGraphicItem *map, wptype type) : coord(coord), reached(false), description(description), shownumber(true), isDragging(false), altitude(altitude), map(map), myType(type)
{
@@ -140,6 +145,8 @@ WayPointItem::WayPointItem(const internals::PointLatLng &coord, int const & alti
emit manualCoordChange(this);
connect(map, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos()));
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
this->setZValue(3);
}
WayPointItem::WayPointItem(const distBearingAltitude &relativeCoordenate, const QString &description, MapGraphicItem *map) : relativeCoord(relativeCoordenate), reached(false), description(description), shownumber(true), isDragging(false), map(map)
@@ -175,6 +182,8 @@ WayPointItem::WayPointItem(const distBearingAltitude &relativeCoordenate, const
emit manualCoordChange(this);
connect(map, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos()));
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
this->setZValue(3);
}
void WayPointItem::setWPType(wptype type)
@@ -188,24 +197,59 @@ void WayPointItem::setWPType(wptype type)
QRectF WayPointItem::boundingRect() const //鼠标可以操作的大小
{
return QRectF(-10,-10,20,20);
}
void WayPointItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
Q_UNUSED(option);
Q_UNUSED(widget);
painter->setPen(Qt::green);
painter->drawRect(-6,-6,12,12);
painter->drawLine(-6,-6,6,6);
painter->drawLine(-6,6,6,-6);
if(isSimple == true)//简单显示
{
painter->setPen(Qt::green);
painter->drawRect(-6,-6,12,12);
painter->drawLine(-6,-6,6,6);
painter->drawLine(-6,6,6,-6);
if (this->isSelected()) {
painter->setPen(Qt::red);
painter->drawRect(QRectF(boundingRect()));
if (this->isSelected()) {
painter->setPen(Qt::red);
painter->drawRect(QRectF(boundingRect()));
}
}
else
{
QPen ePen;
ePen.setWidth(1);
if (this->isSelected()) {
ePen.setColor(QColor("#008B00"));
painter->setBrush(QColor("#008B00"));
}
else {
ePen.setColor(QColor("#8B4500"));
painter->setBrush(QColor("#8B4500"));
}
painter->setPen(ePen);
painter->drawEllipse(boundingRect());
ePen.setColor(QColor("#FFFFFF"));
painter->setPen(ePen);
QFont font;
font.setWeight(QFont::ExtraLight);
font.setFamily("Arial");//非衬线
font.setPixelSize(14);
painter->setFont(font);
painter->drawText(boundingRect(),Qt::AlignCenter,QString::number(number));
}
}
void WayPointItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
@@ -351,23 +395,26 @@ void WayPointItem::SetReached(const bool &value)
}
void WayPointItem::SetShowNumber(const bool &value)
{
shownumber = value;
if ((numberI == 0) && value) {
numberI = new QGraphicsSimpleTextItem(this);
if(isSimple == true)//简单显示
{
shownumber = value;
if ((numberI == 0) && value) {
numberI = new QGraphicsSimpleTextItem(this);
QFont font;
font.setWeight(QFont::ExtraLight);
font.setFamily("Arial");//非衬线
font.setPixelSize(12);
numberI->setFont(font);
numberI->setZValue(3);
QFont font;
font.setWeight(QFont::ExtraLight);
font.setFamily("Arial");//非衬线
font.setPixelSize(12);
numberI->setFont(font);
numberI->setZValue(3);
numberI->setPen(QPen(QColor("#FF00FF")));
numberI->setPos(10, -6);
numberI->setText(QString::number(numberAdjusted()));
} else if (!value && numberI) {
delete numberI;
numberI->setPen(QPen(QColor("#FF00FF")));
numberI->setPos(10, -6);
numberI->setText(QString::number(numberAdjusted()));
} else if (!value && numberI) {
delete numberI;
}
}
this->update();
}
+1
View File
@@ -265,6 +265,7 @@ private:
_property property;
bool isSimple = false;
bool isEdit = false;
internals::PointLatLng coord; // coordinates of this WayPoint
+3 -1
View File
@@ -1,4 +1,4 @@
/**
/**
******************************************************************************
*
* @file waypointline.cpp
@@ -91,6 +91,7 @@ void WayPointLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
angle = (M_PI * 2) - angle;
}
/*
QPointF arrowP1 = line().pointAt(0.5) + QPointF(sin(angle + M_PI / 3) * arrowSize,
cos(angle + M_PI / 3) * arrowSize);
QPointF arrowP2 = line().pointAt(0.5) + QPointF(sin(angle + M_PI - M_PI / 3) * arrowSize,
@@ -98,6 +99,7 @@ void WayPointLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
arrowHead.clear();
arrowHead << line().pointAt(0.5) << arrowP1 << arrowP2;
painter->drawPolygon(arrowHead);
*/
if (dashed) {
QVector<qreal> dashes;