Commit f8a90520 authored by tecnosapiens's avatar tecnosapiens

add SlugsPadCameraWidget

parent deb6ba86
......@@ -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
......
......@@ -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= "<<str<<" -> x= "<<tempPoint->latitude()<<" y= "<<tempPoint->longitude();
// Refresh the screen
// Refresh the screen
mc->updateRequestNew();
//// // emit signal mouse was clicked
......
......@@ -9,6 +9,10 @@
#include <QWheelEvent>
#include <QDebug>
#include <qmath.h>
#include <QPainter>
#include <QGridLayout>
#include <QVBoxLayout>
#include <QHBoxLayout>
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");
}
......@@ -6,6 +6,8 @@
#include <QGraphicsView>
#include <QGraphicsSceneMouseEvent>
#include <QGraphicsScene>
#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;
};
......
......@@ -6,14 +6,14 @@
<rect>
<x>0</x>
<y>0</y>
<width>153</width>
<height>200</height>
<width>165</width>
<height>191</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>153</width>
<height>176</height>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="mouseTracking">
......@@ -27,15 +27,16 @@
<widget class="QFrame" name="padCamContro_frame">
<property name="minimumSize">
<size>
<width>131</width>
<height>91</height>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="mouseTracking">
<bool>true</bool>
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 170, 0);</string>
<string notr="true">background-color: rgba(255, 170, 0,0%);
</string>
</property>
<property name="frameShape">
<enum>QFrame::WinPanel</enum>
......
......@@ -480,11 +480,12 @@ void WaypointList::changeEvent(QEvent *e)
void WaypointList::on_clearWPListButton_clicked()
{
if (uas)
{
if(isGlobalWP)
{
emit clearPathclicked();
emit clearPathclicked();
const QVector<Waypoint *> &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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment