-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPointCloudFileManager.h
More file actions
327 lines (310 loc) · 15.7 KB
/
PointCloudFileManager.h
File metadata and controls
327 lines (310 loc) · 15.7 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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
#ifndef LIBPOINTCLOUDFILEMANAGER_H
#define LIBPOINTCLOUDFILEMANAGER_H
#include <QVector>
#include <QMap>
#include <QObject>
#include <QTextStream>
#include <QDateTime>
#include <QMutex>
#include <QProgressDialog>
#include "PointCloudFileDefinitions.h"
#include "Point.h"
#include "libPointCloudFileManager_global.h"
class ParametersManager;
class ControlROIs;
namespace ProcessTools{
class ProgressExternalProcessDialog;
}
namespace libCRS{
class CRSTools;
}
namespace PCFile{
class PointCloudFile;
class LIBPOINTCLOUDFILEMANAGERSHARED_EXPORT PointCloudFileManager : public QObject
{
Q_OBJECT
public:
inline PointCloudFileManager(QObject *parent = 0)
{
mPtrCrsTools=NULL;
mPtrLastoolsCommandsParameters=NULL;
mPtrInternalCommandsParameters=NULL;
mPtrProgressExternalProcessDialog=NULL;
mPtrMpProgressDialog=NULL;
mPtrControlROIs=NULL;
// mGridSizes.push_back(POINTCLOUDFILE_PROJECT_GRID_SIZE_1);
mGridSizes.push_back(POINTCLOUDFILE_PROJECT_GRID_SIZE_5);
mGridSizes.push_back(POINTCLOUDFILE_PROJECT_GRID_SIZE_10);
mGridSizes.push_back(POINTCLOUDFILE_PROJECT_GRID_SIZE_20);
mGridSizes.push_back(POINTCLOUDFILE_PROJECT_GRID_SIZE_50);
// mGridSizes.push_back(POINTCLOUDFILE_PROJECT_GRID_SIZE_100); // falla
// mGridSizes.push_back(POINTCLOUDFILE_PROJECT_GRID_SIZE_200);
mMaxGridSize=mGridSizes[mGridSizes.size()-1];
mUseMultiProcess=false;
mMaximumNumberOfPoints=POINTCLOUDFILE_WITHOUT_MAXIMUM_NUMBER_OF_POINTS_LIMITS;
setProjectTypes();
};
static inline PointCloudFileManager * getInstance(void )
{
if ( mInstance == 0 ) mInstance = new PointCloudFileManager;
return mInstance;
};
bool addPointCloudFilesToPointCloudFile(QString pcfPath,
int crsEpsgCode,
int verticalCrsEpsgCode,
QVector<QString> &pointCloudFiles,
QString& strError);
bool addPointCloudFilesToPointCloudFile(QString pcfPath,
int crsEpsgCode,
bool altitudeIsMsl,
QVector<QString> &pointCloudFiles,
QString& strError);
bool createPointCloudFile(QString pcfPath,
QString projectType,
double gridSize,
int crsEpsgCode,
int verticalCrsEpsgCode,
QVector<QString> &roisShapefiles,
QString& strError);
bool createPointCloudFile(QString pcfPath,
QString projectType,
double gridSize,
int crsEpsgCode,
bool altitudeIsMsl,
QVector<QString> &roisShapefiles,
QString& strError);
bool exportProcessedPointCloudFiles(QString pcfPath,
QString suffix,
QString outputPath,
QString& strError);
QString getBasePath(){return(mBasePath);};
bool getColorNumberOfBytes(QString pcfPath,
int& numberOfBytes,
QString& strError);
bool getProjectCrsEpsgCode(QString pcfPath,
int& crsEpsgCode,
QString& strError);
bool getProjectCrsEpsgCodes(QString pcfPath,
int& crsEpsgCode,
int& verticalCrsEpsgCode,
QString& strError);
bool getGridSizes(QVector<int> &gridSizes,
QString& strError);
bool getInternalCommands(QVector<QString>& internalCommands,
QString& strError);
bool getLastoolsCommands(QVector<QString>& lastoolsCommands,
QString& strError);
bool getInternalCommandOutputDataFormat(QString& command,
bool& enableOuputPath,
bool& enableOutputFile,
bool& enableSuffix,
bool& enablePrefix,
QString& strError);
bool getLastoolsCommandsOutputDataFormat(QString& command,
bool& enableOuputPath,
bool& enableOutputFile,
bool& enableSuffix,
bool& enablePrefix,
QString& strError);
bool getLastoolsCommandStrings(QString& command,
QVector<QString>& inputFiles,
QString& outputPath,
QString& outputFile,
QString& suffix,
QString& prefix,
QVector<QString> &lastoolsCommandStrings,
QString& strError);
bool getMaximumDensity(QString pcfPath,
double &maximumDensity,
QString& strError);
bool getMinimumCoordinates(QString pcfPath,
double& minFc,
double& minSc,
double& minTc,
QString& strError);
bool getMultiProcess(){return(mUseMultiProcess);};
bool getNeighbors(QString pcfPath,
QVector<double> point, // 2d o 3d
int pointCrsEpsgCode,
QString pointCrsProj4String,
double searchRadius2d, // <=0 se usa 100 por la distancia para densidad media
int numberOfNeighbors, // <=0 se devuelven todos
QVector<PCFile::Point>& points, // ordenado de cercano a lejano
QVector<int> &tilesX,
QVector<int> &tilesY,
QVector<double>& distances, // ordenado de cercano a lejano
QVector<int> &fileIdPoints,
QMap<int, QMap<QString, bool> > &existsFieldsByFileId,
QString& strError);
bool getPointCloudFile(QString pcfPath,
PointCloudFile** ptrPCFile,
QString& strError);
bool getPointsFromWktGeometry(QString pcfPath,
QString wktGeometry,
int geometryCrsEpsgCode,
QString geometryCrsProj4String,
QMap<int,QMap<int,QString> >& tilesTableName,
QMap<int, QMap<int, QMap<int, QVector<PCFile::Point> > > > &pointsByTileByFileId, //[fileId][tileX][tileY]
QMap<int,QMap<QString,bool> >& existsFieldsByFileId,
QVector<QString>& ignoreTilesTableName,
bool tilesFullGeometry,
QString& strError);
bool getProjectTypes(QVector<QString>& projectTypes,
QString& strError);
bool getReachedMaximumNumberOfPoints(QString pcfPath,
bool& reachedMaximumNumberOfPoints,
QString& strError);
bool getROIsWktGeometry(QString pcfPath,
QMap<QString, QString> &values,
QString& strError);
bool getTilesNamesFromWktGeometry(QString pcfPath,
QString wktGeometry,
int geometryCrsEpsgCode,
QString geometryCrsProj4String,
QMap<int,QMap<int,QString> >& tilesTableName,
QString& strError);
bool getTilesWktGeometry(QString pcfPath,
QMap<QString, QString> &values,
QString& strError);
bool getVerticalCRSs(int epsgCode,
QVector<int>& verticalCRSs,
QString& strError);
bool initializeCrsTools(QString &strError);
bool openPointCloudFile(QString pcPath,
QString& strError);
bool processInternalCommand(QString& command,
QVector<QString>& inputFiles,
QString& outputPath,
QString& outputFile,
QString& suffix,
QString& prefix,
QString& strError);
bool processInternalCommandVegetationGrowthEstimate(QString& command,
QVector<QString>& inputFiles,
QString& outputPath,
QString& outputFileName,
QString& suffix,
QString& prefix,
QString& strError);
bool processReclassificationConfusionMatrixReport(QString& pcfPath,
QString& outputFileName,
QVector<int>& selectedClasses,
QString& strError);
bool processProjectFile(QString& fileName,
QString& strError);
bool runProcessList(QVector<QString>& processList,
QString title,
QString& strError,
QWidget* ptrWidget=NULL);
bool selectInternalCommandParameters(QString internalCommand,
QString& strError);
bool selectLastoolsCommandParameters(QString lastoolscommand,
QString& strError);
bool selectProjectParameters(QString projectType,
QString& strError);
bool setBasePath(QString basePath, QString &strError);
void setCrsTools(libCRS::CRSTools* ptrCrsTools){mPtrCrsTools=ptrCrsTools;}
bool setGeoidFilesLastoolsPath(QString value,
QString& strError);
bool setControlROIs(ControlROIs* ptrILicenseManager,
QString& strError);
bool setLastoolsPath(QString path,
QString& strError);
bool setMultiProcess(bool useMultiProcess,
QString& strError);
bool setOutputPath(QString value,
QString& strError);
bool setTempPath(QString value,
QString& strError);
bool updateNotEdited2dToolsPoints(QString pcfPath,
QMap<int, QMap<int, QVector<int> > > &pointFileIdByTile,
QMap<int, QMap<int, QVector<int> > > &pointPositionByTile,
QMap<int, QMap<int, QVector<quint8> > > &pointClassNewByTile,
QMap<int, QMap<int, QVector<quint8> > > &pointClassByTile,
QString& strError);
bool updatePoints(QString pcfPath,
QString strAction,
quint8 classValue,
QMap<int, QMap<int, QVector<int> > > &pointFileIdByTile,
QMap<int, QMap<int, QVector<int> > > &pointPositionByTile,
// QMap<int, QMap<int, QVector<quint8> > > &pointClassNewByTile,
// QMap<int, QMap<int, QVector<quint8> > > &pointClassByTile,
QMap<quint8,bool>& lockedClasses,
QString& strError);
int getMaximumNumberOfPoints(){return(mMaximumNumberOfPoints);};
void setMaximumNumberOfPoints(int maximumNumberOfPoints){mMaximumNumberOfPoints=maximumNumberOfPoints;};
private slots:
void on_ProgressExternalProcessDialog_closed();
private:
// bool addPointCloudFile(QString fileName,
// QTextStream& in,
// QString& strError);
bool addPointCloudFiles(QString fileName,
QTextStream& in,
QString& strError);
bool addROI(QString fileName,
QTextStream& in,
QString& strError);
bool checkInitialize(QString& strError);
bool createPointCloudFile(QString fileName,
QTextStream& in,
QString& strError);
bool getProjectParametersString(QString projectType,
QString& projectParametersString,
QString& strError);
bool processReclassificationConfusionMatrixReport(QString fileName,
QTextStream& in,
QString& strError);
bool readVegetationGrowthModel(QString& fileName,
QMap<int,QVector<double> >& vegetationGrowthModel,
QString& strError);
bool removeDir(QString dirName,
bool onlyContent=false);
bool setProjectsParametersManager(QString projectType,
QString& strError);
void setProjectTypes();
bool validateProjectParametersString(QString projectType,
QString projectParametersString,
QString& strError);
bool writePointCloudFile(QString fileName,
QTextStream& in,
QString& strError);
void mpProcessInternalCommandVegetationGrowthEstimate(int nf);
ControlROIs* mPtrControlROIs;
static PointCloudFileManager * mInstance;
libCRS::CRSTools* mPtrCrsTools;
QMap<QString,PCFile::PointCloudFile*> mPtrPcFiles;
QString mBasePath;
QVector<QString> mProjectTypes;
QMap<QString,QString> mProjectParametersFileByProjectType;
QMap<QString,ParametersManager*> mPtrProjectsParametersManagerByProjectType;
QString mLastoolsPath;
QString mLastoolsCommandsParametersFileName;
QVector<QString> mLastoolsCommands;
ParametersManager* mPtrLastoolsCommandsParameters;
QString mInternalCommandsParametersFileName;
QVector<QString> mInternalCommands;
ParametersManager* mPtrInternalCommandsParameters;
ProcessTools::ProgressExternalProcessDialog* mPtrProgressExternalProcessDialog;
QString mStrExecution;
QDateTime mInitialDateTime;
QString mProgressExternalProcessTitle;
QString mTempPath;
QString mOutputPath;
QString mGeoidFilessLastoolsPath;
QVector<int> mGridSizes;
int mMaxGridSize;
bool mUseMultiProcess;
QMutex mMutex;
int mNumberOfFilesToProcess;
QMap<QString,int> mNumberOfPointsToProcessByFileName;
QVector<QString> mInputFiles;
QProgressDialog* mPtrMpProgressDialog;
QString mStrErrorMpProgressDialog;
int mPICVGESpatialResolution;
QMap<int,QVector<double> > mPICVGEBoundingBoxesByFilePos;
QMap<int,QMap<quint16,QMap<quint16,quint16> > > mPICVGEMaxHeightsByTileXYByFilePos;
int mMaximumNumberOfPoints; // POINTCLOUDFILE_WITHOUT_MAXIMUM_NUMBER_OF_POINTS_LIMITS
};
}
#endif // LIBPOINTCLOUDFILEMANAGER_H