forked from rolker/bagViewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBagViewer.cpp
80 lines (64 loc) · 1.93 KB
/
BagViewer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include "BagViewer.h"
#include "ui_BagViewer.h"
#include "BagGL.h"
#include <QFileDialog>
#include <QMessageBox>
BagViewer::BagViewer(QWidget* parent): QMainWindow(parent), ui(new Ui::BagViewer)
{
ui->setupUi(this);
this->setWindowIcon(QIcon(QString(":/icons/bagViewer.png")));
colormapActionGroup = new QActionGroup(this);
colormapActionGroup->addAction(ui->actionTopographic);
colormapActionGroup->addAction(ui->actionOmnimap);
drawStyleActionGroup = new QActionGroup(this);
drawStyleActionGroup->addAction(ui->actionSolid);
drawStyleActionGroup->addAction(ui->actionWireframe);
drawStyleActionGroup->addAction(ui->actionPoints);
ui->bagGL->setStatusBar(ui->statusbar);
}
BagViewer::~BagViewer()
{
delete ui;
}
void BagViewer::openBag(const std::string& fname)
{
ui->bagGL->openBag(QString(fname.c_str()));
}
void BagViewer::on_actionExit_triggered()
{
qApp->quit();
}
void BagViewer::on_actionOpen_triggered()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), QString(),
tr("Bag Files (*.bag);;All files (*)"));
if (!fileName.isEmpty()) {
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly)) {
QMessageBox::critical(this, tr("Error"), tr("Could not open file"));
return;
}
if(!ui->bagGL->openBag(fileName))
QMessageBox::critical(this, tr("Error"), tr("Could not open bag file"));
}
}
void BagViewer::on_actionTopographic_triggered()
{
ui->bagGL->setColormap("topographic");
}
void BagViewer::on_actionOmnimap_triggered()
{
ui->bagGL->setColormap("omnimap");
}
void BagViewer::on_actionSolid_triggered()
{
ui->bagGL->setDrawStyle("solid");
}
void BagViewer::on_actionWireframe_triggered()
{
ui->bagGL->setDrawStyle("wireframe");
}
void BagViewer::on_actionPoints_triggered()
{
ui->bagGL->setDrawStyle("points");
}