-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPLYData.h
More file actions
103 lines (76 loc) · 2.8 KB
/
PLYData.h
File metadata and controls
103 lines (76 loc) · 2.8 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
#ifndef PLYDATA_H
#define PLYDATA_H
#include <QObject>
#include <QString>
#include <QStringList>
#include <QTime>
#include <QVector>
#include "rply.h"
class PLYData : public QObject
{
Q_OBJECT
public:
explicit PLYData(QObject *parent = 0);
// Path for loaded data
const QString& fileName() const { return m_path; }
// Indicates if most recent call to load was canceled. Call this if load()
// returns false to distinguish user cancel from load error.
bool loadCanceled() const { return m_loadCanceled; }
// Get list of comments contained in PLY file
const QStringList& comments() const { return m_comments; }
// Indicates whether an error occurred during load
bool hasError() const;
// Get most recent error from loading; empty for no error
QString errorString() const { return m_errorString; }
// Vertex property names
const QStringList& vertexProperties() const { return m_vertexProperties; }
// Vertex data
const QVector<float>& vertexData(const QString& property) const;
int vertexCount() const;
// Get minimum/maximum for a vertex property
float minimum(const QString& property) const;
float maximum(const QString& property) const;
// Interleave properties and return as a new vector
QVector<float> interleaved(const QString& a, const QString& b,
const QString &c) const;
signals:
void loadStarted(int);
void loadProgress(int);
void loadFinished();
public slots:
// Loads data for path internally. Result indicates whether data was loaded
// successfully. Will also return false for a canceled load; must check
// loadCanceled() to distinguish from error. If load failed due to error,
// errorString() may provide more information.
bool load(const QString& path);
// Slot for interrupting a file load. Only works while read is in progress.
void cancelLoad();
private:
// Prevent copy for QObject subclasses
Q_DISABLE_COPY(PLYData)
// File path for contained data
QString m_path;
// Current processing error; normally empty
QString m_errorString;
// List of comments contained in PLY file
QStringList m_comments;
// Vertex property names
QStringList m_vertexProperties;
// Data for each property
QVector< QVector<float> > m_vertexData;
// Minimum and maximum values for each property
QVector<float> m_minimums;
QVector<float> m_maximums;
// Null return value used for vertexData()
QVector<float> m_nullData;
// Whether or not load was canceled; only valid after opening a file
bool m_loadCanceled;
// Current number of values loaded during open
int m_valuesLoaded;
// Number of items to load between progress updates
int m_progressInterval;
// Callbacks
static void errorCallback(p_ply ply, const char *message);
static int vertexCallback(p_ply_argument arg);
};
#endif // PLYDATA_H