-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathccCommandLineParser.h
201 lines (163 loc) · 5.24 KB
/
ccCommandLineParser.h
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
#ifndef CC_COMMAND_LINE_PARSER_HEADER
#define CC_COMMAND_LINE_PARSER_HEADER
//qCC_io
#include <FileIOFilter.h>
//qCC_db
#include <ccHObject.h>
#include <ccGenericMesh.h>
#include <ccPointCloud.h>
//Qt
#include <QString>
#include <QStringList>
//system
#include <vector>
class ccProgressDialog;
class QDialog;
//! Command line parser
class ccCommandLineParser
{
public:
static int Parse(int nargs, char** args);
protected:
bool commandLoad (QStringList& arguments);
bool commandSubsample (QStringList& arguments, ccProgressDialog* pDlg = 0);
bool commandCurvature (QStringList& arguments, QDialog* parent = 0);
bool commandDensity (QStringList& arguments, QDialog* parent = 0);
bool commandApproxDensity (QStringList& arguments, QDialog* parent = 0);
bool commandSFGradient (QStringList& arguments, QDialog* parent = 0);
bool commandRoughness (QStringList& arguments, QDialog* parent = 0);
bool commandSampleMesh (QStringList& arguments, ccProgressDialog* pDlg = 0);
bool commandBundler (QStringList& arguments);
bool commandDist (QStringList& arguments, bool cloud2meshDist, QDialog* parent = 0);
bool commandFilterSFByValue (QStringList& arguments);
bool commandMergeClouds (QStringList& arguments);
bool commandStatTest (QStringList& arguments, ccProgressDialog* pDlg = 0);
bool commandBestFitPlane (QStringList& arguments);
bool commandCrop (QStringList& arguments);
bool commandCrop2D (QStringList& arguments);
bool commandCrossSection (QStringList& arguments, QDialog* parent = 0);
bool commandColorBanding (QStringList& arguments);
bool matchBBCenters (QStringList& arguments);
bool commandICP (QStringList& arguments, QDialog* parent = 0);
bool commandDelaunay (QStringList& arguments, QDialog* parent = 0);
bool commandChangeCloudOutputFormat (QStringList& arguments);
bool commandChangeMeshOutputFormat (QStringList& arguments);
bool commandChangePLYExportFormat (QStringList& arguments);
bool commandChangeFBXOutputFormat (QStringList& arguments);
bool commandForceNormalsComputation (QStringList& arguments);
bool commandSaveClouds (QStringList& arguments);
bool commandSaveMeshes (QStringList& arguments);
bool commandAutoSave (QStringList& arguments);
bool setActiveSF (QStringList& arguments);
bool removeAllSFs (QStringList& arguments);
bool commandApplyTransformation (QStringList& arguments);
bool commandLogFile (QStringList& arguments);
protected:
//! Default constructor
/** Shouldn't be called by user.
**/
ccCommandLineParser();
//! Destructor
/** Shouldn't be called by user.
**/
~ccCommandLineParser();
//! Parses command line
int parse(QStringList& arguments, QDialog* parent = 0);
//! Loaded entity description
struct EntityDesc
{
QString basename;
QString path;
int indexInFile;
EntityDesc(QString filename, int _indexInFile =-1);
EntityDesc(QString baseName, QString path, int _indexInFile =-1);
virtual ccHObject* getEntity() = 0;
};
//! Loaded group description
struct GroupDesc : EntityDesc
{
ccHObject* groupEntity;
GroupDesc( ccHObject* group,
QString basename,
QString path = QString())
: EntityDesc(basename, path)
, groupEntity(group)
{}
virtual ccHObject* getEntity() { return groupEntity; }
};
//! Loaded cloud description
struct CloudDesc : EntityDesc
{
ccPointCloud* pc;
CloudDesc()
: EntityDesc(QString())
, pc(0)
{}
CloudDesc( ccPointCloud* cloud,
QString filename,
int index = -1)
: EntityDesc(filename,index)
, pc(cloud)
{}
CloudDesc( ccPointCloud* cloud,
QString basename,
QString path,
int index = -1)
: EntityDesc(basename,path,index)
, pc(cloud)
{}
virtual ccHObject* getEntity() { return static_cast<ccHObject*>(pc); }
};
//! Loaded mesh description
struct MeshDesc : EntityDesc
{
ccGenericMesh* mesh;
MeshDesc()
: EntityDesc(QString())
, mesh(0)
{}
MeshDesc( ccGenericMesh* _mesh,
QString filename,
int index = -1)
: EntityDesc(filename,index)
, mesh(_mesh)
{}
MeshDesc( ccGenericMesh* _mesh,
QString basename,
QString path,
int index = -1)
: EntityDesc(basename,path,index)
, mesh(_mesh)
{}
virtual ccHObject* getEntity() { return static_cast<ccHObject*>(mesh); }
};
//! Exports a cloud or a mesh
/** \return error string (if any)
**/
static QString Export(EntityDesc& cloudDesc, QString suffix = QString(), QString* outputFilename = 0, bool forceIsCloud = false);
//! Reads out file format
static QString GetFileFormatFilter(QStringList& arguments, QString& defaultExt);
//! Saves all clouds
/** \param suffix optional suffix
\return success
**/
bool saveClouds(QString suffix = QString(), bool allAtOnce = false);
//! Saves all meshes
/** \param suffix optional suffix
\return success
**/
bool saveMeshes(QString suffix = QString(), bool allAtOnce = false);
//! Removes all clouds
void removeClouds();
//! Removes all meshes
void removeMeshes();
//! Currently opened point clouds and their filename
std::vector< CloudDesc > m_clouds;
//! Currently opened meshes and their filename
std::vector< MeshDesc > m_meshes;
//! Oprhan entities
ccHObject m_orphans;
//! Mesh filename
QString m_meshFilename;
};
#endif