From f8a905208bf6136911f152e42d78ba07eb311036 Mon Sep 17 00:00:00 2001 From: tecnosapiens Date: Fri, 3 Dec 2010 16:39:02 -0600 Subject: [PATCH] add SlugsPadCameraWidget --- qgroundcontrol.pro | 9 ++++++--- src/ui/MapWidget.cc | 4 +++- src/ui/SlugsVideoCamControl.cpp | 42 +++++++++++++++++++++++++++++++++++++++++ src/ui/SlugsVideoCamControl.h | 8 ++++++++ src/ui/SlugsVideoCamControl.ui | 17 +++++++++-------- src/ui/WaypointList.cc | 10 +++++++++- 6 files changed, 77 insertions(+), 13 deletions(-) diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index 5579dc0..4c3ddfd 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -140,7 +140,8 @@ FORMS += src/ui/MainWindow.ui \ src/ui/SlugsDataSensorView.ui \ src/ui/SlugsHilSim.ui \ src/ui/SlugsPIDControl.ui \ - src/ui/SlugsVideoCamControl.ui + src/ui/SlugsVideoCamControl.ui \ + src/ui/SlugsPadCameraControl.ui INCLUDEPATH += src \ src/ui \ src/ui/linechart \ @@ -243,7 +244,8 @@ HEADERS += src/MG.h \ src/ui/SlugsDataSensorView.h \ src/ui/SlugsHilSim.h \ src/ui/SlugsPIDControl.h \ - src/ui/SlugsVideoCamControl.h + src/ui/SlugsVideoCamControl.h \ + src/ui/SlugsPadCameraControl.h SOURCES += src/main.cc \ src/Core.cc \ src/uas/UASManager.cc \ @@ -326,7 +328,8 @@ SOURCES += src/main.cc \ src/ui/SlugsDataSensorView.cc \ src/ui/SlugsHilSim.cc \ src/ui/SlugsPIDControl.cpp \ - src/ui/SlugsVideoCamControl.cpp + src/ui/SlugsVideoCamControl.cpp \ + src/ui/SlugsPadCameraControl.cpp RESOURCES = mavground.qrc diff --git a/src/ui/MapWidget.cc b/src/ui/MapWidget.cc index a4c626c..5d1fa5e 100644 --- a/src/ui/MapWidget.cc +++ b/src/ui/MapWidget.cc @@ -410,6 +410,7 @@ void MapWidget::createWaypointGraphAtMap(const QPointF coordinate) // Create waypoint name QString str; + str = QString("%1").arg(path->numberOfPoints()); // create the WP and set everything in the LineString to display the path @@ -431,8 +432,9 @@ void MapWidget::createWaypointGraphAtMap(const QPointF coordinate) path->addPoint(tempPoint); wpIndex.insert(str,tempPoint); + qDebug()<<"Funcion createWaypointGraphAtMap WP= "< x= "<latitude()<<" y= "<longitude(); - // Refresh the screen + // Refresh the screen mc->updateRequestNew(); //// // emit signal mouse was clicked diff --git a/src/ui/SlugsVideoCamControl.cpp b/src/ui/SlugsVideoCamControl.cpp index 03be364..0949c6a 100644 --- a/src/ui/SlugsVideoCamControl.cpp +++ b/src/ui/SlugsVideoCamControl.cpp @@ -9,6 +9,10 @@ #include #include #include +#include +#include +#include +#include SlugsVideoCamControl::SlugsVideoCamControl(QWidget *parent) : @@ -20,6 +24,22 @@ SlugsVideoCamControl::SlugsVideoCamControl(QWidget *parent) : x1= 0; y1 = 0; connect(ui->viewCamBordeatMap_checkBox,SIGNAL(clicked(bool)),this,SLOT(changeViewCamBorderAtMapStatus(bool))); + tL = ui->padCamContro_frame->frameGeometry().topLeft(); + bR = ui->padCamContro_frame->frameGeometry().bottomRight(); + //ui->padCamContro_frame->setVisible(true); + + // create a layout for camera pad + QGridLayout* padCameraLayout = new QGridLayout(ui->padCamContro_frame); + padCameraLayout->setSpacing(2); + padCameraLayout->setMargin(0); + padCameraLayout->setAlignment(Qt::AlignTop); + ui->padCamContro_frame->setLayout(padCameraLayout); + // create a camera pad widget + padCamera = new SlugsPadCameraControl(); + + + + padCameraLayout->addWidget(padCamera); @@ -326,6 +346,28 @@ QPointF SlugsVideoCamControl::ObtenerMarcacionDistanciaPixel(double lon1, double } +void SlugsVideoCamControl::paintEvent(QPaintEvent *pe) +{ + Q_UNUSED(pe); + QPainter painter(this); + painter.setPen(Qt::blue); + painter.setFont(QFont("Arial", 30)); + +// QRectF rectangle(tL.x(), tL.y(), ui->padCamContro_frame->width(), ui->padCamContro_frame->height()); +// int startAngle = 30 * 16; +// int spanAngle = 120 * 16; + + painter.drawLine(QPoint(tL.x(),tL.y()),QPoint(bR.x(),bR.y())); + // painter.drawLine(QPoint()); + //painter.drawLines(padLines); + + + // painter.drawPie(rectangle, startAngle, spanAngle); + + //painter.drawText(rect(), Qt::AlignCenter, "Qt"); +} + + diff --git a/src/ui/SlugsVideoCamControl.h b/src/ui/SlugsVideoCamControl.h index 0699ef6..793879d 100644 --- a/src/ui/SlugsVideoCamControl.h +++ b/src/ui/SlugsVideoCamControl.h @@ -6,6 +6,8 @@ #include #include #include +#include "SlugsPadCameraControl.h" + #define DELTA 1000 @@ -36,6 +38,8 @@ protected: virtual void mousePressEvent(QMouseEvent* event); virtual void mouseReleaseEvent(QMouseEvent* event); void mouseMoveEvent(QMouseEvent* event); + //virtual void paintEvent(QPaintEvent *pe); + void paintEvent(QPaintEvent *pe); private: @@ -44,6 +48,10 @@ private: int x1; int y1; + QPoint tL; + QPoint bR; + + SlugsPadCameraControl* padCamera; }; diff --git a/src/ui/SlugsVideoCamControl.ui b/src/ui/SlugsVideoCamControl.ui index f191db7..a94832a 100644 --- a/src/ui/SlugsVideoCamControl.ui +++ b/src/ui/SlugsVideoCamControl.ui @@ -6,14 +6,14 @@ 0 0 - 153 - 200 + 165 + 191 - 153 - 176 + 0 + 0 @@ -27,15 +27,16 @@ - 131 - 91 + 0 + 0 - true + false - background-color: rgb(255, 170, 0); + background-color: rgba(255, 170, 0,0%); + QFrame::WinPanel diff --git a/src/ui/WaypointList.cc b/src/ui/WaypointList.cc index ca458f3..dbbe181 100644 --- a/src/ui/WaypointList.cc +++ b/src/ui/WaypointList.cc @@ -480,11 +480,12 @@ void WaypointList::changeEvent(QEvent *e) void WaypointList::on_clearWPListButton_clicked() { + if (uas) { if(isGlobalWP) { - emit clearPathclicked(); + emit clearPathclicked(); const QVector &waypoints = uas->getWaypointManager().getWaypointList(); while(!waypoints.isEmpty())//for(int i = 0; i <= waypoints.size(); i++) @@ -520,6 +521,13 @@ void WaypointList::on_clearWPListButton_clicked() } } + else + { + if(isGlobalWP) + { + emit clearPathclicked(); + } + } } /** @brief Add a waypoint by mouse click over the map */