SlugsVideoCamControl.cpp 3.45 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
#include "SlugsVideoCamControl.h"
#include "ui_SlugsVideoCamControl.h"

#include <QGraphicsScene>
#include <QGraphicsTextItem>
#include <QTextStream>
#include <QScrollBar>
#include <QMouseEvent>
#include <QWheelEvent>
#include <QDebug>
11
#include <qmath.h>
tecnosapiens's avatar
tecnosapiens committed
12 13 14 15
#include <QPainter>
#include <QGridLayout>
#include <QVBoxLayout>
#include <QHBoxLayout>
16 17
#include <QPushButton>
#include "SlugsPadCameraControl.h"
18 19 20


SlugsVideoCamControl::SlugsVideoCamControl(QWidget *parent) :
21
    QWidget(parent),
22 23
    ui(new Ui::SlugsVideoCamControl)
    //dragging(0)
24

25 26
{
    ui->setupUi(this);
27 28
//   x1= 0;
//   y1 = 0;
29
    connect(ui->viewCamBordeatMap_checkBox,SIGNAL(clicked(bool)),this,SLOT(changeViewCamBorderAtMapStatus(bool)));
30 31
//    tL = ui->padCamContro_frame->frameGeometry().topLeft();
//    bR = ui->padCamContro_frame->frameGeometry().bottomRight();
tecnosapiens's avatar
tecnosapiens committed
32 33
    //ui->padCamContro_frame->setVisible(true);

34 35 36 37 38 39 40
//    // create a layout for camera pad
//    QGridLayout* padCameraLayout = new QGridLayout(this);
//    padCameraLayout->setSpacing(2);
//    padCameraLayout->setMargin(0);
//    padCameraLayout->setAlignment(Qt::AlignTop);

    //ui->padCamContro_frame->setLayout(padCameraLayout);
tecnosapiens's avatar
tecnosapiens committed
41
    // create a camera pad widget
42 43 44 45 46 47 48 49 50 51 52 53
   //test = new QPushButton(QIcon(":/images/actions/list-add.svg"), "", this);
   //test->setMaximumWidth(50);
  //ui->gridLayout->addWidget(test, 0,0);

    padCamera = new SlugsPadCameraControl(this);

    ui->gridLayout->addWidget(padCamera);

    connect(padCamera,SIGNAL(mouseMoveCoord(int,int)),this,SLOT(mousePadMoveEvent(int,int)));
    connect(padCamera,SIGNAL(mousePressCoord(int,int)),this,SLOT(mousePadPressEvent(int,int)));
    connect(padCamera,SIGNAL(mouseReleaseCoord(int,int)),this,SLOT(mousePadReleaseEvent(int,int)));
    connect(padCamera,SIGNAL(changeCursorPosition(double,double,QString)),this,SLOT(getDeltaPositionPad(double,double,QString)));
tecnosapiens's avatar
tecnosapiens committed
54 55 56



57 58 59 60 61
    //padCamera->setVisible(true);



  // padCameraLayout->addWidget(padCamera);
62 63


64 65 66 67 68 69 70 71 72 73 74

//    QGraphicsScene *scene = new QGraphicsScene(ui->CamControlPanel_graphicsView);
//         scene->setItemIndexMethod(QGraphicsScene::NoIndex);
//         scene->setSceneRect(-200, -200, 400, 400);
//         setScene(scene);
//         setCacheMode(CacheBackground);
//         setViewportUpdateMode(BoundingRectViewportUpdate);
//         setRenderHint(QPainter::Antialiasing);
//         setTransformationAnchor(AnchorUnderMouse);
//         setResizeAnchor(AnchorViewCenter);

75 76
//      ui->CamControlPanel_graphicsView->installEventFilter(this);
//      ui->label_x->installEventFilter(this);
77 78 79 80 81 82 83 84 85 86

}

SlugsVideoCamControl::~SlugsVideoCamControl()
{
    delete ui;
}

void SlugsVideoCamControl::mouseMoveEvent(QMouseEvent *event)
{
87
     Q_UNUSED(event);
88

89 90 91
}


92 93 94
void SlugsVideoCamControl::mousePressEvent(QMouseEvent *evnt)
{
  Q_UNUSED(evnt);
95

96
}
97

98 99
void SlugsVideoCamControl::mouseReleaseEvent(QMouseEvent *evnt)
{
100 101
    Q_UNUSED(evnt);

102
}
103

104

105 106
void SlugsVideoCamControl::mousePadMoveEvent(int x, int y)
{
107 108 109

}

110
void SlugsVideoCamControl::mousePadPressEvent(int x, int y)
111 112
{

113
}
114

115 116
void SlugsVideoCamControl::mousePadReleaseEvent(int x, int y)
{
117 118 119 120


}

121
void SlugsVideoCamControl::changeViewCamBorderAtMapStatus(bool status)
122
{
123
    emit viewCamBorderAtMap(status);
124 125
}

126
void SlugsVideoCamControl::getDeltaPositionPad(double bearing, double distance, QString dirText)
tecnosapiens's avatar
tecnosapiens committed
127
{
128 129 130
    ui->label_dir->setText(dirText);
    ui->label_x->setText("Distancia= " + QString::number(distance));
    ui->label_y->setText("Bearing= " + QString::number(bearing));
tecnosapiens's avatar
tecnosapiens committed
131

132
    emit changeCamPosition(20, bearing, dirText);
tecnosapiens's avatar
tecnosapiens committed
133 134
}