-
Notifications
You must be signed in to change notification settings - Fork 1
/
point3d.cpp
88 lines (76 loc) · 1.67 KB
/
point3d.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
#include "point3d.h"
Point3D::Point3D(QObject *parent): QObject(parent)
{
}
void Point3D::clear()
{
{
QWriteLocker locker(&this->rwLock);
this->_data.clear();
}
emit dataChanged();
}
void Point3D::append()
{
{
QWriteLocker locker(&this->rwLock);
this->_data.append(QVector3D(0.0,0.0,0.0));
}
emit dataChanged();
}
void Point3D::remove(int index)
{
{
QWriteLocker locker(&this->rwLock);
if(index>=0&&index<this->_data.size())
this->_data.removeAt(index);
}
emit dataChanged();
}
void Point3D::moveUp(int index)
{
{
QWriteLocker locker(&this->rwLock);
if(index>=1&&index<this->_data.size())
qSwap(this->_data[index],this->_data[index-1]);
}
emit dataChanged();
}
void Point3D::moveDown(int index)
{
{
QWriteLocker locker(&this->rwLock);
if(index>=0&&index<this->_data.size()-1)
qSwap(this->_data[index],this->_data[index+1]);
}
emit dataChanged();
}
QVector3D Point3D::getPoint(int index)const
{
QReadLocker locker(&this->rwLock);
if(index>=0&&index<this->_data.size())
return this->_data[index];
return QVector3D();
}
void Point3D::setPoint(int index, QVector3D point)
{
{
QWriteLocker locker(&this->rwLock);
if(index>=0&&index<this->_data.size())
this->_data[index]=point;
}
emit dataChanged();
}
void Point3D::getContent(QList<QVector3D> &out)
{
QReadLocker locker(&this->rwLock);
out=this->_data;
}
void Point3D::setContent(QList<QVector3D> &in)
{
{
QWriteLocker locker(&this->rwLock);
this->_data=in;
}
emit dataChanged();
}