增加定点导航
This commit is contained in:
+20
-1
@@ -1,4 +1,4 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "QPushButton"
|
#include "QPushButton"
|
||||||
#include "QAction"
|
#include "QAction"
|
||||||
|
|
||||||
@@ -191,6 +191,16 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
map->SetZoom(4);
|
map->SetZoom(4);
|
||||||
|
|
||||||
map->SetCurrentPosition(internals::PointLatLng(33,106));
|
map->SetCurrentPosition(internals::PointLatLng(33,106));
|
||||||
|
// connect(map,SIGNAL(cmd_long( float param1,float param2,float param3,float param4,float param5,float param6,float param7,uint16_t command,uint8_t confirmation) ),
|
||||||
|
// commandUI, SLOT(cmd_long( float param1,float param2,float param3,float param4,float param5,float param6,float param7,uint16_t command,uint8_t confirmation) ) );
|
||||||
|
|
||||||
|
// connect(map, SIGNAL(cmd_long( float param1,float param2,float param3,float param4,float param5,float param6,float param7,uint16_t command,uint8_t confirmation) ),
|
||||||
|
// this, SLOT(cmd_longSlot(float param1,float param2,float param3,float param4,float param5,float param6,float param7,uint16_t command,uint8_t confirmation)) );
|
||||||
|
|
||||||
|
connect(map, SIGNAL(cmd_long( float ,float ,float ,float ,float ,float ,float ,uint16_t ,uint8_t )),
|
||||||
|
commandUI, SIGNAL(cmd_long( float ,float ,float ,float ,float ,float ,float ,uint16_t ,uint8_t )) );
|
||||||
|
connect(map, SIGNAL(cmd_long( float ,float ,float ,float ,float ,float ,float ,uint16_t ,uint8_t )),
|
||||||
|
this, SLOT(cmd_longSlot( float ,float ,float ,float ,float ,float ,float ,uint16_t ,uint8_t )) );
|
||||||
qDebug() << "map start";
|
qDebug() << "map start";
|
||||||
|
|
||||||
|
|
||||||
@@ -982,6 +992,8 @@ void MainWindow::onTabIndexChanged(const int &index)//界面选择管理
|
|||||||
|
|
||||||
if(index == 5)
|
if(index == 5)
|
||||||
{
|
{
|
||||||
|
map->setCircleCreate(true);
|
||||||
|
map->setCircleEdit(true);
|
||||||
if(statusui->isHidden())
|
if(statusui->isHidden())
|
||||||
{
|
{
|
||||||
copk->show();
|
copk->show();
|
||||||
@@ -1003,6 +1015,8 @@ void MainWindow::onTabIndexChanged(const int &index)//界面选择管理
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
map->setCircleEdit(false);
|
||||||
|
map->setCircleCreate(false);
|
||||||
statusui->hide();
|
statusui->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1010,6 +1024,11 @@ void MainWindow::onTabIndexChanged(const int &index)//界面选择管理
|
|||||||
resizeEvent(nullptr);
|
resizeEvent(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::cmd_longSlot(float param1, float param2, float param3, float param4, float param5, float param6, float param7, uint16_t command, uint8_t confirmation)
|
||||||
|
{
|
||||||
|
qDebug() << "MainWindow: 半径" << param3 << " 纬度:" << param5 << " 经度:" << param6;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::showMessage(const QString &message, int TimeOut)
|
void MainWindow::showMessage(const QString &message, int TimeOut)
|
||||||
|
|||||||
+2
-1
@@ -1,4 +1,4 @@
|
|||||||
#ifndef MAINWINDOW_H
|
#ifndef MAINWINDOW_H
|
||||||
#define MAINWINDOW_H
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
@@ -94,6 +94,7 @@ protected slots:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onTabIndexChanged(const int &index);
|
void onTabIndexChanged(const int &index);
|
||||||
|
void cmd_longSlot(float param1,float param2,float param3,float param4,float param5,float param6,float param7,uint16_t command,uint8_t confirmation);
|
||||||
|
|
||||||
|
|
||||||
void updateUI();
|
void updateUI();
|
||||||
|
|||||||
+2
-1
@@ -1,10 +1,11 @@
|
|||||||
#include "Cockpit.h"
|
#include "Cockpit.h"
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QtCore/qmath.h>
|
#include <QtCore/qmath.h>
|
||||||
#include "QThread"
|
#include "QThread"
|
||||||
#include "QDebug"
|
#include "QDebug"
|
||||||
#include "QPicture"
|
#include "QPicture"
|
||||||
#include "QtMath"
|
#include "QtMath"
|
||||||
|
#include <QPainterPath>
|
||||||
|
|
||||||
|
|
||||||
Cockpit::Cockpit(QWidget *parent): QWidget(parent)
|
Cockpit::Cockpit(QWidget *parent): QWidget(parent)
|
||||||
|
|||||||
@@ -0,0 +1,166 @@
|
|||||||
|
#include "circlepointitem.h"
|
||||||
|
#include "math.h"
|
||||||
|
#include "qgraphicssceneevent.h"
|
||||||
|
#include "qgraphicsview.h"
|
||||||
|
|
||||||
|
#define _USE_MATH_DEFINES
|
||||||
|
|
||||||
|
CirclePointItem::CirclePointItem(mapcontrol::MapGraphicItem *map, QPointF const &p) :
|
||||||
|
QGraphicsEllipseItem(map)
|
||||||
|
{
|
||||||
|
this->setAcceptHoverEvents(true);
|
||||||
|
_parentMap = map;
|
||||||
|
setPos(p);
|
||||||
|
|
||||||
|
//参数框
|
||||||
|
paramItem = new WayPointParamDialog;
|
||||||
|
QPointF screenPos = this->screenPos(pos() );
|
||||||
|
paramItem->move(screenPos.x() + 10, screenPos.y() );
|
||||||
|
|
||||||
|
//外圆
|
||||||
|
outside = new QGraphicsEllipseItem(-25, -25, 50, 50, this);
|
||||||
|
QPen pen(QColor(255, 128, 0) );
|
||||||
|
pen.setWidth(2);
|
||||||
|
outside->setPen(pen);
|
||||||
|
|
||||||
|
setBrush(QColor(25, 251, 255) );
|
||||||
|
QPen pen1 = this->pen();
|
||||||
|
pen1.setColor(QColor(25, 251, 255) );
|
||||||
|
setPen(pen1);
|
||||||
|
setRect(-10, -10, 20, 20);
|
||||||
|
|
||||||
|
// setAcceptDrops(true);
|
||||||
|
// setEnabled(true);
|
||||||
|
// this->setFlag(QGraphicsItem::ItemIgnoresTransformations, true);
|
||||||
|
// this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||||
|
// this->setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||||
|
|
||||||
|
connect(paramItem, &WayPointParamDialog::ok, this, &CirclePointItem::acceptedSlot, Qt::DirectConnection );
|
||||||
|
connect(paramItem, SIGNAL(ok() ), this, SIGNAL(accepted() ), Qt::DirectConnection );
|
||||||
|
connect(paramItem, SIGNAL(cancel() ), this, SIGNAL(rejected() ), Qt::DirectConnection );
|
||||||
|
connect(paramItem, &WayPointParamDialog::remove,
|
||||||
|
this, [this](){ this->isRemove = true;}, Qt::DirectConnection );
|
||||||
|
|
||||||
|
connect(map, &mapcontrol::MapGraphicItem::childRefreshPosition, this, &CirclePointItem::refreshPos);
|
||||||
|
connect(map, &mapcontrol::MapGraphicItem::childRefreshPosition, this, &CirclePointItem::refreshOutSideEllipse);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CirclePointItem::~CirclePointItem()
|
||||||
|
{
|
||||||
|
delete paramItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CirclePointItem::autoParamDialogExex() const
|
||||||
|
{
|
||||||
|
// QScreen *screen = qApp->primaryScreen();
|
||||||
|
QScreen *screen = paramItem->screen();
|
||||||
|
QPointF wayScreenPos(screenPos(mapToParent(QPointF(0, 0) ) ) );
|
||||||
|
QPoint showPos(wayScreenPos.x(), wayScreenPos.y() );
|
||||||
|
|
||||||
|
if( ((int)showPos.y() + this->paramItem->size().height() ) > screen->size().height() )
|
||||||
|
{
|
||||||
|
showPos.setY(showPos.y() - paramItem->size().height() - 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
paramItem->move(showPos);
|
||||||
|
paramItem->exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
QPointF CirclePointItem::screenPos(QPointF const &pos) const
|
||||||
|
{
|
||||||
|
QGraphicsItem *map = parentItem(); //获取map
|
||||||
|
QPointF scenePos = map->mapToScene(pos ); //获取pos在scene中的位置
|
||||||
|
QList<QGraphicsView *> views = map->scene()->views();
|
||||||
|
QPointF viewPos = views[0]->mapFromScene(scenePos); //获取航点在view中的位置
|
||||||
|
|
||||||
|
return views[0]->mapToGlobal(QPoint(viewPos.x(), viewPos.y() ) ); //返回pos在屏幕中的位置
|
||||||
|
}
|
||||||
|
|
||||||
|
int CirclePointItem::radiusPixelLength(double angle) const
|
||||||
|
{
|
||||||
|
double const arc = 6371393;
|
||||||
|
|
||||||
|
//根据角度计算加上距离之后的经纬度
|
||||||
|
internals::PointLatLng temp = latLng;
|
||||||
|
double a = outsideRadius * qSin(angle) / (arc * qCos(latLng.Lat() ) * 2 * M_PI / 360);
|
||||||
|
double b = outsideRadius * qCos(angle) / (arc * 2 * M_PI / 360);
|
||||||
|
temp.SetLng(temp.Lng() + a);
|
||||||
|
temp.SetLat(temp.Lat() + b);
|
||||||
|
|
||||||
|
//把经纬度转换成map中的坐标系
|
||||||
|
QPointF origin(_parentMap->FromLatLngToLocal(latLng).X(), _parentMap->FromLatLngToLocal(latLng).Y() );
|
||||||
|
QPointF end(_parentMap->FromLatLngToLocal(temp).X(), _parentMap->FromLatLngToLocal(temp).Y() );
|
||||||
|
|
||||||
|
// //把map坐标系转换成屏幕坐标系
|
||||||
|
// origin = screenPos(origin); //错误,当外圆半径太大时,无法计算
|
||||||
|
// end = screenPos(end);
|
||||||
|
|
||||||
|
QLineF line(origin, end);
|
||||||
|
|
||||||
|
return line.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CirclePointItem::refreshOutSideEllipse()
|
||||||
|
{
|
||||||
|
int rad = radiusPixelLength(0); //获取外圆的像素半径
|
||||||
|
outside->setRect(-rad, -rad, rad * 2, rad * 2); //重新调整大小
|
||||||
|
outside->update(); //重新绘制圆
|
||||||
|
}
|
||||||
|
|
||||||
|
void CirclePointItem::setCircleEdit(bool v)
|
||||||
|
{
|
||||||
|
this->isCircleEdit = v;
|
||||||
|
// this->setFlag(QGraphicsItem::ItemIsSelectable, v);
|
||||||
|
// setFlag(QGraphicsItem::ItemIsMovable, v);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CirclePointItem::setLngLat(double lng, double lat)
|
||||||
|
{
|
||||||
|
this->latLng.SetLat(lat);
|
||||||
|
this->latLng.SetLng(lng);
|
||||||
|
|
||||||
|
paramItem->setlngLat(lng, lat);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CirclePointItem::acceptedSlot()
|
||||||
|
{
|
||||||
|
qDebug() << u8"circlePointItem: acceptedSlot";
|
||||||
|
|
||||||
|
height = paramItem->height; //获取高度
|
||||||
|
outsideRadius = paramItem->outsideRadius * 1000; //获取外圆半径
|
||||||
|
direction = paramItem->direction; //获取方向
|
||||||
|
//获取经纬度
|
||||||
|
latLng.SetLat(paramItem->latitude);
|
||||||
|
latLng.SetLng(paramItem->longitude);
|
||||||
|
QPointF mapPos(_parentMap->FromLatLngToLocal(latLng).X(), _parentMap->FromLatLngToLocal(latLng).Y() ); //把经纬度转换成在map中的位置
|
||||||
|
setPos(mapPos);
|
||||||
|
|
||||||
|
refreshOutSideEllipse();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CirclePointItem::refreshPos()
|
||||||
|
{
|
||||||
|
core::Point point = _parentMap->FromLatLngToLocal(this->latLng);
|
||||||
|
setPos(point.X(), point.Y() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void CirclePointItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||||
|
{
|
||||||
|
if(isCircleEdit)
|
||||||
|
{
|
||||||
|
autoParamDialogExex();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CirclePointItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
{
|
||||||
|
QGraphicsEllipseItem::paint(painter, option, widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
#ifndef CIRCLEPOINTITEM_H
|
||||||
|
#define CIRCLEPOINTITEM_H
|
||||||
|
|
||||||
|
#include "mapgraphicitem.h"
|
||||||
|
#include "waypointparamdialog.h"
|
||||||
|
#include <QGraphicsEllipseItem>
|
||||||
|
#include <QObject>
|
||||||
|
#include "qapplication.h"
|
||||||
|
#include <QScreen>
|
||||||
|
|
||||||
|
class CirclePointItem : public QObject, public QGraphicsEllipseItem
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
enum { Type = UserType + 13 };
|
||||||
|
|
||||||
|
CirclePointItem(mapcontrol::MapGraphicItem *map, QPointF const &p);
|
||||||
|
~CirclePointItem();
|
||||||
|
|
||||||
|
virtual int type() const override
|
||||||
|
{
|
||||||
|
return Type;
|
||||||
|
}
|
||||||
|
|
||||||
|
void autoParamDialogExex() const; //根据航点所在位置显示对话框
|
||||||
|
|
||||||
|
bool paramDialogExec() const //以模态的方式显示参数对话框
|
||||||
|
{
|
||||||
|
autoParamDialogExex();
|
||||||
|
|
||||||
|
return paramItem->isOk;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPointF screenPos(QPointF const &pos) const; //返回pos在屏幕中的位置,pos只能是map(地图图形项)中的局部坐标
|
||||||
|
int radiusPixelLength(double angle) const; //计算外圆在地图上的像素半径
|
||||||
|
void setCircleEdit(bool v);
|
||||||
|
void setLngLat(double lng, double lat); //设置经纬度
|
||||||
|
bool getIsRemove() const
|
||||||
|
{
|
||||||
|
return isRemove;
|
||||||
|
}
|
||||||
|
|
||||||
|
double getHeight() const
|
||||||
|
{
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
internals::PointLatLng getLatLng() const
|
||||||
|
{
|
||||||
|
return latLng;
|
||||||
|
}
|
||||||
|
|
||||||
|
double getRadius() const
|
||||||
|
{
|
||||||
|
return outsideRadius * direction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void acceptedSlot();
|
||||||
|
void refreshPos();
|
||||||
|
void refreshOutSideEllipse(); //刷新外圆
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void accepted();
|
||||||
|
void rejected();
|
||||||
|
void remove();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override; //在航点上右击显示参数对话框
|
||||||
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = Q_NULLPTR) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool isRemove = false;
|
||||||
|
bool isCircleEdit = true;
|
||||||
|
double height; //高度
|
||||||
|
double outsideRadius;//外圈半径,单位:米
|
||||||
|
int direction; //方向,-1左盘旋,1右盘旋
|
||||||
|
internals::PointLatLng latLng; //经纬度
|
||||||
|
mapcontrol::MapGraphicItem *_parentMap; //行单所在的地图
|
||||||
|
QGraphicsEllipseItem *outside; //外圆
|
||||||
|
WayPointParamDialog *paramItem; //航点参数框
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CIRCLEPOINTITEM_H
|
||||||
@@ -200,6 +200,10 @@ void MapGraphicItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
selectionEnd = internals::PointLatLng::Empty;
|
selectionEnd = internals::PointLatLng::Empty;
|
||||||
selectionStart = FromLocalToLatLng(event->pos().x(), event->pos().y());
|
selectionStart = FromLocalToLatLng(event->pos().x(), event->pos().y());
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// QGraphicsItem::mousePressEvent(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void MapGraphicItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
void MapGraphicItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
@@ -297,6 +301,7 @@ void MapGraphicItem::wheelEvent(QGraphicsSceneWheelEvent *event)
|
|||||||
|
|
||||||
core->MouseWheelZooming = false;
|
core->MouseWheelZooming = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
void MapGraphicItem::DrawMap2D(QPainter *painter)
|
void MapGraphicItem::DrawMap2D(QPainter *painter)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,10 +51,14 @@ SOURCES += $$PWD/mapgraphicitem.cpp \
|
|||||||
$$PWD/AltitudeItem.cpp \
|
$$PWD/AltitudeItem.cpp \
|
||||||
$$PWD/waypointbutton.cpp \
|
$$PWD/waypointbutton.cpp \
|
||||||
$$PWD/waypointsetting.cpp \
|
$$PWD/waypointsetting.cpp \
|
||||||
|
circlepointitem.cpp \
|
||||||
geoFencecircle.cpp \
|
geoFencecircle.cpp \
|
||||||
geoFenceitem.cpp \
|
geoFenceitem.cpp \
|
||||||
geoFenceitemline.cpp \
|
geoFenceitemline.cpp \
|
||||||
measureline.cpp
|
measureline.cpp \
|
||||||
|
waypointparamdialog.cpp \
|
||||||
|
waypointparamitem.cpp \
|
||||||
|
waypointparammenu.cpp
|
||||||
|
|
||||||
HEADERS += $$PWD/mapgraphicitem.h \
|
HEADERS += $$PWD/mapgraphicitem.h \
|
||||||
$$PWD/opmapwidget.h \
|
$$PWD/opmapwidget.h \
|
||||||
@@ -75,15 +79,21 @@ HEADERS += $$PWD/mapgraphicitem.h \
|
|||||||
$$PWD/AltitudeItem.h \
|
$$PWD/AltitudeItem.h \
|
||||||
$$PWD/waypointbutton.h \
|
$$PWD/waypointbutton.h \
|
||||||
$$PWD/waypointsetting.h \
|
$$PWD/waypointsetting.h \
|
||||||
|
circlepointitem.h \
|
||||||
geoFencecircle.h \
|
geoFencecircle.h \
|
||||||
geoFenceitem.h \
|
geoFenceitem.h \
|
||||||
geoFenceitemline.h \
|
geoFenceitemline.h \
|
||||||
measureline.h
|
measureline.h \
|
||||||
|
waypointparamdialog.h \
|
||||||
|
waypointparamitem.h \
|
||||||
|
waypointparammenu.h
|
||||||
|
|
||||||
RESOURCES += mapresources.qrc
|
RESOURCES += mapresources.qrc
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
$$PWD/mapripform.ui
|
$$PWD/mapripform.ui \
|
||||||
|
waypointparamdialog.ui \
|
||||||
|
waypointparammenu.ui
|
||||||
|
|
||||||
INCLUDEPATH += $$DESTDIR/include
|
INCLUDEPATH += $$DESTDIR/include
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*
|
*
|
||||||
* @file opmapwidget.cpp
|
* @file opmapwidget.cpp
|
||||||
@@ -163,8 +163,8 @@ OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config) : QGraphicsView
|
|||||||
point_begin.SetLat(0);
|
point_begin.SetLat(0);
|
||||||
point_begin.SetLng(0);
|
point_begin.SetLng(0);
|
||||||
|
|
||||||
point_end.SetLat(1);
|
point_end.SetLat(100);
|
||||||
point_end.SetLng(1);
|
point_end.SetLng(100);
|
||||||
|
|
||||||
measureline = new MeasureLine(point_begin, point_end, map, QColor("#FFFF00"));
|
measureline = new MeasureLine(point_begin, point_end, map, QColor("#FFFF00"));
|
||||||
mscene.addItem(measureline);
|
mscene.addItem(measureline);
|
||||||
@@ -634,6 +634,19 @@ OPMapWidget::~OPMapWidget()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OPMapWidget::setCircleEdit(bool v)
|
||||||
|
{
|
||||||
|
foreach(QGraphicsItem *item, map->childItems() )
|
||||||
|
{
|
||||||
|
CirclePointItem *i = qgraphicsitem_cast<CirclePointItem *>(item);
|
||||||
|
if(i)
|
||||||
|
{
|
||||||
|
i->setCircleEdit(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void OPMapWidget::closeEvent(QCloseEvent *event)
|
void OPMapWidget::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
core->OnMapClose();
|
core->OnMapClose();
|
||||||
@@ -872,7 +885,58 @@ void OPMapWidget::mouseDoubleClickEvent(QMouseEvent *event)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(isCircleCreate) //生成盘旋点
|
||||||
|
{
|
||||||
|
if(event->button() == Qt::LeftButton)
|
||||||
|
{
|
||||||
|
QPointF p = event->pos();
|
||||||
|
p = map->mapFromParent(p);
|
||||||
|
|
||||||
|
internals::PointLatLng temp = map->FromLocalToLatLng(p.x(), p.y() );
|
||||||
|
|
||||||
|
// CirclePointItem *item = new CirclePointItem(map, p);
|
||||||
|
CirclePointItem *item = new CirclePointItem(map, p);
|
||||||
|
|
||||||
|
item->setLngLat(temp.Lng(), temp.Lat() );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool isCircleRemove = !item->paramDialogExec();
|
||||||
|
|
||||||
|
if(isCircleRemove)
|
||||||
|
{
|
||||||
|
delete item;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
connect(item, &CirclePointItem::rejected,
|
||||||
|
this, [this]()
|
||||||
|
{
|
||||||
|
QObject *temp = sender();
|
||||||
|
CirclePointItem *item = qobject_cast<CirclePointItem *>(temp);
|
||||||
|
|
||||||
|
item->setParentItem(nullptr);
|
||||||
|
item->setCircleEdit(false);
|
||||||
|
connect(item, nullptr, nullptr, nullptr);
|
||||||
|
item->deleteLater();
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(item, &CirclePointItem::accepted,
|
||||||
|
this, [this, item]()
|
||||||
|
{
|
||||||
|
double radius = item->getRadius();
|
||||||
|
internals::PointLatLng latLng = item->getLatLng();
|
||||||
|
emit cmd_long( 0,0,radius,0, latLng.Lat(), latLng.Lng(),0,0,0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
isLNOP = false;
|
isLNOP = false;
|
||||||
|
|
||||||
@@ -891,18 +955,33 @@ void OPMapWidget::mouseDoubleClickEvent(QMouseEvent *event)
|
|||||||
WayPointItem *Item = WPCreate(LatLng,50);
|
WayPointItem *Item = WPCreate(LatLng,50);
|
||||||
|
|
||||||
|
|
||||||
foreach(QGraphicsItem * i, map->childItems()) {
|
|
||||||
WayPointItem *w = qgraphicsitem_cast<WayPointItem *>(i);
|
|
||||||
|
|
||||||
if (w) {
|
qDebug() << "opmapwidget : isWayPointCreate:" << isWayPointCreate;
|
||||||
if (w->MissionType() == Item->MissionType()) {
|
|
||||||
if(w->Number() == (Item->Number() - 1))
|
|
||||||
|
// if(isWayPointCreate)
|
||||||
|
// {
|
||||||
|
foreach(QGraphicsItem * i, map->childItems())
|
||||||
|
{
|
||||||
|
WayPointItem *w = qgraphicsitem_cast<WayPointItem *>(i);
|
||||||
|
|
||||||
|
if (w)
|
||||||
|
{
|
||||||
|
if (w->MissionType() == Item->MissionType())
|
||||||
{
|
{
|
||||||
WPLineCreate(w,Item,Qt::green,false,2);
|
if(w->Number() == (Item->Number() - 1))
|
||||||
|
{
|
||||||
|
WPLineCreate(w,Item,Qt::green,false,2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// delete Item;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3708,4 +3787,5 @@ void OPMapWidget::WPShowTip(bool flag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*
|
*
|
||||||
* @file opmapwidget.h
|
* @file opmapwidget.h
|
||||||
@@ -52,6 +52,7 @@
|
|||||||
#include "QTextStream"
|
#include "QTextStream"
|
||||||
|
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
|
#include "circlepointitem.h"
|
||||||
|
|
||||||
|
|
||||||
#include "waypointbutton.h"
|
#include "waypointbutton.h"
|
||||||
@@ -98,6 +99,8 @@ class Helper {
|
|||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
static MapType::Types MapTypeFromString(QString const & value)
|
static MapType::Types MapTypeFromString(QString const & value)
|
||||||
{
|
{
|
||||||
return MapType::TypeByStr(value);
|
return MapType::TypeByStr(value);
|
||||||
@@ -234,6 +237,9 @@ public:
|
|||||||
OPMapWidget(QWidget *parent = 0, Configuration *config = new Configuration);
|
OPMapWidget(QWidget *parent = 0, Configuration *config = new Configuration);
|
||||||
~OPMapWidget();
|
~OPMapWidget();
|
||||||
|
|
||||||
|
void setCircleEdit(bool v);
|
||||||
|
|
||||||
|
void refreshAllCirclePoint(); //刷新盘旋点外圆
|
||||||
|
|
||||||
bool ShowTileGridLines() const
|
bool ShowTileGridLines() const
|
||||||
{
|
{
|
||||||
@@ -469,6 +475,16 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool circleCreate() const
|
||||||
|
{
|
||||||
|
return isCircleCreate;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setCircleCreate(bool v)
|
||||||
|
{
|
||||||
|
isCircleCreate = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
internals::Core *core;
|
internals::Core *core;
|
||||||
@@ -489,6 +505,8 @@ private:
|
|||||||
bool showDiag;
|
bool showDiag;
|
||||||
qreal overlayOpacity;
|
qreal overlayOpacity;
|
||||||
|
|
||||||
|
bool isCircleCreate = true; //是否创建盘旋点
|
||||||
|
bool isWayPointCreate = true;
|
||||||
bool isWPCreate;
|
bool isWPCreate;
|
||||||
bool isWPLock;
|
bool isWPLock;
|
||||||
bool isLNOP = false;
|
bool isLNOP = false;
|
||||||
@@ -535,7 +553,7 @@ protected:
|
|||||||
|
|
||||||
// private slots:
|
// private slots:
|
||||||
signals:
|
signals:
|
||||||
|
void cmd_long( float param1,float param2,float param3,float param4,float param5,float param6,float param7,uint16_t command,uint8_t confirmation);
|
||||||
void cancelRequest();
|
void cancelRequest();
|
||||||
void percentageChanged(int const & perc);
|
void percentageChanged(int const & perc);
|
||||||
void numberOfTilesChanged(int const & total, int const & actual);
|
void numberOfTilesChanged(int const & total, int const & actual);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*
|
*
|
||||||
* @file waypointitem.cpp
|
* @file waypointitem.cpp
|
||||||
@@ -32,6 +32,8 @@
|
|||||||
#include "QJsonDocument"
|
#include "QJsonDocument"
|
||||||
#include "QJsonObject"
|
#include "QJsonObject"
|
||||||
#include "QJsonParseError"
|
#include "QJsonParseError"
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QPen>
|
||||||
|
|
||||||
|
|
||||||
namespace mapcontrol {
|
namespace mapcontrol {
|
||||||
@@ -72,6 +74,15 @@ WayPointItem::WayPointItem(const internals::PointLatLng &coord, int const & alti
|
|||||||
connect(map, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos()));
|
connect(map, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos()));
|
||||||
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
|
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
|
||||||
|
|
||||||
|
|
||||||
|
// paramItem = new WayPointParamItem(this);
|
||||||
|
// paramItem->setPos(20, 20);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this->setZValue(4);
|
this->setZValue(4);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -122,6 +133,9 @@ WayPointItem::WayPointItem(int seq,int missiontype, MapGraphicItem *map, bool ma
|
|||||||
connect(map, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos()));
|
connect(map, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos()));
|
||||||
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
|
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
|
||||||
|
|
||||||
|
setParentItem(map);
|
||||||
|
|
||||||
|
|
||||||
this->setZValue(4);
|
this->setZValue(4);
|
||||||
}
|
}
|
||||||
WayPointItem::WayPointItem(const internals::PointLatLng &coord, int const & altitude,int seq, int missiontype, const QString &description, MapGraphicItem *map, wptype type) : coord(coord), reached(false), description(description), shownumber(true), isDragging(false), altitude(altitude), map(map), myType(type)
|
WayPointItem::WayPointItem(const internals::PointLatLng &coord, int const & altitude,int seq, int missiontype, const QString &description, MapGraphicItem *map, wptype type) : coord(coord), reached(false), description(description), shownumber(true), isDragging(false), altitude(altitude), map(map), myType(type)
|
||||||
@@ -162,6 +176,9 @@ WayPointItem::WayPointItem(const internals::PointLatLng &coord, int const & alti
|
|||||||
connect(map, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos()));
|
connect(map, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos()));
|
||||||
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
|
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
|
||||||
|
|
||||||
|
setParentItem(map);
|
||||||
|
|
||||||
|
|
||||||
this->setZValue(4);
|
this->setZValue(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,9 +219,23 @@ WayPointItem::WayPointItem(const distBearingAltitude &relativeCoordenate,int seq
|
|||||||
connect(map, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos()));
|
connect(map, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos()));
|
||||||
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
|
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
|
||||||
|
|
||||||
|
setParentItem(map);
|
||||||
|
|
||||||
|
|
||||||
this->setZValue(4);
|
this->setZValue(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//QPointF WayPointItem::screenPos() const
|
||||||
|
//{
|
||||||
|
// QGraphicsItem *map = parentItem(); //获取map
|
||||||
|
// QPointF scenePos = map->mapToScene(pos() ); //获取航点在scene中的位置
|
||||||
|
// QList<QGraphicsView *> views = map->scene()->views();
|
||||||
|
// QPointF viewPos = views[0]->mapFromScene(scenePos); //获取航点在view中的位置
|
||||||
|
|
||||||
|
// return views[0]->mapToGlobal(QPoint(viewPos.x(), viewPos.y() ) ); //返回航点在屏幕中的位置
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
void WayPointItem::setWPType(wptype type)
|
void WayPointItem::setWPType(wptype type)
|
||||||
{
|
{
|
||||||
myType = type;
|
myType = type;
|
||||||
@@ -518,6 +549,8 @@ void WayPointItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
//qInfo() << "DoubleClickEvent";
|
//qInfo() << "DoubleClickEvent";
|
||||||
emit waypointdoubleclick(this);
|
emit waypointdoubleclick(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QGraphicsItem::mouseDoubleClickEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WayPointItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
void WayPointItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||||
@@ -535,6 +568,8 @@ void WayPointItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
|
|
||||||
}
|
}
|
||||||
QGraphicsItem::mousePressEvent(event);
|
QGraphicsItem::mousePressEvent(event);
|
||||||
|
|
||||||
|
qDebug() << "waypointitem: press";
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
void WayPointItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
void WayPointItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
@@ -632,6 +667,28 @@ void WayPointItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariant WayPointItem::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||||
|
{
|
||||||
|
if(change == ItemPositionChange)
|
||||||
|
{
|
||||||
|
|
||||||
|
qDebug() << "航点位置发生变化";
|
||||||
|
}
|
||||||
|
|
||||||
|
return QGraphicsItem::itemChange(change, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//void WayPointItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||||
|
//{
|
||||||
|
//// if(this->_isUseParamDialog)
|
||||||
|
//// {
|
||||||
|
//// paramItem->exec();
|
||||||
|
////// QPointF tempPos = this->screenPos();
|
||||||
|
|
||||||
|
//// paramItem->move(QPoint(event->screenPos().x() + 10, event->screenPos().y() + 10) );
|
||||||
|
//// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
void WayPointItem::setPosition(QPointF p)
|
void WayPointItem::setPosition(QPointF p)
|
||||||
{
|
{
|
||||||
@@ -827,6 +884,11 @@ int WayPointItem::type() const
|
|||||||
|
|
||||||
WayPointItem::~WayPointItem()
|
WayPointItem::~WayPointItem()
|
||||||
{
|
{
|
||||||
|
// if(_isUseParamDialog)
|
||||||
|
// {
|
||||||
|
// delete paramItem;
|
||||||
|
// }
|
||||||
|
|
||||||
emit aboutToBeDeleted(this);
|
emit aboutToBeDeleted(this);
|
||||||
|
|
||||||
//--WayPointItem::snumber;
|
//--WayPointItem::snumber;
|
||||||
|
|||||||
@@ -36,6 +36,8 @@
|
|||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include "QDebug"
|
#include "QDebug"
|
||||||
#include "mavlink.h"
|
#include "mavlink.h"
|
||||||
|
#include "waypointparamitem.h"
|
||||||
|
#include "waypointparamdialog.h"
|
||||||
|
|
||||||
|
|
||||||
//#include "propertyui.h"
|
//#include "propertyui.h"
|
||||||
@@ -105,12 +107,19 @@ public:
|
|||||||
}_property;
|
}_property;
|
||||||
|
|
||||||
|
|
||||||
|
WayPointItem( ) {}
|
||||||
WayPointItem(internals::PointLatLng const & coord, int const & altitude,int seq, int missiontype, MapGraphicItem *map, wptype type = absolute);
|
WayPointItem(internals::PointLatLng const & coord, int const & altitude,int seq, int missiontype, MapGraphicItem *map, wptype type = absolute);
|
||||||
WayPointItem(int seq,int missiontype, MapGraphicItem *map, bool magicwaypoint);
|
WayPointItem(int seq,int missiontype, MapGraphicItem *map, bool magicwaypoint);
|
||||||
WayPointItem(internals::PointLatLng const & coord, int const & altitude, int seq,int missiontype, QString const & description, MapGraphicItem *map, wptype type = absolute);
|
WayPointItem(internals::PointLatLng const & coord, int const & altitude, int seq,int missiontype, QString const & description, MapGraphicItem *map, wptype type = absolute);
|
||||||
WayPointItem(distBearingAltitude const & relativeCoord,int seq, int missiontype, QString const & description, MapGraphicItem *map);
|
WayPointItem(distBearingAltitude const & relativeCoord,int seq, int missiontype, QString const & description, MapGraphicItem *map);
|
||||||
|
|
||||||
|
// void paramDialogExec() const //以模态的方式显示参数对话框
|
||||||
|
// {
|
||||||
|
// paramItem->exec();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// QPointF screenPos() const; //返回航点在屏幕中的位置
|
||||||
|
|
||||||
QString Description()
|
QString Description()
|
||||||
{
|
{
|
||||||
return description;
|
return description;
|
||||||
@@ -316,6 +325,12 @@ public:
|
|||||||
return isFancy;
|
return isFancy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MapGraphicItem* getMap() const
|
||||||
|
{
|
||||||
|
return this->map;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||||||
@@ -323,8 +338,10 @@ protected:
|
|||||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
|
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
|
||||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
||||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
||||||
private:
|
QVariant itemChange(GraphicsItemChange change, QVariant const &value) override;
|
||||||
|
// void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
|
||||||
|
|
||||||
|
private:
|
||||||
_property property;
|
_property property;
|
||||||
|
|
||||||
qreal TipOpacity = 0.5;
|
qreal TipOpacity = 0.5;
|
||||||
@@ -416,6 +433,8 @@ public slots:
|
|||||||
void ElevationUpdate(QNetworkReply *reply);
|
void ElevationUpdate(QNetworkReply *reply);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
// void accepted();
|
||||||
|
// void rejected();
|
||||||
|
|
||||||
void currentMissiontype(int group);
|
void currentMissiontype(int group);
|
||||||
void SetCurrent(int group,int seq);
|
void SetCurrent(int group,int seq);
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
#include "waypointparamdialog.h"
|
||||||
|
#include "ui_waypointparamdialog.h"
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
|
WayPointParamDialog::WayPointParamDialog(QWidget *parent, Qt::WindowFlags f) :
|
||||||
|
QDialog(parent, f),
|
||||||
|
ui(new Ui::WayPointParamDialog)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
setWindowFlag(Qt::FramelessWindowHint);
|
||||||
|
setWindowFlag(Qt::SubWindow);
|
||||||
|
|
||||||
|
// connect(ui->buttonBox, &QDialogButtonBox::accepted, this, [=](){ emit ok(); }, Qt::DirectConnection );
|
||||||
|
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, [=](){ isOk = false; emit cancel(); }, Qt::DirectConnection );
|
||||||
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &WayPointParamDialog::acceptedSlot);
|
||||||
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &WayPointParamDialog::setButtonString);
|
||||||
|
}
|
||||||
|
|
||||||
|
WayPointParamDialog::~WayPointParamDialog()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WayPointParamDialog::setlngLat(double lng, double lat)
|
||||||
|
{
|
||||||
|
this->longitude = lng;
|
||||||
|
this->latitude = lat;
|
||||||
|
ui->dSpinLongitude->setValue(lng);
|
||||||
|
ui->dSpinLatitude->setValue(lat);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WayPointParamDialog::setButtonString()
|
||||||
|
{
|
||||||
|
QPushButton *btn = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||||
|
btn->setText("delete");
|
||||||
|
disconnect(ui->buttonBox, &QDialogButtonBox::accepted, this, &WayPointParamDialog::setButtonString);
|
||||||
|
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, [this](){ emit remove(); } );
|
||||||
|
}
|
||||||
|
|
||||||
|
void WayPointParamDialog::acceptedSlot()
|
||||||
|
{
|
||||||
|
isOk = true;
|
||||||
|
this->height = ui->dSpinHeight->value();
|
||||||
|
outsideRadius = ui->dSpinRadius->value();
|
||||||
|
direction = ui->comBoxDirection->currentIndex() == 0 ? 1 : -1; //方向,-1左盘旋,1右盘旋
|
||||||
|
longitude = ui->dSpinLongitude->value(); //经度
|
||||||
|
latitude = ui->dSpinLatitude->value(); //纬度
|
||||||
|
|
||||||
|
emit ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#ifndef WAYPOINTPARAMDIALOG_H
|
||||||
|
#define WAYPOINTPARAMDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class WayPointParamDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct WayPointParamDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit WayPointParamDialog(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags() );
|
||||||
|
~WayPointParamDialog();
|
||||||
|
bool isOk = false;
|
||||||
|
double height; //高度
|
||||||
|
double outsideRadius;//外圈半径
|
||||||
|
double direction; //方向,-1左盘旋,1右盘旋
|
||||||
|
double longitude; //经度
|
||||||
|
double latitude; //纬度
|
||||||
|
|
||||||
|
void setlngLat(double lng, double lat); //设置经纬度,并且把对话框上面的值进行修改
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void ok();
|
||||||
|
void cancel();
|
||||||
|
void remove();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void acceptedSlot();
|
||||||
|
void setButtonString(); //把取消按钮设置成删除
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::WayPointParamDialog *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // WAYPOINTPARAMDIALOG_H
|
||||||
@@ -0,0 +1,204 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>WayPointParamDialog</class>
|
||||||
|
<widget class="QDialog" name="WayPointParamDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>248</width>
|
||||||
|
<height>174</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="dSpinLongitude">
|
||||||
|
<property name="suffix">
|
||||||
|
<string>°</string>
|
||||||
|
</property>
|
||||||
|
<property name="decimals">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>-100000000.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>100000000.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>方向:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>半径:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>高度</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="dSpinRadius">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="suffix">
|
||||||
|
<string>km</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>0.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>10000000.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="dSpinHeight">
|
||||||
|
<property name="suffix">
|
||||||
|
<string>m</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>-10000000.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>100000000.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>纬度</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="dSpinLatitude">
|
||||||
|
<property name="suffix">
|
||||||
|
<string>°</string>
|
||||||
|
</property>
|
||||||
|
<property name="decimals">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>-10000000.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>100000000.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>经度:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QComboBox" name="comBoxDirection">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>右盘旋</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>左盘旋</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>WayPointParamDialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>WayPointParamDialog</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#include "waypointparamitem.h"
|
||||||
|
#include <QIcon>
|
||||||
|
|
||||||
|
WayPointParamItem::WayPointParamItem(QGraphicsItem *parent, Qt::WindowFlags wFlags) :
|
||||||
|
QGraphicsProxyWidget(parent, wFlags)
|
||||||
|
{
|
||||||
|
dialog = new WayPointParamDialog();
|
||||||
|
setWidget(dialog);
|
||||||
|
// setWindowFlags(dialog->windowFlags() );
|
||||||
|
// this->setWindowTitle(u8"参数:");
|
||||||
|
// dialog->setWindowIcon(QIcon() );
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#ifndef WAYPOINTPARAMITEM_H
|
||||||
|
#define WAYPOINTPARAMITEM_H
|
||||||
|
|
||||||
|
#include <QGraphicsProxyWidget>
|
||||||
|
#include <QObject>
|
||||||
|
#include "waypointparamdialog.h"
|
||||||
|
|
||||||
|
class WayPointParamItem : public QGraphicsProxyWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WayPointParamItem(QGraphicsItem *parent = Q_NULLPTR, Qt::WindowFlags wFlags = Qt::WindowFlags() );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
WayPointParamDialog *dialog;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // WAYPOINTPARAMITEM_H
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
#include "waypointparammenu.h"
|
||||||
|
#include "ui_waypointparammenu.h"
|
||||||
|
|
||||||
|
WayPointParamMenu::WayPointParamMenu(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::WayPointParamMenu)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
WayPointParamMenu::~WayPointParamMenu()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
#ifndef WAYPOINTPARAMMENU_H
|
||||||
|
#define WAYPOINTPARAMMENU_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class WayPointParamMenu;
|
||||||
|
}
|
||||||
|
|
||||||
|
class WayPointParamMenu : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit WayPointParamMenu(QWidget *parent = nullptr);
|
||||||
|
~WayPointParamMenu();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::WayPointParamMenu *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // WAYPOINTPARAMMENU_H
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<ui version="4.0">
|
||||||
|
<author/>
|
||||||
|
<comment/>
|
||||||
|
<exportmacro/>
|
||||||
|
<class>WayPointParamMenu</class>
|
||||||
|
<widget class="QWidget" name="WayPointParamMenu">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<pixmapfunction/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
Reference in New Issue
Block a user