-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscannerdrawer.cpp
44 lines (36 loc) · 1000 Bytes
/
scannerdrawer.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
#include "scannerdrawer.h"
#include <QSettings>
ScannerDrawer::ScannerDrawer() :
QObject() //实际上会自动调用父类的无参构造函数,因此不写也没事
{
m_pointSize = 2.0;
}
void ScannerDrawer::update(unsigned int resolution)
{
m_resolution = resolution;
ShaderDrawable::update();
emit updateGraph();
}
void ScannerDrawer::setScanFeedrate(int feedrate)
{
m_scanFeedrate = feedrate;
}
bool ScannerDrawer::updateData()
{
m_points.clear();
QVector3D color = { 1.0f,0.3f,0.2f };
if (m_resolution == 0)
return true;
m_profileCount = vdValueX.size() / m_resolution;
QSettings settings("ZJU", "scanner");
if (settings.contains("shutterTime")) {
unsigned int scanRate = settings.value("scanRate").toUInt();
m_stepY = m_scanFeedrate / (scanRate * 60.0);
}
for (int i = 0; i < m_profileCount; i++) {
for (int j = 0; j < m_resolution; j++) {
m_points.append({ QVector3D(vdValueX[i*m_resolution + j],m_stepY*i,vdValueZ[i*m_resolution + j]),color, m_vectorNaN });
}
}
return true;
}