-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwindow.cpp
More file actions
184 lines (153 loc) · 4.55 KB
/
Copy pathwindow.cpp
File metadata and controls
184 lines (153 loc) · 4.55 KB
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
// window.cpp
#include <QWidget>
#include "window.h"
#include "ui_window.h"
#include "myglwidget.h"
#include "calculategirth.h"
extern char * filename;
//extern list<struct node> pclList;
void rigidTransform(float &x,float &y,float &z,int rotx,int roty,int rotz);
Window::Window(QWidget *parent) :
QWidget(parent),
ui(new Ui::Window)
{
ui->setupUi(this);
connect(ui->myGLWidget, SIGNAL(xRotationChanged(int)), ui->rotXSlider, SLOT(setValue(int)));
connect(ui->myGLWidget, SIGNAL(yRotationChanged(int)), ui->rotYSlider, SLOT(setValue(int)));
connect(ui->myGLWidget, SIGNAL(zRotationChanged(int)), ui->rotZSlider, SLOT(setValue(int)));
ui->doubleSpinBox_2->setValue(ui->myGLWidget->platSize);
ui->horizontalSlider->setValue(int(ui->myGLWidget->platSize*100));
//ui->widget->setXRotation(90);
ui->myGLWidget->getPoints(filename);
ui->widget->redPoints=0;
//ui->checkBox_2->clicked((bool)ui->myGLWidget->showAxis);//no use
}
Window::~Window()
{
delete ui;
}
void Window::keyPressEvent(QKeyEvent *e)
{
//if (e->key() == Qt::Key_Escape)
// close();
//else
// QWidget::keyPressEvent(e);
}
void Window::on_rotXSlider_valueChanged(int value)
{
ui->rotXSpinBox->setValue(value);
}
void Window::on_rotYSlider_valueChanged(int value)
{
ui->rotYSpinBox->setValue(value);
}
void Window::on_rotZSlider_valueChanged(int value)
{
ui->rotZSpinBox->setValue(value);
}
void Window::on_rotXSpinBox_valueChanged(int arg1)
{
ui->rotXSlider->setValue(arg1);
}
void Window::on_rotYSpinBox_valueChanged(int arg1)
{
ui->rotYSlider->setValue(arg1);
}
void Window::on_rotZSpinBox_valueChanged(int arg1)
{
ui->rotZSlider->setValue(arg1);
}
void Window::on_checkBox_stateChanged(int arg1)
{
ui->myGLWidget->showPlat=arg1;
ui->myGLWidget->updateGL();
}
void Window::on_doubleSpinBox_valueChanged(double arg1)
{
ui->myGLWidget->platHeight=arg1/100;
ui->myGLWidget->updateGL();
}
void Window::on_pushButton_clicked()
{
ui->widget->pclList.clear();
list<struct node> tmpPclList;
list<struct node>::iterator it;
for(it=ui->myGLWidget->pclList.begin();it!=ui->myGLWidget->pclList.end();++it)
{
struct node tmpnode;
tmpnode.x=(*it).x;tmpnode.y=(*it).y;tmpnode.z=(*it).z;
rigidTransform(tmpnode.x,tmpnode.y,tmpnode.z,ui->myGLWidget->xPointRot,ui->myGLWidget->yPointRot,ui->myGLWidget->zPointRot);
tmpPclList.push_back(tmpnode);
}
float girth=calculateGirth(tmpPclList,ui->myGLWidget->platHeight,ui->doubleSpinBox_3->value()/100.0,ui->widget->pclList);
QString str;
str.setNum(girth*100);
ui->lineEdit->setText(str);
ui->widget->updateGL();
}
void Window::on_pushButton_2_clicked()
{
ui->lineEdit->setText(QString(""));
ui->widget->pclList.clear();
ui->widget->updateGL();
}
void Window::on_horizontalSlider_valueChanged(int value)
{
ui->myGLWidget->platSize=value/100.0;
ui->doubleSpinBox_2->setValue(value/100.0);
ui->myGLWidget->updateGL();
}
void Window::on_doubleSpinBox_2_valueChanged(double arg1)
{
ui->myGLWidget->platSize=arg1;
ui->horizontalSlider->setValue(int(arg1*100));
ui->myGLWidget->updateGL();
}
void Window::on_spinBox_valueChanged(int arg1)
{
ui->myGLWidget->redPoints=arg1;
ui->myGLWidget->updateGL();
ui->LastRedPoint_LineEdit->setText(ui->myGLWidget->lastRedPoint);
}
void Window::on_pushButton_3_clicked()
{
int tmpvalue=ui->spinBox->value();
ui->spinBox->setValue(-tmpvalue);
}
void Window::on_spinBox_4_valueChanged(int arg1)
{
ui->myGLWidget->xPointRot=arg1;
ui->myGLWidget->updateGL();
}
void Window::on_spinBox_3_valueChanged(int arg1)
{
ui->myGLWidget->yPointRot=arg1;
ui->myGLWidget->updateGL();
}
void Window::on_spinBox_2_valueChanged(int arg1)
{
ui->myGLWidget->zPointRot=arg1;
ui->myGLWidget->updateGL();
}
void Window::on_checkBox_2_stateChanged(int arg1)
{
ui->myGLWidget->showAxis=arg1;
ui->widget->showAxis=arg1;
ui->myGLWidget->updateGL();
ui->widget->updateGL();
}
void Window::on_doubleSpinBox_4_valueChanged(double arg1)
{
ui->myGLWidget->greenPointX=arg1;
ui->myGLWidget->updateGL();
}
void Window::on_doubleSpinBox_5_valueChanged(double arg1)
{
ui->myGLWidget->greenPointY=arg1;
ui->myGLWidget->updateGL();
}
void Window::on_doubleSpinBox_6_valueChanged(double arg1)
{
ui->myGLWidget->greenPointZ=arg1;
ui->myGLWidget->updateGL();
}