同步代码
parent
ee51705be7
commit
4208aca10a
|
@ -772,4 +772,25 @@ TimestampMicroseconds parseAndConvert( std::string dateTimeStr) {
|
|||
return { msecsSinceEpoch, microseconds };
|
||||
}
|
||||
|
||||
bool BASECONSTVARIABLEAPI convertBitsPerSample(const char* bitsPerSampleVal, int32_t& result)
|
||||
{
|
||||
char* endPtr;
|
||||
errno = 0; // 重置错误标志
|
||||
long longVal = std::strtol(bitsPerSampleVal, &endPtr, 10); // 十进制转换
|
||||
|
||||
// 检查转换错误
|
||||
if (bitsPerSampleVal == endPtr) {
|
||||
return false; // 无有效字符
|
||||
}
|
||||
if (errno == ERANGE || longVal < INT32_MIN || longVal > INT32_MAX) {
|
||||
return false; // 数值溢出
|
||||
}
|
||||
if (*endPtr != '\0') {
|
||||
return false; // 含非数字字符
|
||||
}
|
||||
|
||||
result = static_cast<int32_t>(longVal);
|
||||
return true; // 成功
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -145,6 +145,7 @@ int BASECONSTVARIABLEAPI daysInMonth(int year, int month);
|
|||
|
||||
TimestampMicroseconds BASECONSTVARIABLEAPI parseAndConvert( std::string dateTimeStr);
|
||||
|
||||
bool BASECONSTVARIABLEAPI convertBitsPerSample(const char* bitsPerSampleVal, int32_t& result);
|
||||
|
||||
/** 模板函数类 ***********************************************************************************************************/
|
||||
|
||||
|
|
|
@ -295,7 +295,7 @@ bool BASECONSTVARIABLEAPI createNewFolerPath(QString inpath, bool isremoveExist)
|
|||
return true;
|
||||
}
|
||||
|
||||
QFileInfoList findFilePath(const QString& strFilePath, const QString& strNameFilters)
|
||||
QFileInfoList findFilePath(const QString& strFilePath, const QString& strNameFilters, QDirIterator::IteratorFlag flag)
|
||||
{
|
||||
QFileInfoList fileList;
|
||||
if (strFilePath.isEmpty() || strNameFilters.isEmpty())
|
||||
|
@ -308,7 +308,7 @@ QFileInfoList findFilePath(const QString& strFilePath, const QString& strNameF
|
|||
filters << strNameFilters;
|
||||
dir.setPath(strFilePath);
|
||||
dir.setNameFilters(filters);
|
||||
QDirIterator iter(dir, QDirIterator::Subdirectories);
|
||||
QDirIterator iter(dir, flag);
|
||||
while (iter.hasNext())
|
||||
{
|
||||
iter.next();
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <QFile>
|
||||
#include <QDebug>
|
||||
#include <QFileInfoList>
|
||||
#include <QDirIterator>
|
||||
|
||||
|
||||
bool BASECONSTVARIABLEAPI isDirectory(const QString& path);
|
||||
|
@ -59,6 +60,6 @@ bool BASECONSTVARIABLEAPI copyAndReplaceFile(const QString& sourceFilePath, co
|
|||
bool BASECONSTVARIABLEAPI unTarfile(QString inTargzPath,QString outGzFolderPath);
|
||||
bool BASECONSTVARIABLEAPI createNewFolerPath(QString inpath, bool isremoveExist = false);
|
||||
|
||||
QFileInfoList BASECONSTVARIABLEAPI findFilePath(const QString& dirPath, const QString& pattern);
|
||||
QFileInfoList BASECONSTVARIABLEAPI findFilePath(const QString& dirPath, const QString& pattern, QDirIterator::IteratorFlag flag= QDirIterator::IteratorFlag::Subdirectories);
|
||||
|
||||
#endif
|
|
@ -232,9 +232,10 @@ Eigen::MatrixXd gdalImage::getData(int start_row, int start_col, int rows_count,
|
|||
else {
|
||||
}
|
||||
GDALClose((GDALDatasetH)rasterDataset);
|
||||
GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
|
||||
omp_unset_lock(&lock); // �ͷŻ�½ï¿½
|
||||
omp_destroy_lock(&lock); // ½Ù»ï¿½½ï¿½
|
||||
GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
|
||||
|
||||
return datamatrix;
|
||||
}
|
||||
|
||||
|
@ -361,9 +362,10 @@ Eigen::MatrixXf gdalImage::getDataf(int start_row, int start_col, int rows_count
|
|||
else {
|
||||
}
|
||||
GDALClose((GDALDatasetH)rasterDataset);
|
||||
GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
|
||||
omp_unset_lock(&lock); // �ͷŻ�½ï¿½
|
||||
omp_destroy_lock(&lock); // ½Ù»ï¿½½ï¿½
|
||||
GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
|
||||
|
||||
return datamatrix;
|
||||
}
|
||||
|
||||
|
@ -490,9 +492,10 @@ Eigen::MatrixXi gdalImage::getDatai(int start_row, int start_col, int rows_count
|
|||
else {
|
||||
}
|
||||
GDALClose((GDALDatasetH)rasterDataset);
|
||||
GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
|
||||
omp_unset_lock(&lock); // �ͷŻ�½ï¿½
|
||||
omp_destroy_lock(&lock); // ½Ù»ï¿½½ï¿½
|
||||
GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
|
||||
|
||||
return datamatrix;
|
||||
}
|
||||
|
||||
|
@ -521,6 +524,7 @@ ErrorCode gdalImage::getData(double* data, int start_row, int start_col, int row
|
|||
state = ErrorCode::FAIL;
|
||||
}
|
||||
GDALClose((GDALDatasetH)rasterDataset);
|
||||
GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
|
||||
omp_unset_lock(&lock); // �ͷŻ�½ï¿½
|
||||
omp_destroy_lock(&lock); // ½Ù»ï¿½½ï¿½
|
||||
return state;
|
||||
|
@ -549,6 +553,7 @@ ErrorCode gdalImage::getData(long* data, int start_row, int start_col, int rows_
|
|||
state = ErrorCode::FAIL;
|
||||
}
|
||||
GDALClose((GDALDatasetH)rasterDataset);
|
||||
GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
|
||||
omp_unset_lock(&lock); // �ͷŻ�½ï¿½
|
||||
omp_destroy_lock(&lock); // ½Ù»ï¿½½ï¿½
|
||||
return state;
|
||||
|
|
Loading…
Reference in New Issue