-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.cpp
executable file
·101 lines (88 loc) · 3.59 KB
/
mainwindow.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include "mainwindow.h"
#include <qdebug.h>
#include <QFileDialog>
//#include <QOpenGLContext>
//#include <QOpenGLWidget>
#include "ui_mainwindow.h"
#include <CGAL/Polygon_mesh_processing/measure.h>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow) {
ui->setupUi(this);
resize(800, 600);
connect(this, SIGNAL(modelLoaded(std::string)), ui->openGLWidget,
SLOT(loadModel(std::string)));
connect(this, SIGNAL(stateCheckBoxAxesChanged(bool)), ui->openGLWidget,
SLOT(updateAxesState(bool)));
connect(this, SIGNAL(stateCheckBoxMeshSurfaceChanged(int)),
ui->openGLWidget, SLOT(updateMeshSurfaceState(int)));
connect(this, SIGNAL(buttonResetCameraClicked()), ui->openGLWidget,
SLOT(resetCamera()));
connect(this, SIGNAL(stateCheckBoxShowVerticesChanged(int)),
ui->openGLWidget, SLOT(showVerticesStateChange(int)));
connect(this, SIGNAL(actionSaveModelTriggered(std::string)),
ui->openGLWidget, SLOT(saveModel(std::string)));
connect(this, SIGNAL(actionSaveSegmentTriggered(std::string)),
ui->openGLWidget, SLOT(saveSegment(std::string)));
connect(this, SIGNAL(contractionVolumeThresholdChanged(int)),
ui->openGLWidget, SLOT(updateContractionVolumeThreshold(int)));
connect(this, SIGNAL(updateContractionMode(bool)), ui->openGLWidget,
SLOT(updateContractionMode(bool)));
connect(this, SIGNAL(clearSkeleton()), ui->openGLWidget,
SLOT(clearSkeleton()));
connect(this, SIGNAL(stateCheckBoxLaplacianHeatMapChanged(int)),
ui->openGLWidget,
SLOT(updateLaplacianHeatMapVisualization(int)));
emit stateCheckBoxAxesChanged((int)(ui->checkBoxAxis->isChecked()));
emit stateCheckBoxAxesChanged(
(int)(ui->contractionModeCheckBox->isChecked()));
}
MainWindow::~MainWindow() { delete ui; }
void MainWindow::on_checkBoxAxis_clicked(bool state) {
emit stateCheckBoxAxesChanged(state);
}
void MainWindow::on_actionOpenFile_triggered() {
QString filename =
QFileDialog::getOpenFileName(this, tr("Load Model"), "../Models/",
tr("Object files(*.obj *off)"));
if (filename != NULL) {
std::string filenameString = filename.toUtf8().constData();
emit modelLoaded(filenameString);
}
// uncheck show vertices when model is loaded
// ui->checkBoxShowVertices->setChecked(false);
}
void MainWindow::on_pushButtonResetCamera_clicked() {
emit buttonResetCameraClicked();
}
void MainWindow::on_checkBoxShowVertices_stateChanged(int arg1) {
emit stateCheckBoxShowVerticesChanged(arg1);
}
void MainWindow::on_actionSave_Model_triggered() {
QString destinationDirectory = QFileDialog::getSaveFileName(
this, tr("Save Model"), "../Models/", tr("Object file(*.off)"));
if (destinationDirectory != NULL) {
std::string destinationDirectory_std =
destinationDirectory.toUtf8().constData();
emit actionSaveModelTriggered(destinationDirectory_std);
}
}
void MainWindow::on_actionSave_Segment_triggered() {
QString destinationDirectory = QFileDialog::getSaveFileName(
this, tr("Save Model"), "../Models/Test Set/",
tr("Object file(*.off)"));
if (destinationDirectory != NULL) {
std::string destinationDirectory_std =
destinationDirectory.toUtf8().constData();
emit actionSaveSegmentTriggered(destinationDirectory_std);
}
}
void MainWindow::on_contractionThresholdSpinBox_valueChanged(int newThreshold) {
emit contractionVolumeThresholdChanged(newThreshold);
}
void MainWindow::on_contractionModeCheckBox_stateChanged(int arg1) {
emit updateContractionMode(bool(arg1));
}
void MainWindow::on_clearSkeletonButton_clicked() { emit clearSkeleton(); }
void MainWindow::on_checkBoxMeshSurface_stateChanged(int arg1) {
emit stateCheckBoxMeshSurfaceChanged(arg1);
}