diff --git a/BaseCommonLibrary/BaseCommonLibrary.vcxproj b/BaseCommonLibrary/BaseCommonLibrary.vcxproj
index d7c78f9..002db1e 100644
--- a/BaseCommonLibrary/BaseCommonLibrary.vcxproj
+++ b/BaseCommonLibrary/BaseCommonLibrary.vcxproj
@@ -220,11 +220,13 @@
pch.h
true
true
- NotSet
+ NoExtensions
true
stdcpp14
stdc11
true
+ false
+ MaxSpeed
Windows
diff --git a/BaseCommonLibrary/BaseTool/BaseConstVariable.h b/BaseCommonLibrary/BaseTool/BaseConstVariable.h
index f16210d..67114db 100644
--- a/BaseCommonLibrary/BaseTool/BaseConstVariable.h
+++ b/BaseCommonLibrary/BaseTool/BaseConstVariable.h
@@ -15,6 +15,9 @@
+/** 定义常见文件格式*********/
+#define ENVI_FILE_FORMAT_FILTER u8"ALL File(*.*);;ENVI Bin(*.bin);;ENVI Data(*.dat);;ENVI Data(*.data);;tiff影像(*.tif);;tiff影像(*.tiff)"
+#define XML_FILE_FORMAT_FILTER u8"ALL File(*.*);;XML File(*.xml);;tiff影像(*.tiff)"
//
@@ -136,6 +139,14 @@ struct Point3 {
void setZ(double iz) { z = iz; }
};
+struct Point_3d {
+ double x;
+ double y;
+ double z;
+};
+
+
+
struct DemBox {
double min_lon;
double max_lon;
@@ -154,7 +165,7 @@ struct Vector3_single {
/*********************************************** FEKO仿真参数 ********************************************************************/
-struct SatellitePos {
+extern "C" struct SatellitePos {
double time;
double Px ;
double Py ;
@@ -165,7 +176,7 @@ struct SatellitePos {
};
-struct SatelliteAntPos {
+extern "C" struct SatelliteAntPos {
double time; // 0
double Px;
double Py;
@@ -188,7 +199,7 @@ struct SatelliteAntPos {
};
-struct PatternImageDesc {
+extern "C" struct PatternImageDesc {
long phinum;
long thetanum;
double startTheta;
diff --git a/BaseCommonLibrary/BaseTool/BaseTool.cpp b/BaseCommonLibrary/BaseTool/BaseTool.cpp
index 64d6252..5ea4ed0 100644
--- a/BaseCommonLibrary/BaseTool/BaseTool.cpp
+++ b/BaseCommonLibrary/BaseTool/BaseTool.cpp
@@ -38,7 +38,10 @@
#include // 包含SSE指令集头文件
#include // 包含SSE2指令集头文件
#include // 包含OpenMP头文件
-
+#include
+#include
+#include
+#include
QString longDoubleToQStringScientific(long double value) {
std::ostringstream stream;
@@ -702,3 +705,71 @@ Eigen::MatrixXd BASECONSTVARIABLEAPI dB2Amp(Eigen::MatrixXd& sigma0)
}
+
+QDateTime parseCustomDateTime(const QString& dateTimeStr) {
+ // 手动解析日期时间字符串
+ int year = dateTimeStr.left(4).toInt();
+ int month = dateTimeStr.mid(5, 2).toInt();
+ int day = dateTimeStr.mid(8, 2).toInt();
+ int hour = dateTimeStr.mid(11, 2).toInt();
+ int minute = dateTimeStr.mid(14, 2).toInt();
+ int second = dateTimeStr.mid(17, 2).toInt();
+ int msec = dateTimeStr.mid(20, 6).toInt(); // 只取毫秒的前三位,因为QDateTime支持到毫秒
+
+ // 创建 QDate 和 QTime 对象
+ QDate date(year, month, day);
+ QTime time(hour, minute, second, msec ); // 转换为微秒,但QTime只支持毫秒精度
+
+ // 构造 QDateTime 对象
+ QDateTime result(date, time);
+
+ return result;
+}
+
+
+bool isLeapYear(int year) {
+ return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
+}
+
+int daysInMonth(int year, int month) {
+ if (month == 2) return isLeapYear(year) ? 29 : 28;
+ else if (month == 4 || month == 6 || month == 9 || month == 11) return 30;
+ else return 31;
+}
+
+
+TimestampMicroseconds parseAndConvert( std::string dateTimeStr) {
+ // 解析年、月、日、时、分、秒和微秒
+ int year = std::stoi(dateTimeStr.substr(0, 4));
+ int month = std::stoi(dateTimeStr.substr(5, 2));
+ int day = std::stoi(dateTimeStr.substr(8, 2));
+ int hour = std::stoi(dateTimeStr.substr(11, 2));
+ int minute = std::stoi(dateTimeStr.substr(14, 2));
+ int second = std::stoi(dateTimeStr.substr(17, 2));
+ int microsec = std::stoi(dateTimeStr.substr(20, 6));
+
+ // 计算从1970年至目标年份前一年的总天数
+ long long totalDays = 0;
+ for (int y = 1970; y < year; ++y) {
+ totalDays += isLeapYear(y) ? 366 : 365;
+ }
+
+ // 加上目标年份从1月到上一个月的天数
+ for (int m = 1; m < month; ++m) {
+ totalDays += daysInMonth(year, m);
+ }
+
+ // 加上本月的天数
+ totalDays += day - 1;
+
+ // 转换为总秒数,再加上小时、分钟、秒
+ long long totalSeconds = totalDays * 24 * 60 * 60 + hour * 60 * 60 + minute * 60 + second;
+
+ // 转换为毫秒和微秒
+ long long msecsSinceEpoch = totalSeconds * 1000 + microsec / 1000;
+ int microseconds = microsec % 1000;
+
+ return { msecsSinceEpoch, microseconds };
+}
+
+
diff --git a/BaseCommonLibrary/BaseTool/BaseTool.h b/BaseCommonLibrary/BaseTool/BaseTool.h
index 9bc6296..6ad57ff 100644
--- a/BaseCommonLibrary/BaseTool/BaseTool.h
+++ b/BaseCommonLibrary/BaseTool/BaseTool.h
@@ -31,7 +31,8 @@
#include
#include
#include
-
+#include
+#include
///////////////////////////////////// 基础数学函数 /////////////////////////////////////////////////////////////
@@ -101,7 +102,7 @@ Eigen::Matrix3d BASECONSTVARIABLEAPI rotationMatrix(const Eigen::Vector3d& axis
long double BASECONSTVARIABLEAPI convertToMilliseconds(const std::string& dateTimeStr);
-
+QDateTime BASECONSTVARIABLEAPI parseCustomDateTime(const QString& dateTimeStr);
///
/// list 应该是按照从小到大的顺序排好
///
@@ -132,6 +133,19 @@ void initializeMatrixWithSSE2(Eigen::MatrixXf& mat, const float* data, long rowc
Eigen::MatrixXd BASECONSTVARIABLEAPI MuhlemanSigmaArray(Eigen::MatrixXd& eta_deg);
Eigen::MatrixXd BASECONSTVARIABLEAPI dB2Amp(Eigen::MatrixXd& sigma0);
+
+struct TimestampMicroseconds {
+ boost::int64_t msecsSinceEpoch; // 自1970-01-01T00:00:00 UTC以来的毫秒数
+ int microseconds; // 额外的微秒(精确到微秒)
+};
+
+
+bool BASECONSTVARIABLEAPI isLeapYear(int year);
+int BASECONSTVARIABLEAPI daysInMonth(int year, int month);
+
+TimestampMicroseconds BASECONSTVARIABLEAPI parseAndConvert( std::string dateTimeStr);
+
+
/** 模板函数类 ***********************************************************************************************************/
inline double calculate_MuhlemanSigma(double eta_deg) {
diff --git a/BaseCommonLibrary/BaseTool/FileOperator.cpp b/BaseCommonLibrary/BaseTool/FileOperator.cpp
index d2b1343..6d6ba6c 100644
--- a/BaseCommonLibrary/BaseTool/FileOperator.cpp
+++ b/BaseCommonLibrary/BaseTool/FileOperator.cpp
@@ -93,7 +93,8 @@ QString getFileNameFromPath(const QString& path)
QString getFileNameWidthoutExtend(QString path)
{
QFileInfo fileInfo(path);
- QString fileNameWithoutExtension = fileInfo.baseName(); // 获取无后缀文件名
+ QString fileNameWithoutExtension = fileInfo.completeBaseName(); // 获取无后缀文件名
+ qDebug() << u8"File name without extension: " << fileNameWithoutExtension;
return fileNameWithoutExtension;
}
diff --git a/BaseCommonLibrary/BaseTool/FileOperator.h b/BaseCommonLibrary/BaseTool/FileOperator.h
index 72d542a..b016ede 100644
--- a/BaseCommonLibrary/BaseTool/FileOperator.h
+++ b/BaseCommonLibrary/BaseTool/FileOperator.h
@@ -16,7 +16,7 @@
#include
#include
#include
-
+
bool BASECONSTVARIABLEAPI isDirectory(const QString& path);
bool BASECONSTVARIABLEAPI isExists(const QString& path);
@@ -29,7 +29,7 @@ unsigned long BASECONSTVARIABLEAPI convertToULong(const QString& input);
///
///
///
-std::vector BASECONSTVARIABLEAPI getFilelist(const QString& folderpath, const QString& FilenameExtension = ".*",int (*logfun)(QString logtext,int value)=nullptr);
+std::vector BASECONSTVARIABLEAPI getFilelist(const QString& folderpath, const QString& FilenameExtension = ".*", int (*logfun)(QString logtext, int value) = nullptr);
QString BASECONSTVARIABLEAPI getParantFolderNameFromPath(const QString& path);
@@ -41,11 +41,11 @@ QString BASECONSTVARIABLEAPI getFileExtension(QString path);
int BASECONSTVARIABLEAPI write_binfile(char* filepath, char* data, size_t data_len);
-char* read_textfile(char* text_path, int* length);
+char* read_textfile(char* text_path, int* length);
-bool BASECONSTVARIABLEAPI exists_test(const QString& name);
+bool BASECONSTVARIABLEAPI exists_test(const QString& name);
-size_t BASECONSTVARIABLEAPI fsize(FILE* fp);
+size_t BASECONSTVARIABLEAPI fsize(FILE* fp);
QString BASECONSTVARIABLEAPI getParantFromPath(const QString& path);
void BASECONSTVARIABLEAPI copyFile(const QString& sourcePath, const QString& destinationPath);
diff --git a/BaseCommonLibrary/BaseTool/GeoOperator.cpp b/BaseCommonLibrary/BaseTool/GeoOperator.cpp
index 9784c3a..ce49a3e 100644
--- a/BaseCommonLibrary/BaseTool/GeoOperator.cpp
+++ b/BaseCommonLibrary/BaseTool/GeoOperator.cpp
@@ -18,7 +18,9 @@
#include
#include
#include "GeoOperator.h"
-
+#include // OGRSpatialReference ڿռοת
+#include // GDALWarp
+#include
Landpoint operator +(const Landpoint& p1, const Landpoint& p2)
@@ -135,6 +137,44 @@ Landpoint XYZ2LLA(const Landpoint& XYZ) {
+void XYZ2BLH_FixedHeight(double x, double y, double z,double ati, Landpoint& point) {
+ const double a = 6378137.0; // WGS84
+ const double f = 1.0 / 298.257223563;
+ const double e2 = 2 * f - f * f; // һƫƽ
+
+ // 㾭L ()
+ const double L_rad = std::atan2(y, x);
+ point.lon = L_rad * 180.0 / M_PI; // תΪ
+
+ const double p = std::sqrt(x * x + y * y);
+ const double H = ati; // ʹ֪߶
+
+ // ʼγȹ㣨֪߶H
+ double B_rad = std::atan2(z, p * (1 - e2 * (a / (a + H))));
+
+ // γB̶H
+ for (int i = 0; i < 10; ++i) { // ֪Hʱ
+ const double sin_B = std::sin(B_rad);
+ const double N = a / std::sqrt(1 - e2 * sin_B * sin_B);
+ const double delta = e2 * N / (N + H); // ߶ȹ̶ʱ
+
+ const double B_new = std::atan2(z, p * (1 - delta));
+
+ if (std::abs(B_new - B_rad) < 1e-9) {
+ B_rad = B_new;
+ break;
+ }
+ B_rad = B_new;
+ }
+
+ point.lat = B_rad * 180.0 / M_PI; // ת
+
+ // ȷΧ [-180, 180]
+ point.lon = std::fmod(point.lon + 360.0, 360.0);
+ if (point.lon > 180.0) point.lon -= 360.0;
+ point.ati = ati;
+}
+
double getAngle(const Landpoint& a, const Landpoint& b)
{
@@ -408,3 +448,53 @@ double getlocalIncAngle(Vector3D& satepoint, Vector3D& landpoint, Vector3D& slop
return angle;
}
}
+
+bool BASECONSTVARIABLEAPI ConvertResolutionToDegrees(int sourceEPSG, double resolutionMeters, double refLon, double refLat, double& degreePerPixelX, double& degreePerPixelY){
+ // ʼԴϵƽͶӰĿϵWGS84 γȣ
+ OGRSpatialReference sourceSRS, targetSRS;
+ sourceSRS.importFromEPSG(sourceEPSG); // Դϵȷ EPSG
+ targetSRS.importFromEPSG(4326); // ĿΪ WGS84 γ
+
+ // תγ -> ƽ
+ OGRCoordinateTransformation* toPlane = OGRCreateCoordinateTransformation(&targetSRS, &sourceSRS);
+ if (!toPlane) return false;
+
+ // ο㾭γתΪƽ
+ double x = refLon, y = refLat;
+ if (!toPlane->Transform(1, &x, &y)) {
+ OGRCoordinateTransformation::DestroyCT(toPlane);
+ return false;
+ }
+
+ // תƽ -> γ
+ OGRCoordinateTransformation* toGeo = OGRCreateCoordinateTransformation(&sourceSRS, &targetSRS);
+ if (!toGeo) {
+ OGRCoordinateTransformation::DestroyCT(toPlane);
+ return false;
+ }
+
+ // 㶫ֱʣȱ仯
+ double eastX = x + resolutionMeters, eastY = y;
+ double eastLon = eastX, eastLat = eastY;
+ if (!toGeo->Transform(1, &eastLon, &eastLat)) {
+ OGRCoordinateTransformation::DestroyCT(toPlane);
+ OGRCoordinateTransformation::DestroyCT(toGeo);
+ return false;
+ }
+ degreePerPixelX = (eastLon - refLon) / resolutionMeters; // ȷÿӦ
+
+ // 㱱ֱʣγȱ仯
+ double northX = x, northY = y + resolutionMeters;
+ double northLon = northX, northLat = northY;
+ if (!toGeo->Transform(1, &northLon, &northLat)) {
+ OGRCoordinateTransformation::DestroyCT(toPlane);
+ OGRCoordinateTransformation::DestroyCT(toGeo);
+ return false;
+ }
+ degreePerPixelY = (northLat - refLat) / resolutionMeters; // γȷÿӦ
+
+ // ͷԴ
+ OGRCoordinateTransformation::DestroyCT(toPlane);
+ OGRCoordinateTransformation::DestroyCT(toGeo);
+ return true;
+}
diff --git a/BaseCommonLibrary/BaseTool/GeoOperator.h b/BaseCommonLibrary/BaseTool/GeoOperator.h
index 6d4eb8a..66ce525 100644
--- a/BaseCommonLibrary/BaseTool/GeoOperator.h
+++ b/BaseCommonLibrary/BaseTool/GeoOperator.h
@@ -30,6 +30,7 @@ Eigen::MatrixXd BASECONSTVARIABLEAPI LLA2XYZ(Eigen::MatrixXd landpoint);
/// 经纬度--degree
Landpoint BASECONSTVARIABLEAPI XYZ2LLA(const Landpoint& XYZ);
+void BASECONSTVARIABLEAPI XYZ2BLH_FixedHeight(double x, double y, double z, double ati, Landpoint& point);
Landpoint BASECONSTVARIABLEAPI operator +(const Landpoint& p1, const Landpoint& p2);
@@ -123,4 +124,24 @@ CartesianCoordinates BASECONSTVARIABLEAPI sphericalToCartesian(const Spheric
double BASECONSTVARIABLEAPI getlocalIncAngle(Vector3D& satepoint, Vector3D& landpoint, Vector3D& slopeVector);
+
+/**
+ * @brief 将平面坐标分辨率(米)转换为经纬度分辨率(度)
+ * @param sourceEPSG 平面坐标系 EPSG 码(如 UTM Zone 50N 对应 32650)
+ * @param resolutionMeters 输入分辨率(单位:米)
+ * @param refLon 参考点经度(十进制度,用于计算局部转换系数)
+ * @param refLat 参考点纬度(十进制度,用于计算局部转换系数)
+ * @param[out] degreePerPixelX 经度方向分辨率(度/像素)
+ * @param[out] degreePerPixelY 纬度方向分辨率(度/像素)
+ * @return 是否转换成功
+ */
+bool BASECONSTVARIABLEAPI ConvertResolutionToDegrees(
+ int sourceEPSG,
+ double resolutionMeters,
+ double refLon,
+ double refLat,
+ double& degreePerPixelX,
+ double& degreePerPixelY
+);
+
#endif
\ No newline at end of file
diff --git a/BaseCommonLibrary/BaseTool/ImageOperatorBase.h b/BaseCommonLibrary/BaseTool/ImageOperatorBase.h
index 060df9a..b16127d 100644
--- a/BaseCommonLibrary/BaseTool/ImageOperatorBase.h
+++ b/BaseCommonLibrary/BaseTool/ImageOperatorBase.h
@@ -89,7 +89,7 @@ enum GDALREADARRCOPYMETHOD {
/// \param long 经度
/// \param lat 纬度
/// \return 对应投影坐标系统的 EPSG编码,-1 表示计算错误
-long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat(double long, double lat, ProjectStripDelta stripState);
+long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat(double lon, double lat, ProjectStripDelta stripState= ProjectStripDelta::Strip_6);
long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat_inStrip3(double lon, double lat);
@@ -135,10 +135,10 @@ GDALDataType BASECONSTVARIABLEAPI getGDALDataType(QString fileptah);
struct RasterExtend {
- double min_x; //纬度
- double min_y;//经度
- double max_x;//纬度
- double max_y;//经度
+ double min_x;
+ double min_y;
+ double max_x;
+ double max_y;
};
@@ -174,8 +174,6 @@ public: // 方法
virtual void saveImage(std::shared_ptr, int start_row, int start_col, int rowcount, int colcount, int band_ids);
virtual void saveImage(std::shared_ptr, int start_row, int start_col, int rowcount, int colcount, int band_ids);
-
-
virtual void saveImage();
virtual void setNoDataValue(double nodatavalue, int band_ids);
virtual void setNoDataValuei(int nodatavalue, int band_ids);
@@ -197,6 +195,10 @@ public: // 方法
virtual RasterExtend getExtend();
+
+
+
+
public:
QString img_path; // 图像文件
int height; // 高
@@ -236,6 +238,10 @@ public:
Eigen::MatrixXcd data;
};
+
+bool BASECONSTVARIABLEAPI CopyProjectTransformMatrixFromRasterAToRasterB(QString RasterAPath, QString RasterBPath);
+
+
// 创建影像
gdalImage BASECONSTVARIABLEAPI CreategdalImageDouble(QString& img_path, int height, int width, int band_num, bool overwrite = false, bool isEnvi = false);
gdalImage BASECONSTVARIABLEAPI CreategdalImageFloat(QString& img_path, int height, int width, int band_num, bool overwrite = false, bool isEnvi = false);
@@ -310,6 +316,24 @@ void BASECONSTVARIABLEAPI testOutDataArr(QString filename, long* data, long row
void BASECONSTVARIABLEAPI CreateSARIntensityByLookTable(QString IntensityRasterPath, QString LookTableRasterPath, QString SARIntensityPath, long min_rid, long max_rid, long min_cid, long max_cid, std::function processBarShow = {});
+bool BASECONSTVARIABLEAPI ConvertVrtToEnvi(QString vrtPath, QString outPath);
+
+
+
+
+void BASECONSTVARIABLEAPI MultiLookRaster(QString inRasterPath, QString outRasterPath, long looklineNumrow, long looklineNumCol);
+ErrorCode BASECONSTVARIABLEAPI Complex2PhaseRaster(QString inComplexPath, QString outRasterPath);
+ErrorCode BASECONSTVARIABLEAPI Complex2dBRaster(QString inComplexPath, QString outRasterPath);
+ErrorCode BASECONSTVARIABLEAPI Complex2AmpRaster(QString inComplexPath, QString outRasterPath);
+ErrorCode BASECONSTVARIABLEAPI amp2dBRaster(QString inPath, QString outRasterPath);
+
+
+ErrorCode BASECONSTVARIABLEAPI ResampleDEM(QString indemPath, QString outdemPath, double gridx, double gridy);
+
+
+void BASECONSTVARIABLEAPI CloseAllGDALRaster();
+
+
//--------------------- 图像文件读写 ------------------------------
diff --git a/BaseCommonLibrary/BaseTool/RasterToolBase.cpp b/BaseCommonLibrary/BaseTool/RasterToolBase.cpp
index 32711fb..5debe6f 100644
--- a/BaseCommonLibrary/BaseTool/RasterToolBase.cpp
+++ b/BaseCommonLibrary/BaseTool/RasterToolBase.cpp
@@ -15,6 +15,8 @@
#include
#include
#include
+#include "SARSimulationImageL1.h"
+#include
namespace RasterToolBase {
long getProjectEPSGCodeByLon_Lat(double lon, double lat, ProjectStripDelta stripState)
@@ -268,4 +270,7 @@ namespace RasterToolBase {
return CoordinateSystemType::UNKNOW;
}
}
-} // namespace RasterToolBase
\ No newline at end of file
+}; // namespace RasterToolBase
+
+
+
diff --git a/BaseCommonLibrary/BaseTool/RasterToolBase.h b/BaseCommonLibrary/BaseTool/RasterToolBase.h
index bc6842f..254d4bb 100644
--- a/BaseCommonLibrary/BaseTool/RasterToolBase.h
+++ b/BaseCommonLibrary/BaseTool/RasterToolBase.h
@@ -12,40 +12,42 @@
#include "BaseConstVariable.h"
#include "gdal_priv.h"
#include
+#include "LogInfoCls.h"
+
namespace RasterToolBase {
- static bool GDALAllRegisterEnable=false;
+ static bool GDALAllRegisterEnable = false;
- enum ProjectStripDelta{
+ enum ProjectStripDelta {
Strip_6, // 6度带
Strip_3
};
- enum CoordinateSystemType{ // 坐标系类型
+ enum CoordinateSystemType { // 坐标系类型
GeoCoordinateSystem,
ProjectCoordinateSystem,
UNKNOW
};
- struct PointRaster{ // 影像坐标点
+ struct PointRaster { // 影像坐标点
double x;
double y;
double z;
};
- struct PointXYZ{
- double x,y,z;
+ struct PointXYZ {
+ double x, y, z;
};
- struct PointGeo{
- double lon,lat,ati;
+ struct PointGeo {
+ double lon, lat, ati;
};
- struct PointImage{
- double pixel_x,pixel_y;
+ struct PointImage {
+ double pixel_x, pixel_y;
};
/// 根据经纬度获取
@@ -56,14 +58,14 @@ namespace RasterToolBase {
/// \param lat 纬度
/// \return 对应投影坐标系统的 EPSG编码,-1 表示计算错误
long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat(double long, double lat,
- ProjectStripDelta stripState = ProjectStripDelta::Strip_3);
+ ProjectStripDelta stripState = ProjectStripDelta::Strip_3);
long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat_inStrip3(double lon, double lat);
long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat_inStrip6(double lon, double lat);
- QString BASECONSTVARIABLEAPI GetProjectionNameFromEPSG(long epsgCode) ;
+ QString BASECONSTVARIABLEAPI GetProjectionNameFromEPSG(long epsgCode);
long BASECONSTVARIABLEAPI GetEPSGFromRasterFile(QString filepath);
@@ -72,9 +74,23 @@ namespace RasterToolBase {
CoordinateSystemType BASECONSTVARIABLEAPI getCoordinateSystemTypeByEPSGCode(long EPSGCODE);
+};// namespace RasterProjectConvertor
+
+
+
+
+// 遥感类常用数据
+
+
+
+
+
+
+
+
+
-} // namespace RasterProjectConvertor
#endif // LAMPCAE_RASTERTOOLBASE_H
diff --git a/BaseCommonLibrary/BaseTool/SARSimulationImageL1.cpp b/BaseCommonLibrary/BaseTool/SARSimulationImageL1.cpp
index 16134d2..2fbfbb8 100644
--- a/BaseCommonLibrary/BaseTool/SARSimulationImageL1.cpp
+++ b/BaseCommonLibrary/BaseTool/SARSimulationImageL1.cpp
@@ -106,7 +106,7 @@ ErrorCode SARSimulationImageL1Dataset::OpenOrNew(QString folder, QString filenam
this->saveToXml();
}
- if (this->Rasterlevel!=RasterL2||QFile(this->GPSPointFilePath).exists() == false) {
+ if (this->Rasterlevel==RasterL2||QFile(this->GPSPointFilePath).exists() == false) {
// ļ
omp_lock_t lock;
omp_init_lock(&lock);
@@ -122,7 +122,7 @@ ErrorCode SARSimulationImageL1Dataset::OpenOrNew(QString folder, QString filenam
omp_destroy_lock(&lock);
}
- if (this->Rasterlevel == RasterLevel::RasterSLC || QFile(this->ImageRasterPath).exists() == false) {
+ else if (this->Rasterlevel == RasterLevel::RasterSLC || QFile(this->ImageRasterPath).exists() == false) {
// ļ
omp_lock_t lock;
@@ -140,7 +140,7 @@ ErrorCode SARSimulationImageL1Dataset::OpenOrNew(QString folder, QString filenam
}
- if (this->Rasterlevel != RasterLevel::RasterSLC || QFile(this->ImageRasterPath).exists() == false) {
+ else if (this->Rasterlevel == RasterLevel::RasterL1B || QFile(this->ImageRasterPath).exists() == false) {
// ļ
omp_lock_t lock;
@@ -150,11 +150,11 @@ ErrorCode SARSimulationImageL1Dataset::OpenOrNew(QString folder, QString filenam
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI");
- std::shared_ptr poDstDS(poDriver->Create(this->ImageRasterPath.toUtf8().constData(), colCount, rowCount, 1, GDT_CFloat32, NULL));
+ std::shared_ptr poDstDS(poDriver->Create(this->GPSPointFilePath.toUtf8().constData(), 19, rowCount, 1, GDT_Float64, NULL));
GDALFlushCache((GDALDatasetH)poDstDS.get());
poDstDS.reset();
- omp_unset_lock(&lock); //
- omp_destroy_lock(&lock); //
+ omp_unset_lock(&lock);
+ omp_destroy_lock(&lock);
}
@@ -203,7 +203,7 @@ ErrorCode SARSimulationImageL1Dataset::Open(QString xmlPath)
QFileInfo fileInfo(xmlPath);
QString fileName = fileInfo.fileName(); // ȡļ
QString fileSuffix = fileInfo.suffix(); // ȡ
- QString fileNameWithoutSuffix = fileInfo.baseName(); // ȡļ
+ QString fileNameWithoutSuffix = fileInfo.completeBaseName(); // ȡļ
QString directoryPath = fileInfo.path(); // ȡļ·
if (fileSuffix.toLower() == "xml" || fileSuffix.toLower() == ".xml") {
return this->Open(directoryPath, fileNameWithoutSuffix);
@@ -246,12 +246,13 @@ void SARSimulationImageL1Dataset::saveToXml()
xmlWriter.writeTextElement("RowCount", QString::number(this->rowCount));
xmlWriter.writeTextElement("ColCount", QString::number(this->colCount));
- xmlWriter.writeTextElement("Rnear", QString::number(this->Rnear));
- xmlWriter.writeTextElement("Rfar", QString::number(this->Rfar));
- xmlWriter.writeTextElement("Rref", QString::number(this->Rref));
- xmlWriter.writeTextElement("CenterFreq", QString::number(this->centerFreq));
- xmlWriter.writeTextElement("Fs", QString::number(this->Fs));
- xmlWriter.writeTextElement("CenterAngle", QString::number(this->CenterAngle));
+ xmlWriter.writeTextElement("Rnear", QString::number(this->Rnear, 'e', 18));
+ xmlWriter.writeTextElement("Rfar", QString::number(this->Rfar, 'e', 18));
+ xmlWriter.writeTextElement("Rref", QString::number(this->Rref, 'e', 18));
+ xmlWriter.writeTextElement("CenterFreq", QString::number(this->centerFreq, 'e', 18));
+ xmlWriter.writeTextElement("Fs", QString::number(this->Fs, 'e', 18));
+ xmlWriter.writeTextElement("PRF", QString::number(this->prf, 'e', 18));
+ xmlWriter.writeTextElement("CenterAngle", QString::number(this->CenterAngle, 'e', 18));
xmlWriter.writeTextElement("LookSide", this->LookSide);
// sateantpos
@@ -259,60 +260,60 @@ void SARSimulationImageL1Dataset::saveToXml()
for (long i = 0; i < this->sateposes.count(); i++) {
xmlWriter.writeStartElement("AntPosParam");
- xmlWriter.writeTextElement("time", QString::number(this->sateposes[i].time)); // time
- xmlWriter.writeTextElement("Px", QString::number(this->sateposes[i].Px)); // Px
- xmlWriter.writeTextElement("Py", QString::number(this->sateposes[i].Py)); // Py
- xmlWriter.writeTextElement("Pz", QString::number(this->sateposes[i].Pz)); // Pz
- xmlWriter.writeTextElement("Vx", QString::number(this->sateposes[i].Vx)); // Vx
- xmlWriter.writeTextElement("Vy", QString::number(this->sateposes[i].Vy)); // Vy
- xmlWriter.writeTextElement("Vz", QString::number(this->sateposes[i].Vz)); // Vz
- xmlWriter.writeTextElement("AntDirectX", QString::number(this->sateposes[i].AntDirectX)); // AntDirectX
- xmlWriter.writeTextElement("AntDirectY", QString::number(this->sateposes[i].AntDirectY)); // AntDirectY
- xmlWriter.writeTextElement("AntDirectZ", QString::number(this->sateposes[i].AntDirectZ)); // AntDirectZ
- xmlWriter.writeTextElement("AVx", QString::number(this->sateposes[i].AVx)); // AVx
- xmlWriter.writeTextElement("AVy", QString::number(this->sateposes[i].AVy)); // AVy
- xmlWriter.writeTextElement("AVz", QString::number(this->sateposes[i].AVz)); // AVz
- xmlWriter.writeTextElement("lon", QString::number(this->sateposes[i].lon)); // lon
- xmlWriter.writeTextElement("lat", QString::number(this->sateposes[i].lat)); // lat
- xmlWriter.writeTextElement("ati", QString::number(this->sateposes[i].ati)); // ati
+ xmlWriter.writeTextElement("time", QString::number(this->sateposes[i].time, 'e', 18)); // time
+ xmlWriter.writeTextElement("Px", QString::number(this->sateposes[i].Px, 'e', 18)); // Px
+ xmlWriter.writeTextElement("Py", QString::number(this->sateposes[i].Py, 'e', 18)); // Py
+ xmlWriter.writeTextElement("Pz", QString::number(this->sateposes[i].Pz, 'e', 18)); // Pz
+ xmlWriter.writeTextElement("Vx", QString::number(this->sateposes[i].Vx, 'e', 18)); // Vx
+ xmlWriter.writeTextElement("Vy", QString::number(this->sateposes[i].Vy, 'e', 18)); // Vy
+ xmlWriter.writeTextElement("Vz", QString::number(this->sateposes[i].Vz, 'e', 18)); // Vz
+ xmlWriter.writeTextElement("AntDirectX", QString::number(this->sateposes[i].AntDirectX, 'e', 18)); // AntDirectX
+ xmlWriter.writeTextElement("AntDirectY", QString::number(this->sateposes[i].AntDirectY, 'e', 18)); // AntDirectY
+ xmlWriter.writeTextElement("AntDirectZ", QString::number(this->sateposes[i].AntDirectZ, 'e', 18)); // AntDirectZ
+ xmlWriter.writeTextElement("AVx", QString::number(this->sateposes[i].AVx, 'e', 18)); // AVx
+ xmlWriter.writeTextElement("AVy", QString::number(this->sateposes[i].AVy, 'e', 18)); // AVy
+ xmlWriter.writeTextElement("AVz", QString::number(this->sateposes[i].AVz, 'e', 18)); // AVz
+ xmlWriter.writeTextElement("lon", QString::number(this->sateposes[i].lon, 'e', 18)); // lon
+ xmlWriter.writeTextElement("lat", QString::number(this->sateposes[i].lat, 'e', 18)); // lat
+ xmlWriter.writeTextElement("ati", QString::number(this->sateposes[i].ati, 'e', 18)); // ati
xmlWriter.writeEndElement(); //
}
- xmlWriter.writeTextElement("ImageStartTime", QString::number(this->startImageTime));
- xmlWriter.writeTextElement("ImageEndTime", QString::number(this->EndImageTime));
+ xmlWriter.writeTextElement("ImageStartTime", QString::number(this->startImageTime, 'e', 18));
+ xmlWriter.writeTextElement("ImageEndTime", QString::number(this->EndImageTime, 'e', 18));
- xmlWriter.writeTextElement("incidenceAngleNearRange", QString::number(this->incidenceAngleNearRange));
- xmlWriter.writeTextElement("incidenceAngleFarRange", QString::number(this->incidenceAngleFarRange));
- xmlWriter.writeTextElement("TotalProcessedAzimuthBandWidth", QString::number(this->TotalProcessedAzimuthBandWidth));
- xmlWriter.writeTextElement("DopplerParametersReferenceTime", QString::number(this->DopplerParametersReferenceTime));
+ xmlWriter.writeTextElement("incidenceAngleNearRange", QString::number(this->incidenceAngleNearRange, 'e', 18));
+ xmlWriter.writeTextElement("incidenceAngleFarRange", QString::number(this->incidenceAngleFarRange, 'e', 18));
+ xmlWriter.writeTextElement("TotalProcessedAzimuthBandWidth", QString::number(this->TotalProcessedAzimuthBandWidth, 'e', 18));
+ xmlWriter.writeTextElement("DopplerParametersReferenceTime", QString::number(this->DopplerParametersReferenceTime, 'e', 18));
xmlWriter.writeStartElement("DopplerCentroidCoefficients");
- xmlWriter.writeTextElement("d0", QString::number(this->d0));
- xmlWriter.writeTextElement("d1", QString::number(this->d1));
- xmlWriter.writeTextElement("d2", QString::number(this->d2));
- xmlWriter.writeTextElement("d3", QString::number(this->d3));
- xmlWriter.writeTextElement("d4", QString::number(this->d4));
+ xmlWriter.writeTextElement("d0", QString::number(this->d0, 'e', 18));
+ xmlWriter.writeTextElement("d1", QString::number(this->d1, 'e', 18));
+ xmlWriter.writeTextElement("d2", QString::number(this->d2, 'e', 18));
+ xmlWriter.writeTextElement("d3", QString::number(this->d3, 'e', 18));
+ xmlWriter.writeTextElement("d4", QString::number(this->d4, 'e', 18));
xmlWriter.writeEndElement(); // DopplerCentroidCoefficients
xmlWriter.writeStartElement("DopplerRateValuesCoefficients");
- xmlWriter.writeTextElement("r0", QString::number(this->r0));
- xmlWriter.writeTextElement("r1", QString::number(this->r1));
- xmlWriter.writeTextElement("r2", QString::number(this->r2));
- xmlWriter.writeTextElement("r3", QString::number(this->r3));
- xmlWriter.writeTextElement("r4", QString::number(this->r4));
+ xmlWriter.writeTextElement("r0", QString::number(this->r0, 'e', 18));
+ xmlWriter.writeTextElement("r1", QString::number(this->r1, 'e', 18));
+ xmlWriter.writeTextElement("r2", QString::number(this->r2, 'e', 18));
+ xmlWriter.writeTextElement("r3", QString::number(this->r3, 'e', 18));
+ xmlWriter.writeTextElement("r4", QString::number(this->r4, 'e', 18));
xmlWriter.writeEndElement(); // DopplerRateValuesCoefficients
- xmlWriter.writeTextElement("latitude_center", QString::number(this->latitude_center));
- xmlWriter.writeTextElement("longitude_center", QString::number(this->longitude_center));
- xmlWriter.writeTextElement("latitude_topLeft", QString::number(this->latitude_topLeft));
- xmlWriter.writeTextElement("longitude_topLeft", QString::number(this->longitude_topLeft));
- xmlWriter.writeTextElement("latitude_topRight", QString::number(this->latitude_topRight));
- xmlWriter.writeTextElement("longitude_topRight", QString::number(this->longitude_topRight));
- xmlWriter.writeTextElement("latitude_bottomLeft", QString::number(this->latitude_bottomLeft));
- xmlWriter.writeTextElement("longitude_bottomLeft", QString::number(this->longitude_bottomLeft));
- xmlWriter.writeTextElement("latitude_bottomRight", QString::number(this->latitude_bottomRight));
- xmlWriter.writeTextElement("longitude_bottomRight", QString::number(this->longitude_bottomRight));
+ xmlWriter.writeTextElement("latitude_center", QString::number(this->latitude_center, 'e', 18));
+ xmlWriter.writeTextElement("longitude_center", QString::number(this->longitude_center, 'e', 18));
+ xmlWriter.writeTextElement("latitude_topLeft", QString::number(this->latitude_topLeft, 'e', 18));
+ xmlWriter.writeTextElement("longitude_topLeft", QString::number(this->longitude_topLeft, 'e', 18));
+ xmlWriter.writeTextElement("latitude_topRight", QString::number(this->latitude_topRight, 'e', 18));
+ xmlWriter.writeTextElement("longitude_topRight", QString::number(this->longitude_topRight, 'e', 18));
+ xmlWriter.writeTextElement("latitude_bottomLeft", QString::number(this->latitude_bottomLeft, 'e', 18));
+ xmlWriter.writeTextElement("longitude_bottomLeft", QString::number(this->longitude_bottomLeft, 'e', 18));
+ xmlWriter.writeTextElement("latitude_bottomRight", QString::number(this->latitude_bottomRight, 'e', 18));
+ xmlWriter.writeTextElement("longitude_bottomRight", QString::number(this->longitude_bottomRight, 'e', 18));
xmlWriter.writeEndElement(); // Parameters
xmlWriter.writeEndDocument();
@@ -371,6 +372,9 @@ ErrorCode SARSimulationImageL1Dataset::loadFromXml()
else if (xmlReader.name() == "Fs") {
this->Fs = xmlReader.readElementText().toDouble();
}
+ else if (xmlReader.name() == "PRF") {
+ this->prf = xmlReader.readElementText().toDouble();
+ }
else if(xmlReader.name() == "ImageStartTime"){
this->startImageTime = xmlReader.readElementText().toDouble();
}
@@ -873,6 +877,7 @@ QVector SARSimulationImageL1Dataset::getDopplerParams()
result[2] = d2;
result[3] = d3;
result[4] = d4;
+
return result;
}
@@ -888,11 +893,13 @@ void SARSimulationImageL1Dataset::setDopplerParams(double id0, double id1, doubl
QVector SARSimulationImageL1Dataset::getDopplerCenterCoff()
{
QVector result(5);
- result[0]=r0;
- result[1]=r1;
- result[2]=r2;
- result[3]=r3;
- result[4]=r4;
+ result[0] = r0;
+ result[1] = r1;
+ result[2] = r2;
+ result[3] = r3;
+ result[4] = r4;
+
+
return result;
}
diff --git a/BaseCommonLibrary/BaseTool/SARSimulationImageL1.h b/BaseCommonLibrary/BaseTool/SARSimulationImageL1.h
index c2abecf..6d8325a 100644
--- a/BaseCommonLibrary/BaseTool/SARSimulationImageL1.h
+++ b/BaseCommonLibrary/BaseTool/SARSimulationImageL1.h
@@ -143,9 +143,11 @@ public:
double getDopplerParametersReferenceTime();
void setDopplerParametersReferenceTime(double v);
+ // ղ
QVector getDopplerParams();
void setDopplerParams(double d0, double d1, double d2, double d3, double d4);
+ // ϵ
QVector getDopplerCenterCoff();
void setDopplerCenterCoff(double r0, double r1, double r2, double r3, double r4);
@@ -208,3 +210,9 @@ private:
};
+
+
+
+
+
+
diff --git a/BaseCommonLibrary/BaseTool/gdalImageComplexOperator.cpp b/BaseCommonLibrary/BaseTool/gdalImageComplexOperator.cpp
index bc8a0a9..7d0df86 100644
--- a/BaseCommonLibrary/BaseTool/gdalImageComplexOperator.cpp
+++ b/BaseCommonLibrary/BaseTool/gdalImageComplexOperator.cpp
@@ -121,20 +121,48 @@ void gdalImageComplex::saveImage(Eigen::MatrixXcd data, int start_row, int start
int datarows = data.rows();
int datacols = data.cols();
- double* databuffer = new double[data.size() * 2];
- for (int i = 0; i < data.rows(); i++) {
- for (int j = 0; j < data.cols(); j++) {
- databuffer[i * data.cols() * 2 + j * 2] = data(i, j).real();
- databuffer[i * data.cols() * 2 + j * 2 + 1] = data(i, j).imag();
+ if (this->getDataType() == GDT_CFloat64)
+ {
+
+ double* databuffer = new double[data.size() * 2];
+ for (int i = 0; i < data.rows(); i++) {
+ for (int j = 0; j < data.cols(); j++) {
+ databuffer[i * data.cols() * 2 + j * 2] = data(i, j).real();
+ databuffer[i * data.cols() * 2 + j * 2 + 1] = data(i, j).imag();
+ }
}
+
+ // poDstDS->RasterIO(GF_Write,start_col, start_row, datacols, datarows, databuffer, datacols,
+ // datarows, GDT_Float32,band_ids, num,0,0,0);
+ poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, datacols, datarows,
+ databuffer, datacols, datarows, GDT_CFloat64, 0, 0);
+ GDALFlushCache(poDstDS);
+ delete databuffer;
+
+ }
+ else if (this->getDataType() == GDT_CFloat32) {
+
+ float* databuffer = new float[data.size() * 2];
+ for (int i = 0; i < data.rows(); i++) {
+ for (int j = 0; j < data.cols(); j++) {
+ databuffer[i * data.cols() * 2 + j * 2] = float(data(i, j).real());
+ databuffer[i * data.cols() * 2 + j * 2 + 1] =float( data(i, j).imag());
+ }
+ }
+
+ // poDstDS->RasterIO(GF_Write,start_col, start_row, datacols, datarows, databuffer, datacols,
+ // datarows, GDT_Float32,band_ids, num,0,0,0);
+ poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, datacols, datarows,
+ databuffer, datacols, datarows, GDT_CFloat32, 0, 0);
+ GDALFlushCache(poDstDS);
+ delete databuffer;
+ }
+ else {
+ throw std::exception("gdalImageComplex::saveImage: data type error");
}
- // poDstDS->RasterIO(GF_Write,start_col, start_row, datacols, datarows, databuffer, datacols,
- // datarows, GDT_Float32,band_ids, num,0,0,0);
- poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, datacols, datarows,
- databuffer, datacols, datarows, GDT_CFloat64, 0, 0);
- GDALFlushCache(poDstDS);
- delete databuffer;
+
+
GDALClose((GDALDatasetH)poDstDS);
GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
omp_unset_lock(&lock); //
@@ -265,24 +293,46 @@ Eigen::MatrixXcd gdalImageComplex::getDataComplex(int start_row, int start_col,
// ȡݼĵһ
GDALRasterBand* poBand;
poBand = poDataset->GetRasterBand(1);
-
+ rows_count = start_row + rows_count <= this->height ? rows_count : this->height - start_row;
+ cols_count = start_col + cols_count <= this->width ? cols_count : this->width - start_col;
// ȡϢǸ
int nXSize = cols_count; poBand->GetXSize();
int nYSize = rows_count; poBand->GetYSize();
-
- double* databuffer = new double[nXSize * nYSize * 2];
- poBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, databuffer, cols_count,
- rows_count, GDT_CFloat64, 0, 0);
- GDALClose((GDALDatasetH)poDataset);
Eigen::MatrixXcd rasterData(nYSize, nXSize); // ʹEigenMatrixXcd
- for (size_t i = 0; i < nYSize; i++) {
- for (size_t j = 0; j < nXSize; j++) {
- rasterData(i, j) = std::complex(databuffer[i * nXSize * 2 + j * 2],
- databuffer[i * nXSize * 2 + j * 2 + 1]);
+ if (this->getDataType() == GDT_CFloat64)
+ {
+ long long pixelCount =long long( nXSize) *long long( nYSize);
+ double* databuffer = new double[pixelCount * 2];
+ poBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, databuffer, cols_count, rows_count, GDT_CFloat64, 0, 0);
+ GDALClose((GDALDatasetH)poDataset);
+
+ for (long long i = 0; i < nYSize; i++) {
+ for (long long j = 0; j < nXSize; j++) {
+ rasterData(i, j) = std::complex(databuffer[i * nXSize * 2 + j * 2],
+ databuffer[i * nXSize * 2 + j * 2 + 1]);
+ }
}
+
+ delete[] databuffer;
+ }
+ else if(this->getDataType()==GDT_CFloat32)
+ {
+ long long pixelCount = long long(nXSize) * long long(nYSize);
+ float* databuffer = new float[pixelCount * 2];
+ poBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, databuffer, cols_count, rows_count, GDT_CFloat32, 0, 0);
+ GDALClose((GDALDatasetH)poDataset);
+
+ for (long long i = 0; i < nYSize; i++) {
+ for (long long j = 0; j < nXSize; j++) {
+ rasterData(i, j) = std::complex(databuffer[i * nXSize * 2 + j * 2],
+ databuffer[i * nXSize * 2 + j * 2 + 1]);
+ }
+ }
+
+ delete[] databuffer;
}
- delete[] databuffer;
+
return rasterData;
}
diff --git a/BaseCommonLibrary/BaseTool/gdalImageOperator.cpp b/BaseCommonLibrary/BaseTool/gdalImageOperator.cpp
index bce0668..9fe8bfd 100644
--- a/BaseCommonLibrary/BaseTool/gdalImageOperator.cpp
+++ b/BaseCommonLibrary/BaseTool/gdalImageOperator.cpp
@@ -1228,8 +1228,8 @@ RasterExtend gdalImage::getExtend()
double x1 = this->gt(0, 0);
double y1 = this->gt(1, 0);
- double x2 = this->gt(0, 0) + (this->width - 1) * gt(0, 1) + (0) * gt(0, 2);
- double y2 = this->gt(1, 0) + (this->width - 1) * gt(1, 1) + (0) * gt(1, 2);
+ double x2 = this->gt(0, 0) + (this->width - 1) * gt(0, 1) + (0) * gt(0, 2); //
+ double y2 = this->gt(1, 0) + (this->width - 1) * gt(1, 1) + (0) * gt(1, 2); // γ
double x3 = this->gt(0, 0) + (0) * gt(0, 1) + (this->height - 1) * gt(0, 2);
double y3 = this->gt(1, 0) + (0) * gt(1, 1) + (this->height - 1) * gt(1, 2);
@@ -1401,6 +1401,15 @@ gdalImage CreategdalImage(const QString& img_path, int height, int width, int ba
GDALDataset* poDstDS = poDriver->Create(img_path.toUtf8().constData(), width, height, band_num,
datetype, NULL); // ������
+
+ if (NULL == poDstDS)
+ {
+ qDebug() << "Create image failed!";
+ throw "Create image failed!";
+ exit(1);
+ }
+
+
if (need_gt) {
if (!projection.isEmpty()) {
poDstDS->SetProjection(projection.toUtf8().constData());
@@ -1470,6 +1479,51 @@ gdalImage CreategdalImage(const QString& img_path, int height, int width, int ba
}
+bool CopyProjectTransformMatrixFromRasterAToRasterB(QString RasterAPath, QString RasterBPath) {
+ // עGDAL
+ GDALAllRegister();
+
+ // ӰAֻģʽ
+ GDALDataset* ds_a = (GDALDataset*)GDALOpen(RasterAPath.toUtf8().constData(), GA_ReadOnly);
+ if (ds_a == nullptr) {
+ std::cerr << "ӰA" << std::endl;
+ return false;
+ }
+
+ // ȡAķͶӰϢ
+ double geotransform[6];
+ ds_a->GetGeoTransform(geotransform); // 任
+ const char* projection = ds_a->GetProjectionRef(); // WKTʽͶӰ
+
+ // ӰBģʽ
+ GDALDataset* ds_b = (GDALDataset*)GDALOpen(RasterBPath.toUtf8().constData(), GA_Update);
+ if (ds_b == nullptr) {
+ std::cerr << "ӰB" << std::endl;
+ GDALClose(ds_a);
+ return false;
+ }
+
+ // ÷
+ if (ds_b->SetGeoTransform(geotransform) != CE_None) {
+ std::cerr << "÷ʧ" << std::endl;
+ }
+
+ // ͶӰϵ
+ if (ds_b->SetProjection(projection) != CE_None) {
+ std::cerr << "ͶӰʧ" << std::endl;
+ }
+
+ // ͷԴ
+ GDALClose(ds_a);
+ GDALClose(ds_b);
+
+ return true;
+
+
+
+
+
+}
diff --git a/BaseCommonLibrary/ImageOperatorFuntion.cpp b/BaseCommonLibrary/ImageOperatorFuntion.cpp
index 67c620a..ee94390 100644
--- a/BaseCommonLibrary/ImageOperatorFuntion.cpp
+++ b/BaseCommonLibrary/ImageOperatorFuntion.cpp
@@ -1,4 +1,4 @@
-#include "stdafx.h"
+#include "stdafx.h"
#include "ImageOperatorBase.h"
#include "BaseTool.h"
#include "GeoOperator.h"
@@ -25,8 +25,12 @@
#include
#include
#include
-#include // OGRSpatialReference ڿռοת
-#include // GDALWarp
+#include // OGRSpatialReference 用于空间参考转换
+#include // 用于 GDALWarp 操作
+
+#include "gdal_priv.h"
+#include "cpl_conv.h"
+#include
std::shared_ptr OpenDataset(const QString& in_path, GDALAccess rwmode)
@@ -105,13 +109,13 @@ GDALDataType getGDALDataType(QString fileptah)
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen(
- fileptah.toUtf8().constData(), GA_ReadOnly)); // ��ֻ�ʽ��ȡ�Ӱ��
+ fileptah.toUtf8().constData(), GA_ReadOnly)); // 锟斤拷只斤拷式锟斤拷取斤拷影锟斤拷
GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType();
GDALClose((GDALDatasetH)rasterDataset);
- omp_unset_lock(&lock); // �ͷŻ��
- omp_destroy_lock(&lock); // ٻ��
+ omp_unset_lock(&lock); // 锟酵放伙拷斤拷
+ omp_destroy_lock(&lock); // 劫伙拷斤拷
return gdal_datatype;
}
@@ -124,14 +128,14 @@ GDALDataType getGDALDataType(QString fileptah)
int block_num_pre_memory(int block_width, int height, GDALDataType gdal_datatype, double memey_size)
{
- // С
+ // 计算大小
int size_meta = 0;
if (gdal_datatype == GDT_Byte) {
size_meta = 1;
}
else if (gdal_datatype == GDT_UInt16) {
- size_meta = 2; // ֻ˫ܹͨ
+ size_meta = 2; // 只有双通道才能构建 复数矩阵
}
else if (gdal_datatype == GDT_UInt16) {
size_meta = 2;
@@ -172,7 +176,7 @@ int block_num_pre_memory(int block_width, int height, GDALDataType gdal_datatype
else {
}
int block_num = int(memey_size / (size_meta * block_width));
- block_num = block_num > height ? height : block_num; //
+ block_num = block_num > height ? height : block_num; // 行数
block_num = block_num < 1 ? 1 : block_num;
return block_num;
}
@@ -203,84 +207,85 @@ int ENVI2TIFF(QString in_envi_path, QString out_tiff_path)
void ConvertCoordinateSystem(QString inRasterPath, QString outRasterPath, long outepsgcode) {
- // עGDAL
+ // 注册所有GDAL驱动
GDALAllRegister();
+ CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
- // դļ
+ // 打开输入栅格文件
GDALDataset* srcDataset = (GDALDataset*)GDALOpen(inRasterPath.toUtf8().constData(), GA_ReadOnly);
if (!srcDataset) {
- // ļʧ
- // qDebug() << "ļ" << inRasterPath;
+ // 错误处理:输出文件打开失败
+ // qDebug() << "无法打开输入文件:" << inRasterPath;
return;
}
- // Ŀϵ
+ // 创建目标坐标系
OGRSpatialReference targetSRS;
if (targetSRS.importFromEPSG(outepsgcode) != OGRERR_NONE) {
GDALClose(srcDataset);
- // qDebug() << "ЧEPSG룺" << outepsgcode;
+ // qDebug() << "无效的EPSG代码:" << outepsgcode;
return;
}
GDALDataType datetype = srcDataset->GetRasterBand(1)->GetRasterDataType();
- // ȡĿϵWKTʾ
+ // 获取目标坐标系的WKT表示
char* targetSRSWkt = nullptr;
targetSRS.exportToWkt(&targetSRSWkt);
bool flag = (datetype == GDT_Byte || datetype == GDT_Int8 || datetype == GDT_Int16 || datetype == GDT_UInt16 || datetype == GDT_Int32 || datetype == GDT_UInt32 || datetype == GDT_Int64 || datetype == GDT_UInt64);
- // ͶӰݼWarped VRT
+ // 创建重投影后的虚拟数据集(Warped VRT)
GDALDataset* warpedVRT = flag ? (GDALDataset*)GDALAutoCreateWarpedVRT(
srcDataset,
- nullptr, // ϵĬʹԴݣ
- targetSRSWkt, // Ŀϵ
- GRA_NearestNeighbour, // ز˫Բֵ
- 0.0, // 0ʾԶ㣩
- nullptr // ѡ
+ nullptr, // 输入坐标系(默认使用源数据)
+ targetSRSWkt, // 目标坐标系
+ GRA_NearestNeighbour, // 重采样方法:双线性插值
+ 0.0, // 最大误差(0表示自动计算)
+ nullptr // 其他选项
) : (GDALDataset*)GDALAutoCreateWarpedVRT(
srcDataset,
- nullptr, // ϵĬʹԴݣ
- targetSRSWkt, // Ŀϵ
- GRA_Bilinear, // ز˫Բֵ
- 0.0, // 0ʾԶ㣩
- nullptr // ѡ
+ nullptr, // 输入坐标系(默认使用源数据)
+ targetSRSWkt, // 目标坐标系
+ GRA_Bilinear, // 重采样方法:双线性插值
+ 0.0, // 最大误差(0表示自动计算)
+ nullptr // 其他选项
);
- CPLFree(targetSRSWkt); // ͷWKTڴ
+ CPLFree(targetSRSWkt); // 释放WKT内存
if (!warpedVRT) {
GDALClose(srcDataset);
- qDebug() << u8"ͶӰתVRTʧ";
+ qDebug() << u8"创建投影转换VRT失败";
return;
}
- // ȡGeoTIFFʽ
+ // 获取输出驱动(GeoTIFF格式)
QString filesuffer = getFileExtension(outRasterPath).toLower();
bool isTiff = filesuffer.contains("tif");
GDALDriver* driver = isTiff ? GetGDALDriverManager()->GetDriverByName("GTiff") : GetGDALDriverManager()->GetDriverByName("ENVI");
if (!driver) {
GDALClose(warpedVRT);
GDALClose(srcDataset);
- // qDebug() << "ȡGeoTIFF";
+ // qDebug() << "无法获取GeoTIFF驱动";
return;
}
- // դļ
+ // 创建输出栅格文件
GDALDataset* dstDataset = driver->CreateCopy(
- outRasterPath.toUtf8().constData(), // ļ·
- warpedVRT, // ݼVRT
- false, // Ƿϸ
- nullptr, // ѡ
- nullptr, // Ȼص
- nullptr // ص
+ outRasterPath.toUtf8().constData(), // 输出文件路径
+ warpedVRT, // 输入数据集(VRT)
+ false, // 是否严格复制
+ nullptr, // 创建选项
+ nullptr, // 进度回调
+ nullptr // 回调参数
);
if (!dstDataset) {
- // qDebug() << "ļʧܣ" << outRasterPath;
+ // qDebug() << "创建输出文件失败:" << outRasterPath;
GDALClose(warpedVRT);
GDALClose(srcDataset);
return;
}
- // ͷԴ
+ // 释放资源
GDALClose(dstDataset);
GDALClose(warpedVRT);
GDALClose(srcDataset);
@@ -290,7 +295,7 @@ void ConvertCoordinateSystem(QString inRasterPath, QString outRasterPath, long o
void ResampleByReferenceRasterB(QString pszSrcFile, QString RefrasterBPath, QString pszOutFile, GDALResampleAlg eResample) {
GDALAllRegister();
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
- CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "NO");
+
GDALDataset* pDSrc = (GDALDataset*)GDALOpen(pszSrcFile.toLocal8Bit().constData(), GA_ReadOnly);
if (pDSrc == NULL) {
qDebug() << u8"do not open In Raster file: " << pszSrcFile;
@@ -320,11 +325,11 @@ void ResampleByReferenceRasterB(QString pszSrcFile, QString RefrasterBPath, QStr
char* pszSrcWKT = NULL;
pszSrcWKT = const_cast(pDSrc->GetProjectionRef());
- // ���û��ͶӰ����?���һ�?1?7
+ // 锟斤拷锟矫伙拷锟酵队帮拷锟斤拷锟轿?拷锟斤拷锟揭伙拷锟?1锟?7
if (strlen(pszSrcWKT) <= 0) {
OGRSpatialReference oSRS;
oSRS.importFromEPSG(4326);
- // oSRS.SetUTM(50, true); //������ ����120��
+ // oSRS.SetUTM(50, true); //锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷120锟斤拷
// oSRS.SetWellKnownGeogCS("WGS84");
oSRS.exportToWkt(&pszSrcWKT);
}
@@ -332,12 +337,12 @@ void ResampleByReferenceRasterB(QString pszSrcFile, QString RefrasterBPath, QStr
char* pdstSrcWKT = NULL;
pdstSrcWKT = const_cast(pDRef->GetProjectionRef());
- // ���û��ͶӰ����?���һ�?1?7
+ // 锟斤拷锟矫伙拷锟酵队帮拷锟斤拷锟轿?拷锟斤拷锟揭伙拷锟?1锟?7
if (strlen(pdstSrcWKT) <= 0)
{
OGRSpatialReference oSRS;
oSRS.importFromEPSG(4326);
- // oSRS.SetUTM(50, true); //������ ����120��
+ // oSRS.SetUTM(50, true); //锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷120锟斤拷
// oSRS.SetWellKnownGeogCS("WGS84");
oSRS.exportToWkt(&pdstSrcWKT);
}
@@ -369,7 +374,7 @@ void ResampleByReferenceRasterB(QString pszSrcFile, QString RefrasterBPath, QStr
hTransformArg = GDALCreateGenImgProjTransformer((GDALDatasetH)pDSrc, pszSrcWKT, NULL, pszSrcWKT,
FALSE, 0.0, 1);
qDebug() << "no proj ";
- //(û��ͶӰ��Ӱ��������߲�??1?7)
+ //(没锟斤拷投影锟斤拷影锟斤拷锟斤拷锟斤拷锟斤拷卟锟酵?拷锟?1锟?7)
if (hTransformArg == NULL) {
qDebug() << "hTransformArg create failure";
GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc);
@@ -392,8 +397,8 @@ void ResampleByReferenceRasterB(QString pszSrcFile, QString RefrasterBPath, QStr
GDALWarpOptions* psWo = GDALCreateWarpOptions();
- CPLSetConfigOption("GDAL_NUM_THREADS", "ALL_CPUS"); // ʹпõCPU
- CPLSetConfigOption("GDAL_CACHEMAX", "16000"); // ûСΪ500MB
+ CPLSetConfigOption("GDAL_NUM_THREADS", "ALL_CPUS"); // 使用所有可用的CPU核心
+ CPLSetConfigOption("GDAL_CACHEMAX", "16000"); // 设置缓存大小为500MB
// psWo->papszWarpOptions = CSLDuplicate(NULL);
psWo->eWorkingDataType = dataType;
@@ -440,20 +445,20 @@ void ResampleByReferenceRasterB(QString pszSrcFile, QString RefrasterBPath, QStr
void ResampleByReferenceRasterB(QString InrasterAPath, QString RefrasterBPath, QString OutrasterCPath) {
- // עGDAL
+ // 注册所有GDAL驱动
GDALAllRegister();
- // οդB
+ // 打开参考栅格B
GDALDataset* refDS = (GDALDataset*)GDALOpen(RefrasterBPath.toUtf8().constData(), GA_ReadOnly);
if (!refDS) {
- qDebug() << "οդB" << RefrasterBPath;
+ qDebug() << "无法打开参考栅格B:" << RefrasterBPath;
return;
}
- // ȡοդĵ任ͶӰͳߴ
+ // 获取参考栅格的地理变换、投影和尺寸
double geotransform[6];
if (refDS->GetGeoTransform(geotransform) != CE_None) {
- qDebug() << "ȡοդĵ任ʧܡ";
+ qDebug() << "获取参考栅格的地理变换失败。";
GDALClose(refDS);
return;
}
@@ -461,28 +466,28 @@ void ResampleByReferenceRasterB(QString InrasterAPath, QString RefrasterBPath, Q
const char* proj = refDS->GetProjectionRef();
int cols = refDS->GetRasterXSize();
int rows = refDS->GetRasterYSize();
- GDALClose(refDS); // ȡϢرղοդ
+ GDALClose(refDS); // 获取信息后关闭参考栅格
- // դA
+ // 打开输入栅格A
GDALDataset* srcDS = (GDALDataset*)GDALOpen(InrasterAPath.toUtf8().constData(), GA_ReadOnly);
if (!srcDS) {
- qDebug() << "դA" << InrasterAPath;
+ qDebug() << "无法打开输入栅格A:" << InrasterAPath;
return;
}
- // ȡդIJ
+ // 获取输入栅格的波段数和数据类型
int nBands = srcDS->GetRasterCount();
if (nBands == 0) {
- qDebug() << "դûвݡ";
+ qDebug() << "输入栅格没有波段数据。";
GDALClose(srcDS);
return;
}
GDALDataType dataType = srcDS->GetRasterBand(1)->GetRasterDataType();
- // դC
+ // 创建输出栅格C
GDALDriver* driver = GetGDALDriverManager()->GetDriverByName("GTiff");
if (!driver) {
- qDebug() << "ȡGeoTIFF";
+ qDebug() << "无法获取GeoTIFF驱动。";
GDALClose(srcDS);
return;
}
@@ -496,16 +501,16 @@ void ResampleByReferenceRasterB(QString InrasterAPath, QString RefrasterBPath, Q
nullptr
);
if (!dstDS) {
- qDebug() << "դ" << OutrasterCPath;
+ qDebug() << "无法创建输出栅格:" << OutrasterCPath;
GDALClose(srcDS);
return;
}
- // դĵ任ͶӰ
+ // 设置输出栅格的地理变换和投影
dstDS->SetGeoTransform(geotransform);
dstDS->SetProjection(proj);
- // GDAL Warpѡ
+ // 配置GDAL Warp选项
GDALWarpOptions* psWO = GDALCreateWarpOptions();
psWO->hSrcDS = srcDS;
psWO->hDstDS = dstDS;
@@ -516,9 +521,9 @@ void ResampleByReferenceRasterB(QString InrasterAPath, QString RefrasterBPath, Q
psWO->panSrcBands[i] = i + 1;
psWO->panDstBands[i] = i + 1;
}
- psWO->eResampleAlg = GRA_NearestNeighbour; // ʹز
+ psWO->eResampleAlg = GRA_NearestNeighbour; // 使用最近邻重采样
- // ʼת
+ // 初始化坐标转换器
psWO->pfnTransformer = GDALGenImgProjTransform;
psWO->pTransformerArg = GDALCreateGenImgProjTransformer(
srcDS, GDALGetProjectionRef(srcDS),
@@ -526,17 +531,17 @@ void ResampleByReferenceRasterB(QString InrasterAPath, QString RefrasterBPath, Q
FALSE, 0.0, 1
);
if (!psWO->pTransformerArg) {
- qDebug() << "תʧܡ";
+ qDebug() << "创建坐标转换器失败。";
GDALDestroyWarpOptions(psWO);
GDALClose(srcDS);
GDALClose(dstDS);
return;
}
- // ִWarp
+ // 执行Warp操作
GDALWarpOperation oWarp;
if (oWarp.Initialize(psWO) != CE_None) {
- qDebug() << "ʼWarpʧܡ";
+ qDebug() << "初始化Warp操作失败。";
GDALDestroyGenImgProjTransformer(psWO->pTransformerArg);
GDALDestroyWarpOptions(psWO);
GDALClose(srcDS);
@@ -546,79 +551,80 @@ void ResampleByReferenceRasterB(QString InrasterAPath, QString RefrasterBPath, Q
CPLErr eErr = oWarp.ChunkAndWarpImage(0, 0, cols, rows);
if (eErr != CE_None) {
- qDebug() << "ִWarpʧܡ";
+ qDebug() << "执行Warp操作失败。";
}
- // Դ
+ // 清理资源
GDALDestroyGenImgProjTransformer(psWO->pTransformerArg);
GDALDestroyWarpOptions(psWO);
GDALClose(srcDS);
GDALClose(dstDS);
- qDebug() << "زɣѱ" << OutrasterCPath;
+ qDebug() << "重采样完成,结果已保存至:" << OutrasterCPath;
}
void cropRasterByLatLon(const char* inputFile, const char* outputFile, double minLon, double maxLon, double minLat, double maxLat) {
- // ʼ GDAL
+ // 初始化 GDAL 库
GDALAllRegister();
+ CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
- // դݼ
+ // 打开栅格数据集
GDALDataset* poDataset = (GDALDataset*)GDALOpen(inputFile, GA_ReadOnly);
if (poDataset == nullptr) {
- std::cerr << "Failed to open input raster." << std::endl;
+ qDebug() << "Failed to open input raster." ;
return;
}
- // ȡդݵĵοϢ
+ // 获取栅格数据的地理参考信息
double adfGeoTransform[6];
if (poDataset->GetGeoTransform(adfGeoTransform) != CE_None) {
- std::cerr << "Failed to get geotransform." << std::endl;
+ qDebug() << "Failed to get geotransform." ;
GDALClose(poDataset);
return;
}
- // ȡӰͶӰϢ
+ // 获取输入影像的投影信息
const char* projection = poDataset->GetProjectionRef();
- // ݾγȼüӦդ
+ // 根据经纬度计算出裁剪区域对应的栅格像素坐标
int xMin = (int)((minLon - adfGeoTransform[0]) / adfGeoTransform[1]);
int xMax = (int)((maxLon - adfGeoTransform[0]) / adfGeoTransform[1]);
int yMin = (int)((maxLat - adfGeoTransform[3]) / adfGeoTransform[5]);
int yMax = (int)((minLat - adfGeoTransform[3]) / adfGeoTransform[5]);
- // üĿդݼ
+ // 创建裁剪区域的目标栅格数据集
GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff");
if (poDriver == nullptr) {
- std::cerr << "Failed to get GTiff driver." << std::endl;
+ qDebug() << "Failed to get GTiff driver." ;
GDALClose(poDataset);
return;
}
- // դݼָߴ
+ // 创建输出栅格数据集,指定尺寸
int width = xMax - xMin;
int height = yMax - yMin;
GDALDataset* poOutDataset = poDriver->Create(outputFile, width, height, poDataset->GetRasterCount(), GDT_Float32, nullptr);
if (poOutDataset == nullptr) {
- std::cerr << "Failed to create output raster." << std::endl;
+ qDebug() << "Failed to create output raster." ;
GDALClose(poDataset);
return;
}
- // դͶӰϢ͵任
+ // 设置输出栅格的投影信息和地理变换
poOutDataset->SetProjection(projection);
double newGeoTransform[6] = { adfGeoTransform[0] + xMin * adfGeoTransform[1], adfGeoTransform[1], 0.0, adfGeoTransform[3] + yMin * adfGeoTransform[5], 0.0, adfGeoTransform[5] };
poOutDataset->SetGeoTransform(newGeoTransform);
- // ѭȡԴݲдĿݼ
+ // 循环读取源数据并写入目标数据集
for (int i = 0; i < poDataset->GetRasterCount(); ++i) {
GDALRasterBand* poBand = poDataset->GetRasterBand(i + 1);
GDALRasterBand* poOutBand = poOutDataset->GetRasterBand(i + 1);
- // ȡԴ
+ // 读取源数据
int* pData = new int[width * height];
poBand->RasterIO(GF_Read, xMin, yMin, width, height, pData, width, height, GDT_Int32, 0, 0);
- // дĿ
+ // 写入目标数据
poOutBand->RasterIO(GF_Write, 0, 0, width, height, pData, width, height, GDT_Int32, 0, 0);
delete[] pData;
@@ -626,28 +632,30 @@ void cropRasterByLatLon(const char* inputFile, const char* outputFile, double mi
qDebug() << "Raster cropped and saved to: " << outputFile;
- //
- GDALClose(poDataset);
- GDALClose(poOutDataset);
+ // 清理
+
+ GDALClose((GDALDatasetH)(GDALDatasetH)poDataset);
+ GDALClose((GDALDatasetH)(GDALDatasetH)poOutDataset);
+ GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
}
ErrorCode transformCoordinate(double x, double y, int sourceEPSG, int targetEPSG, Point2& p) {
- // Դϵԭʼϵ
+ // 创建源坐标系(原始坐标系)
OGRSpatialReference sourceSRS;
- sourceSRS.importFromEPSG(sourceEPSG); // ʹ EPSG ָϵ
+ sourceSRS.importFromEPSG(sourceEPSG); // 使用 EPSG 编码来指定坐标系
- // ĿϵĿϵ
+ // 创建目标坐标系(目标坐标系)
OGRSpatialReference targetSRS;
- targetSRS.importFromEPSG(targetEPSG); // WGS84 ϵ EPSG:4326
+ targetSRS.importFromEPSG(targetEPSG); // WGS84 坐标系 EPSG:4326
- // 任
+ // 创建坐标变换对象
OGRCoordinateTransformation* transform = OGRCreateCoordinateTransformation(&sourceSRS, &targetSRS);
if (transform == nullptr) {
qDebug() << "Failed to create coordinate transformation.";
return ErrorCode::FAIL;
}
- // ת
+ // 转换坐标
double transformedX = x;
double transformedY = y;
if (transform->Transform(1, &transformedX, &transformedY)) {
@@ -658,7 +666,7 @@ ErrorCode transformCoordinate(double x, double y, int sourceEPSG, int targetEPSG
qDebug() << "Coordinate transformation failed.";
}
- //
+ // 清理
delete transform;
p.x = transformedX;
p.y = transformedY;
@@ -668,23 +676,23 @@ ErrorCode transformCoordinate(double x, double y, int sourceEPSG, int targetEPSG
void transformRaster(const char* inputFile, const char* outputFile, int sourceEPSG, int targetEPSG) {
- // ʼ GDAL
+ // 初始化 GDAL 库
GDALAllRegister();
- // Դդļ
+ // 打开源栅格文件
GDALDataset* poSrcDS = (GDALDataset*)GDALOpen(inputFile, GA_ReadOnly);
if (poSrcDS == nullptr) {
qDebug() << "Failed to open input file:" << inputFile;
return;
}
- // ȡԴդĻϢ
+ // 获取源栅格的基本信息
int nXSize = poSrcDS->GetRasterXSize();
int nYSize = poSrcDS->GetRasterYSize();
int nBands = poSrcDS->GetRasterCount();
GDALDataType eDT = poSrcDS->GetRasterBand(1)->GetRasterDataType();
- // Ŀդļ
+ // 创建目标栅格文件
GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff");
if (poDriver == nullptr) {
qDebug() << "GTiff driver not available.";
@@ -699,7 +707,7 @@ void transformRaster(const char* inputFile, const char* outputFile, int sourceEP
return;
}
- // ĿդĿռοϵͳ
+ // 设置目标栅格的空间参考系统
OGRSpatialReference oSRS;
oSRS.importFromEPSG(targetEPSG);
@@ -708,10 +716,10 @@ void transformRaster(const char* inputFile, const char* outputFile, int sourceEP
poDstDS->SetProjection(pszWKT);
CPLFree(pszWKT);
- // Ԫ
+ // 复制元数据
poDstDS->SetMetadata(poSrcDS->GetMetadata());
- // ÿε
+ // 复制每个波段的数据
for (int i = 1; i <= nBands; ++i) {
GDALRasterBand* poSrcBand = poSrcDS->GetRasterBand(i);
GDALRasterBand* poDstBand = poDstDS->GetRasterBand(i);
@@ -726,7 +734,7 @@ void transformRaster(const char* inputFile, const char* outputFile, int sourceEP
CPLFree(pafScanline);
}
- // رݼ
+ // 关闭数据集
GDALClose(poSrcDS);
GDALClose(poDstDS);
@@ -735,81 +743,56 @@ void transformRaster(const char* inputFile, const char* outputFile, int sourceEP
void resampleRaster(const char* inputRaster, const char* outputRaster, double targetPixelSizeX, double targetPixelSizeY) {
- // ʼGDAL
+ // 初始化GDAL
GDALAllRegister();
- // դļ
+ // 打开输入栅格文件
GDALDataset* poDataset = (GDALDataset*)GDALOpen(inputRaster, GA_ReadOnly);
if (poDataset == nullptr) {
- std::cerr << "Failed to open raster file." << std::endl;
+ qDebug() << "Failed to open raster file." ;
return;
}
- // ȡԭʼդĿռο
+ // 获取原始栅格的空间参考
double adfGeoTransform[6];
if (poDataset->GetGeoTransform(adfGeoTransform) != CE_None) {
- std::cerr << "Failed to get geotransform." << std::endl;
+ qDebug() << "Failed to get geotransform." ;
GDALClose(poDataset);
return;
}
- // ȡԭʼդijߴ
+ // 获取原始栅格的尺寸
int nXSize = poDataset->GetRasterXSize();
int nYSize = poDataset->GetRasterYSize();
- // Ŀդijߴ
- double targetXSize = (adfGeoTransform[1] * nXSize) / targetPixelSizeX;
- double targetYSize = (adfGeoTransform[5] * nYSize) / targetPixelSizeY;
+ // 计算目标栅格的尺寸
+ double targetXSize = ceil((adfGeoTransform[1] * nXSize) / targetPixelSizeX);
+ double targetYSize = ceil(std::abs((adfGeoTransform[5] * nYSize) / targetPixelSizeY));
- // Ŀݼդ
+ // 创建目标数据集(输出栅格)
GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff");
if (poDriver == nullptr) {
- std::cerr << "Failed to get GTiff driver." << std::endl;
+ qDebug() << "Failed to get GTiff driver." ;
GDALClose(poDataset);
return;
}
- // ݼ
- GDALDataset* poOutDataset = poDriver->Create(outputRaster, (int)targetXSize, (int)targetYSize, poDataset->GetRasterCount(), GDT_Float32, nullptr);
- if (poOutDataset == nullptr) {
- std::cerr << "Failed to create output raster." << std::endl;
- GDALClose(poDataset);
- return;
- }
-
- // ݼĵ任ϵ
+ // 设置输出数据集的地理变换(坐标系)
double targetGeoTransform[6] = {
adfGeoTransform[0], targetPixelSizeX, 0, adfGeoTransform[3], 0, -targetPixelSizeY
};
- poOutDataset->SetGeoTransform(targetGeoTransform);
-
- // ݼͶӰϢ
- poOutDataset->SetProjection(poDataset->GetProjectionRef());
-
- // ز
- for (int i = 0; i < poDataset->GetRasterCount(); i++) {
- GDALRasterBand* poBand = poDataset->GetRasterBand(i + 1);
- GDALRasterBand* poOutBand = poOutDataset->GetRasterBand(i + 1);
-
- // ʹGDALزѡһʵزʽ
- poOutBand->RasterIO(GF_Write, 0, 0, (int)targetXSize, (int)targetYSize,
- nullptr, (int)targetXSize, (int)targetYSize,
- poBand->GetRasterDataType(), 0, 0, nullptr);
- }
-
- // رݼ
- GDALClose(poDataset);
- GDALClose(poOutDataset);
-
+ GDALClose((GDALDatasetH)(GDALDatasetH)poDataset);
+ GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
+ ResampleGDAL(inputRaster, outputRaster, targetGeoTransform, targetXSize, targetYSize,GRA_Bilinear);
qDebug() << "Resampling completed.";
}
std::shared_ptr GetCenterPointInRaster(QString filepath)
{
qDebug() << "============= GetCenterPointInRaster ======================";
- // QTextCodec* codec = QTextCodec::codecForLocale(); // ȡϵͳĬϱı
- // QByteArray byteArray = codec->fromUnicode(filepath); // QStringתΪQByteArray
- //,ӦûԶͷ const char* charArray = byteArray.constData(); //
- // ȡQByteArrayconst char*ָ
+ // QTextCodec* codec = QTextCodec::codecForLocale(); // 获取系统默认编码的文本编解码器
+ // QByteArray byteArray = codec->fromUnicode(filepath); // 将QString转换为QByteArray
+ //,这个应该会自动释放 const char* charArray = byteArray.constData(); //
+ // 获取QByteArray的const char*指针
GDALAllRegister();
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
@@ -817,7 +800,7 @@ std::shared_ptr GetCenterPointInRaster(QString filepath)
GDALDataset* poDataset = (GDALDataset*)GDALOpen(filepath.toUtf8().data(), GA_ReadOnly);
if (nullptr == poDataset || NULL == poDataset) {
qDebug() << "Could not open dataset";
- return nullptr; // ʾȡʧ
+ return nullptr; // 表示读取失败
}
double x, y, z;
@@ -834,7 +817,7 @@ std::shared_ptr GetCenterPointInRaster(QString filepath)
double dfWidth = poDataset->GetRasterXSize();
double dfHeight = poDataset->GetRasterYSize();
- // ĵ꣨꣩
+ // 计算中心点坐标(像素坐标)
double dfCenterX = adfGeoTransform[0] + dfWidth * adfGeoTransform[1] / 2.0
+ dfHeight * adfGeoTransform[2] / 2.0;
double dfCenterY = adfGeoTransform[3] + dfWidth * adfGeoTransform[4] / 2.0
@@ -851,7 +834,7 @@ std::shared_ptr GetCenterPointInRaster(QString filepath)
y = dfCenterY;
}
else {
- // ǵϵתWGS84
+ // 如果不是地理坐标系,转换到WGS84
OGRSpatialReference oSRS_WGS84;
oSRS_WGS84.SetWellKnownGeogCS("WGS84");
@@ -899,10 +882,10 @@ std::shared_ptr GetCenterPointInRaster(QString filepath)
long GetEPSGFromRasterFile(QString filepath)
{
qDebug() << "============= GetEPSGFromRasterFile ======================";
- // QTextCodec* codec = QTextCodec::codecForLocale(); // ȡϵͳĬϱı
- // QByteArray byteArray = codec->fromUnicode(filepath); // QStringתΪQByteArray
- //,ӦûԶͷ const char* charArray = byteArray.constData(); //
- // ȡQByteArrayconst char*ָ
+ // QTextCodec* codec = QTextCodec::codecForLocale(); // 获取系统默认编码的文本编解码器
+ // QByteArray byteArray = codec->fromUnicode(filepath); // 将QString转换为QByteArray
+ //,这个应该会自动释放 const char* charArray = byteArray.constData(); //
+ // 获取QByteArray的const char*指针
{
if (QFile(filepath).exists()) {
@@ -913,9 +896,9 @@ long GetEPSGFromRasterFile(QString filepath)
}
GDALAllRegister();
- CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // עGDAL
+ CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // 注册GDAL驱动
// qDebug()<GetProjectionRef();
qDebug() << QString::fromUtf8(pszProjection);
- // SpatialReference
+ // 创建SpatialReference对象
OGRSpatialReference oSRS;
if (oSRS.importFromWkt((char**)&pszProjection) != OGRERR_NONE) {
qDebug() << ("Error: Unable to import projection information.\n");
@@ -945,7 +928,7 @@ long GetEPSGFromRasterFile(QString filepath)
return -1;
}
- long epsgCode = atoi(epscodestr); // ȡEPSG
+ long epsgCode = atoi(epscodestr); // 获取EPSG代码
if (epsgCode != 0) {
GDALClose(poDataset);
@@ -963,14 +946,16 @@ long GetEPSGFromRasterFile(QString filepath)
-long getProjectEPSGCodeByLon_Lat(double long, double lat, ProjectStripDelta stripState)
+long getProjectEPSGCodeByLon_Lat(double lon, double lat, ProjectStripDelta stripState)
{
long EPSGCode = 0;
switch (stripState) {
case ProjectStripDelta::Strip_3: {
+ EPSGCode = getProjectEPSGCodeByLon_Lat_inStrip3(lon, lat);
break;
};
case ProjectStripDelta::Strip_6: {
+ EPSGCode = getProjectEPSGCodeByLon_Lat_inStrip6(lon, lat);
break;
}
default: {
@@ -983,16 +968,16 @@ long getProjectEPSGCodeByLon_Lat(double long, double lat, ProjectStripDelta stri
}
long getProjectEPSGCodeByLon_Lat_inStrip3(double lon, double lat)
{
- // EPSG 4534 ~ 4554 3 ȴ
- // жǷ йΧ
- // ľȷΧ 75E ~ 135E ʵʷΧ 73.5E ~ 136.5E,
- // γȷΧ 3N ~ 54Nſ 0N~ 60N
- if (73.5 <= lon && lon <= 136.5 && 0 <= lat && lat <= 60) { // й
+ // EPSG 4534 ~ 4554 3 度带
+ // 首先判断是否是在 中国带宽范围
+ // 中心经度范围 :75E ~ 135E 实际范围 73.5E ~ 136.5E,
+ // 纬度范围 3N ~ 54N,放宽到 0N~ 60N
+ if (73.5 <= lon && lon <= 136.5 && 0 <= lat && lat <= 60) { // 中国境内
long code = trunc((lon - 73.5) / 3) + 4534;
return code;
}
- else { // й ʹ ˹
- bool isSouth = lat < 0; // жϱΪʾʵӦÿҪϸµ
+ else { // 非中国境内 使用 高斯克吕格
+ bool isSouth = lat < 0; // 简单判断南北半球,这里仅为示例,实际应用可能需要更细致的逻辑
long prefix = isSouth ? 327000 : 326000;
// std::string prefix = isSouth ? "327" : "326";
lon = fmod(lon + 360.0, 360.0);
@@ -1004,18 +989,18 @@ long getProjectEPSGCodeByLon_Lat_inStrip3(double lon, double lat)
}
long getProjectEPSGCodeByLon_Lat_inStrip6(double lon, double lat)
{
- // EPSG 4502 ~ 4512 6ȴ
- // жǷ йΧ
- // ľȷΧ 75E ~ 135E ʵʷΧ 72.0E ~ 138E,
- // γȷΧ 3N ~ 54Nſ 0N~ 60N
- if (73.5 <= lon && lon <= 136.5 && 0 <= lat && lat <= 60) { // й
+ // EPSG 4502 ~ 4512 6度带
+ // 首先判断是否是在 中国带宽范围
+ // 中心经度范围 :75E ~ 135E 实际范围 72.0E ~ 138E,
+ // 纬度范围 3N ~ 54N,放宽到 0N~ 60N
+ if (73.5 <= lon && lon <= 136.5 && 0 <= lat && lat <= 60) { // 中国境内
long code = trunc((lon - 72.0) / 6) + 4502;
return code;
}
- else { // й ʹ UTM// ȷţ6ȴ1ʼ60ÿ6һ
+ else { // 非中国境内 使用 UTM// 确定带号,6度带从1开始到60,每6度一个带
int zone = static_cast((lon + 180.0) / 6.0) + 1;
- bool isSouth = lon < 0; // жǷϰ
- long epsgCodeBase = isSouth ? 32700 : 32600; // EPSG
+ bool isSouth = lon < 0; // 判断是否在南半球
+ long epsgCodeBase = isSouth ? 32700 : 32600; // 计算EPSG代码
long prefix = static_cast(epsgCodeBase + zone);
return prefix;
}
@@ -1027,13 +1012,13 @@ QString GetProjectionNameFromEPSG(long epsgCode)
qDebug() << "============= GetProjectionNameFromEPSG ======================";
OGRSpatialReference oSRS;
- // EPSG
+ // 设置EPSG代码
if (oSRS.importFromEPSG(epsgCode) != OGRERR_NONE) {
qDebug() << "epsgcode not recognition";
return "";
}
- // ȡϵƣ
+ // 获取并输出坐标系的描述(名称)
const char* pszName = oSRS.GetAttrValue("GEOGCS");
if (pszName) {
qDebug() << "Coordinate system name for EPSG " + QString::number(epsgCode)
@@ -1046,19 +1031,19 @@ QString GetProjectionNameFromEPSG(long epsgCode)
}
// char* wkt = NULL;
- // // תΪWKTʽ
+ // // 转换为WKT格式
// oSRS.exportToWkt(&wkt);
//
// qDebug() << wkt;
//
- // // WKTнͶӰƣʵʿҪӵȷȡ
+ // // 从WKT中解析投影名称,这里简化处理,实际可能需要更复杂的逻辑来准确提取名称
// std::string wktStr(wkt);
- // long start = wktStr.find("PROJCS[\"") + 8; // ҵ"PROJCS["ĵһ˫λ
- // // startλÿʼһ˫ţ֮ݼΪͶӰ
+ // long start = wktStr.find("PROJCS[\"") + 8; // 找到"PROJCS["后的第一个双引号位置
+ // // 从start位置开始找下一个双引号,这之间的内容即为投影名称
// int end = wktStr.find('\"', start);
// QString projName = QString::fromStdString(wktStr.substr(start, end - start));
//
- // // ͷWKTַڴ
+ // // 释放WKT字符串内存
// CPLFree(wkt);
// return projName;
@@ -1111,11 +1096,11 @@ int ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int
char* pszSrcWKT = NULL;
pszSrcWKT = const_cast(pDSrc->GetProjectionRef());
- // ���û��ͶӰ����?���һ�?1?7
+ // 锟斤拷锟矫伙拷锟酵队帮拷锟斤拷锟轿?拷锟斤拷锟揭伙拷锟?1锟?7
if (strlen(pszSrcWKT) <= 0) {
OGRSpatialReference oSRS;
oSRS.importFromEPSG(4326);
- // oSRS.SetUTM(50, true); //������ ����120��
+ // oSRS.SetUTM(50, true); //锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷120锟斤拷
// oSRS.SetWellKnownGeogCS("WGS84");
oSRS.exportToWkt(&pszSrcWKT);
}
@@ -1124,7 +1109,7 @@ int ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int
hTransformArg = GDALCreateGenImgProjTransformer((GDALDatasetH)pDSrc, pszSrcWKT, NULL, pszSrcWKT,
FALSE, 0.0, 1);
qDebug() << "no proj " << Qt::endl;
- //(û��ͶӰ��Ӱ��������߲�??1?7)
+ //(没锟斤拷投影锟斤拷影锟斤拷锟斤拷锟斤拷锟斤拷卟锟酵?拷锟?1锟?7)
if (hTransformArg == NULL) {
GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc);
return -3;
@@ -1152,8 +1137,8 @@ int ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int
pDDst->SetGeoTransform(gt);
GDALWarpOptions* psWo = GDALCreateWarpOptions();
- CPLSetConfigOption("GDAL_NUM_THREADS", "ALL_CPUS"); // ʹпõCPU
- CPLSetConfigOption("GDAL_CACHEMAX", "4000"); // ûСΪ500MB
+ CPLSetConfigOption("GDAL_NUM_THREADS", "ALL_CPUS"); // 使用所有可用的CPU核心
+ CPLSetConfigOption("GDAL_CACHEMAX", "4000"); // 设置缓存大小为500MB
// psWo->papszWarpOptions = CSLDuplicate(NULL);
psWo->eWorkingDataType = dataType;
psWo->eResampleAlg = eResample;
@@ -1361,7 +1346,7 @@ int alignRaster(QString inputPath, QString referencePath, QString outputPath, GD
-/** 2025.03.25 ĺ Eigenʹ****************************/
+/** 2025.03.25 下面的函数存在 Eigen使用****************************/
@@ -1392,8 +1377,8 @@ int saveMatrixXcd2TiFF(Eigen::MatrixXcd data, QString out_tiff_path)
Eigen::MatrixXd gt = Eigen::MatrixXd::Zero(2, 3);
gdalImage image_tiff =
- CreategdalImage(out_tiff_path, rows, cols, 2, gt, "", false, true); // עﱣ
- // ļ
+ CreategdalImage(out_tiff_path, rows, cols, 2, gt, "", false, true); // 注意这里保留仿真结果
+ // 保存二进制文件
Eigen::MatrixXd real_img = data.array().real();
Eigen::MatrixXd imag_img = data.array().imag();
image_tiff.saveImage(real_img, 0, 0, 1);
@@ -1430,23 +1415,30 @@ void clipRaster(QString inRasterPath, QString outRasterPath, long minRow, long m
ErrorCode DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QString demsloperPath)
{
- gdalImage demds(dempath);
- gdalImage demxyz = CreategdalImage(demxyzpath, demds.height, demds.width, 3, demds.gt, demds.projection, true, true);// X,Y,Z
+ QString DEMPath = dempath;
+ QString XYZPath = demxyzpath;
+ QString SLOPERPath = demsloperPath;
- // ֿ㲢תΪXYZ
+
+
+ gdalImage demds(DEMPath);
+ gdalImage demxyz = CreategdalImageDouble(XYZPath, demds.height, demds.width, 3, demds.gt, demds.projection, true, true, false);// X,Y,Z
+
+ // 分块计算并转换为XYZ
+
+ //Eigen::MatrixXd demArr = demds.getData(0, 0, demds.height, demds.width, 1);
+ //Eigen::MatrixXd demR = demArr;
- Eigen::MatrixXd demArr = demds.getData(0, 0, demds.height, demds.width, 1);
- Eigen::MatrixXd demR = demArr;
- Landpoint LandP{ 0,0,0 };
- Point3 GERpoint{ 0,0,0 };
double R = 0;
double dem_row = 0, dem_col = 0, dem_alt = 0;
- long line_invert = 1000;
+ long line_invert = Memory1MB / 8.0 / demds.width * 1000;
+
+
- double rowidx = 0;
- double colidx = 0;
for (int max_rows_ids = 0; max_rows_ids < demds.height; max_rows_ids = max_rows_ids + line_invert) {
+ qDebug() << "dem -> XYZ [" << max_rows_ids*100.0/ demds.height << "] %" ;
+
Eigen::MatrixXd demdata = demds.getData(max_rows_ids, 0, line_invert, demds.width, 1);
Eigen::MatrixXd xyzdata_x = demdata.array() * 0;
Eigen::MatrixXd xyzdata_y = demdata.array() * 0;
@@ -1455,12 +1447,17 @@ ErrorCode DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QStri
int datarows = demdata.rows();
int datacols = demdata.cols();
+#pragma omp parallel for
for (int i = 0; i < datarows; i++) {
+ Landpoint LandP{ 0,0,0 };
+ Point3 GERpoint{ 0,0,0 };
+ double rowidx = 0;
+ double colidx = 0;
for (int j = 0; j < datacols; j++) {
rowidx = i + max_rows_ids;
colidx = j;
- demds.getLandPoint(rowidx, colidx, demdata(i, j), LandP); // ȡ
- LLA2XYZ(LandP, GERpoint); // γתΪϵ
+ demds.getLandPoint(rowidx, colidx, demdata(i, j), LandP); // 获取地理坐标
+ LLA2XYZ(LandP, GERpoint); // 经纬度转换为地心坐标系
xyzdata_x(i, j) = GERpoint.x;
xyzdata_y(i, j) = GERpoint.y;
xyzdata_z(i, j) = GERpoint.z;
@@ -1469,35 +1466,39 @@ ErrorCode DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QStri
demxyz.saveImage(xyzdata_x, max_rows_ids, 0, 1);
demxyz.saveImage(xyzdata_y, max_rows_ids, 0, 2);
demxyz.saveImage(xyzdata_z, max_rows_ids, 0, 3);
+
}
- //
- gdalImage demsloperxyz = CreategdalImage(demsloperPath, demds.height, demds.width, 4, demds.gt, demds.projection, true, true);// X,Y,Z,cosangle
+ // 计算坡向角
+
+
+
+ gdalImage demsloperxyz = CreategdalImageDouble(SLOPERPath, demds.height, demds.width, 4, demds.gt, demds.projection, true, true, false);// X,Y,Z,cosangle
line_invert = 1000;
long start_ids = 0;
long dem_rows = 0, dem_cols = 0;
-
for (start_ids = 1; start_ids < demds.height; start_ids = start_ids + line_invert) {
Eigen::MatrixXd demdata = demds.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 1);
long startlineid = start_ids;
+
Eigen::MatrixXd demsloper_x = demsloperxyz.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 1);
Eigen::MatrixXd demsloper_y = demsloperxyz.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 2);
Eigen::MatrixXd demsloper_z = demsloperxyz.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 3);
Eigen::MatrixXd demsloper_angle = demsloperxyz.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 4);
- Landpoint p0, p1, p2, p3, p4, pslopeVector, pp;
- Vector3D slopeVector;
-
- dem_rows = demsloper_y.rows();
- dem_cols = demsloper_y.cols();
- double sloperAngle = 0;
- Vector3D Zaxis = { 0,0,1 };
-
- double rowidx = 0, colidx = 0;
+ dem_rows = demsloper_x.rows();
+ dem_cols = demsloper_x.cols();
+#pragma omp parallel for
for (long i = 1; i < dem_rows - 1; i++) {
+ Landpoint p0, p1, p2, p3, p4, pslopeVector, pp;
+ Vector3D slopeVector;
+ double sloperAngle = 0;
+ Vector3D Zaxis = { 0,0,1 };
+
+ double rowidx = 0, colidx = 0;
for (long j = 1; j < dem_cols - 1; j++) {
rowidx = i + startlineid;
colidx = j;
@@ -1507,27 +1508,31 @@ ErrorCode DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QStri
demds.getLandPoint(rowidx + 1, colidx, demdata(i + 1, j), p3);
demds.getLandPoint(rowidx, colidx + 1, demdata(i, j + 1), p4);
- pslopeVector = getSlopeVector(p0, p1, p2, p3, p4); // ʸ
+ pslopeVector = getSlopeVector(p0, p1, p2, p3, p4); // 地面坡向矢量
slopeVector = { pslopeVector.lon,pslopeVector.lat,pslopeVector.ati };
pp = LLA2XYZ(p0);
Zaxis.x = pp.lon;
Zaxis.y = pp.lat;
Zaxis.z = pp.ati;
- sloperAngle = getCosAngle(slopeVector, Zaxis); //
+ sloperAngle = getCosAngle(slopeVector, Zaxis); // 地面坡向角
demsloper_x(i, j) = slopeVector.x;
demsloper_y(i, j) = slopeVector.y;
demsloper_z(i, j) = slopeVector.z;
demsloper_angle(i, j) = sloperAngle;
+
}
}
+
demsloperxyz.saveImage(demsloper_x, start_ids - 1, 0, 1);
demsloperxyz.saveImage(demsloper_y, start_ids - 1, 0, 2);
demsloperxyz.saveImage(demsloper_z, start_ids - 1, 0, 3);
demsloperxyz.saveImage(demsloper_angle, start_ids - 1, 0, 4);
+
}
+
return ErrorCode::SUCCESS;
}
@@ -1549,7 +1554,7 @@ void CreateSARIntensityByLookTable(QString IntensityRasterPath,
Eigen::MatrixXd SARData = SARIntensity.getData(0, 0, SARIntensity.height, SARIntensity.width, 1);
SARData = SARData.array() * 0;
- // ֿ鴦
+ // 分块处理
for (int yOff = 0; yOff < looktableds.height; yOff += blockYSize)
{
processBarShow(yOff, looktableds.height);
@@ -1575,9 +1580,293 @@ void CreateSARIntensityByLookTable(QString IntensityRasterPath,
}
-/* ĺᵼ±Eigen bugأŲ飬̫ʱ䣬ҲһŲ
+
+
+
+
+
+
+/**
+* @brief 将VRT文件转换为ENVI格式(生成.dat和.hdr文件)
+* @param inputVrtPath 输入VRT文件路径
+* @param outputEnviPath 输出ENVI数据文件路径(不含扩展名,自动生成.dat和.hdr)
+* @param papszOptions GDAL创建选项(如压缩参数、存储顺序等,默认NULL)
+* @return 成功返回true,失败返回false
+*/
+bool ConvertVrtToEnvi(QString vrtPath, QString outPath) {
+
+ GDALAllRegister();
+ CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // 注绞斤拷斤拷锟?1锟?7
+ CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
+
+ const char* inputVrtPath = vrtPath.toUtf8().constData();
+ const char* outputEnviPath = outPath.toUtf8().constData();
+
+ // 注册所有GDAL驱动[7](@ref)
+ GDALAllRegister();
+
+ // 打开输入VRT文件[1,3](@ref)
+ GDALDataset* poVRTDataset = (GDALDataset*)GDALOpen(inputVrtPath, GA_ReadOnly);
+ if (!poVRTDataset) {
+ qDebug() << "错误:无法打开VRT文件 " << inputVrtPath ;
+ return false;
+ }
+
+ // 获取ENVI驱动[4,7](@ref)
+ GDALDriver* poENVIDriver = GetGDALDriverManager()->GetDriverByName("ENVI");
+ if (!poENVIDriver) {
+ qDebug() << "错误:ENVI驱动未加载" ;
+ GDALClose(poVRTDataset);
+ return false;
+ }
+
+ // 构造输出文件名(强制添加.dat后缀)[4](@ref)
+ std::string outputPath = std::string(outputEnviPath) + ".dat";
+
+ // 执行格式转换(自动生成.hdr头文件)[4,7](@ref)
+ GDALDataset* poENVIDataset = poENVIDriver->CreateCopy(
+ outputPath.c_str(), // 输出路径
+ poVRTDataset, // 输入数据集
+ FALSE, // 非严格模式(允许格式调整)
+ nullptr, // 用户自定义选项(如压缩参数)
+ nullptr, nullptr // 进度条和参数(暂不启用)
+ );
+
+ // 检查转换结果
+ bool success = (poENVIDataset != nullptr);
+ if (!success) {
+ qDebug() << "错误:ENVI文件创建失败" ;
+ }
+ else {
+ GDALClose(poENVIDataset);
+ }
+
+ // 关闭输入数据集
+ GDALClose(poVRTDataset);
+ return success;
+}
+
+
+
+
+// 遥感类
+ErrorCode ResampleDEM(QString indemPath, QString outdemPath, double gridx, double gridy)
+{
+ double gridlat = gridy / 110000.0;
+ double gridlon = gridx / 100000.0;
+
+ long espgcode = GetEPSGFromRasterFile(indemPath.toUtf8().constData());
+ if (espgcode == 4326) {
+ resampleRaster(indemPath.toUtf8().constData(), outdemPath.toUtf8().constData(), gridlon, gridlat);
+ return ErrorCode::SUCCESS;
+ }
+ else {
+ QMessageBox::warning(nullptr, u8"警告", u8"请输入WGS84坐标的DEM影像");
+ return ErrorCode::FAIL;
+ }
+}
+
+void BASECONSTVARIABLEAPI CloseAllGDALRaster()
+{
+ GDALDestroyDriverManager();
+ return ;
+}
+
+
+
+ErrorCode Complex2AmpRaster(QString inComplexPath, QString outRasterPath)
+{
+ gdalImageComplex inimg(inComplexPath);
+ gdalImage ampimg = CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true);
+
+ long blocklines = Memory1GB * 2 / 8 / inimg.width;
+ blocklines = blocklines < 100 ? 100 : blocklines;
+
+ long startrow = 0;
+ for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) {
+
+ Eigen::MatrixXd imgArrb1 = ampimg.getData(startrow, 0, blocklines, inimg.width, 1);
+ Eigen::MatrixXcd imgArr = inimg.getDataComplex(startrow, 0, blocklines, inimg.width, 1);
+ imgArrb1 = imgArr.array().abs();
+ ampimg.saveImage(imgArrb1, startrow, 0, 1);
+ }
+ qDebug() << u8"影像写入到:" << outRasterPath;
+ return ErrorCode::SUCCESS;
+}
+
+ErrorCode Complex2PhaseRaster(QString inComplexPath, QString outRasterPath)
+{
+ gdalImageComplex inimg(inComplexPath);
+ gdalImage ampimg = CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true);
+
+
+ long blocklines = Memory1GB * 2 / 8 / inimg.width;
+ blocklines = blocklines < 100 ? 100 : blocklines;
+ Eigen::MatrixXd imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width);
+ Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width);
+
+ long startrow = 0;
+ for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) {
+
+ imgArrb1 = ampimg.getData(startrow, 0, blocklines, inimg.width, 1);
+ imgArr = inimg.getData(startrow, 0, blocklines, inimg.width, 1);
+ imgArrb1 = imgArr.array().arg();
+ ampimg.saveImage(imgArrb1, startrow, 0, 1);
+ }
+ qDebug() << "影像写入到:" << outRasterPath;
+ return ErrorCode::SUCCESS;
+}
+
+ErrorCode Complex2dBRaster(QString inComplexPath, QString outRasterPath)
+{
+ gdalImageComplex inimg(inComplexPath);
+ gdalImage ampimg = CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true);
+
+
+ long blocklines = Memory1GB * 2 / 8 / inimg.width;
+ blocklines = blocklines < 100 ? 100 : blocklines;
+ Eigen::MatrixXd imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width);
+ Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width);
+
+ long startrow = 0;
+ for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) {
+
+ imgArrb1 = ampimg.getData(startrow, 0, blocklines, inimg.width, 1);
+ imgArr = inimg.getData(startrow, 0, blocklines, inimg.width, 1);
+ imgArrb1 = imgArr.array().abs().log10() * 20.0;
+ ampimg.saveImage(imgArrb1, startrow, 0, 1);
+ }
+ qDebug() << "影像写入到:" << outRasterPath;
+ return ErrorCode::SUCCESS;
+}
+
+
+
+ErrorCode BASECONSTVARIABLEAPI amp2dBRaster(QString inPath, QString outRasterPath)
+{
+ gdalImage inimg(inPath);
+ gdalImage dBimg = CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true);
+
+ long blocklines = Memory1GB * 2 / 8 / inimg.width;
+ blocklines = blocklines < 100 ? 100 : blocklines;
+ Eigen::MatrixXd imgArrdB = Eigen::MatrixXd::Zero(blocklines, dBimg.width);
+ Eigen::MatrixXd imgArr = Eigen::MatrixXd::Zero(blocklines, inimg.width);
+
+ long startrow = 0;
+ for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) {
+
+ imgArrdB = dBimg.getData(startrow, 0, blocklines, inimg.width, 1);
+ imgArr = inimg.getData(startrow, 0, blocklines, inimg.width, 1);
+ imgArrdB = imgArr.array().log10() * 20.0;
+ dBimg.saveImage(imgArrdB, startrow, 0, 1);
+ }
+ qDebug() << "影像写入到:" << outRasterPath;
+ return ErrorCode::SUCCESS;
+}
+
+
+
+void MultiLookRaster(QString inRasterPath, QString outRasterPath, long looklineNumrow, long looklineNumCol)
+{
+ gdalImage inRaster(inRasterPath);
+
+ int outRows = inRaster.height / looklineNumrow;
+ int outCols = inRaster.width / looklineNumCol;
+ int bandnum = 1;
+ QString project = inRaster.projection;
+ Eigen::MatrixXd inRasterGt = inRaster.gt;
+ GDALDataType datetype = inRaster.getDataType();
+
+ gdalImage outRaster = CreategdalImage(outRasterPath, outRows, outCols, 1, inRasterGt, project, true, true, true, datetype);
+
+ Eigen::MatrixXd inRasterArr = inRaster.getData(0, 0, inRaster.height, inRaster.width, 1);
+ Eigen::MatrixXd outRasterArr = outRaster.getData(0, 0, outRows, outCols, 1);
+
+
+ // 多视处理
+#pragma omp parallel for collapse(2)
+ for (int row = 0; row < outRows; ++row) {
+ for (int col = 0; col < outCols; ++col) {
+ // 计算输入矩阵的窗口位置[2,3](@ref)
+ const int inputRow = row * looklineNumrow;
+ const int inputCol = col * looklineNumCol;
+
+ // 动态计算实际窗口大小(处理边界情况)[3](@ref)
+ const int actualRows = (row == outRows - 1) ?
+ (inRaster.height - inputRow) : looklineNumrow;
+ const int actualCols = (col == outCols - 1) ?
+ (inRaster.width - inputCol) : looklineNumCol;
+
+ // 提取当前窗口数据块[7](@ref)
+ Eigen::MatrixXd window = inRasterArr.block(inputRow, inputCol, actualRows, actualCols);
+
+ // 计算多视平均值(自动处理数据类型转换)[2,7](@ref)
+ double sum = 0.0;
+ if constexpr (std::is_integral_v) {
+ sum = window.cast().sum(); // 整型数据转换为双精度计算
+ }
+ else {
+ sum = window.sum();
+ }
+ outRasterArr(row, col) = sum / (actualRows * actualCols);
+ }
+ }
+
+ // 可选:处理残留边界(当输入尺寸不是整数倍时)
+ if ((inRaster.height % looklineNumrow != 0) || (inRaster.width % looklineNumCol != 0)) {
+ // 底部边界处理[3](@ref)
+ const int residualRowStart = outRows * looklineNumrow;
+ const int residualRowSize = inRaster.height - residualRowStart;
+ if (residualRowSize > 0) {
+#pragma omp parallel for
+ for (int col = 0; col < outCols; ++col) {
+ const int inputCol = col * looklineNumCol;
+ const int actualCols = (col == outCols - 1) ?
+ (inRaster.width - inputCol) : looklineNumCol;
+
+ Eigen::MatrixXd window = inRasterArr.block(residualRowStart, inputCol,
+ residualRowSize, actualCols);
+ outRasterArr(outRows - 1, col) = window.mean();
+ }
+ }
+
+ // 右侧边界处理[3](@ref)
+ const int residualColStart = outCols * looklineNumCol;
+ const int residualColSize = inRaster.width - residualColStart;
+ if (residualColSize > 0) {
+#pragma omp parallel for
+ for (int row = 0; row < outRows; ++row) {
+ const int inputRow = row * looklineNumrow;
+ const int actualRows = (row == outRows - 1) ?
+ (inRaster.height - inputRow) : looklineNumrow;
+
+ Eigen::MatrixXd window = inRasterArr.block(inputRow, residualColStart,
+ actualRows, residualColSize);
+ outRasterArr(row, outCols - 1) = window.mean();
+ }
+ }
+ }
+
+ // 保存结果
+ outRaster.saveImage(outRasterArr, 0, 0, 1);
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+/* 启动下面的函数,会导致编译器错误,可能与Eigen 库 本身的bug相关,不建议排查,太费时间,而且不一定能排查出来
*
-***
+***
Eigen::Matrix ReadComplexMatrixData(int start_line, int width, int line_num,
std::shared_ptr rasterDataset, GDALDataType gdal_datatype)
@@ -1601,7 +1890,7 @@ Eigen::Matrix ReadCompl
}
bool _flag = false;
Eigen::Matrix data_mat(
- line_num * width, 2); // ǿ
+ line_num * width, 2); // 必须强制行优先
if (gdal_datatype == GDT_Byte) {
Eigen::MatrixX real_mat(line_num * width, 1);
Eigen::MatrixX imag_mat(line_num * width, 1);
@@ -1751,14 +2040,14 @@ Eigen::Matrix ReadCompl
}
else {
}
- //
+ // 保存数据
if (_flag) {
return data_mat;
}
else {
return Eigen::Matrix(
- 0, 0); // ǿ;
+ 0, 0); // 必须强制行优先;
}
}
@@ -1767,10 +2056,10 @@ ReadMatrixDoubleData(int start_line, int width, int line_num,
std::shared_ptr rasterDataset, GDALDataType gdal_datatype,
int band_idx)
{
- // 飬ʹeigen о㣬ټ
+ // 构建矩阵块,使用eigen 进行矩阵计算,加速计算
bool _flag = false;
Eigen::Matrix data_mat(
- line_num * width, 1); // ǿ
+ line_num * width, 1); // 必须强制行优先
if (gdal_datatype == GDT_Byte) {
Eigen::MatrixX real_mat(line_num * width, 1);
rasterDataset->GetRasterBand(band_idx)->RasterIO(GF_Read, 0, start_line, width, line_num,
diff --git a/BaseCommonLibrary/ToolAbstract/QToolAbstract.cpp b/BaseCommonLibrary/ToolAbstract/QToolAbstract.cpp
index 302abc3..a20a9c5 100644
--- a/BaseCommonLibrary/ToolAbstract/QToolAbstract.cpp
+++ b/BaseCommonLibrary/ToolAbstract/QToolAbstract.cpp
@@ -32,5 +32,10 @@ QString QToolAbstract::getToolName()
}
void QToolAbstract::excute()
+{
+ this->run();
+}
+
+void QToolAbstract::run()
{
}
diff --git a/BaseCommonLibrary/ToolAbstract/QToolAbstract.h b/BaseCommonLibrary/ToolAbstract/QToolAbstract.h
index 5f00324..fda74f6 100644
--- a/BaseCommonLibrary/ToolAbstract/QToolAbstract.h
+++ b/BaseCommonLibrary/ToolAbstract/QToolAbstract.h
@@ -27,6 +27,8 @@ public slots:
public:
QVector toolPath;
QString toolname;
+public:
+ virtual void run();
};
/*
diff --git a/GPUBaseLib/GPUTool/GPUTool.cuh b/GPUBaseLib/GPUTool/GPUTool.cuh
index 6c513e3..c2bd1d4 100644
--- a/GPUBaseLib/GPUTool/GPUTool.cuh
+++ b/GPUBaseLib/GPUTool/GPUTool.cuh
@@ -20,13 +20,15 @@
/** CUDA ò ************************************************************************************/
#define BLOCK_SIZE 256
#define SHAREMEMORY_BYTE 49152
-#define SHAREMEMORY_FLOAT_HALF 6144
-#define SHAREMEMORY_FLOAT_HALF_STEP 24
+#define SHAREMEMORY_FLOAT_HALF_STEP 2
+#define SHAREMEMORY_FLOAT_HALF 512
+
#define SHAREMEMORY_DEM_STEP 768
#define SHAREMEMORY_Reflect 612
+
enum LAMPGPUDATETYPE {
LAMP_LONG,
LAMP_FLOAT,
diff --git a/LAMPDataProcess.sln b/LAMPDataProcess.sln
index 1f54f80..0559e59 100644
--- a/LAMPDataProcess.sln
+++ b/LAMPDataProcess.sln
@@ -38,10 +38,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RasterMainWidgetGUI", "Rast
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageshowTool", "ImageshowTool\ImageshowTool.vcxproj", "{8C8CA066-A93A-4098-9A46-B855EFEAADF2}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SPG4Tool", "SPG4Tool\SPG4Tool.vcxproj", "{80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pluginToolboxLibrary", "pluginToolboxLibrary\pluginToolboxLibrary.vcxproj", "{667625A5-8DE2-4373-99F0-8BAD2CCED011}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SPG4Tool", "SPG4Tool\SPG4Tool.vcxproj", "{80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
@@ -172,18 +172,6 @@ Global
{8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Release|x64.Build.0 = Release|x64
{8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Release|x86.ActiveCfg = Release|x64
{8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Release|x86.Build.0 = Release|x64
- {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|ARM.ActiveCfg = Debug|x64
- {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|ARM.Build.0 = Debug|x64
- {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|x64.ActiveCfg = Debug|x64
- {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|x64.Build.0 = Debug|x64
- {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|x86.ActiveCfg = Debug|x64
- {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|x86.Build.0 = Debug|x64
- {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|ARM.ActiveCfg = Release|x64
- {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|ARM.Build.0 = Release|x64
- {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x64.ActiveCfg = Release|x64
- {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x64.Build.0 = Release|x64
- {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x86.ActiveCfg = Release|x64
- {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x86.Build.0 = Release|x64
{667625A5-8DE2-4373-99F0-8BAD2CCED011}.Debug|ARM.ActiveCfg = Debug|x64
{667625A5-8DE2-4373-99F0-8BAD2CCED011}.Debug|ARM.Build.0 = Debug|x64
{667625A5-8DE2-4373-99F0-8BAD2CCED011}.Debug|x64.ActiveCfg = Debug|x64
@@ -196,6 +184,18 @@ Global
{667625A5-8DE2-4373-99F0-8BAD2CCED011}.Release|x64.Build.0 = Release|x64
{667625A5-8DE2-4373-99F0-8BAD2CCED011}.Release|x86.ActiveCfg = Release|Win32
{667625A5-8DE2-4373-99F0-8BAD2CCED011}.Release|x86.Build.0 = Release|Win32
+ {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|ARM.ActiveCfg = Debug|x64
+ {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|ARM.Build.0 = Debug|x64
+ {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|x64.ActiveCfg = Debug|x64
+ {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|x64.Build.0 = Debug|x64
+ {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|x86.ActiveCfg = Debug|x64
+ {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|x86.Build.0 = Debug|x64
+ {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|ARM.ActiveCfg = Release|x64
+ {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|ARM.Build.0 = Release|x64
+ {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x64.ActiveCfg = Release|x64
+ {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x64.Build.0 = Release|x64
+ {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x86.ActiveCfg = Release|x64
+ {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x86.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.cpp b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.cpp
index eb4f02a..2cebd5e 100644
--- a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.cpp
+++ b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.cpp
@@ -14,7 +14,7 @@
#include "FileOperator.h"
#include "RasterWidgetMessageShow.h"
-
+#include "ImageOperatorBase.h"
#pragma execution_character_set("utf-8")
@@ -46,7 +46,7 @@ RasterMainWidget::RasterMainWidget(QWidget *parent)
mLayerList(),
mLeftTop(),
mRightBottom() {
- this->setWindowTitle(tr(u8"LAMP影像处理软件"));
+ this->setWindowTitle(tr(u8"大场景仿真组件"));
mUi->setupUi(dynamic_cast(this));
setupWindow();
setupTaskWindow();
@@ -59,6 +59,14 @@ RasterMainWidget::RasterMainWidget(QWidget *parent)
//mUi->layerList->setCurrentItem(mLayerList.first());
+ connect(mUi->actioncloseAllRasterFile, SIGNAL(triggered()), this, SLOT(onactioncloseAllRasterFile_triggered()));
+
+ this->mUi->toolBar->hide();
+ this->mUi->dockWidget_Map->hide();
+ this->mUi->dockWidget->hide();
+ this->mUi->statusbar->hide();
+ this->mUi->dockWidget_2->hide();
+ this->mUi->dockWidget_3->hide();
}
@@ -341,6 +349,11 @@ void RasterMainWidget::on_addPlaneaction_triggered()
mMapConvas->selectTool("addplane_tool");
}
+void RasterMainWidget::onactioncloseAllRasterFile_triggered()
+{
+ CloseAllGDALRaster();
+}
+
QTableWidget* RasterMainWidget::getTaskTable()
{
return this->mUi->taskTable;
diff --git a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.h b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.h
index a64eb49..f4f3316 100644
--- a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.h
+++ b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.h
@@ -77,7 +77,7 @@ namespace LAMPMainWidget {
private slots:
void on_drawArea_triggered();
void on_addPlaneaction_triggered();
-
+ void onactioncloseAllRasterFile_triggered();
private:
Ui::RasterMainWidget* mUi;
MapCanvas* mMapConvas;
diff --git a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.ui b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.ui
index af85019..e317cec 100644
--- a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.ui
+++ b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.ui
@@ -31,111 +31,15 @@
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 0
-
-
-
- 地图
-
-
-
-
-
-
-
-
-
-
- 任务
-
-
-
-
- 0
- 0
- 1431
- 871
-
-
-
- -
-
-
-
-
-
-
-
-
+
-
+
+ false
+
toolBar
@@ -377,6 +281,85 @@ p, li { white-space: pre-wrap; }
+
+
+ Qt::LeftToRight
+
+
+ 地图窗口
+
+
+ 1
+
+
+
+
+
+ 10
+ 0
+ 502
+ 274
+
+
+
+
+ 0
+ 0
+
+
+
+ 0
+
+
+
+ 地图
+
+
+ -
+
+
+
+
+
+
+ 任务
+
+
+
+
+ 0
+ 0
+ 1431
+ 871
+
+
+
+ -
+
+
+
+
+
+
+
+
+
使用教程
@@ -513,6 +496,11 @@ p, li { white-space: pre-wrap; }
飞机
+
+
+ 释放影像文件
+
+
diff --git a/RasterProcessToolWidget/ToolBoxWidget.cpp b/RasterProcessToolWidget/ToolBoxWidget.cpp
index 5bb44ae..d0a9ae4 100644
--- a/RasterProcessToolWidget/ToolBoxWidget.cpp
+++ b/RasterProcessToolWidget/ToolBoxWidget.cpp
@@ -25,6 +25,7 @@ ToolBoxWidget::ToolBoxWidget(LAMPMainWidget::RasterMainWidget* mainWindows, QWid
ui->setupUi(this);
setContextMenuPolicy(Qt::CustomContextMenu); // Ҽݲ˵
QObject::connect(this, SIGNAL(addBoxToolItemSIGNAL(QToolAbstract*)), this, SLOT(addBoxToolItemSLOT(QToolAbstract*)));
+ QObject::connect(this, SIGNAL(addBoxToolItemInPathSIGNAL(QVector , QToolAbstract* )), this, SLOT(addBoxToolItemInPathSLOT(QVector, QToolAbstract * )));
}
@@ -122,6 +123,37 @@ void ToolBoxWidget::addBoxToolItemSLOT(QToolAbstract* item)
}
+void ToolBoxWidget::addBoxToolItemInPathSLOT(QVector xnodepath, QToolAbstract* item)
+{
+ QString toolName = item->getToolName();
+
+ QTreeWidgetItem* parentItem = findOrCreateParentItem(xnodepath);
+
+ // øǷѾ toolButton
+ if (parentItem && ui->treeWidgetToolBox->itemWidget(parentItem, 0) == nullptr) {
+
+ toollist.append(QToolboxTreeWidgetItem(ui->treeWidgetToolBox, parentItem, item));
+
+
+ //QTreeWidgetItem* actionItem = new QTreeWidgetItem(parentItem);
+ //parentItem->addChild(actionItem);
+ //actionItem->setText(0,toolName);
+ //QIcon icon(QString::fromUtf8(":/ToolBoxWidget/toolicon"));
+ //QPushButton* button = new QPushButton(ui->treeWidgetToolBox);
+ //button->setIcon(icon);
+ //button->setText(toolName);
+ //button->setLayoutDirection(Qt::LeftToRight);
+ //button->setStyleSheet("QPushButton { text-align: left; }");
+ //ui->treeWidgetToolBox->setItemWidget(actionItem, 0, button);
+ //connect(button, SIGNAL(clicked()), item, SLOT(excute()));
+ //item->setParent(ui->treeWidgetToolBox);
+ //qDebug() << "ToolButton bound to parent:" << actionItem->text(0);
+ }
+ else {
+ qDebug() << "ToolButton already bound to parent:" << parentItem->text(0);
+ }
+}
+
// ·һ
QTreeWidgetItem* ToolBoxWidget::findOrCreateParentItem( QVector& path) {
QTreeWidgetItem* currentItem = nullptr;
@@ -171,7 +203,17 @@ QTreeWidgetItem* ToolBoxWidget::findChildItemByName(QTreeWidgetItem* parentItem,
return childItem;
}
}
- return nullptr;
+
+
+ // ûҵµĶڵ
+ QTreeWidgetItem* newItem = new QTreeWidgetItem(parentItem);
+ QIcon icon(QString::fromUtf8(":/RasterProcessTool/toolboxIcon"));
+ newItem->setIcon(0, icon);
+ newItem->setTextAlignment(0, Qt::AlignLeft);
+ newItem->setText(0, name);
+ parentItem->addChild(newItem);
+ return newItem;
+ // return nullptr;
}
void ToolBoxWidget::OpenToolboxManagerWidget()
diff --git a/RasterProcessToolWidget/ToolBoxWidget.h b/RasterProcessToolWidget/ToolBoxWidget.h
index 39f7c48..fc84b7b 100644
--- a/RasterProcessToolWidget/ToolBoxWidget.h
+++ b/RasterProcessToolWidget/ToolBoxWidget.h
@@ -49,9 +49,11 @@ private:
signals:
void addBoxToolItemSIGNAL(QToolAbstract* item);
+ void addBoxToolItemInPathSIGNAL(QVector xnodepath, QToolAbstract* item);
public slots:
void addBoxToolItemSLOT(QToolAbstract* item);
+ void addBoxToolItemInPathSLOT(QVector xnodepath, QToolAbstract* item);
QTreeWidgetItem* findOrCreateParentItem( QVector& path);
QTreeWidgetItem* findOrCreateTopLevelItem( QString& name);
QTreeWidgetItem* findChildItemByName(QTreeWidgetItem* parentItem, QString& name);
diff --git a/Toolbox/BaseToolbox/BaseToolbox.cpp b/Toolbox/BaseToolbox/BaseToolbox.cpp
index 1bad4fa..22ed9c8 100644
--- a/Toolbox/BaseToolbox/BaseToolbox.cpp
+++ b/Toolbox/BaseToolbox/BaseToolbox.cpp
@@ -13,6 +13,9 @@
#include "QResampleRefrenceRaster.h"
#include "QtLookTableCorrectOffsetDialog.h"
#include "QtCreateGPSPointsDialog.h"
+#include "RasterVRT2ENVIdataDialog.h"
+
+#include "SARSatalliteSimulationWorkflow.h" //
GF3ImportDataToolButton::GF3ImportDataToolButton(QWidget* parent) :QToolAbstract(parent)
{
@@ -115,6 +118,19 @@ void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWi
emit toolbox->addBoxToolItemSIGNAL(new QResampleRefrenceRasterToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new QLookTableCorrectOffsetToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new QCreateGPSPointsToolButton(toolbox));
+ emit toolbox->addBoxToolItemSIGNAL(new RasterVRT2ENVIdataDialogToolButton(toolbox));
+
+
+ //
+#ifdef __BASETOOLBOX__SARSATALLITESIMULATIONWORKFLOW__H__
+ initBaseToolSARSateSimulationWorkflow(toolbox);
+#endif // __BASETOOLBOX__SARSATALLITESIMULATIONWORKFLOW__H__
+
+
+
+
+
+
}
QDEMResampleDialogToolButton::QDEMResampleDialogToolButton(QWidget* parent)
@@ -215,4 +231,21 @@ void QCreateGPSPointsToolButton::excute()
{
QtCreateGPSPointsDialog* dialog = new QtCreateGPSPointsDialog;
dialog->show();
-}
\ No newline at end of file
+}
+
+RasterVRT2ENVIdataDialogToolButton::RasterVRT2ENVIdataDialogToolButton(QWidget* parent)
+{
+ this->toolPath = QVector(0);
+ this->toolPath.push_back(u8"");
+ this->toolname = QString(u8"vrtļתenviݸʽ");
+}
+
+RasterVRT2ENVIdataDialogToolButton::~RasterVRT2ENVIdataDialogToolButton()
+{
+}
+
+void RasterVRT2ENVIdataDialogToolButton::run()
+{
+ RasterVRT2ENVIdataDialog* dialog = new RasterVRT2ENVIdataDialog;
+ dialog->show();
+}
diff --git a/Toolbox/BaseToolbox/BaseToolbox.h b/Toolbox/BaseToolbox/BaseToolbox.h
index 5c15ea7..42a024b 100644
--- a/Toolbox/BaseToolbox/BaseToolbox.h
+++ b/Toolbox/BaseToolbox/BaseToolbox.h
@@ -10,6 +10,8 @@ namespace LAMPMainWidget {
class ToolBoxWidget;
+extern "C" BASETOOLBOX_EXPORT void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox);
+
class BASETOOLBOX_EXPORT GF3ImportDataToolButton : public QToolAbstract {
Q_OBJECT
public:
@@ -132,4 +134,18 @@ public slots:
};
-extern "C" BASETOOLBOX_EXPORT void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox);
+
+
+
+
+class BASETOOLBOX_EXPORT RasterVRT2ENVIdataDialogToolButton : public QToolAbstract {
+ Q_OBJECT
+public:
+ RasterVRT2ENVIdataDialogToolButton(QWidget* parent = nullptr);
+ ~RasterVRT2ENVIdataDialogToolButton();
+public :
+ virtual void run() override;
+
+};
+
+
diff --git a/Toolbox/BaseToolbox/BaseToolbox.vcxproj b/Toolbox/BaseToolbox/BaseToolbox.vcxproj
index 5384b55..1ace8fc 100644
--- a/Toolbox/BaseToolbox/BaseToolbox.vcxproj
+++ b/Toolbox/BaseToolbox/BaseToolbox.vcxproj
@@ -60,12 +60,12 @@
tools_qt5
- core
+ core;gui;widgets
debug
tools_qt5
- core
+ core;gui;widgets
debug
@@ -122,6 +122,7 @@
true
stdcpp14
stdc11
+ Disabled
@@ -207,10 +208,13 @@
+
+
+
@@ -225,6 +229,7 @@
+
@@ -246,6 +251,7 @@
+
diff --git a/Toolbox/BaseToolbox/BaseToolbox.vcxproj.filters b/Toolbox/BaseToolbox/BaseToolbox.vcxproj.filters
index 03e37b6..dbe0ff5 100644
--- a/Toolbox/BaseToolbox/BaseToolbox.vcxproj.filters
+++ b/Toolbox/BaseToolbox/BaseToolbox.vcxproj.filters
@@ -106,6 +106,12 @@
BaseToolbox
+
+ BaseToolbox
+
+
+ Source Files
+
@@ -147,6 +153,12 @@
BaseToolbox
+
+ BaseToolbox
+
+
+ Header Files
+
@@ -185,5 +197,8 @@
BaseToolbox
+
+ BaseToolbox
+
\ No newline at end of file
diff --git a/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp b/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp
index 76188ba..aadbd71 100644
--- a/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp
+++ b/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp
@@ -26,7 +26,7 @@ ErrorCode GF3CalibrationRaster(QString inRasterPath, QString outRasterPath, doub
double quayCoff = Qualifyvalue * 1.0 / 32767;
double caliCoff = std::pow(10.0, (calibrationConst * 1.0 / 20));
- qDebug() << "ϵ:\t" << quayCoff / caliCoff;
+ qDebug() << u8"ϵ:\t" << quayCoff / caliCoff;
long startrow = 0;
for (startrow = 0; startrow < imgraster.height; startrow = startrow + blocklines) {
@@ -37,7 +37,7 @@ ErrorCode GF3CalibrationRaster(QString inRasterPath, QString outRasterPath, doub
imgArr.imag() = imgArrb2.array() * quayCoff / caliCoff;
outraster.saveImage(imgArr, startrow, 0, 1);
}
- qDebug() << "Ӱд뵽" << outRasterPath;
+ qDebug() << u8"Ӱд뵽" << outRasterPath;
return ErrorCode::SUCCESS;
}
@@ -80,29 +80,29 @@ ErrorCode ImportGF3L1ARasterToWorkspace(QString inMetaxmlPath, QString inRasterP
QString outRasterpath = l1dataset.getImageRasterPath();
ErrorCode errorcode = ErrorCode::SUCCESS;
- qDebug() << ":\t" << inRasterPath;
+ qDebug() << u8":\t" << inRasterPath;
switch (polsartype)
{
case POLARHH:
- qDebug() << "HH";
+ qDebug() << u8"HH";
errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.HH_QualifyValue, gf3xml.HH_CalibrationConst);
break;
case POLARHV:
- qDebug() << "HH";
+ qDebug() << u8"HH";
errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.HV_QualifyValue, gf3xml.HV_CalibrationConst);
break;
case POLARVH:
- qDebug() << "VH";
+ qDebug() << u8"VH";
errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.VH_QualifyValue, gf3xml.VH_CalibrationConst);
break;
case POLARVV:
- qDebug() << "VV";
+ qDebug() << u8"VV";
errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.VV_QualifyValue, gf3xml.VV_CalibrationConst);
break;
default:
break;
}
- qDebug() << "״̬\t" << QString::fromStdString(errorCode2errInfo(errorcode));
+ qDebug() << u8"״̬\t" << QString::fromStdString(errorCode2errInfo(errorcode));
return errorcode;
}
@@ -115,7 +115,7 @@ QVector SearchGF3DataTiff(QString inMetaxmlPath)
// ȡ·ڵĿ¼
QDir directory(absPath);
if (!directory.exists()) {
- qDebug() << "Directory does not exist:" << directory.absolutePath();
+ qDebug() << u8"Directory does not exist:" << directory.absolutePath();
return QVector(0);
}
@@ -124,7 +124,7 @@ QVector SearchGF3DataTiff(QString inMetaxmlPath)
filters << "*.tif" << "*.TIF" << "*.tiff" << "*.TIFF";
QStringList files = directory.entryList(filters, QDir::Files);
- qDebug() << "TIFF Files in the directory" << directory.absolutePath() << ":";
+ qDebug() << u8"TIFF Files in the directory" << directory.absolutePath() << ":";
QVector filepath(0);
for (long i = 0; i < files.count(); i++) {
@@ -144,7 +144,7 @@ POLARTYPEENUM getDatasetGF3FilePolsarType(QString fileName)
if (match.hasMatch()) {
polarization = match.captured(1);
polarization = polarization.toLower().replace("_", "");
- qDebug() << "Polarization extracted:" << polarization;
+ qDebug() << u8"Polarization extracted:" << polarization;
if (polarization == "hh") {
return POLARTYPEENUM::POLARHH;
}
@@ -162,7 +162,7 @@ POLARTYPEENUM getDatasetGF3FilePolsarType(QString fileName)
}
}
else {
- qDebug() << "No polarization found in the path.";
+ qDebug() << u8"No polarization found in the path.";
return POLARTYPEENUM::POLARUNKOWN;
}
@@ -199,7 +199,7 @@ ErrorCode ImportGF3L1AProcess(QString inMetaxmlPath, QString outWorkDirPath)
break;
}
if (errorcode == ErrorCode::SUCCESS) {
- return errorcode;
+ continue;
}
else {
QMessageBox::warning(nullptr, u8"", u8"ݵ");
@@ -209,94 +209,10 @@ ErrorCode ImportGF3L1AProcess(QString inMetaxmlPath, QString outWorkDirPath)
return errorcode;
}
-ErrorCode Complex2AmpRaster(QString inComplexPath, QString outRasterPath)
-{
- gdalImageComplex inimg(inComplexPath);
- gdalImage ampimg = CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true);
-
- long blocklines = Memory1GB * 2 / 8 / inimg.width;
- blocklines = blocklines < 100 ? 100 : blocklines;
- Eigen::MatrixXd imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width);
- Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width);
-
- long startrow = 0;
- for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) {
-
- imgArrb1 = ampimg.getData(startrow, 0, blocklines, inimg.width, 1);
- imgArr = inimg.getData(startrow, 0, blocklines, inimg.width, 2);
- imgArrb1 = imgArr.array().abs();
- ampimg.saveImage(imgArrb1, startrow, 0, 1);
- }
- qDebug() << "Ӱд뵽" << outRasterPath;
- return ErrorCode::SUCCESS;
-}
-
-ErrorCode Complex2PhaseRaster(QString inComplexPath, QString outRasterPath)
-{
- gdalImageComplex inimg(inComplexPath);
- gdalImage ampimg = CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true);
-
-
- long blocklines = Memory1GB * 2 / 8 / inimg.width;
- blocklines = blocklines < 100 ? 100 : blocklines;
- Eigen::MatrixXd imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width);
- Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width);
-
- long startrow = 0;
- for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) {
-
- imgArrb1 = ampimg.getData(startrow, 0, blocklines, inimg.width, 1);
- imgArr = inimg.getData(startrow, 0, blocklines, inimg.width, 2);
- imgArrb1 = imgArr.array().arg();
- ampimg.saveImage(imgArrb1, startrow, 0, 1);
- }
- qDebug() << "Ӱд뵽" << outRasterPath;
- return ErrorCode::SUCCESS;
-}
-
-ErrorCode Complex2dBRaster(QString inComplexPath, QString outRasterPath)
-{
- gdalImageComplex inimg(inComplexPath);
- gdalImage ampimg = CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true);
-
-
- long blocklines = Memory1GB * 2 / 8 / inimg.width;
- blocklines = blocklines < 100 ? 100 : blocklines;
- Eigen::MatrixXd imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width);
- Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width);
-
- long startrow = 0;
- for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) {
-
- imgArrb1 = ampimg.getData(startrow, 0, blocklines, inimg.width, 1);
- imgArr = inimg.getData(startrow, 0, blocklines, inimg.width, 2);
- imgArrb1 = imgArr.array().abs().log10() * 20.0;
- ampimg.saveImage(imgArrb1, startrow, 0, 1);
- }
- qDebug() << "Ӱд뵽" << outRasterPath;
- return ErrorCode::SUCCESS;
-}
-
-ErrorCode ResampleDEM(QString indemPath, QString outdemPath, double gridx, double gridy)
-{
- double gridlat = gridy / 110000.0;
- double gridlon = gridx / 100000.0;
-
- long espgcode = GetEPSGFromRasterFile(indemPath.toUtf8().constData());
- if (espgcode == 4326) {
- resampleRaster(indemPath.toUtf8().constData(), outdemPath.toUtf8().constData(), gridlon, gridlat);
- return ErrorCode::SUCCESS;
- }
- else {
- QMessageBox::warning(nullptr, u8"", u8"WGS84DEMӰ");
- return ErrorCode::FAIL;
- }
-}
-
ErrorCode RD_PSTN(double& refrange, double& lamda, double& timeR, double& R, double& tx, double& ty, double& tz, double& slopex, double& slopey, double& slopez, GF3PolyfitSatelliteOribtModel& polyfitmodel, SatelliteOribtNode& node, double& d0, double& d1, double& d2, double& d3, double& d4)
{
- double dt = 1e-6;
+ double dt = 1e-4;
double inct = 0;
bool antfalg = false;
double timeR2 = 0;
@@ -315,21 +231,24 @@ ErrorCode RD_PSTN(double& refrange, double& lamda, double& timeR, double& R, dou
for (int i = 0; i < 50; i++) {
polyfitmodel.getSatelliteOribtNode(timeR, node, antfalg);
R1 = std::sqrt(std::pow(node.Px - tx, 2) + std::pow(node.Py - ty, 2) + std::pow(node.Pz - tz, 2));
- dplerTheory1 = (-2 / lamda) * (((node.Px - tx) * (node.Vx + EARTHWE * ty) + (node.Py - ty) * (node.Vy - EARTHWE * tz) + (node.Pz - tz) * (node.Vz - 0)) / R1);
- dplerR = (R1 - refrange) * 1e6 / LIGHTSPEED;
+ //dplerTheory1 = (-2 / lamda / R1) * ((node.Px - tx) * (node.Vx + EARTHWE * ty) + (node.Py - ty) * (node.Vy - EARTHWE * tx) + (node.Pz - tz) * (node.Vz - 0));
+ dplerTheory1 = (-2 / lamda / R1) * ((node.Px - tx) * (node.Vx + 0) + (node.Py - ty) * (node.Vy -0) + (node.Pz - tz) * (node.Vz - 0));
+ dplerR = (R1 - refrange) * 1e6 / LIGHTSPEED; // GF3 㹫ʽ
dplerNumber1 = d0 + dplerR * d1 + std::pow(dplerR, 2) * d2 + std::pow(dplerR, 3) * d3 + std::pow(dplerR, 4) * d4;
timeR2 = timeR + dt;
polyfitmodel.getSatelliteOribtNode(timeR2, node, antfalg);
R2 = std::sqrt(std::pow(node.Px - tx, 2) + std::pow(node.Py - ty, 2) + std::pow(node.Pz - tz, 2));
- dplerTheory2 = (-2 / lamda) * (((node.Px - tx) * (node.Vx + EARTHWE * ty) + (node.Py - ty) * (node.Vy - EARTHWE * tz) + (node.Pz - tz) * (node.Vz - 0)) / R2);
- dplerR = (R2 - refrange) * 1e6 / LIGHTSPEED;
- dplerNumber2 = d0 + dplerR * d1 + std::pow(dplerR, 2) * d2 + std::pow(dplerR, 3) * d3 + std::pow(dplerR, 4) * d4;
-
- inct = dt * (dplerTheory2 - dplerNumber1) / (dplerTheory1 - dplerTheory2);
- if (std::abs(dplerTheory1 - dplerTheory2) < 1e-9 || std::abs(inct) < dt) {
+ //dplerTheory2 = (-2 / lamda/R2) * ((node.Px - tx) * (node.Vx + EARTHWE * ty) + (node.Py - ty) * (node.Vy - EARTHWE * tx) + (node.Pz - tz) * (node.Vz - 0));
+ dplerTheory2 = (-2 / lamda/R2) * ((node.Px - tx) * (node.Vx +0) + (node.Py - ty) * (node.Vy -0) + (node.Pz - tz) * (node.Vz - 0));
+ //dplerR = (R2 - refrange) * 1e6 / LIGHTSPEED; // GF3 㹫ʽ
+ //dplerNumber2 = d0 + dplerR * d1 + std::pow(dplerR, 2) * d2 + std::pow(dplerR, 3) * d3 + std::pow(dplerR, 4) * d4;
+
+ inct = dt*(dplerTheory2-dplerNumber1) / (dplerTheory2 - dplerTheory1);
+ if (std::abs(dplerNumber1 - dplerTheory2) < 1e-6 || std::abs(inct) < 1.0e-4) {
break;
}
+ inct = std::abs(inct) < 10 ?inct:inct*1e-2;
timeR = timeR - inct;
}
R = R1; // б
@@ -349,7 +268,7 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out
gdalImage rasterRC = CreategdalImage(outlooktablePath, demxyz.height, demxyz.width, 2, demxyz.gt, demxyz.projection, true, true);// X,Y,Z
gdalImage localincangleRaster;
if (localincAngleFlag) {
- localincangleRaster = CreategdalImage(outLocalIncidenceAnglePath, demxyz.height, demxyz.width, 2, demxyz.gt, demxyz.projection, true, true);// X,Y,Z
+ localincangleRaster = CreategdalImage(outLocalIncidenceAnglePath, demxyz.height, demxyz.width, 1, demxyz.gt, demxyz.projection, true, true);// X,Y,Z
}
@@ -363,44 +282,64 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out
double d3 = dopplers[3];
double d4 = dopplers[4];
- double fs = l1dataset.getFs();// Fs
- double prf = (l1dataset.getEndImageTime() - l1dataset.getStartImageTime()) / (l1dataset.getrowCount() - 1);// PRF
+ double fs = l1dataset.getFs()*1e6;// Fs
+ double prf = l1dataset.getPRF();// PRF
double nearRange = l1dataset.getNearRange();
double imagestarttime = l1dataset.getStartImageTime();
+ double imageendtime = l1dataset.getEndImageTime();
double refrange = l1dataset.getRefRange();
- double lamda = (LIGHTSPEED*1e-6)/ l1dataset.getCenterFreq();
+ double lamda = (LIGHTSPEED*1.0e-9)/ l1dataset.getCenterFreq();
+ // ӡ
+ qDebug() << "Fs:\t" << fs;
+ qDebug() << "prf:\t" << prf;
+ qDebug() << "nearRange:\t" << nearRange;
+ qDebug() << "imagestarttime:\t" << imagestarttime;
+ qDebug() << "imageendtime:\t" << imageendtime;
+ qDebug() << "refrange:\t" << refrange;
+ qDebug() << "lamda:\t" << lamda;
+ //ӡ۲
+ qDebug() << u8"-----------------------------------";
+ qDebug() << u8"ղ\n";
+ qDebug() << u8"d0:\t" << d0;
+ qDebug() << u8"d1:\t" << d1;
+ qDebug() << u8"d2:\t" << d2;
+ qDebug() << u8"d3:\t" << d3;
+ qDebug() << u8"d4:\t" << d4;
+ qDebug() << u8"-----------------------------------";
// ģ
GF3PolyfitSatelliteOribtModel polyfitmodel;
QVector < SatelliteAntPos > antposes = l1dataset.getXmlSateAntPos();
- polyfitmodel.setSatelliteOribtStartTime(imagestarttime);
+ polyfitmodel.setSatelliteOribtStartTime((imagestarttime+imageendtime)/2);
for (long i = 0; i < antposes.size(); i++) {
- SatelliteOribtNode node;
- node.time = antposes[i].time;
- node.Px = antposes[i].Px;
- node.Py = antposes[i].Py;
- node.Pz = antposes[i].Pz;
- node.Vx = antposes[i].Vx;
- node.Vy = antposes[i].Vy;
- node.Vz = antposes[i].Vz;
- polyfitmodel.addOribtNode(node);
+ if (antposes[i].time > imagestarttime - 5 && antposes[i].time < imageendtime + 5) {
+ SatelliteOribtNode node;
+ node.time = antposes[i].time;
+ node.Px = antposes[i].Px;
+ node.Py = antposes[i].Py;
+ node.Pz = antposes[i].Pz;
+ node.Vx = antposes[i].Vx;
+ node.Vy = antposes[i].Vy;
+ node.Vz = antposes[i].Vz;
+ polyfitmodel.addOribtNode(node);
+ }
}
polyfitmodel.polyFit(3, false);
qDebug() << "-----------------------------------";
- qDebug() << "satellite polyfit model params:\n";
+ qDebug() << u8"satellite polyfit model params:\n";
qDebug() << polyfitmodel.getSatelliteOribtModelParamsString();
qDebug() << "-----------------------------------";
// ʼұ
//1.ֿ
long cpucore_num = std::thread::hardware_concurrency();
- long blockline = Memory1MB * 500 / 8 / cpucore_num / 4 / l1dataset.getcolCount();
- blockline = blockline < 50 ? 50 : blockline;
+ long blocklineinit = Memory1MB / 8 / cpucore_num / 4 / l1dataset.getcolCount() * 8000;
+ blocklineinit = blocklineinit < 50 ? 50 : blocklineinit;
//2.
- long colcount = l1dataset.getcolCount();
- long rowcount = l1dataset.getrowCount();
+ long colcount = rasterRC.width;//l1dataset.getcolCount();
+ long rowcount = rasterRC.height;//l1dataset.getrowCount();
long startRId = 0;
long processNumber = 0;
@@ -417,33 +356,41 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out
-#pragma omp parallel for num_threads(cpucore_num-1)
- for (startRId = 0; startRId < rowcount; startRId = startRId + blockline) {
+
+ for (startRId = 0; startRId < rowcount; startRId = startRId + blocklineinit) {
+ long blockline = blocklineinit;
+ if (startRId + blockline > rowcount) {
+ blockline = rowcount - startRId;
+ }
Eigen::MatrixXd sar_r = rasterRC.getData(startRId, 0, blockline, colcount, 1);
Eigen::MatrixXd sar_c = rasterRC.getData(startRId, 0, blockline, colcount, 2);
Eigen::MatrixXd dem_x = demxyz.getData(startRId, 0, blockline, colcount, 1);
Eigen::MatrixXd dem_y = demxyz.getData(startRId, 0, blockline, colcount, 2);
Eigen::MatrixXd dem_z = demxyz.getData(startRId, 0, blockline, colcount, 3);
- // ص
- double timeR = 0;
+
long blockrows = sar_r.rows();
long blockcols = sar_r.cols();
- double tx = 0;
- double ty = 0;
- double tz = 0;
- double R = 0;
- double slopex=0, slopey=0, slopez=0;
- SatelliteOribtNode node{0,0,0,0,0,0,0,0};
- bool antflag = false;
+
+#pragma omp parallel for
for (long i = 0; i < blockrows; i++) {
+ // ص
+ double timeR = 0;
+ double tx = 0;
+ double ty = 0;
+ double tz = 0;
+ double R = 0;
+ double slopex = 0, slopey = 0, slopez = 0;
+ SatelliteOribtNode node{ 0,0,0,0,0,0,0,0 };
+ bool antflag = false;
for (long j = 0; j < blockcols; j++) {
+
tx = dem_x(i, j);
ty = dem_y(i, j);
tz = dem_z(i, j);
if (RD_PSTN(refrange,lamda, timeR,R,tx,ty,tz,slopex,slopey,slopez,polyfitmodel,node,d0,d1,d2,d3,d4) == ErrorCode::SUCCESS) {
- sar_r(i, j) = timeR * prf;
- sar_c(i, j) = ((R - nearRange) / 2 / LIGHTSPEED) * fs;
+ sar_r(i, j) =( timeR+ (imagestarttime + imageendtime) / 2 -imagestarttime) * prf;
+ sar_c(i, j) = ((R - nearRange) * 2 / LIGHTSPEED) * fs;
}
else {
sar_r(i, j) = -1;
@@ -452,6 +399,14 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out
}
}
+ //
+ omp_set_lock(&lock);
+ rasterRC.saveImage(sar_r, startRId, 0, 1);
+ rasterRC.saveImage(sar_c, startRId, 0, 2);
+
+ omp_unset_lock(&lock);
+
+
Eigen::MatrixXd Angle_Arr = Eigen::MatrixXd::Zero(dem_x.rows(),dem_x.cols()).array()+181;
if (localincAngleFlag) {
Eigen::MatrixXd demslope_x = demslope.getData(startRId, 0, blockline, colcount, 1);
@@ -461,7 +416,20 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out
double Rst_x = 0, Rst_y = 0, Rst_z = 0, localangle = 0;
double slopeR = 0;
+#pragma omp parallel for
for (long i = 0; i < blockrows; i++) {
+ // ص
+ double timeR = 0;
+ double tx = 0;
+ double ty = 0;
+ double tz = 0;
+ double R = 0;
+ double slopex = 0, slopey = 0, slopez = 0;
+ SatelliteOribtNode node{ 0,0,0,0,0,0,0,0 };
+ bool antflag = false;
+
+
+
for (long j = 0; j < blockcols; j++) {
timeR = sar_r(i, j) / prf;
slopex = demslope_x(i, j);
@@ -482,18 +450,25 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out
Angle_Arr(i, j) = localangle;
}
}
+
+ //
+ omp_set_lock(&lock);
+
+ if (localincAngleFlag) {
+ localincangleRaster.saveImage(Angle_Arr, startRId, 0, 1);
+ }
+ else {}
+
+ omp_unset_lock(&lock);
+
}
+
//
omp_set_lock(&lock);
- rasterRC.saveImage(sar_r, startRId, 0, 1);
- rasterRC.saveImage(sar_c, startRId, 0, 2);
- if (localincAngleFlag) {
- localincangleRaster.saveImage(Angle_Arr, startRId, 0, 1);
- }
- else {}
+
processNumber = processNumber + blockrows;
- qDebug() << "\rprocess bar:\t" << processNumber * 100.0 / rowcount << " % " << "\t\t\t";
+ qDebug() << u8"\rprocess bar:\t" << processNumber * 100.0 / rowcount << " % " << "\t\t\t";
if (progressDialog.maximum() <= processNumber) {
processNumber = progressDialog.maximum() - 1;
}
@@ -511,16 +486,17 @@ ErrorCode GF3OrthSLC( QString inRasterPath, QString inlooktablePath, QString out
gdalImage slcRaster(inRasterPath);//
gdalImage looktableRaster(inlooktablePath);//
- gdalImage outRaster(outRasterPath);//
+ gdalImage outRaster = CreategdalImage(outRasterPath, looktableRaster.height, looktableRaster.width, 1, looktableRaster.gt, looktableRaster.projection, true, true);// X,Y,Z
+ //gdalImage outRaster(outRasterPath);//
if (outRaster.height != looktableRaster.height || outRaster.width != looktableRaster.width) {
- qDebug() << "look table size is not same as outRaster size"<< looktableRaster.height <<"!="<= slcRows || nextc >= slcCols) {
continue;
}
- p11 = { sar_r(i,j),sar_c(i,j),0 };
+
+ p0 = { sar_c(i,j)-lastc, sar_r(i,j)-lastr,0 };
p11 = Landpoint{ 0,0,slcImg(lastr,lastc) };
p21 = Landpoint{ 0,1,slcImg(nextr,lastc) };
p12 = Landpoint{ 1,0,slcImg(lastr,nextc) };
p22 = Landpoint{ 1,1,slcImg(nextr,nextc) };
+
Bileanervalue = Bilinear_interpolation(p0, p11, p21, p12, p22);
outImg(i, j) = Bileanervalue;
}
@@ -585,6 +563,35 @@ ErrorCode GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir,
double minlon = box.min_lon - dlon;
double maxlat = box.max_lat + dlat;
double maxlon = box.max_lon + dlon;
+ qDebug() << u8"ӰΧ:";
+ qDebug() << u8"Bounding Box:";
+ qDebug() << u8"Latitude:" << minlat <<" - "<< maxlat;
+ qDebug() << u8"Longitude:" << minlon <<" - "<< maxlon;
+ double centerlat = (minlat + maxlat) / 2;
+ double centerlon = (minlon + maxlon) / 2;
+ long sourceespgcode = getProjectEPSGCodeByLon_Lat(centerlon, centerlat);
+ long demespgcode = GetEPSGFromRasterFile(indemPath);
+ double grid_resolution = gridx < gridy ? gridx : gridy;
+ double degreePerPixelX = grid_resolution / 110000.0;
+ double degreePerPixelY = grid_resolution / 110000.0;
+ bool meter2degreeflag = ConvertResolutionToDegrees(
+ sourceespgcode,
+ grid_resolution,
+ centerlon,
+ centerlat,
+ degreePerPixelX,
+ degreePerPixelY
+ );
+ if (!meter2degreeflag) {
+ qDebug() << u8"תֱΪγʧ";
+ degreePerPixelX = grid_resolution / 110000.0;
+ degreePerPixelY = grid_resolution / 110000.0;
+ }
+ qDebug() << u8"DEMӰΧ:";
+ qDebug() << u8"ֱʣ"< SearchGF3DataTiff(QString inMetaxmlPath);
POLARTYPEENUM getDatasetGF3FilePolsarType(QString fileName);
ErrorCode ImportGF3L1AProcess(QString inMetaxmlPath, QString outWorkDirPath);
-// תʵ
-ErrorCode Complex2AmpRaster(QString inComplexPath, QString outRasterPath);
-//תλ
-ErrorCode Complex2PhaseRaster(QString inComplexPath, QString outRasterPath);
-ErrorCode Complex2dBRaster(QString inComplexPath, QString outRasterPath);
-
-ErrorCode ResampleDEM(QString indemPath, QString outdemPath, double gridx, double gridy);
// RD 㷨
ErrorCode RD_PSTN(double& refrange,double& lamda, double& timeR, double& R, double& tx, double& ty, double& tz, double& slopex, double& slopey, double& slopez, GF3PolyfitSatelliteOribtModel& polyfitmodel, SatelliteOribtNode& node,double& d0,double& d1, double& d2, double& d3, double& d4);
@@ -36,6 +29,3 @@ ErrorCode GF3OrthSLC( QString inRasterPath, QString inlooktablePath, QString out
// 䴦
ErrorCode GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir, double gridx, double gridy);
-
-
-
diff --git a/Toolbox/BaseToolbox/BaseToolbox/GF3PSTNClass.cpp b/Toolbox/BaseToolbox/BaseToolbox/GF3PSTNClass.cpp
index b350012..735d954 100644
--- a/Toolbox/BaseToolbox/BaseToolbox/GF3PSTNClass.cpp
+++ b/Toolbox/BaseToolbox/BaseToolbox/GF3PSTNClass.cpp
@@ -66,7 +66,7 @@ QString GF3PolyfitSatelliteOribtModel::getSatelliteOribtModelParamsString()
result += QString::number(this->polyfitVz[i], 'e', 6) + "\n";
}
result += "------------------------------------------------------\n";
-
+ printf("%s\n", result.toUtf8().constData());
return result;
}
diff --git a/Toolbox/BaseToolbox/BaseToolbox/QComplex2AmpPhase.cpp b/Toolbox/BaseToolbox/BaseToolbox/QComplex2AmpPhase.cpp
index 90b6580..ea9936f 100644
--- a/Toolbox/BaseToolbox/BaseToolbox/QComplex2AmpPhase.cpp
+++ b/Toolbox/BaseToolbox/BaseToolbox/QComplex2AmpPhase.cpp
@@ -5,6 +5,7 @@
#include "BaseTool.h"
#include "SARSimulationImageL1.h"
#include "GF3CalibrationAndGeocodingClass.h"
+#include "RasterToolBase.h"
QComplex2AmpPhase::QComplex2AmpPhase(QWidget *parent)
: QDialog(parent)
@@ -15,7 +16,8 @@ QComplex2AmpPhase::QComplex2AmpPhase(QWidget *parent)
QObject::connect(ui.radioButtonAmp,SIGNAL(toggled(bool)),this,SLOT(radioButtonAmptoggled(bool)));
QObject::connect(ui.radioButtonPhase, SIGNAL(toggled(bool)), this, SLOT(radioButtonPhasetoggled(bool)));
QObject::connect(ui.radioButtonSigma0, SIGNAL(toggled(bool)), this, SLOT(radioButtonSigma0toggled(bool)));
- QObject::connect(ui.buttonBox, SIGNAL(accept()), this, SLOT(onaccept()));
+ QObject::connect(ui.pushButtonWorkSpace, SIGNAL(clicked(bool)), this, SLOT(onpushButtonWorkSpaceClicked(bool)));
+ QObject::connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(onaccept()));
QObject::connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(onreject()));
//toggled(bool )
}
@@ -46,19 +48,19 @@ void QComplex2AmpPhase::onaccept()
slcl1.Open(folderpath, filename);
QString l2bfilename = filename + ui.lineEditHZ->text();
SARSimulationImageL1Dataset l1B(RasterLevel::RasterL1B);
- slcl1.OpenOrNew(outworkdir, l2bfilename,slcl1.getrowCount(),slcl1.getcolCount());
+ l1B.OpenOrNew(outworkdir, l2bfilename,slcl1.getrowCount(),slcl1.getcolCount());
QString srcxmlpath = slcl1.getxmlFilePath();
QString tarxmlpath = l1B.getxmlFilePath();
copyAndReplaceFile(srcxmlpath, tarxmlpath);
l1B.loadFromXml();
if (ui.radioButtonAmp->isChecked()) {
- Complex2AmpRaster(imgfilepath, slcl1.getImageRasterPath());
+ Complex2AmpRaster(imgfilepath, l1B.getImageRasterPath());
}
else if (ui.radioButtonPhase->isChecked()) {
- Complex2PhaseRaster(imgfilepath, slcl1.getImageRasterPath());
+ Complex2PhaseRaster(imgfilepath, l1B.getImageRasterPath());
}
else if (ui.radioButtonSigma0->isChecked()) {
- Complex2dBRaster(imgfilepath, slcl1.getImageRasterPath());
+ Complex2dBRaster(imgfilepath, l1B.getImageRasterPath());
}
progressDialog.setValue(i);
}
diff --git a/Toolbox/BaseToolbox/BaseToolbox/QImportGF3StripL1ADataset.cpp b/Toolbox/BaseToolbox/BaseToolbox/QImportGF3StripL1ADataset.cpp
index 12793e3..e6146f0 100644
--- a/Toolbox/BaseToolbox/BaseToolbox/QImportGF3StripL1ADataset.cpp
+++ b/Toolbox/BaseToolbox/BaseToolbox/QImportGF3StripL1ADataset.cpp
@@ -7,10 +7,9 @@ QImportGF3StripL1ADataset::QImportGF3StripL1ADataset(QWidget *parent)
{
ui.setupUi(this);
- QListWidget* listWidgetMetaxml;
- QObject::connect(ui.pushButtonAdd,SIGNAL(clicked(clicked)),this,SLOT(onpushButtonAddClicked(bool)));
- QObject::connect(ui.pushButtonRemove, SIGNAL(clicked(clicked)), this, SLOT(onpushButtonRemoveClicked(bool)));
- QObject::connect(ui.pushButtonWorkSpace, SIGNAL(clicked(clicked)), this, SLOT(onpushButtonWorkSpaceClicked(bool)));
+ QObject::connect(ui.pushButtonAdd,SIGNAL(clicked(bool)),this,SLOT(onpushButtonAddClicked(bool)));
+ QObject::connect(ui.pushButtonRemove, SIGNAL(clicked(bool)), this, SLOT(onpushButtonRemoveClicked(bool)));
+ QObject::connect(ui.pushButtonWorkSpace, SIGNAL(clicked(bool)), this, SLOT(onpushButtonWorkSpaceClicked(bool)));
QObject::connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(onreject()));
QObject::connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(onaccept()));
diff --git a/Toolbox/BaseToolbox/BaseToolbox/QOrthSlrRaster.cpp b/Toolbox/BaseToolbox/BaseToolbox/QOrthSlrRaster.cpp
index 6e4ad79..62a5ad5 100644
--- a/Toolbox/BaseToolbox/BaseToolbox/QOrthSlrRaster.cpp
+++ b/Toolbox/BaseToolbox/BaseToolbox/QOrthSlrRaster.cpp
@@ -14,10 +14,10 @@ QOrthSlrRaster::QOrthSlrRaster(QWidget *parent)
connect(ui.pushButtonAdd, SIGNAL(clicked(bool)), this, SLOT(onpushButtonAddClicked(bool)));
connect(ui.pushButtonRemove, SIGNAL(clicked(bool)), this, SLOT(onpushButtonRemoveClicked(bool)));
- connect(ui.pushButtonDEMSelect, SIGNAL(clicked(bool)), this, SLOT(onpushButtonWorkSpaceClicked(bool)));
- connect(ui.pushButtonWorkSpace, SIGNAL(clicked(bool)), this, SLOT(pushButtonDEMSelectClicked(bool)));
+ connect(ui.pushButtonDEMSelect, SIGNAL(clicked(bool)), this, SLOT(pushButtonDEMSelectClicked(bool)));
+ connect(ui.pushButtonWorkSpace, SIGNAL(clicked(bool)), this, SLOT(onpushButtonWorkSpaceClicked(bool)));
QObject::connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(onreject()));
- QObject::connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(onreject()));
+ QObject::connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(onaccept()));
}
QOrthSlrRaster::~QOrthSlrRaster()
@@ -61,7 +61,7 @@ void QOrthSlrRaster::onpushButtonAddClicked(bool)
this, //
tr(u8"ѡxmlļ"), //
QString(), // Ĭ·
- tr(u8"xml Files (*.xml);;All Files (*)") // ļ
+ tr(ENVI_FILE_FORMAT_FILTER) // ļ
);
// ûѡļ
diff --git a/Toolbox/BaseToolbox/BaseToolbox/QRDOrthProcessClass.cpp b/Toolbox/BaseToolbox/BaseToolbox/QRDOrthProcessClass.cpp
index 2ad3480..c9ec7cc 100644
--- a/Toolbox/BaseToolbox/BaseToolbox/QRDOrthProcessClass.cpp
+++ b/Toolbox/BaseToolbox/BaseToolbox/QRDOrthProcessClass.cpp
@@ -10,8 +10,8 @@ QRDOrthProcessClass::QRDOrthProcessClass(QWidget *parent)
connect(ui.pushButtonAdd,SIGNAL(clicked(bool)),this,SLOT(onpushButtonAddClicked(bool)));
connect(ui.pushButtonRemove,SIGNAL(clicked(bool)),this,SLOT(onpushButtonRemoveClicked(bool)));
- connect(ui.pushButtonDEMSelect,SIGNAL(clicked(bool)),this,SLOT(onpushButtonWorkSpaceClicked(bool)));
- connect(ui.pushButtonWorkSpace, SIGNAL(clicked(bool)), this, SLOT(pushButtonDEMSelectClicked(bool)));
+ connect(ui.pushButtonWorkSpace,SIGNAL(clicked(bool)),this,SLOT(onpushButtonWorkSpaceClicked(bool)));
+ connect(ui.pushButtonDEMSelect, SIGNAL(clicked(bool)), this, SLOT(pushButtonDEMSelectClicked(bool)));
QObject::connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(onreject()));
QObject::connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(onaccept()));
// QDialogButtonBox* buttonBox;
diff --git a/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.cpp b/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.cpp
new file mode 100644
index 0000000..85964ab
--- /dev/null
+++ b/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.cpp
@@ -0,0 +1,77 @@
+#include "RasterVRT2ENVIdataDialog.h"
+#include "ui_RasterVRT2ENVIdataDialog.h"
+#include "BaseConstVariable.h"
+#include "BaseTool.h"
+#include "RasterToolBase.h"
+#include "LogInfoCls.h"
+#include
+#include
+#include "ImageOperatorBase.h"
+
+RasterVRT2ENVIdataDialog::RasterVRT2ENVIdataDialog(QWidget *parent)
+ : QDialog(parent)
+ ,ui(new Ui::RasterVRT2ENVIdataDialogClass)
+{
+ ui->setupUi(this);
+
+ connect(ui->pushButtonVRTSelect, SIGNAL(clicked()), this, SLOT(onpushButtonVRTSelect_clicked()));
+ connect(ui->pushButtonENVIDatSelect, SIGNAL(clicked()), this, SLOT(onpushButtonENVIDatSelect_clicked()));
+ connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbuttonBox_accepted()));
+ connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbuttonBox_rejected()));
+
+}
+
+RasterVRT2ENVIdataDialog::~RasterVRT2ENVIdataDialog()
+{}
+
+void RasterVRT2ENVIdataDialog::onpushButtonVRTSelect_clicked()
+{
+ QString fileNames = QFileDialog::getOpenFileName(
+ this, //
+ tr(u8"ѡL1Bļ"), //
+ QString(), // Ĭ·
+ tr(ENVI_FILE_FORMAT_FILTER) // ļ
+ );
+ // ûѡļ
+ if (!fileNames.isEmpty()) {
+ QString message = "ѡļУ\n";
+ this->ui->lineEditVRTPath->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ"));
+ }
+}
+
+void RasterVRT2ENVIdataDialog::onpushButtonENVIDatSelect_clicked()
+{
+ QString fileNames = QFileDialog::getSaveFileName(
+ this, //
+ tr(u8"ѡENVIDataļ"), //
+ QString(), // Ĭ·
+ tr(ENVI_FILE_FORMAT_FILTER) // ļ
+ );
+ // ûѡļ
+ if (!fileNames.isEmpty()) {
+ QString message = "ѡļУ\n";
+ this->ui->lineEditENVIDatPath->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ"));
+ }
+}
+
+void RasterVRT2ENVIdataDialog::onbuttonBox_accepted()
+{
+ QString vrtrasterpath = ui->lineEditVRTPath->text();
+ QString envidatapath = ui->lineEditENVIDatPath->text();
+
+ ConvertVrtToEnvi(vrtrasterpath, envidatapath);
+
+
+ QMessageBox::information(this, tr(u8"ʾ"), tr(u8""));
+}
+
+void RasterVRT2ENVIdataDialog::onbuttonBox_rejected()
+{
+ this->close();
+}
diff --git a/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.h b/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.h
new file mode 100644
index 0000000..b4123c8
--- /dev/null
+++ b/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.h
@@ -0,0 +1,26 @@
+#pragma once
+
+#include
+
+namespace Ui {
+ class RasterVRT2ENVIdataDialogClass;
+}
+
+
+class RasterVRT2ENVIdataDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ RasterVRT2ENVIdataDialog(QWidget *parent = nullptr);
+ ~RasterVRT2ENVIdataDialog();
+
+
+public slots:
+ void onpushButtonVRTSelect_clicked();
+ void onpushButtonENVIDatSelect_clicked();
+ void onbuttonBox_accepted();
+ void onbuttonBox_rejected();
+private:
+ Ui::RasterVRT2ENVIdataDialogClass* ui;
+};
diff --git a/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.ui b/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.ui
new file mode 100644
index 0000000..9e76517
--- /dev/null
+++ b/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.ui
@@ -0,0 +1,126 @@
+
+
+ RasterVRT2ENVIdataDialogClass
+
+
+
+ 0
+ 0
+ 396
+ 156
+
+
+
+ RasterVRT2ENVIdataDialog
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ vrt文件地址:
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 输出dat地址:
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+
+
diff --git a/Toolbox/BaseToolbox/BaseToolbox/SatelliteGF3xmlParser.cpp b/Toolbox/BaseToolbox/BaseToolbox/SatelliteGF3xmlParser.cpp
index 4cae6ee..5c8ae39 100644
--- a/Toolbox/BaseToolbox/BaseToolbox/SatelliteGF3xmlParser.cpp
+++ b/Toolbox/BaseToolbox/BaseToolbox/SatelliteGF3xmlParser.cpp
@@ -5,24 +5,41 @@
bool SatelliteGF3xmlParser::loadFile(const QString& filename) {
QFile file(filename);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
- qWarning() << "Cannot open file:" << filename;
+ qWarning() << u8"Cannot open file:" << filename;
return false;
}
QDomDocument doc;
if (!doc.setContent(&file)) {
file.close();
- qWarning() << "Failed to parse the file into a DOM tree.";
+ qWarning() << u8"Failed to parse the file into a DOM tree.";
return false;
}
file.close();
xml = doc;
+
+ this->parseAdditionalData();
+ this->parseImageInfo();
+ this->parsePlatform();
+ this->parseGPS();
+
+ //ʱ
+ double tempreftime = start + (end - start) / 2;
+ for (long i = 0;i < antposs.size();i++)
+ {
+ antposs[i].time = antposs[i].time - tempreftime;
+ }
+
+ start = start- tempreftime;
+ end = end- tempreftime;
+
+
return true;
}
void SatelliteGF3xmlParser::parsePlatform() {
- QDomElement platform = xml.firstChildElement("root").firstChildElement("platform");
+ QDomElement platform = xml.firstChildElement("product").firstChildElement("platform");
if (!platform.isNull()) {
CenterTime = platform.firstChildElement("CenterTime").text();
Rs = platform.firstChildElement("Rs").text().toDouble();
@@ -37,24 +54,24 @@ void SatelliteGF3xmlParser::parsePlatform() {
Vys = platform.firstChildElement("Vys").text().toDouble();
Vzs = platform.firstChildElement("Vzs").text().toDouble();
- qDebug() << "Platform Data:";
- qDebug() << "CenterTime:" << CenterTime;
- qDebug() << "Rs:" << Rs;
- qDebug() << "satVelocity:" << satVelocity;
- qDebug() << "RollAngle:" << RollAngle;
- qDebug() << "PitchAngle:" << PitchAngle;
- qDebug() << "YawAngle:" << YawAngle;
- qDebug() << "Xs:" << Xs;
- qDebug() << "Ys:" << Ys;
- qDebug() << "Zs:" << Zs;
- qDebug() << "Vxs:" << Vxs;
- qDebug() << "Vys:" << Vys;
- qDebug() << "Vzs:" << Vzs;
+ qDebug() << u8"Platform Data:";
+ qDebug() << u8"CenterTime:" << CenterTime;
+ qDebug() << u8"Rs:" << Rs;
+ qDebug() << u8"satVelocity:" << satVelocity;
+ qDebug() << u8"RollAngle:" << RollAngle;
+ qDebug() << u8"PitchAngle:" << PitchAngle;
+ qDebug() << u8"YawAngle:" << YawAngle;
+ qDebug() << u8"Xs:" << Xs;
+ qDebug() << u8"Ys:" << Ys;
+ qDebug() << u8"Zs:" << Zs;
+ qDebug() << u8"Vxs:" << Vxs;
+ qDebug() << u8"Vys:" << Vys;
+ qDebug() << u8"Vzs:" << Vzs;
}
}
void SatelliteGF3xmlParser::parseGPS() {
- QDomElement GPS = xml.firstChildElement("root").firstChildElement("GPS");
+ QDomElement GPS = xml.firstChildElement("product").firstChildElement("GPS");
if (!GPS.isNull()) {
QDomNodeList GPSParams = GPS.elementsByTagName("GPSParam");
for (int i = 0; i < GPSParams.count(); ++i) {
@@ -69,37 +86,52 @@ void SatelliteGF3xmlParser::parseGPS() {
QString yVelocity = GPSParam.firstChildElement("yVelocity").text();
QString zVelocity = GPSParam.firstChildElement("zVelocity").text();
- QDateTime dateTime = QDateTime::fromString(TimeStamp, "yyyy-MM-dd HH:mm:ss.zzzzzz");
- satepos.time = dateTime.toMSecsSinceEpoch() / 1000.0;
- satepos.Px = xPosition.toDouble();
- satepos.Py = yPosition.toDouble();
- satepos.Pz = zPosition.toDouble();
- satepos.Vx = xVelocity.toDouble();
- satepos.Vy = yVelocity.toDouble();
- satepos.Vz = zVelocity.toDouble();
+
+ TimestampMicroseconds dateTime = parseAndConvert(TimeStamp.toStdString());
+ satepos.time = dateTime.msecsSinceEpoch / 1000.0 + dateTime.microseconds / 100000.0;
+ satepos.Px = xPosition.toDouble();
+ satepos.Py = yPosition.toDouble();
+ satepos.Pz = zPosition.toDouble();
+ satepos.Vx = xVelocity.toDouble();
+ satepos.Vy = yVelocity.toDouble();
+ satepos.Vz = zVelocity.toDouble();
this->antposs.append(satepos);
- qDebug() << "\nGPS Param Data:";
- qDebug() << "TimeStamp:" << TimeStamp;
- qDebug() << "xPosition:" << xPosition;
- qDebug() << "yPosition:" << yPosition;
- qDebug() << "zPosition:" << zPosition;
- qDebug() << "xVelocity:" << xVelocity;
- qDebug() << "yVelocity:" << yVelocity;
- qDebug() << "zVelocity:" << zVelocity;
+ qDebug() << u8"\nGPS Param Data:";
+ qDebug() << u8"TimeStamp:" << TimeStamp;
+ qDebug() << u8"xPosition:" << xPosition;
+ qDebug() << u8"yPosition:" << yPosition;
+ qDebug() << u8"zPosition:" << zPosition;
+ qDebug() << u8"xVelocity:" << xVelocity;
+ qDebug() << u8"yVelocity:" << yVelocity;
+ qDebug() << u8"zVelocity:" << zVelocity;
}
}
}
void SatelliteGF3xmlParser::parseImageInfo() {
- QDomElement imageinfo = xml.firstChildElement("root").firstChildElement("imageinfo");
+ QDomElement imageinfo = xml.firstChildElement("product").firstChildElement("imageinfo");
if (!imageinfo.isNull()) {
QDomElement imagingTime = imageinfo.firstChildElement("imagingTime");
- ;
- start = QDateTime::fromString(imagingTime.firstChildElement("start").text(), "yyyy-MM-dd HH:mm:ss.zzzzzz").toMSecsSinceEpoch()/1000.0;
- end = QDateTime::fromString(imagingTime.firstChildElement("end").text(), "yyyy-MM-dd HH:mm:ss.zzzzzz").toMSecsSinceEpoch() / 1000.0;
-
+
+ QString starttimestr = imagingTime.firstChildElement("start").text().trimmed();
+ QString endtimestr = imagingTime.firstChildElement("end").text().trimmed();
+
+ TimestampMicroseconds starttime = parseAndConvert(starttimestr.toStdString());
+ TimestampMicroseconds endtime = parseAndConvert(endtimestr.toStdString());
+
+ start = starttime.msecsSinceEpoch / 1000.0 + starttime.microseconds / 100000.0;
+ end = endtime.msecsSinceEpoch / 1000.0 + endtime.microseconds / 100000.0;
+
+ // ӡstarttime,endtime
+ qDebug() << u8"ʼʱ(parse)" << starttime.msecsSinceEpoch << "\t" << starttime.microseconds;
+ qDebug() << u8"ʱ(parse)" << endtime.msecsSinceEpoch << "\t" << endtime.microseconds;
+
+ qDebug() << u8"ʼʱ䣺" << start <<"\t"<< starttimestr;
+ qDebug() << u8"ʱ䣺" << end << "\t" << endtimestr;
+
+
nearRange = imageinfo.firstChildElement("nearRange").text().toDouble();
refRange = imageinfo.firstChildElement("refRange").text().toDouble();
eqvFs = imageinfo.firstChildElement("eqvFs").text().toDouble();
@@ -154,35 +186,36 @@ void SatelliteGF3xmlParser::parseImageInfo() {
incidenceAngleNearRange = imageinfo.firstChildElement("incidenceAngleNearRange").text().toDouble();
incidenceAngleFarRange = imageinfo.firstChildElement("incidenceAngleFarRange").text().toDouble();
- qDebug() << "\nImage Info Data:";
- qDebug() << "Start:" << start;
- qDebug() << "End:" << end;
- qDebug() << "Near Range:" << nearRange;
- qDebug() << "Ref Range:" << refRange;
- qDebug() << "Eqv Fs:" << eqvFs;
- qDebug() << "Eqv PRF:" << eqvPRF;
- qDebug() << "Center Latitude:" << latitude_center << ", Longitude:" << longitude_center;
- qDebug() << "Top Left Corner Latitude:" << latitude_topLeft << ", Longitude:" << longitude_topLeft;
- qDebug() << "Top Right Corner Latitude:" << latitude_topRight << ", Longitude:" << longitude_topRight;
- qDebug() << "Bottom Left Corner Latitude:" << latitude_bottomLeft << ", Longitude:" << longitude_bottomLeft;
- qDebug() << "Bottom Right Corner Latitude:" << latitude_bottomRight << ", Longitude:" << longitude_bottomRight;
- qDebug() << "Width:" << width;
- qDebug() << "Height:" << height;
- qDebug() << "Width Space:" << widthspace;
- qDebug() << "Height Space:" << heightspace;
- qDebug() << "Scene Shift:" << sceneShift;
- qDebug() << "Image Bit:" << imagebit;
- qDebug() << "HH Qualify Value:" << HH_QualifyValue;
- qDebug() << "HV Qualify Value:" << HV_QualifyValue;
- qDebug() << "HH Echo Saturation:" << HH_echoSaturation;
- qDebug() << "HV Echo Saturation:" << HV_echoSaturation;
- qDebug() << "incidenceAngleNearRange:" << incidenceAngleNearRange;
- qDebug() << "incidenceAngleFarRange:" << incidenceAngleFarRange;
+ qDebug() << u8"\nImage Info Data:";
+ qDebug() << u8"Start:" << start;
+ qDebug() << u8"End:" << end;
+ qDebug() << u8"Near Range:" << nearRange;
+ qDebug() << u8"Ref Range:" << refRange;
+ qDebug() << u8"Eqv Fs:" << eqvFs;
+ qDebug() << u8"Eqv PRF:" << eqvPRF;
+ qDebug() << u8"Center Latitude:" << latitude_center << ", Longitude:" << longitude_center;
+ qDebug() << u8"Top Left Corner Latitude:" << latitude_topLeft << ", Longitude:" << longitude_topLeft;
+ qDebug() << u8"Top Right Corner Latitude:" << latitude_topRight << ", Longitude:" << longitude_topRight;
+ qDebug() << u8"Bottom Left Corner Latitude:" << latitude_bottomLeft << ", Longitude:" << longitude_bottomLeft;
+ qDebug() << u8"Bottom Right Corner Latitude:" << latitude_bottomRight << ", Longitude:" << longitude_bottomRight;
+ qDebug() << u8"Width:" << width;
+ qDebug() << u8"Height:" << height;
+ qDebug() << u8"Width Space:" << widthspace;
+ qDebug() << u8"Height Space:" << heightspace;
+ qDebug() << u8"Scene Shift:" << sceneShift;
+ qDebug() << u8"Image Bit:" << imagebit;
+ qDebug() << u8"HH Qualify Value:" << HH_QualifyValue;
+ qDebug() << u8"HV Qualify Value:" << HV_QualifyValue;
+ qDebug() << u8"HH Echo Saturation:" << HH_echoSaturation;
+ qDebug() << u8"HV Echo Saturation:" << HV_echoSaturation;
+ qDebug() << u8"incidenceAngleNearRange:" << incidenceAngleNearRange;
+ qDebug() << u8"incidenceAngleFarRange:" << incidenceAngleFarRange;
}
}
void SatelliteGF3xmlParser::parseAdditionalData() {
- QDomElement calibrationConst = xml.firstChildElement("root").firstChildElement("CalibrationConst");
+ QDomElement processinfo = xml.firstChildElement("product").firstChildElement("processinfo");
+ QDomElement calibrationConst = processinfo.firstChildElement("CalibrationConst");
if (!calibrationConst.isNull()) {
bool HH_CalibrationConstISNULL=false;
@@ -201,50 +234,50 @@ void SatelliteGF3xmlParser::parseAdditionalData() {
- qDebug() << "\nCalibration Const Data:";
- qDebug() << "HH Calibration Const:" << HH_CalibrationConst;
- qDebug() << "HV Calibration Const:" << HV_CalibrationConst;
- qDebug() << "VH Calibration Const:" << VH_CalibrationConst;
- qDebug() << "VV Calibration Const:" << VV_CalibrationConst;
+ qDebug() << u8"\nCalibration Const Data:";
+ qDebug() << u8"HH Calibration Const:" << HH_CalibrationConst;
+ qDebug() << u8"HV Calibration Const:" << HV_CalibrationConst;
+ qDebug() << u8"VH Calibration Const:" << VH_CalibrationConst;
+ qDebug() << u8"VV Calibration Const:" << VV_CalibrationConst;
}
- AzFdc0 = xml.firstChildElement("root").firstChildElement("AzFdc0").text().toDouble();
- AzFdc1 = xml.firstChildElement("root").firstChildElement("AzFdc1").text().toDouble();
+ AzFdc0 = processinfo.firstChildElement("AzFdc0").text().toDouble();
+ AzFdc1 = processinfo.firstChildElement("AzFdc1").text().toDouble();
+ QDomElement sensorNode = xml.firstChildElement("product").firstChildElement("sensor");
+ sensorID = sensorNode.firstChildElement("sensorID").text();
+ imagingMode = sensorNode.firstChildElement("imagingMode").text();
+ lamda = sensorNode.firstChildElement("lamda").text().toDouble();
+ RadarCenterFrequency = sensorNode.firstChildElement("RadarCenterFrequency").text().toDouble();
- sensorID = xml.firstChildElement("root").firstChildElement("sensorID").text();
- imagingMode = xml.firstChildElement("root").firstChildElement("imagingMode").text();
- lamda = xml.firstChildElement("root").firstChildElement("lamda").text().toDouble();
- RadarCenterFrequency = xml.firstChildElement("root").firstChildElement("RadarCenterFrequency").text().toDouble();
+ TotalProcessedAzimuthBandWidth = processinfo.firstChildElement("TotalProcessedAzimuthBandWidth").text().toDouble();
+ DopplerParametersReferenceTime = processinfo.firstChildElement("DopplerParametersReferenceTime").text().toDouble();
- TotalProcessedAzimuthBandWidth = xml.firstChildElement("root").firstChildElement("TotalProcessedAzimuthBandWidth").text().toDouble();
- DopplerParametersReferenceTime = xml.firstChildElement("root").firstChildElement("DopplerParametersReferenceTime").text().toDouble();
-
- QDomElement dopplerCentroidCoefficients = xml.firstChildElement("root").firstChildElement("DopplerCentroidCoefficients");
+ QDomElement dopplerCentroidCoefficients = processinfo.firstChildElement("DopplerCentroidCoefficients");
d0 = dopplerCentroidCoefficients.firstChildElement("d0").text().toDouble();
d1 = dopplerCentroidCoefficients.firstChildElement("d1").text().toDouble();
d2 = dopplerCentroidCoefficients.firstChildElement("d2").text().toDouble();
d3 = dopplerCentroidCoefficients.firstChildElement("d3").text().toDouble();
d4 = dopplerCentroidCoefficients.firstChildElement("d4").text().toDouble();
- QDomElement dopplerRateValuesCoefficients = xml.firstChildElement("root").firstChildElement("DopplerRateValuesCoefficients");
+ QDomElement dopplerRateValuesCoefficients = processinfo.firstChildElement("DopplerRateValuesCoefficients");
r0 = dopplerRateValuesCoefficients.firstChildElement("r0").text().toDouble();
r1 = dopplerRateValuesCoefficients.firstChildElement("r1").text().toDouble();
r2 = dopplerRateValuesCoefficients.firstChildElement("r2").text().toDouble();
r3 = dopplerRateValuesCoefficients.firstChildElement("r3").text().toDouble();
r4 = dopplerRateValuesCoefficients.firstChildElement("r4").text().toDouble();
- DEM = xml.firstChildElement("root").firstChildElement("DEM").text().toDouble();
+ DEM = processinfo.firstChildElement("DEM").text().toDouble();
- qDebug() << "\nAdditional Data:";
- qDebug() << "AzFdc0:" << AzFdc0;
- qDebug() << "AzFdc1:" << AzFdc1;
- qDebug() << "Sensor ID:" << sensorID;
- qDebug() << "Imaging Mode:" << imagingMode;
- qDebug() << "Lambda:" << lamda;
- qDebug() << "Radar Center Frequency:" << RadarCenterFrequency;
- qDebug() << "Total Processed Azimuth Band Width:" << TotalProcessedAzimuthBandWidth;
- qDebug() << "Doppler Parameters Reference Time:" << DopplerParametersReferenceTime;
- qDebug() << "Doppler Centroid Coefficients: d0=" << d0 << ", d1=" << d1 << ", d2=" << d2 << ", d3=" << d3 << ", d4=" << d4;
- qDebug() << "Doppler Rate Values Coefficients: r0=" << r0 << ", r1=" << r1 << ", r2=" << r2 << ", r3=" << r3 << ", r4=" << r4;
- qDebug() << "DEM:" << DEM;
+ qDebug() << u8"\nAdditional Data:";
+ qDebug() << u8"AzFdc0:" << AzFdc0;
+ qDebug() << u8"AzFdc1:" << AzFdc1;
+ qDebug() << u8"Sensor ID:" << sensorID;
+ qDebug() << u8"Imaging Mode:" << imagingMode;
+ qDebug() << u8"Lambda:" << lamda;
+ qDebug() << u8"Radar Center Frequency:" << RadarCenterFrequency;
+ qDebug() << u8"Total Processed Azimuth Band Width:" << TotalProcessedAzimuthBandWidth;
+ qDebug() << u8"Doppler Parameters Reference Time:" << DopplerParametersReferenceTime;
+ qDebug() << u8"Doppler Centroid Coefficients: d0=" << d0 << ", d1=" << d1 << ", d2=" << d2 << ", d3=" << d3 << ", d4=" << d4;
+ qDebug() << u8"Doppler Rate Values Coefficients: r0=" << r0 << ", r1=" << r1 << ", r2=" << r2 << ", r3=" << r3 << ", r4=" << r4;
+ qDebug() << u8"DEM:" << DEM;
}
diff --git a/Toolbox/BaseToolbox/SARSatalliteSimulationWorkflow.cpp b/Toolbox/BaseToolbox/SARSatalliteSimulationWorkflow.cpp
new file mode 100644
index 0000000..a7d7db9
--- /dev/null
+++ b/Toolbox/BaseToolbox/SARSatalliteSimulationWorkflow.cpp
@@ -0,0 +1,90 @@
+#include "SARSatalliteSimulationWorkflow.h"
+#include "QtCreateGPSPointsDialog.h"
+#include "QResampleRefrenceRaster.h"
+#include "DEMLLA2XYZTool.h"
+
+
+void initBaseToolSARSateSimulationWorkflow(ToolBoxWidget* toolbox)
+{
+ // 1. иɹڵ
+ emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"", u8"GF3B"}, new TLE2SatePositionVelocityToolButton(toolbox));
+ emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"", u8"GF3C"}, new TLE2SatePositionVelocityToolButton(toolbox));
+ emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"", u8"LT1A"}, new TLE2SatePositionVelocityToolButton(toolbox));
+ emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"", u8"LT1B"}, new TLE2SatePositionVelocityToolButton(toolbox));
+ emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"", u8"HJ2E"}, new TLE2SatePositionVelocityToolButton(toolbox));
+ emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"", u8"HJ2F"}, new TLE2SatePositionVelocityToolButton(toolbox));
+ emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"", u8"LT04"}, new TLE2SatePositionVelocityToolButton(toolbox));
+
+ // 3. Ӱ
+ emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"", u8"GF3B"}, new QAligendLandClsAndDEMToolButton(toolbox));
+ emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"", u8"GF3C"}, new QAligendLandClsAndDEMToolButton(toolbox));
+ emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"", u8"LT1A"}, new QAligendLandClsAndDEMToolButton(toolbox));
+ emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"", u8"LT1B"}, new QAligendLandClsAndDEMToolButton(toolbox));
+ emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"", u8"HJ2E"}, new QAligendLandClsAndDEMToolButton(toolbox));
+ emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"", u8"HJ2F"}, new QAligendLandClsAndDEMToolButton(toolbox));
+ emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"", u8"LT04"}, new QAligendLandClsAndDEMToolButton(toolbox));
+
+
+ // 4. عʸӰ
+ emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"", u8"GF3B"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox));
+ emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"", u8"GF3C"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox));
+ emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"", u8"LT1A"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox));
+ emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"", u8"LT1B"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox));
+ emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"", u8"HJ2E"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox));
+ emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"", u8"HJ2F"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox));
+ emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"", u8"LT04"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox));
+
+
+
+
+
+
+}
+
+TLE2SatePositionVelocityToolButton::TLE2SatePositionVelocityToolButton(QWidget* parent)
+{
+ this->toolname = QString(u8" иɹڵ");
+}
+
+TLE2SatePositionVelocityToolButton::~TLE2SatePositionVelocityToolButton()
+{
+}
+
+void TLE2SatePositionVelocityToolButton::run()
+{
+ QtCreateGPSPointsDialog* dialog = new QtCreateGPSPointsDialog;
+ dialog->setWindowTitle(u8"иɹڵ");
+ dialog->show();
+}
+
+QAligendLandClsAndDEMToolButton::QAligendLandClsAndDEMToolButton(QWidget* parent)
+{
+ this->toolname = QString(u8" Ӱ");
+}
+
+QAligendLandClsAndDEMToolButton::~QAligendLandClsAndDEMToolButton()
+{
+}
+
+void QAligendLandClsAndDEMToolButton::run()
+{
+ QResampleRefrenceRaster* dialog = new QResampleRefrenceRaster;
+ dialog->setWindowTitle(u8"ΣݵդزӰ");
+ dialog->show();
+}
+
+QDEMLLA2XYZSloperVectorToolButton::QDEMLLA2XYZSloperVectorToolButton(QWidget* parent)
+{
+ this->toolname = QString(u8" ɵĿʸ");
+}
+
+QDEMLLA2XYZSloperVectorToolButton::~QDEMLLA2XYZSloperVectorToolButton()
+{
+}
+
+void QDEMLLA2XYZSloperVectorToolButton::run()
+{
+ DEMLLA2XYZTool* dialog = new DEMLLA2XYZTool();
+ dialog->setWindowTitle(u8"ݵդɵĿʸ");
+ dialog->show();
+}
diff --git a/Toolbox/BaseToolbox/SARSatalliteSimulationWorkflow.h b/Toolbox/BaseToolbox/SARSatalliteSimulationWorkflow.h
new file mode 100644
index 0000000..9f447b9
--- /dev/null
+++ b/Toolbox/BaseToolbox/SARSatalliteSimulationWorkflow.h
@@ -0,0 +1,64 @@
+#pragma once
+
+
+#ifndef __BASETOOLBOX__SARSATALLITESIMULATIONWORKFLOW__H__
+#define __BASETOOLBOX__SARSATALLITESIMULATIONWORKFLOW__H__
+
+
+/**
+ * \file SARSatalliteSimulationWorkflow.h
+ * \brief 洦˵
+ *
+ * \author 30453
+ * \date April 2025
+ *
+ **/
+#include "basetoolbox_global.h"
+#include "ToolBoxWidget.h"
+
+
+extern "C" BASETOOLBOX_EXPORT void initBaseToolSARSateSimulationWorkflow(ToolBoxWidget* toolbox);
+
+
+
+
+class BASETOOLBOX_EXPORT TLE2SatePositionVelocityToolButton : public QToolAbstract {
+ Q_OBJECT
+public:
+ TLE2SatePositionVelocityToolButton(QWidget* parent = nullptr);
+ ~TLE2SatePositionVelocityToolButton();
+public:
+ virtual void run() override;
+
+};
+
+
+
+class BASETOOLBOX_EXPORT QAligendLandClsAndDEMToolButton : public QToolAbstract {
+ Q_OBJECT
+public:
+ QAligendLandClsAndDEMToolButton(QWidget* parent = nullptr);
+ ~QAligendLandClsAndDEMToolButton();
+public :
+ virtual void run() override;
+
+};
+
+class BASETOOLBOX_EXPORT QDEMLLA2XYZSloperVectorToolButton : public QToolAbstract {
+ Q_OBJECT
+public:
+ QDEMLLA2XYZSloperVectorToolButton(QWidget* parent = nullptr);
+ ~QDEMLLA2XYZSloperVectorToolButton();
+public:
+ virtual void run() override;
+
+};
+
+
+
+
+
+#endif
+
+
+
diff --git a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/LookTableSimulationComputer.cu b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/LookTableSimulationComputer.cu
index 6d6e7ef..2252520 100644
--- a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/LookTableSimulationComputer.cu
+++ b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/LookTableSimulationComputer.cu
@@ -145,6 +145,87 @@ __global__ void Kernel_RDProcess_doppler(
+__global__ void Kernel_RDProcess_doppler_calRangeDistance(
+ double* demX, double* demY, double* demZ,
+ double* outR,
+ long pixelcount,
+ double Xp0, double Yp0, double Zp0, double Xv0, double Yv0, double Zv0,
+ double Xp1, double Yp1, double Zp1, double Xv1, double Yv1, double Zv1,
+ double Xp2, double Yp2, double Zp2, double Xv2, double Yv2, double Zv2,
+ double Xp3, double Yp3, double Zp3, double Xv3, double Yv3, double Zv3,
+ double Xp4, double Yp4, double Zp4, double Xv4, double Yv4, double Zv4,
+ double Xp5, double Yp5, double Zp5, double Xv5, double Yv5, double Zv5,
+ double reftime, double r0, double r1, double r2, double r3, double r4,
+ double starttime, double nearRange, double farRange,
+ double PRF, double Fs,
+ double fact_lamda
+) {
+ long idx = blockIdx.x * blockDim.x + threadIdx.x;
+ if (idx < pixelcount) {
+ double demx = demX[idx];
+ double demy = demY[idx];
+ double demz = demZ[idx];
+ double dt = 1.0 / PRF / 3;
+ double Spx = 0, Spy = 0, Spz = 0, Svx = 0, Svy = 0, Svz = 0;
+ double Rx = 0, Ry = 0, Rz = 0, R = 0;
+
+ double dp1 = 0, dpn1 = 0, dp2 = 0, dpn2 = 0;
+
+ double ti = 0;
+ double inct = 0;
+ for (long i = 0; i < 10000; i++) { // Χ
+ Spx = getPolyfitNumber(ti + dt, Xp0, Xp1, Xp2, Xp3, Xp4, Xp5);
+ Spy = getPolyfitNumber(ti + dt, Yp0, Yp1, Yp2, Yp3, Yp4, Yp5);
+ Spz = getPolyfitNumber(ti + dt, Zp0, Zp1, Zp2, Zp3, Zp4, Zp5);
+ Svx = getPolyfitNumber(ti + dt, Xv0, Xv1, Xv2, Xv3, Xv4, Xv5);
+ Svy = getPolyfitNumber(ti + dt, Yv0, Yv1, Yv2, Yv3, Yv4, Yv5);
+ Svz = getPolyfitNumber(ti + dt, Zv0, Zv1, Zv2, Zv3, Zv4, Zv5);
+
+ Rx = Spx - demx;
+ Ry = Spy - demy;
+ Rz = Spz - demz;
+ R = sqrt(Rx * Rx + Ry * Ry + Rz * Rz);
+ Rx = Rx / R;
+ Ry = Ry / R;
+ Rz = Rz / R;
+
+ dp2 = getDopplerCenterRate(Rx, Ry, Rz, Svx, Svy, Svz, fact_lamda);
+ dpn2 = getNumberDopplerCenterRate(R, r0, r1, r2, r3, r4, reftime);
+
+ // ti
+ Spx = getPolyfitNumber(ti, Xp0, Xp1, Xp2, Xp3, Xp4, Xp5);
+ Spy = getPolyfitNumber(ti, Yp0, Yp1, Yp2, Yp3, Yp4, Yp5);
+ Spz = getPolyfitNumber(ti, Zp0, Zp1, Zp2, Zp3, Zp4, Zp5);
+ Svx = getPolyfitNumber(ti, Xv0, Xv1, Xv2, Xv3, Xv4, Xv5);
+ Svy = getPolyfitNumber(ti, Yv0, Yv1, Yv2, Yv3, Yv4, Yv5);
+ Svz = getPolyfitNumber(ti, Zv0, Zv1, Zv2, Zv3, Zv4, Zv5);
+
+ Rx = Spx - demx;
+ Ry = Spy - demy;
+ Rz = Spz - demz;
+ R = sqrt(Rx * Rx + Ry * Ry + Rz * Rz);
+ Rx = Rx / R;
+ Ry = Ry / R;
+ Rz = Rz / R;
+
+ dp1 = getDopplerCenterRate(Rx, Ry, Rz, Svx, Svy, Svz, fact_lamda);
+ dpn1 = getNumberDopplerCenterRate(R, r0, r1, r2, r3, r4, reftime);
+
+ // iter
+ inct = dt * (dp2 - dpn1) / (dp1 - dp2);
+
+ if (abs(inct) <= dt || isnan(inct)) {
+ outR[idx] = R;//Rd_c;
+ return;
+ }
+ ti = ti + inct;
+ }
+ outR[idx] = 0;
+ }
+}
+
+
+
void RDProcess_dopplerGPU(
@@ -185,6 +266,51 @@ void RDProcess_dopplerGPU(
cudaDeviceSynchronize();
}
+
+
+void RDProcess_dopplerGPU_InSARImagePlaneXYZR(
+ double* demX, double* demY, double* demZ,
+ double* outR,
+ long rowcount, long colcount,
+ double starttime, double nearRange, double farRange,
+ double PRF, double Fs,
+ double fact_lamda,
+ double Xp0, double Yp0, double Zp0, double Xv0, double Yv0, double Zv0,
+ double Xp1, double Yp1, double Zp1, double Xv1, double Yv1, double Zv1,
+ double Xp2, double Yp2, double Zp2, double Xv2, double Yv2, double Zv2,
+ double Xp3, double Yp3, double Zp3, double Xv3, double Yv3, double Zv3,
+ double Xp4, double Yp4, double Zp4, double Xv4, double Yv4, double Zv4,
+ double Xp5, double Yp5, double Zp5, double Xv5, double Yv5, double Zv5,
+ double reftime, double r0, double r1, double r2, double r3, double r4
+
+)
+{
+ long pixelcount = rowcount * colcount;
+ int numBlocks = (pixelcount + BLOCK_SIZE - 1) / BLOCK_SIZE;
+ Kernel_RDProcess_doppler_calRangeDistance << > > (
+ demX, demY, demZ,
+ outR,
+ pixelcount,
+ Xp0, Yp0, Zp0, Xv0, Yv0, Zv0,
+ Xp1, Yp1, Zp1, Xv1, Yv1, Zv1,
+ Xp2, Yp2, Zp2, Xv2, Yv2, Zv2,
+ Xp3, Yp3, Zp3, Xv3, Yv3, Zv3,
+ Xp4, Yp4, Zp4, Xv4, Yv4, Zv4,
+ Xp5, Yp5, Zp5, Xv5, Yv5, Zv5,
+ reftime, r0, r1, r2, r3, r4,
+ starttime, nearRange, farRange,
+ PRF, Fs,
+ fact_lamda
+ );
+ PrintLasterError("RD with doppler function");
+ cudaDeviceSynchronize();
+}
+
+
+
+
+
+
__device__ double calculateIncidenceAngle(double Rx, double Ry, double Rz, double Sx, double Sy, double Sz) {
double dotProduct = Rx * Sx + Ry * Sy + Rz * Sz;
double magnitudeR = sqrt(Rx * Rx + Ry * Ry + Rz * Rz);
diff --git a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/LookTableSimulationComputer.cuh b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/LookTableSimulationComputer.cuh
index 1ce140e..a697719 100644
--- a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/LookTableSimulationComputer.cuh
+++ b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/LookTableSimulationComputer.cuh
@@ -57,3 +57,21 @@ extern "C" void RDProcess_demSloperGPU(
);
+
+
+
+extern "C" void RDProcess_dopplerGPU_InSARImagePlaneXYZR(
+ double* demX, double* demY, double* demZ,
+ double* outR,
+ long rowcount, long colcount,
+ double starttime, double nearRange, double farRange,
+ double PRF, double Fs,
+ double fact_lamda,
+ double Xp0, double Yp0, double Zp0, double Xv0, double Yv0, double Zv0,
+ double Xp1, double Yp1, double Zp1, double Xv1, double Yv1, double Zv1,
+ double Xp2, double Yp2, double Zp2, double Xv2, double Yv2, double Zv2,
+ double Xp3, double Yp3, double Zp3, double Xv3, double Yv3, double Zv3,
+ double Xp4, double Yp4, double Zp4, double Xv4, double Yv4, double Zv4,
+ double Xp5, double Yp5, double Zp5, double Xv5, double Yv5, double Zv5,
+ double reftime, double r0, double r1, double r2, double r3, double r4
+);
\ No newline at end of file
diff --git a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.cpp b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.cpp
new file mode 100644
index 0000000..38004a5
--- /dev/null
+++ b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.cpp
@@ -0,0 +1,95 @@
+#include "QLookTableResampleFromWGS84ToRange.h"
+#include "BaseConstVariable.h"
+#include "BaseTool.h"
+#include
+#include
+#include "ui_QLookTableResampleFromWGS84ToRange.h"
+#include "ImageNetOperator.h"
+
+QLookTableResampleFromWGS84ToRange::QLookTableResampleFromWGS84ToRange(QWidget *parent)
+ : QDialog(parent)
+ ,ui(new Ui::QLookTableResampleFromWGS84ToRangeClass)
+{
+ ui->setupUi(this);
+
+ connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onaccepted()));
+ connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onrejected()));
+ connect(ui->pushButtonLookTableWGS84Select, SIGNAL(clicked(bool)), this, SLOT(onpushButtonLookTableWGS84SelectClicked(bool)));
+ connect(ui->pushButtonLookTableRangeSelect, SIGNAL(clicked(bool)), this, SLOT(onpushButtonLookTableRangeSelectClicked(bool)));
+ connect(ui->pushButtonLookTableCountSelect, SIGNAL(clicked(bool)), this, SLOT(onpushButtonLookTableCountSelectClicked(bool)));
+}
+
+QLookTableResampleFromWGS84ToRange::~QLookTableResampleFromWGS84ToRange()
+{}
+
+void QLookTableResampleFromWGS84ToRange::onaccepted()
+{
+ QString looktableWGS84Ptah = ui->lineEditLookTableWGS84Path->text();
+ QString looktableRangePtah = ui->lineEditLookTableRangePath->text();
+ QString looktableCountPtah = ui->lineEditLookTableCountPath->text();
+
+ long Oriheight = ui->spinBoxRowCount->value();
+ long OriWidth = ui->spinBoxColCount->value();
+
+ ReflectTable_WGS2Range(looktableWGS84Ptah, looktableRangePtah, looktableCountPtah, Oriheight, OriWidth);
+ QMessageBox::information(nullptr, u8"ʾ", u8"");
+}
+
+void QLookTableResampleFromWGS84ToRange::onrejected()
+{
+ this->close();
+}
+
+void QLookTableResampleFromWGS84ToRange::onpushButtonLookTableWGS84SelectClicked(bool)
+{
+ QString fileNames = QFileDialog::getOpenFileName(
+ this,
+ tr(u8"ѡWGS84ļ"),
+ QString(),
+ tr(ENVI_FILE_FORMAT_FILTER)
+ );
+
+ if (!fileNames.isEmpty()) {
+ QString message = "ѡļ\n";
+ this->ui->lineEditLookTableWGS84Path->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ʾ"), tr(u8"ûѡļ"));
+ }
+}
+
+void QLookTableResampleFromWGS84ToRange::onpushButtonLookTableRangeSelectClicked(bool)
+{
+ QString fileNames = QFileDialog::getSaveFileName(
+ this,
+ tr(u8"бƽļ"),
+ QString(),
+ tr(ENVI_FILE_FORMAT_FILTER)
+ );
+
+ if (!fileNames.isEmpty()) {
+ QString message = "ѡļ\n";
+ this->ui->lineEditLookTableRangePath->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ʾ"), tr(u8"ûѡļ"));
+ }
+}
+
+void QLookTableResampleFromWGS84ToRange::onpushButtonLookTableCountSelectClicked(bool)
+{
+ QString fileNames = QFileDialog::getSaveFileName(
+ this,
+ tr(u8"ͳƲƽļ"),
+ QString(),
+ tr(ENVI_FILE_FORMAT_FILTER)
+ );
+
+ if (!fileNames.isEmpty()) {
+ QString message = "ѡļ\n";
+ this->ui->lineEditLookTableCountPath->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ʾ"), tr(u8"ûѡļ"));
+ }
+}
diff --git a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.h b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.h
new file mode 100644
index 0000000..6f90bf2
--- /dev/null
+++ b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.h
@@ -0,0 +1,30 @@
+#pragma once
+
+#include
+
+
+namespace Ui {
+ class QLookTableResampleFromWGS84ToRangeClass;
+}
+
+class QLookTableResampleFromWGS84ToRange : public QDialog
+{
+ Q_OBJECT
+
+public:
+ QLookTableResampleFromWGS84ToRange(QWidget *parent = nullptr);
+ ~QLookTableResampleFromWGS84ToRange();
+
+
+public slots:
+
+ void onaccepted();
+ void onrejected();
+ void onpushButtonLookTableWGS84SelectClicked(bool);
+ void onpushButtonLookTableRangeSelectClicked(bool);
+ void onpushButtonLookTableCountSelectClicked(bool);
+
+
+private:
+ Ui::QLookTableResampleFromWGS84ToRangeClass* ui;
+};
diff --git a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.ui b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.ui
new file mode 100644
index 0000000..42e6ae2
--- /dev/null
+++ b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.ui
@@ -0,0 +1,201 @@
+
+
+ QLookTableResampleFromWGS84ToRangeClass
+
+
+
+ 0
+ 0
+ 747
+ 293
+
+
+
+ QLookTableResampleFromWGS84ToRange
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 行数
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 查找表(斜距)
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 查找表(WGS84)
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 查找表采样点数
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 列数
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 999999999
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 999999999
+
+
+
+
+
+
+
+
+
diff --git a/Toolbox/SimulationSARTool/SARImage/GPUBPImageNet.cu b/Toolbox/SimulationSARTool/SARImage/GPUBPImageNet.cu
new file mode 100644
index 0000000..c5e94a2
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/GPUBPImageNet.cu
@@ -0,0 +1,204 @@
+#include "GPUBaseTool.h"
+#include "GPUBPTool.cuh"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "BaseConstVariable.h"
+#include "GPUBPImageNet.cuh"
+
+#ifndef MAX_ITER
+#define EPSILON 1e-12
+#define MAX_ITER 50
+#endif
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
+
+__global__ void kernel_TimeBPImageGridNet(
+ double* antPx, double* antPy, double* antPz,
+ double* antDirx, double* antDiry, double* antDirz,
+ double* imgx, double* imgy, double* imgz,
+ long prfcount, long freqpoints, double meanH,
+ double Rnear, double dx) {
+
+ long idx = blockIdx.x * blockDim.x + threadIdx.x;
+ long pixelcount = prfcount * freqpoints;
+ long prfid = idx / freqpoints;
+ long Rid = idx % freqpoints;
+ if (idx < pixelcount) {
+ //
+ Vector3 S = { antPx[prfid], antPy[prfid], antPz[prfid] }; // λ (m)
+ Vector3 ray = { antDirx[prfid], antDiry[prfid], antDirz[prfid] }; // ߷
+ double H = meanH; // ƽ߳
+ double R = Rnear + dx * Rid; // Ŀ
+ // У
+ if (R <= 0 || H < -WGS84_A * 0.1 || H > WGS84_A * 0.1) {
+ //printf("\n HΧ%.1f km\n R>0\n", WGS84_A * 0.1 / 1000);
+ imgx[idx] = 0;
+ imgy[idx] = 0;
+ imgz[idx] = 0;
+ return;
+ //printf("idx=%d;prfid=%d;Rid=%d;S=[%f , %f ,%f ];ray=[%f ,%f ,%f ];H=%f;R=%f,imgP=[%f ,%f , %f ];Rextend\n",
+ // idx, prfid, Rid, S.x, S.y, S.z, ray.x, ray.y, ray.z, H, R,imgx[idx],imgy[idx],imgz[idx]);
+ // У
+ //return;
+ }
+
+ // Step 1: 㽻T
+ Vector3 T = compute_T(S, ray, H);
+ if (isnan(T.x)) {
+ imgx[idx] = 0;
+ imgy[idx] = 0;
+ imgz[idx] = 0;
+ //printf("idx=%d;prfid=%d;Rid=%d;Tnan\n",
+ // idx, prfid, Rid, S.x, S.y, S.z, ray.x, ray.y, ray.z, H, R,T.x,T.y,T.z, imgx[idx], imgy[idx], imgz[idx]);
+ return;
+ }
+
+ // Step 2: ĿP
+
+ Vector3 P;// = compute_P(S, T, R, H);
+ { // P
+ Vector3 ex, ey, ez; // ƽ
+ Vector3 ST = vec_normalize(vec_sub(T, S));// S->T
+ Vector3 SO = vec_normalize(vec_sub(Vector3{ 0, 0, 0 }, S)); // S->O
+
+
+ Vector3 st1 = vec_sub(T, S);
+ double R0 = sqrt(st1.x * st1.x + st1.y * st1.y + st1.z * st1.z);
+ ez = vec_normalize(vec_cross(SO, ST)); // Z
+ ey = vec_normalize(vec_cross(ez, SO)); // Y ST ͬ --ǵؼԼȻģ
+ ex = vec_normalize(SO); //X
+
+
+
+ double h2 = (WGS84_A + H) * (WGS84_A + H);
+ double b2 = WGS84_B * WGS84_B;
+ double R2 = R * R;
+ double A = R2 * ((ex.x * ex.x + ex.y * ex.y) / h2 + (ex.z * ex.z) / b2);
+ double B = R2 * ((ex.x * ey.x + ex.y * ey.y) / h2 + (ex.z * ey.z) / b2) * 2;
+ double C = R2 * ((ey.x * ey.x + ey.y * ey.y) / h2 + (ey.z * ey.z) / b2);
+ double D = 1 - ((S.x * S.x + S.y * S.y) / h2 + (S.z * S.z) / b2);
+ double E = 2 * R * ((S.x * ex.x + S.y * ex.y) / h2 + (S.z * ex.z) / b2);
+ double F = 2 * R * ((S.x * ey.x + S.y * ey.y) / h2 + (S.z * ey.z) / b2);
+ double Q0 = angleBetweenVectors(SO, ST, false);
+ double dQ = 0;
+ double fQ = 0;
+ double dfQ = 0;
+ double Q = R < R0 ? Q0 - 1e-3 : Q0 + 1e-3;
+
+ //printf("A=%f;B=%f;C=%f;D=%f;E=%f;F=%f;Q=%f;\
+ // S=[%f , %f ,%f ];\
+ // T=[%f , %f ,%f ];\
+ // ex=[%f , %f ,%f ];\
+ // ey=[%f , %f ,%f ];\
+ // ez=[%f , %f ,%f ];\
+ //ray=[%f ,%f ,%f ];\
+ //H=%f;R=%f;;\n",A,B,C,D,E,F,Q,
+ // S.x,S.y,S.z,
+ // T.x,T.y,T.z ,
+ // ex.x,ex.y,ex.z,
+ // ey.x,ey.y,ey.z,
+ // ez.x,ez.y,ez.z,
+ // ray.x, ray.y, ray.z,
+ // H, R);
+ // return;
+
+ // ţٵ
+ for (int iter = 0; iter < MAX_ITER * 10; ++iter) {
+ fQ = A * cos(Q) * cos(Q) + B * sin(Q) * cos(Q) + C * sin(Q) * sin(Q) + E * cos(Q) + F * sin(Q) - D;
+ dfQ = (C - A) * sin(2 * Q) + B * cos(2 * Q) - E * sin(Q) + F * cos(Q);
+ dQ = fQ / dfQ;
+ if (abs(dQ) < 1e-8) {
+ //printf("iter=%d;check Q0=%f;Q=%f;dQ=%f;fQ=%f;dfQ=%f;break\n", iter, Q0, Q, dQ, fQ, dfQ);
+ break;
+ }
+ else {
+ dQ = (abs(dQ) < d2r * 3) ? dQ : (abs(dQ) / dQ * d2r * 3);
+ Q = Q - dQ;
+ //printf("iter=%d;check Q0=%f;Q=%f;dQ=%f;fQ=%f;dfQ=%f;\n", iter, Q0, Q, dQ, fQ, dfQ);
+ }
+
+ }
+ //printf("check Q0=%f;Q=%f;\n", Q0, Q);
+ double t1 = R * cos(Q);
+ double t2 = R * sin(Q);
+ P = Vector3{
+ S.x + t1 * ex.x + t2 * ey.x, //Ϊ t3=0
+ S.y + t1 * ex.y + t2 * ey.y,
+ S.z + t1 * ex.z + t2 * ey.z,
+ };
+ double check = (P.x * P.x + P.y * P.y) / ((WGS84_A + H) * (WGS84_A + H))
+ + P.z * P.z / (WGS84_B * WGS84_B);
+ if (isnan(Q) || isinf(Q) || fabs(check - 1.0) > 1e-6) {
+ P = Vector3{ 0,0,0 };
+ imgx[idx] = 0;
+ imgy[idx] = 0;
+ imgz[idx] = 0;
+ return;
+ }
+ }
+
+ double Rt = sqrt(pow(S.x - T.x, 2) + pow(S.y - T.y, 2) + pow(S.z - T.z, 2));
+ double Rp = sqrt(pow(S.x - P.x, 2) + pow(S.y - P.y, 2) + pow(S.z - P.z, 2));
+ double Rop = sqrt(pow(P.x, 2) + pow(P.y, 2) + pow(P.z, 2));
+
+ if (!isnan(P.x) && (Rop > WGS84_A * 0.3) && (Rop < WGS84_A * 3)) {
+
+ imgx[idx] = P.x;
+ imgy[idx] = P.y;
+ imgz[idx] = P.z;
+ return;
+ //printf("idx=%d; S=[%f , %f ,%f ]; H=%f;R=%f;RP=%f;Rr=%f;imgT=[%f ,%f ,%f ];imgP=[%f ,%f , %f ]; \n",
+ // idx, S.x, S.y, S.z, H, R, Rp, Rt,T.x, T.y, T.z, P.x, P.y, P.z);
+ }
+ else {
+ imgx[idx] = 0;
+ imgy[idx] = 0;
+ imgz[idx] = 0;
+ printf("idx=%d; S=[%f , %f ,%f ]; H=%f;R=%f;RP=%f;Rr=%f;imgT=[%f ,%f ,%f ];imgP=[%f ,%f , %f ]; ERROR\n",
+ idx, S.x, S.y, S.z, H, R, Rp, Rt, T.x, T.y, T.z, P.x, P.y, P.z);
+ return;
+ }
+ }
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+void TIMEBPCreateImageGrid(double* antPx, double* antPy, double* antPz,
+ double* antDirx, double* antDiry, double* antDirz,
+ double* imgx, double* imgy, double* imgz,
+ long prfcount, long freqpoints, double meanH,
+ double Rnear, double dx
+)
+{
+ long pixelcount = prfcount * freqpoints;
+ int grid_size = (pixelcount + BLOCK_SIZE - 1) / BLOCK_SIZE;
+
+ kernel_TimeBPImageGridNet << > > (
+ antPx, antPy, antPz,
+ antDirx, antDiry, antDirz,
+ imgx, imgy, imgz,
+ prfcount, freqpoints, meanH,
+ Rnear, dx);
+ PrintLasterError("TIMEBPCreateImageGrid");
+ cudaDeviceSynchronize();
+}
diff --git a/Toolbox/SimulationSARTool/SARImage/GPUBPImageNet.cuh b/Toolbox/SimulationSARTool/SARImage/GPUBPImageNet.cuh
new file mode 100644
index 0000000..e62e525
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/GPUBPImageNet.cuh
@@ -0,0 +1,28 @@
+#ifndef __GPUBPIMAGENET_CUH___
+#define __GPUBPIMAGENET_CUH___
+
+
+#include "BaseConstVariable.h"
+#include "GPUTool.cuh"
+#include
+#include
+#include
+#include
+#include "GPUTool.cuh"
+#include "GPUBPTool.cuh"
+
+
+
+
+
+extern "C" void TIMEBPCreateImageGrid(
+ double* antPx, double* antPy, double* antPz, // S
+ double* antDirx, double* antDiry, double* antDirz, //
+ double* imgx, double* imgy, double* imgz,
+ long prfcount, long freqpoints, double meanH,
+ double Rnear, double dx
+);
+
+
+
+#endif
\ No newline at end of file
diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp
new file mode 100644
index 0000000..cd5078d
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp
@@ -0,0 +1,1118 @@
+#include "ImageNetOperator.h"
+#include "LogInfoCls.h"
+#include "PrintMsgToQDebug.h"
+#include
+#include "ImageOperatorBase.h"
+#include "GPUBaseTool.h"
+#include "GPUBPImageNet.cuh"
+#include "BaseTool.h"
+#include "BaseConstVariable.h"
+
+
+void InitCreateImageXYZProcess(QString& outImageLLPath, QString& outImageXYZPath, QString& InEchoGPSDataPath,
+ double& NearRange, double& RangeResolution, int64_t& RangeNum)
+{
+ qDebug() << "---------------------------------------------------------------------------------";
+ qDebug() << u8"ֳƽбͶӰ";
+ gdalImage antimg(InEchoGPSDataPath);
+ qDebug() << u8"1. زGPSļ\t";
+ qDebug() << u8"ļ·\t" << InEchoGPSDataPath;
+ qDebug() << u8"GPS \t" << antimg.height;
+ qDebug() << u8"ļ\t" << antimg.width;
+ qDebug() << u8"2.б";
+ qDebug() << u8"룺\t" << NearRange;
+ qDebug() << u8"ֱʣ\t" << RangeResolution;
+ qDebug() << u8"\t" << RangeNum;
+ qDebug() << u8"3.ļ";
+ gdalImage outimgll = CreategdalImageDouble(outImageLLPath, antimg.height,RangeNum, 3,true,true);
+ gdalImage outimgxyz = CreategdalImageDouble(outImageXYZPath, antimg.height, RangeNum, 3, true, true);
+ qDebug() << u8"ƽļγȣ·\t" << outImageLLPath;
+ qDebug() << u8"ƽļXYZ·\t" << outImageXYZPath;
+ qDebug() << u8"4.ʼXYZ";
+ long prfcount = antimg.height;
+ long rangeNum = RangeNum;
+ double Rnear = NearRange;
+ double dx = RangeResolution;
+
+ long blockRangeCount = Memory1GB / sizeof(double) / 4 / prfcount *6;
+ blockRangeCount = blockRangeCount < 1 ? 1 : blockRangeCount;
+
+ std::shared_ptr Pxs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
+ std::shared_ptr Pys((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
+ std::shared_ptr Pzs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
+ std::shared_ptr AntDirectX((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
+ std::shared_ptr AntDirectY((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
+ std::shared_ptr AntDirectZ((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
+
+ {
+ long colnum = 19;
+ std::shared_ptr antpos =readDataArr(antimg,0,0,prfcount, colnum,1,GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
+ double time = 0;
+ double Px = 0;
+ double Py = 0;
+ double Pz = 0;
+ for (long i = 0; i < prfcount; i++) {
+
+ Pxs.get()[i] = antpos.get()[i * 19 + 1]; //
+ Pys.get()[i] = antpos.get()[i * 19 + 2];
+ Pzs.get()[i] = antpos.get()[i * 19 + 3];
+ AntDirectX.get()[i] = antpos.get()[i * 19 + 13];// zero doppler
+ AntDirectY.get()[i] = antpos.get()[i * 19 + 14];
+ AntDirectZ.get()[i] = antpos.get()[i * 19 + 15];
+
+ double NormAnt = std::sqrt(AntDirectX.get()[i] * AntDirectX.get()[i] +
+ AntDirectY.get()[i] * AntDirectY.get()[i] +
+ AntDirectZ.get()[i] * AntDirectZ.get()[i]);
+ AntDirectX.get()[i] = AntDirectX.get()[i] / NormAnt;
+ AntDirectY.get()[i] = AntDirectY.get()[i] / NormAnt;
+ AntDirectZ.get()[i] = AntDirectZ.get()[i] / NormAnt;// һ
+ }
+ antpos.reset();
+ }
+
+ std::shared_ptr d_Pxs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
+ std::shared_ptr d_Pys((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
+ std::shared_ptr d_Pzs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
+ std::shared_ptr d_AntDirectX((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
+ std::shared_ptr d_AntDirectY((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
+ std::shared_ptr d_AntDirectZ((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
+
+ HostToDevice(Pxs.get(), d_Pxs.get(), sizeof(double) * prfcount);
+ HostToDevice(Pys.get(), d_Pys.get(), sizeof(double) * prfcount);
+ HostToDevice(Pzs.get(), d_Pzs.get(), sizeof(double) * prfcount);
+ HostToDevice(AntDirectX.get(), d_AntDirectX.get(), sizeof(double) * prfcount);
+ HostToDevice(AntDirectY.get(), d_AntDirectY.get(), sizeof(double) * prfcount);
+ HostToDevice(AntDirectZ.get(), d_AntDirectZ.get(), sizeof(double) * prfcount);
+
+
+ for (long startcolidx = 0; startcolidx < RangeNum; startcolidx = startcolidx + blockRangeCount) {
+
+ long tempechocol = blockRangeCount;
+ if (startcolidx + tempechocol >= RangeNum) {
+ tempechocol = RangeNum - startcolidx;
+ }
+ qDebug() << " imgxyz :\t" << startcolidx << "\t-\t" << startcolidx + tempechocol << " / " << RangeNum;
+
+ std::shared_ptr demx = readDataArr(outimgxyz, 0, startcolidx, prfcount, tempechocol, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
+ std::shared_ptr demy = readDataArr(outimgxyz, 0, startcolidx, prfcount, tempechocol, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
+ std::shared_ptr demz = readDataArr(outimgxyz, 0, startcolidx, prfcount, tempechocol, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
+
+ std::shared_ptr h_demx((double*)mallocCUDAHost(sizeof(double) * prfcount * tempechocol), FreeCUDAHost);
+ std::shared_ptr h_demy((double*)mallocCUDAHost(sizeof(double) * prfcount * tempechocol), FreeCUDAHost);
+ std::shared_ptr h_demz((double*)mallocCUDAHost(sizeof(double) * prfcount * tempechocol), FreeCUDAHost);
+
+#pragma omp parallel for
+ for (long ii = 0; ii < prfcount; ii++) {
+ for (long jj = 0; jj < tempechocol; jj++) {
+ h_demx.get()[ii * tempechocol + jj] = demx.get()[ii * tempechocol + jj];
+ h_demy.get()[ii * tempechocol + jj] = demy.get()[ii * tempechocol + jj];
+ h_demz.get()[ii * tempechocol + jj] = demz.get()[ii * tempechocol + jj];
+ }
+ }
+
+ std::shared_ptr d_demx((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice);
+ std::shared_ptr d_demy((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice);
+ std::shared_ptr d_demz((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice);
+
+ HostToDevice(h_demx.get(), d_demx.get(), sizeof(double) * prfcount * tempechocol);
+ HostToDevice(h_demy.get(), d_demy.get(), sizeof(double) * prfcount * tempechocol);
+ HostToDevice(h_demz.get(), d_demz.get(), sizeof(double) * prfcount * tempechocol);
+
+
+ TIMEBPCreateImageGrid(
+ d_Pxs.get(), d_Pys.get(), d_Pzs.get(),
+ d_AntDirectX.get(), d_AntDirectY.get(), d_AntDirectZ.get(),
+ d_demx.get(), d_demy.get(), d_demz.get(),
+ prfcount, tempechocol, 0,
+ Rnear + dx * startcolidx, dx //
+ );
+
+ DeviceToHost(h_demx.get(), d_demx.get(), sizeof(double) * prfcount * tempechocol);
+ DeviceToHost(h_demy.get(), d_demy.get(), sizeof(double) * prfcount * tempechocol);
+ DeviceToHost(h_demz.get(), d_demz.get(), sizeof(double) * prfcount * tempechocol);
+
+#pragma omp parallel for
+ for (long ii = 0; ii < prfcount; ii++) {
+ for (long jj = 0; jj < tempechocol; jj++) {
+ demx.get()[ii * tempechocol + jj] = h_demx.get()[ii * tempechocol + jj];
+ demy.get()[ii * tempechocol + jj] = h_demy.get()[ii * tempechocol + jj];
+ demz.get()[ii * tempechocol + jj] = h_demz.get()[ii * tempechocol + jj];
+ }
+ }
+
+ outimgxyz.saveImage(demx, 0, startcolidx, prfcount, tempechocol, 1);
+ outimgxyz.saveImage(demy, 0, startcolidx, prfcount, tempechocol, 2);
+ outimgxyz.saveImage(demz, 0, startcolidx, prfcount, tempechocol, 3);
+
+ // XYZתΪγ
+ std::shared_ptr demllx = readDataArr(outimgll, 0, startcolidx, prfcount, tempechocol, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
+ std::shared_ptr demlly = readDataArr(outimgll, 0, startcolidx, prfcount, tempechocol, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
+ std::shared_ptr demllz = readDataArr(outimgll, 0, startcolidx, prfcount, tempechocol, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
+
+#pragma omp parallel for
+ for (long ii = 0; ii < prfcount; ii++) {
+ for (long jj = 0; jj < tempechocol; jj++) {
+ double x = demx.get()[ii * tempechocol + jj];
+ double y = demy.get()[ii * tempechocol + jj];
+ double z = demz.get()[ii * tempechocol + jj];
+ Landpoint point;
+ XYZ2BLH_FixedHeight(x, y, z, 0, point);
+ demllx.get()[ii * tempechocol + jj] = point.lon;
+ demlly.get()[ii * tempechocol + jj] = point.lat;
+ demllz.get()[ii * tempechocol + jj] = point.ati;
+ }
+ }
+
+
+ outimgll.saveImage(demllx, 0, startcolidx, prfcount, tempechocol, 1);
+ outimgll.saveImage(demlly, 0, startcolidx, prfcount, tempechocol, 2);
+ outimgll.saveImage(demllz, 0, startcolidx, prfcount, tempechocol, 3);
+
+ }
+
+ qDebug() << u8"6.";
+ qDebug() << "---------------------------------------------------------------------------------";
+}
+
+bool OverlapCheck(QString& ImageLLPath, QString& ImageDEMPath)
+{
+ // DEMǷWGS84ϵ
+ //long demEPSG = GetEPSGFromRasterFile(ImageDEMPath);
+ //if (demEPSG != 4326) {
+ // qDebug() << u8"DEMϵWGS84ϵ,ESPG:"<< demEPSG;
+ // return false;
+ //}
+
+ gdalImage demimg(ImageDEMPath);
+ gdalImage imgll(ImageLLPath);
+
+ long imgheight = imgll.height;
+ long imgwidth = imgll.width;
+ Eigen::MatrixXd imglonArr = imgll.getData(0, 0, imgheight, imgwidth, 1);
+ Eigen::MatrixXd imglatArr = imgll.getData(0, 0, imgheight, imgwidth, 2);
+
+ // ӡΧ
+ qDebug() << u8"ӰΧ";
+ qDebug() << u8"Сȣ\t" << imglonArr.minCoeff();
+ qDebug() << u8"ȣ\t" << imglonArr.maxCoeff();
+ qDebug() << u8"Сγȣ\t" << imglatArr.minCoeff();
+ qDebug() << u8"γȣ\t" << imglatArr.maxCoeff();
+ qDebug() << u8"DEMΧ";
+ RasterExtend demextend = demimg.getExtend();
+ qDebug() << u8"Сȣ\t" << demextend.min_x;
+ qDebug() << u8"ȣ\t" << demextend.max_x;
+ qDebug() << u8"Сγȣ\t" << demextend.min_y;
+ qDebug() << u8"γȣ\t" << demextend.max_y;
+ qDebug() << u8"ӰС\t" << demimg.height << " * " << demimg.width;
+
+
+
+ for (long i = 0; i < imgheight; i++)
+ {
+ for (long j = 0; j < imgwidth; j++)
+ {
+ double lon = imglonArr(i, j); // X
+ double lat = imglatArr(i, j); // Y
+ Landpoint point = demimg.getRow_Col(lon, lat);
+ imglonArr(i, j) = point.lon;
+ imglatArr(i, j) = point.lat;
+ }
+ }
+
+ double minX = imglonArr.minCoeff();
+ double maxX = imglonArr.maxCoeff();
+ double minY = imglatArr.minCoeff();
+ double maxY = imglatArr.maxCoeff();
+
+ //ӡΧ
+ qDebug() << u8"dem ķΧ";
+ qDebug() << u8"minX:"<demimg.width - 1 || minY<1 || maxY>demimg.height - 1) {
+ return false;
+ }
+ else {
+ return true;
+ }
+
+
+
+}
+
+bool GPSPointsNumberEqualCheck(QString& ImageLLPath, QString& InEchoGPSDataPath)
+{
+
+ gdalImage antimg(InEchoGPSDataPath);
+ gdalImage imgll(ImageLLPath);
+ return antimg.height == imgll.height;
+
+}
+
+
+
+void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath, QString& InEchoGPSDataPath)
+{
+ gdalImage demimg(ImageDEMPath);
+ gdalImage imgll(ImageLLPath);
+ gdalImage outimgll = CreategdalImageDouble(outImageLLAPath, imgll.height, imgll.width, 4, true, true); // ȡγȡ̡߳б
+
+ long imgheight = imgll.height;
+ long imgwidth = imgll.width;
+
+ Eigen::MatrixXd imglonArr = imgll.getData(0, 0, imgheight, imgwidth, 1);
+ Eigen::MatrixXd imglatArr = imgll.getData(0, 0, imgheight, imgwidth, 2);
+ Eigen::MatrixXd demArr = demimg.getData(0, 0, demimg.height, demimg.width, 1);
+ Eigen::MatrixXd imgatiArr = Eigen::MatrixXd::Zero(imgheight, imgwidth);
+ Eigen::MatrixXd imgRArr = Eigen::MatrixXd::Zero(imgheight, imgwidth);
+
+ outimgll.saveImage(imglonArr, 0, 0, 1);
+ outimgll.saveImage(imglatArr, 0, 0, 2);
+
+
+ double minX = imglonArr.minCoeff();
+ double maxX = imglonArr.maxCoeff();
+ double minY = imglatArr.minCoeff();
+ double maxY = imglatArr.maxCoeff();
+ //ӡΧ
+ qDebug() << u8"dem ķΧ";
+ qDebug() << u8"minX:" << minX << "\t" << demimg.width;
+ qDebug() << u8"maxX:" << maxX << "\t" << demimg.width;
+ qDebug() << u8"minY:" << minY << "\t" << demimg.height;
+ qDebug() << u8"maxY:" << maxY << "\t" << demimg.height;
+ qDebug() << u8"ͼУ\t" << demimg.height << " , " << demimg.width;
+
+
+ for (long i = 0; i < imgheight; i++) {
+ //printf("\rprocess:%f precent\t\t\t",i*100.0/imgheight);
+ for (long j = 0; j < imgwidth; j++) {
+ double lon = imglonArr(i, j);
+ double lat = imglatArr(i, j);
+ Landpoint point = demimg.getRow_Col(lon, lat);
+
+ if (point.lon<1 || point.lon>demimg.width - 2 || point.lat < 1 || point.lat - 2) {
+ continue;
+ }
+ else {}
+
+ Landpoint p0, p11, p21, p12, p22;
+
+ p0.lon = point.lon;
+ p0.lat = point.lat;
+
+ p11.lon = floor(p0.lon);
+ p11.lat = floor(p0.lat);
+ p11.ati = demArr(long(p11.lat), long(p11.lon));
+
+ p12.lon = ceil(p0.lon);
+ p12.lat = floor(p0.lat);
+ p12.ati = demArr(long(p12.lat), long(p12.lon));
+
+ p21.lon = floor(p0.lon);
+ p21.lat = ceil(p0.lat);
+ p21.ati = demArr(long(p21.lat), long(p21.lon));
+
+ p22.lon = ceil(p0.lon);
+ p22.lat = ceil(p0.lat);
+ p22.ati = demArr(long(p22.lat), long(p22.lon));
+
+ p0.lon = p0.lon - p11.lon;
+ p0.lat = p0.lat - p11.lat;
+
+ p12.lon = p12.lon - p11.lon;
+ p12.lat = p12.lat - p11.lat;
+
+ p21.lon = p21.lon - p11.lon;
+ p21.lat = p21.lat - p11.lat;
+
+ p22.lon = p22.lon - p11.lon;
+ p22.lat = p22.lat - p11.lat;
+
+ p11.lon = p11.lon - p11.lon;
+ p11.lat = p11.lat - p11.lat;
+
+ p0.ati=Bilinear_interpolation(p0, p11, p21, p12, p22);
+ imgatiArr(i, j) = p0.ati;
+
+ }
+ }
+ outimgll.saveImage(imgatiArr, 0, 0, 3);
+ qDebug() << u8"ÿбֵ";
+
+
+ gdalImage antimg(InEchoGPSDataPath);
+ qDebug() << u8"1. زGPSļ\t";
+ qDebug() << u8"ļ·\t" << InEchoGPSDataPath;
+ qDebug() << u8"GPS \t" << antimg.height;
+ qDebug() << u8"ļ\t" << antimg.width;
+
+ long prfcount = antimg.height;
+
+
+ std::shared_ptr Pxs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
+ std::shared_ptr Pys((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
+ std::shared_ptr Pzs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
+ std::shared_ptr AntDirectX((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
+ std::shared_ptr AntDirectY((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
+ std::shared_ptr AntDirectZ((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
+
+ {
+ long colnum = 19;
+ std::shared_ptr antpos = readDataArr(antimg, 0, 0, prfcount, colnum, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
+ double time = 0;
+ double Px = 0;
+ double Py = 0;
+ double Pz = 0;
+ for (long i = 0; i < prfcount; i++) {
+
+ Pxs.get()[i] = antpos.get()[i * 19 + 1]; //
+ Pys.get()[i] = antpos.get()[i * 19 + 2];
+ Pzs.get()[i] = antpos.get()[i * 19 + 3];
+ AntDirectX.get()[i] = antpos.get()[i * 19 + 13];// zero doppler
+ AntDirectY.get()[i] = antpos.get()[i * 19 + 14];
+ AntDirectZ.get()[i] = antpos.get()[i * 19 + 15];
+
+ double NormAnt = std::sqrt(AntDirectX.get()[i] * AntDirectX.get()[i] +
+ AntDirectY.get()[i] * AntDirectY.get()[i] +
+ AntDirectZ.get()[i] * AntDirectZ.get()[i]);
+ AntDirectX.get()[i] = AntDirectX.get()[i] / NormAnt;
+ AntDirectY.get()[i] = AntDirectY.get()[i] / NormAnt;
+ AntDirectZ.get()[i] = AntDirectZ.get()[i] / NormAnt;// һ
+ }
+ antpos.reset();
+ }
+
+
+
+#pragma omp parallel for
+ for (long prfid = 0; prfid < prfcount; prfid++) {
+ double Px = Pxs.get()[prfid];
+ double Py = Pys.get()[prfid];
+ double Pz = Pzs.get()[prfid];
+ double R = 0;
+ Landpoint LLA = {};
+ Point3 XYZ = {};
+ for (long j = 0; j < imgwidth; j++) {
+ LLA.lon = imglonArr(prfid, j);
+ LLA.lat = imglatArr(prfid, j);
+ LLA.ati = imgatiArr(prfid, j);
+
+ LLA2XYZ(LLA, XYZ);
+
+ R = sqrt(pow(Px - XYZ.x, 2) +
+ pow(Py - XYZ.y, 2) +
+ pow(Pz - XYZ.z, 2));
+ imgRArr(prfid, j) = R;
+ }
+ }
+
+ outimgll.saveImage(imgRArr, 0, 0, 4);
+
+ qDebug() << u8"ֵ";
+}
+
+
+void InterploateClipAtiByRefDEM(QString ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath, QString& InEchoGPSDataPath) {
+
+ gdalImage demimg(ImageDEMPath);
+ gdalImage imgll(ImageLLPath);
+
+ // ü
+ long imgheight = imgll.height;
+ long imgwidth = imgll.width;
+
+ long minRow = -1;
+ long maxRow = imgheight;
+ long minCol = -1;
+ long maxCol = imgwidth;
+
+
+ Eigen::MatrixXd imglonArr = imgll.getData(0, 0, imgheight, imgwidth, 1);
+ Eigen::MatrixXd imglatArr = imgll.getData(0, 0, imgheight, imgwidth, 2);
+
+#pragma omp parallel for
+ for (long i = 0; i < imgheight; i++) {
+ for (long j = 0; j < imgwidth; j++) {
+ double lon = imglonArr(i, j);
+ double lat = imglatArr(i, j);
+ Landpoint point = demimg.getRow_Col(lon, lat);
+ imglonArr(i, j) = point.lon;
+ imglatArr(i, j) = point.lat;
+ }
+ }
+
+ // ʼɨ
+
+ bool minRowFlag=true, maxRowFlag= true, minColFlag = true, maxColFlag = true;
+
+ for (long i = 0; i < imgheight; i++) {
+ for (long j = 0; j < imgwidth; j++) {
+ if (imglonArr(i, j) > 0 && minRowFlag) {
+ minRowFlag = false;
+ minRow = i;
+ break;
+ }
+ if (imglonArr(i, j) < imgheight) {
+ maxRow = i;
+ }
+ }
+ }
+
+ for (long j = 0; j < imgwidth; j++) {
+ for (long i = 0; i < imgheight; i++) {
+ if (imglatArr(i, j) > 0 && minColFlag) {
+ minColFlag = false;
+ minCol = j;
+ break;
+ }
+ if (imglatArr(i, j) < imgheight) {
+ maxCol = j;
+ }
+ }
+ }
+
+
+ long RowCount = maxRow - minRow;
+ long ColCount = maxCol - minCol;
+
+ gdalImage outimgll = CreategdalImageDouble(outImageLLAPath, RowCount, ColCount, 4, true, true); // ȡγȡ̡߳б
+
+ imgheight = outimgll.height;
+ imgwidth = outimgll.width;
+
+ imglonArr = imgll.getData(minRow, minCol, RowCount, ColCount, 1);
+ imglatArr = imgll.getData(minRow, minCol, RowCount, ColCount, 2);
+
+ Eigen::MatrixXd demArr = demimg.getData(0, 0, demimg.height, demimg.width, 1);
+
+ Eigen::MatrixXd imgatiArr = Eigen::MatrixXd::Zero(imgheight, imgwidth);
+ Eigen::MatrixXd imgRArr = Eigen::MatrixXd::Zero(imgheight, imgwidth);
+
+ outimgll.saveImage(imglonArr, 0, 0, 1);
+ outimgll.saveImage(imglatArr, 0, 0, 2);
+
+
+ double minX = imglonArr.minCoeff();
+ double maxX = imglonArr.maxCoeff();
+ double minY = imglatArr.minCoeff();
+ double maxY = imglatArr.maxCoeff();
+
+ //ӡΧ
+ qDebug() << u8"dem ķΧ";
+ qDebug() << u8"minX:" << minX << "\t" << demimg.width;
+ qDebug() << u8"maxX:" << maxX << "\t" << demimg.width;
+ qDebug() << u8"minY:" << minY << "\t" << demimg.height;
+ qDebug() << u8"maxY:" << maxY << "\t" << demimg.height;
+ qDebug() << u8"ͼУ\t" << demimg.height << " , " << demimg.width;
+
+
+ for (long i = 0; i < imgheight; i++) {
+ //printf("\rprocess:%f precent\t\t\t",i*100.0/imgheight);
+ for (long j = 0; j < imgwidth; j++) {
+ double lon = imglonArr(i, j);
+ double lat = imglatArr(i, j);
+ Landpoint point = demimg.getRow_Col(lon, lat);
+
+ if (point.lon<1 || point.lon>demimg.width - 2 || point.lat < 1 || point.lat - 2) {
+ continue;
+ }
+ else {}
+
+ Landpoint p0, p11, p21, p12, p22;
+
+ p0.lon = point.lon;
+ p0.lat = point.lat;
+
+ p11.lon = floor(p0.lon);
+ p11.lat = floor(p0.lat);
+ p11.ati = demArr(long(p11.lat), long(p11.lon));
+
+ p12.lon = ceil(p0.lon);
+ p12.lat = floor(p0.lat);
+ p12.ati = demArr(long(p12.lat), long(p12.lon));
+
+ p21.lon = floor(p0.lon);
+ p21.lat = ceil(p0.lat);
+ p21.ati = demArr(long(p21.lat), long(p21.lon));
+
+ p22.lon = ceil(p0.lon);
+ p22.lat = ceil(p0.lat);
+ p22.ati = demArr(long(p22.lat), long(p22.lon));
+
+ p0.lon = p0.lon - p11.lon;
+ p0.lat = p0.lat - p11.lat;
+
+ p12.lon = p12.lon - p11.lon;
+ p12.lat = p12.lat - p11.lat;
+
+ p21.lon = p21.lon - p11.lon;
+ p21.lat = p21.lat - p11.lat;
+
+ p22.lon = p22.lon - p11.lon;
+ p22.lat = p22.lat - p11.lat;
+
+ p11.lon = p11.lon - p11.lon;
+ p11.lat = p11.lat - p11.lat;
+
+ p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22);
+ imgatiArr(i, j) = p0.ati;
+ }
+ }
+
+ outimgll.saveImage(imgatiArr, 0, 0, 3);
+ qDebug() << u8"ÿбֵ";
+
+
+ gdalImage antimg(InEchoGPSDataPath);
+ qDebug() << u8"1. زGPSļ\t";
+ qDebug() << u8"ļ·\t" << InEchoGPSDataPath;
+ qDebug() << u8"GPS \t" << antimg.height;
+ qDebug() << u8"ļ\t" << antimg.width;
+
+ long prfcount = antimg.height;
+
+
+ std::shared_ptr Pxs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
+ std::shared_ptr Pys((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
+ std::shared_ptr Pzs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
+ std::shared_ptr AntDirectX((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
+ std::shared_ptr AntDirectY((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
+ std::shared_ptr AntDirectZ((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
+
+ {
+ long colnum = 19;
+ std::shared_ptr antpos = readDataArr(antimg, 0, 0, prfcount, colnum, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
+ double time = 0;
+ double Px = 0;
+ double Py = 0;
+ double Pz = 0;
+ for (long i = 0; i < prfcount; i++) {
+
+ Pxs.get()[i] = antpos.get()[i * 19 + 1]; //
+ Pys.get()[i] = antpos.get()[i * 19 + 2];
+ Pzs.get()[i] = antpos.get()[i * 19 + 3];
+ AntDirectX.get()[i] = antpos.get()[i * 19 + 13];// zero doppler
+ AntDirectY.get()[i] = antpos.get()[i * 19 + 14];
+ AntDirectZ.get()[i] = antpos.get()[i * 19 + 15];
+
+ double NormAnt = std::sqrt(AntDirectX.get()[i] * AntDirectX.get()[i] +
+ AntDirectY.get()[i] * AntDirectY.get()[i] +
+ AntDirectZ.get()[i] * AntDirectZ.get()[i]);
+ AntDirectX.get()[i] = AntDirectX.get()[i] / NormAnt;
+ AntDirectY.get()[i] = AntDirectY.get()[i] / NormAnt;
+ AntDirectZ.get()[i] = AntDirectZ.get()[i] / NormAnt;// һ
+ }
+ antpos.reset();
+ }
+
+
+
+#pragma omp parallel for
+ for (long prfid = minRow; prfid < maxRow; prfid++) {
+ double Px = Pxs.get()[prfid];
+ double Py = Pys.get()[prfid];
+ double Pz = Pzs.get()[prfid];
+ double R = 0;
+ Landpoint LLA = {};
+ Point3 XYZ = {};
+ for (long j = 0; j < imgwidth; j++) {
+ LLA.lon = imglonArr(prfid-minRow, j);
+ LLA.lat = imglatArr(prfid - minRow, j);
+ LLA.ati = imgatiArr(prfid - minRow, j);
+
+ LLA2XYZ(LLA, XYZ);
+
+ R = sqrt(pow(Px - XYZ.x, 2) +
+ pow(Py - XYZ.y, 2) +
+ pow(Pz - XYZ.z, 2));
+ imgRArr(prfid - minRow, j) = R;
+ }
+ }
+
+ outimgll.saveImage(imgRArr, 0, 0, 4);
+
+ qDebug() << u8"ֵ";
+
+}
+
+
+int ReflectTable_WGS2Range(QString dem_rc_path,QString outOriSimTiffPath,QString ori_sim_count_tiffPath,long OriHeight,long OriWidth)
+{
+ gdalImage sim_rc(dem_rc_path);
+ gdalImage sim_sar_img = CreategdalImage(outOriSimTiffPath, OriHeight, OriWidth, 2, sim_rc.gt, sim_rc.projection, false);// עﱣ
+ for (int max_rows_ids = 0; max_rows_ids < OriHeight; max_rows_ids = max_rows_ids + 1000) {
+ Eigen::MatrixXd sim_sar = sim_sar_img.getData(max_rows_ids, 0, 1000, OriWidth, 1);
+ Eigen::MatrixXd sim_sarc = sim_sar_img.getData(max_rows_ids, 0, 1000, OriWidth, 2);
+ sim_sar = sim_sar.array() * 0 - 9999;
+ sim_sarc = sim_sar.array() * 0 - 9999;
+ sim_sar_img.saveImage(sim_sar, max_rows_ids, 0, 1);
+ sim_sar_img.saveImage(sim_sarc, max_rows_ids, 0, 2);
+ }
+ sim_sar_img.setNoDataValue(-9999, 1);
+ sim_sar_img.setNoDataValue(-9999, 2);
+ int conver_lines = 5000;
+ int line_invert = 4000;// ص
+ int line_offset = 60;
+ //
+ omp_lock_t lock;
+ omp_init_lock(&lock); // ʼ
+ int allCount = 0;
+
+ for (int max_rows_ids = 0; max_rows_ids < sim_rc.height; max_rows_ids = max_rows_ids + line_invert) {
+ Eigen::MatrixXd dem_r = sim_rc.getData(max_rows_ids, 0, conver_lines, sim_rc.width, 1);
+ Eigen::MatrixXd dem_c = sim_rc.getData(max_rows_ids, 0, conver_lines, sim_rc.width, 2);
+ int dem_rows_num = dem_r.rows();
+ int dem_cols_num = dem_r.cols();
+ // ²ֵγ
+ //Eigen::MatrixXd dem_lon = dem_r;
+ //Eigen::MatrixXd dem_lat = dem_c;
+ // ¾γȲ
+
+ int temp_r, temp_c;
+
+ int min_row = dem_r.minCoeff() + 1;
+ int max_row = dem_r.maxCoeff() + 1;
+
+ if (max_row < 0) {
+ continue;
+ }
+
+ int len_rows = max_row - min_row;
+ min_row = min_row < 0 ? 0 : min_row;
+ Eigen::MatrixXd sar_r = sim_sar_img.getData(min_row, 0, len_rows, OriWidth, 1);
+ Eigen::MatrixXd sar_c = sim_sar_img.getData(min_row, 0, len_rows, OriWidth, 2);
+ len_rows = sar_r.rows();
+
+
+#pragma omp parallel for num_threads(8) // NEW ADD
+ for (int i = 0; i < dem_rows_num - 1; i++) {
+ for (int j = 0; j < dem_cols_num - 1; j++) {
+ Point3 p, p1, p2, p3, p4;
+ Landpoint lp1, lp2, lp3, lp4;
+ lp1 = sim_rc.getLandPoint(i + max_rows_ids, j, 0);
+ lp2 = sim_rc.getLandPoint(i + max_rows_ids, j + 1, 0);
+ lp3 = sim_rc.getLandPoint(i + 1 + max_rows_ids, j + 1, 0);
+ lp4 = sim_rc.getLandPoint(i + 1 + max_rows_ids, j, 0);
+
+ p1 = { dem_r(i,j),dem_c(i,j) };
+ p2 = { dem_r(i,j + 1),dem_c(i,j + 1) };
+ p3 = { dem_r(i + 1,j + 1),dem_c(i + 1,j + 1) };
+ p4 = { dem_r(i + 1,j),dem_c(i + 1,j) };
+
+ //if (angle(i, j) >= 90 && angle(i, j + 1) >= 90 && angle(i + 1, j) >= 90 && angle(i + 1, j + 1) >= 90) {
+ // continue;
+ //}
+
+ double temp_min_r = dem_r.block(i, j, 2, 2).minCoeff();
+ double temp_max_r = dem_r.block(i, j, 2, 2).maxCoeff();
+ double temp_min_c = dem_c.block(i, j, 2, 2).minCoeff();
+ double temp_max_c = dem_c.block(i, j, 2, 2).maxCoeff();
+ if ((int(temp_min_r) != int(temp_max_r)) && (int(temp_min_c) != int(temp_max_c))) {
+ for (int ii = int(temp_min_r); ii <= temp_max_r + 1; ii++) {
+ for (int jj = int(temp_min_c); jj < temp_max_c + 1; jj++) {
+ if (ii < min_row || ii - min_row >= len_rows || jj < 0 || jj >= OriWidth) {
+ continue;
+ }
+ p = { double(ii),double(jj),0 };
+ //if (PtInRect(p, p1, p2, p3, p4)) {
+ p1.z = lp1.lon;
+ p2.z = lp2.lon;
+ p3.z = lp3.lon;
+ p4.z = lp4.lon;
+
+ p = invBilinear(p, p1, p2, p3, p4);
+ if (isnan(p.z)) {
+ continue;
+ }
+
+ if (p.x < 0) {
+ continue;
+ }
+ double mean = (p1.z + p2.z + p3.z + p4.z) / 4;
+ if (p.z > p1.z && p.z > p2.z && p.z > p3.z && p.z > p4.z) {
+ p.z = mean;
+ }
+ if (p.z < p1.z && p.z < p2.z && p.z < p3.z && p.z < p4.z) {
+ p.z = mean;
+ }
+ sar_r(ii - min_row, jj) = p.z;
+ p1.z = lp1.lat;
+ p2.z = lp2.lat;
+ p3.z = lp3.lat;
+ p4.z = lp4.lat;
+ p = invBilinear(p, p1, p2, p3, p4);
+ if (isnan(p.z)) {
+ continue;
+ }
+
+ if (p.x < 0) {
+ continue;
+ }
+ mean = (p1.z + p2.z + p3.z + p4.z) / 4;
+ if (p.z > p1.z && p.z > p2.z && p.z > p3.z && p.z > p4.z) {
+ p.z = mean;
+ }
+ if (p.z < p1.z && p.z < p2.z && p.z < p3.z && p.z < p4.z) {
+ p.z = mean;
+ }
+ sar_c(ii - min_row, jj) = p.z;
+ //}
+ }
+ }
+
+ }
+ }
+ }
+
+ omp_set_lock(&lock); //û
+ sim_sar_img.saveImage(sar_r, min_row, 0, 1);
+ sim_sar_img.saveImage(sar_c, min_row, 0, 2);
+ allCount = allCount + conver_lines;
+ qDebug() << "rows:\t" << allCount << "/" << sim_rc.height << "\t computing.....\t" ;
+ omp_unset_lock(&lock); //ͷŻ
+
+
+ }
+
+ return 0;
+}
+
+
+int ResampleEChoDataFromGeoEcho(QString L2echodataPath, QString RangeLooktablePath, QString L1AEchoDataPath) {
+ gdalImageComplex echodata(L2echodataPath);
+ gdalImage looktable(RangeLooktablePath);
+ gdalImageComplex l1adata(L1AEchoDataPath);
+ Eigen::MatrixXcd echoArr = echodata.getDataComplex(0, 0, echodata.height, echodata.width, 1);
+
+ long blockHeight = Memory1GB / looktable.width / 8 * 2;
+
+ for (long startRow = 0; startRow < looktable.height; startRow = startRow + blockHeight) {
+ printf("\rGEC: process:%f precent\t\t\t", startRow * 100.0 / looktable.height);
+ blockHeight = blockHeight + startRow < looktable.height ? blockHeight : looktable.height - startRow;
+ Eigen::MatrixXd imglonArr = looktable.getData(startRow, 0, blockHeight, looktable.width, 1);
+ Eigen::MatrixXd imglatArr = looktable.getData(startRow, 0, blockHeight, looktable.width, 2);
+ Eigen::MatrixXcd l1aArr = l1adata.getDataComplex(0, 0, blockHeight, l1adata.width, 1);
+ l1aArr = l1aArr.array() * 0;
+
+ long imgheight = blockHeight;
+ long imgwidth = looktable.width;
+#pragma omp parallel for
+ for (long i = 0; i < imgheight; i++) {
+
+ for (long j = 0; j < imgwidth; j++) {
+ double lon = imglonArr(i, j);
+ double lat = imglatArr(i, j);
+ Landpoint point = echodata.getRow_Col(lon, lat);
+
+ if (point.lon<1 || point.lon>echodata.width - 2 || point.lat < 1 || point.lat >echodata.height - 2) {
+ continue;
+ }
+ else {}
+ // ʵֵ
+ {
+ Landpoint p0, p11, p21, p12, p22;
+
+ p0.lon = point.lon;
+ p0.lat = point.lat;
+
+ p11.lon = floor(p0.lon);
+ p11.lat = floor(p0.lat);
+ p11.ati = echoArr(long(p11.lat), long(p11.lon)).real();
+
+ p12.lon = ceil(p0.lon);
+ p12.lat = floor(p0.lat);
+ p12.ati = echoArr(long(p12.lat), long(p12.lon)).real();
+
+ p21.lon = floor(p0.lon);
+ p21.lat = ceil(p0.lat);
+ p21.ati = echoArr(long(p21.lat), long(p21.lon)).real();
+
+ p22.lon = ceil(p0.lon);
+ p22.lat = ceil(p0.lat);
+ p22.ati = echoArr(long(p22.lat), long(p22.lon)).real();
+
+ p0.lon = p0.lon - p11.lon;
+ p0.lat = p0.lat - p11.lat;
+
+ p12.lon = p12.lon - p11.lon;
+ p12.lat = p12.lat - p11.lat;
+
+ p21.lon = p21.lon - p11.lon;
+ p21.lat = p21.lat - p11.lat;
+
+ p22.lon = p22.lon - p11.lon;
+ p22.lat = p22.lat - p11.lat;
+
+ p11.lon = p11.lon - p11.lon;
+ p11.lat = p11.lat - p11.lat;
+
+ p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22);
+ l1aArr(i, j).real(p0.ati);
+ }
+ //鲿ֵ
+ {
+ Landpoint p0, p11, p21, p12, p22;
+
+ p0.lon = point.lon;
+ p0.lat = point.lat;
+
+ p11.lon = floor(p0.lon);
+ p11.lat = floor(p0.lat);
+ p11.ati = echoArr(long(p11.lat), long(p11.lon)).imag();
+
+ p12.lon = ceil(p0.lon);
+ p12.lat = floor(p0.lat);
+ p12.ati = echoArr(long(p12.lat), long(p12.lon)).imag();
+
+ p21.lon = floor(p0.lon);
+ p21.lat = ceil(p0.lat);
+ p21.ati = echoArr(long(p21.lat), long(p21.lon)).imag();
+
+ p22.lon = ceil(p0.lon);
+ p22.lat = ceil(p0.lat);
+ p22.ati = echoArr(long(p22.lat), long(p22.lon)).imag();
+
+ p0.lon = p0.lon - p11.lon;
+ p0.lat = p0.lat - p11.lat;
+
+ p12.lon = p12.lon - p11.lon;
+ p12.lat = p12.lat - p11.lat;
+
+ p21.lon = p21.lon - p11.lon;
+ p21.lat = p21.lat - p11.lat;
+
+ p22.lon = p22.lon - p11.lon;
+ p22.lat = p22.lat - p11.lat;
+
+ p11.lon = p11.lon - p11.lon;
+ p11.lat = p11.lat - p11.lat;
+
+ p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22);
+ l1aArr(i, j).imag(p0.ati);
+ }
+
+ }
+ }
+
+ l1adata.saveImage(l1aArr, startRow, 0, 1);
+ }
+
+
+
+ return 0;
+
+}
+
+int ResampleRangeDataFromGeoImage(QString geodataPath, QString RangeLooktablePath, QString RangeDataPath)
+{
+ gdalImage echodata(geodataPath);
+ gdalImage looktable(RangeLooktablePath);
+ gdalImage l1adata(RangeDataPath);
+ Eigen::MatrixXd echoArr = echodata.getData(0, 0, echodata.height, echodata.width, 1);
+
+ long blockHeight = Memory1GB / looktable.width / 8 * 2;
+
+ for (long startRow = 0; startRow < looktable.height; startRow = startRow + blockHeight) {
+ printf("\rGEC: process:%f precent\t\t\t", startRow * 100.0 / looktable.height);
+ blockHeight = blockHeight + startRow < looktable.height ? blockHeight : looktable.height - startRow;
+ Eigen::MatrixXd imglonArr = looktable.getData(startRow, 0, blockHeight, looktable.width, 1);
+ Eigen::MatrixXd imglatArr = looktable.getData(startRow, 0, blockHeight, looktable.width, 2);
+ Eigen::MatrixXd l1aArr = l1adata.getData(0, 0, blockHeight, l1adata.width, 1);
+ l1aArr = l1aArr.array() * 0;
+
+ long imgheight = blockHeight;
+ long imgwidth = looktable.width;
+#pragma omp parallel for
+ for (long i = 0; i < imgheight; i++) {
+
+ for (long j = 0; j < imgwidth; j++) {
+ double lon = imglonArr(i, j);
+ double lat = imglatArr(i, j);
+ Landpoint point = echodata.getRow_Col(lon, lat);
+
+ if (point.lon<1 || point.lon>echodata.width - 2 || point.lat < 1 || point.lat >echodata.height - 2) {
+ continue;
+ }
+ else {}
+ {
+ Landpoint p0, p11, p21, p12, p22;
+
+ p0.lon = point.lon;
+ p0.lat = point.lat;
+
+ p11.lon = floor(p0.lon);
+ p11.lat = floor(p0.lat);
+ p11.ati = echoArr(long(p11.lat), long(p11.lon));
+
+ p12.lon = ceil(p0.lon);
+ p12.lat = floor(p0.lat);
+ p12.ati = echoArr(long(p12.lat), long(p12.lon));
+
+ p21.lon = floor(p0.lon);
+ p21.lat = ceil(p0.lat);
+ p21.ati = echoArr(long(p21.lat), long(p21.lon));
+
+ p22.lon = ceil(p0.lon);
+ p22.lat = ceil(p0.lat);
+ p22.ati = echoArr(long(p22.lat), long(p22.lon));
+
+ p0.lon = p0.lon - p11.lon;
+ p0.lat = p0.lat - p11.lat;
+
+ p12.lon = p12.lon - p11.lon;
+ p12.lat = p12.lat - p11.lat;
+
+ p21.lon = p21.lon - p11.lon;
+ p21.lat = p21.lat - p11.lat;
+
+ p22.lon = p22.lon - p11.lon;
+ p22.lat = p22.lat - p11.lat;
+
+ p11.lon = p11.lon - p11.lon;
+ p11.lat = p11.lat - p11.lat;
+
+ p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22);
+ l1aArr(i, j)=p0.ati;
+ }
+ }
+ }
+
+ l1adata.saveImage(l1aArr, startRow, 0, 1);
+ }
+
+
+
+ return 0;
+}
+
+void InterpLookTableRfromDEM(QString lonlatPath, QString DEMPath, QString outllrpath)
+{
+ gdalImage LLimg(lonlatPath);
+ gdalImage demimg(DEMPath);
+ gdalImage LLRimg = CreategdalImageDouble(outllrpath, LLimg.height, LLimg.width, 3, true, true);
+
+ long llimgheight = LLimg.height;
+ long llimgWidth = LLimg.width;
+
+ Eigen::MatrixXd imglonArr = LLimg.getData(0, 0, llimgheight, llimgWidth, 1);
+ Eigen::MatrixXd imglatArr = LLimg.getData(0, 0, llimgheight, llimgWidth, 2);
+ Eigen::MatrixXd demArr = demimg.getData(0, 0, demimg.height, demimg.width, 1);
+
+ Eigen::MatrixXd outRArr = imglonArr.array() * 0;
+
+ LLRimg.saveImage(imglonArr, 0, 0, 1);
+ LLRimg.saveImage(imglatArr, 0, 0, 2);
+
+
+ for (long i = 0; i < llimgheight; i++) {
+ for (long j = 0; j < llimgWidth; j++) {
+ double lon = imglonArr(i, j);
+ double lat = imglatArr(i, j);
+ Landpoint point = demimg.getRow_Col(lon, lat);
+
+ if (point.lon<1 || point.lon>demimg.width - 2 || point.lat < 1 || point.lat - 2) {
+ continue;
+ }
+ else {}
+
+ Landpoint p0, p11, p21, p12, p22;
+
+ p0.lon = point.lon;
+ p0.lat = point.lat;
+
+ p11.lon = floor(p0.lon);
+ p11.lat = floor(p0.lat);
+ p11.ati = demArr(long(p11.lat), long(p11.lon));
+
+ p12.lon = ceil(p0.lon);
+ p12.lat = floor(p0.lat);
+ p12.ati = demArr(long(p12.lat), long(p12.lon));
+
+ p21.lon = floor(p0.lon);
+ p21.lat = ceil(p0.lat);
+ p21.ati = demArr(long(p21.lat), long(p21.lon));
+
+ p22.lon = ceil(p0.lon);
+ p22.lat = ceil(p0.lat);
+ p22.ati = demArr(long(p22.lat), long(p22.lon));
+
+ p0.lon = p0.lon - p11.lon;
+ p0.lat = p0.lat - p11.lat;
+
+ p12.lon = p12.lon - p11.lon;
+ p12.lat = p12.lat - p11.lat;
+
+ p21.lon = p21.lon - p11.lon;
+ p21.lat = p21.lat - p11.lat;
+
+ p22.lon = p22.lon - p11.lon;
+ p22.lat = p22.lat - p11.lat;
+
+ p11.lon = p11.lon - p11.lon;
+ p11.lat = p11.lat - p11.lat;
+
+ p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22);
+ outRArr(i, j) = p0.ati;
+
+ }
+ }
+
+ LLRimg.saveImage(outRArr, 0, 0, 3);
+
+ return;
+}
+
+void RangeLooktableLLA_2_RangeLooktableXYZ(QString LLAPath, QString outXYZPath)
+{
+
+ gdalImage LLAimg(LLAPath);
+ gdalImage xyzimg = CreategdalImageDouble(outXYZPath, LLAimg.height, LLAimg.width, 3, true, true);
+
+ long llimgheight = LLAimg.height;
+ long llimgWidth = LLAimg.width;
+
+ Eigen::MatrixXd lonArr = LLAimg.getData(0, 0, llimgheight, llimgWidth, 1);
+ Eigen::MatrixXd latArr = LLAimg.getData(0, 0, llimgheight, llimgWidth, 2);
+ Eigen::MatrixXd atiArr = LLAimg.getData(0, 0, llimgheight, llimgWidth, 3);
+
+ // ʹLLAץΪXYZ
+ Eigen::MatrixXd xArr = lonArr.array() * 0;
+ Eigen::MatrixXd yArr = lonArr.array() * 0;
+ Eigen::MatrixXd zArr = lonArr.array() * 0;
+
+
+
+ for (long i = 0; i < llimgheight; i++) {
+ for (long j = 0; j < llimgWidth; j++) {
+ double lon = lonArr(i, j);
+ double lat = latArr(i, j);
+ double ati = atiArr(i, j);
+ Landpoint p{ lon,lat,ati };
+ Landpoint XYZP=LLA2XYZ(p);
+
+ xArr(i, j) = XYZP.lon;
+ yArr(i, j) = XYZP.lat;
+ zArr(i, j) = XYZP.ati;
+
+
+ }
+ }
+
+ xyzimg.saveImage(xArr, 0, 0, 1);
+ xyzimg.saveImage(yArr, 0, 0, 2);
+ xyzimg.saveImage(zArr, 0, 0, 3);
+
+ return;
+}
+
+
+
+
+
+
+
+
+
diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h
new file mode 100644
index 0000000..59f5920
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h
@@ -0,0 +1,28 @@
+#pragma once
+#ifndef __ImageNetOperator__H_
+#define __ImageNetOperator__H_
+#include "BaseConstVariable.h"
+#include
+
+
+void InitCreateImageXYZProcess(QString& outImageLLPath, QString& outImageXYZPath, QString& InEchoGPSDataPath, double& NearRange, double& RangeResolution, int64_t& RangeNum);
+
+bool OverlapCheck(QString& ImageLLPath, QString& ImageDEMPath);
+
+bool GPSPointsNumberEqualCheck(QString& ImageLLPath, QString& InEchoGPSDataPath);
+
+void InterploateClipAtiByRefDEM(QString ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath, QString& InEchoGPSDataPath);
+void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath, QString& InEchoGPSDataPath);
+int ReflectTable_WGS2Range(QString dem_rc_path, QString outOriSimTiffPath, QString ori_sim_count_tiffPath, long OriHeight, long OriWidth);
+
+int ResampleEChoDataFromGeoEcho(QString L2complexechodataPath, QString RangeLooktablePath, QString L1AEchoDataPath);
+
+int ResampleRangeDataFromGeoImage(QString geodataPath, QString RangeLooktablePath, QString RangeDataPath);
+
+
+void InterpLookTableRfromDEM(QString lonlatPath, QString DEMPath, QString outllrpath);
+
+void RangeLooktableLLA_2_RangeLooktableXYZ(QString LLAPath, QString outXYZPath);
+
+
+#endif
diff --git a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp
new file mode 100644
index 0000000..4c78e3b
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp
@@ -0,0 +1,146 @@
+#include "ImagePlaneAtiInterpDialog.h"
+#include "ui_ImagePlaneAtiInterpDialog.h"
+#include
+#include
+#include
+#include "BaseConstVariable.h"
+#include "ImageNetOperator.h"
+
+ImagePlaneAtiInterpDialog::ImagePlaneAtiInterpDialog(QWidget *parent)
+ : QDialog(parent)
+ , ui(new Ui::ImagePlaneAtiInterpDialogClass)
+{
+ ui->setupUi(this);
+
+ connect(ui->pushButtonImageLLASelect, SIGNAL(clicked()), this, SLOT(onpushButtonImageLLASelect_clicked()));
+ connect(ui->pushButtonImageNet0Select, SIGNAL(clicked()), this, SLOT(onpushButtonImageNet0Select_clicked()));
+ connect(ui->pushButtonRefRangeDEMSelect, SIGNAL(clicked()), this, SLOT(onpushButtonRefRangeDEMSelect_clicked()));
+ connect(ui->pushButtonEchoGPSPointDataSelect, SIGNAL(clicked()), this, SLOT(onpushButtonEchoGPSPointSelect_clicked()));
+ connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbuttonBoxAccepted()));
+ connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbuttonBoxRejected()));
+
+
+}
+
+ImagePlaneAtiInterpDialog::~ImagePlaneAtiInterpDialog()
+{}
+
+void ImagePlaneAtiInterpDialog::onpushButtonImageNet0Select_clicked()
+{
+ QString fileNames = QFileDialog::getOpenFileName(
+ this,
+ tr(u8"ѡƽļ"),
+ QString(),
+ tr(ENVI_FILE_FORMAT_FILTER)
+ );
+
+ if (!fileNames.isEmpty()) {
+ QString message = "ѡļ\n";
+ this->ui->lineEditImageNet0Path->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ʾ"), tr(u8"ûѡļ"));
+ }
+}
+
+void ImagePlaneAtiInterpDialog::onpushButtonEchoGPSPointSelect_clicked()
+{
+ QString fileNames = QFileDialog::getOpenFileName(
+ this, //
+ tr(u8"ѡزGPSļ"), //
+ QString(), // Ĭ·
+ tr(u8"GPSļ(*.gpspos.data);;All Files(*.*)") // ļ
+ );
+ // ûѡļ
+ if (!fileNames.isEmpty()) {
+ QString message = "ѡļУ\n";
+ this->ui->lineEditGPSPointsPath->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ"));
+ }
+}
+
+void ImagePlaneAtiInterpDialog::onpushButtonRefRangeDEMSelect_clicked()
+{
+ QString fileNames = QFileDialog::getOpenFileName(
+ this,
+ tr(u8"ѡοDEM"),
+ QString(),
+ tr(ENVI_FILE_FORMAT_FILTER)
+ );
+ if (!fileNames.isEmpty()) {
+ QString message = "ѡļ\n";
+ this->ui->lineEditRefRangeDEMPath->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ʾ"), tr(u8"ûѡļ"));
+ }
+}
+
+void ImagePlaneAtiInterpDialog::onpushButtonImageLLASelect_clicked()
+{
+ QString fileNames = QFileDialog::getSaveFileName(
+ this,
+ tr(u8"ʾ"),
+ QString(),
+ tr(ENVI_FILE_FORMAT_FILTER)
+ );
+
+ if (!fileNames.isEmpty()) {
+ QString message = "ѡļ\n";
+ this->ui->lineEditImageLLAPath->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ʾ"), tr(u8"ûѡļ"));
+ }
+}
+
+void ImagePlaneAtiInterpDialog::onbuttonBoxAccepted()
+{
+ QString imageNet0Path = this->ui->lineEditImageNet0Path->text().trimmed();
+ QString refRangeDEMPath = this->ui->lineEditRefRangeDEMPath->text().trimmed();
+ QString imageLLAPath = this->ui->lineEditImageLLAPath->text().trimmed();
+ QString echoGPSDataPath = this->ui->lineEditGPSPointsPath->text().trimmed();
+ if (imageNet0Path.isEmpty() || refRangeDEMPath.isEmpty() || imageLLAPath.isEmpty()||echoGPSDataPath.isEmpty()) {
+ QMessageBox::warning(this, tr(u8"ʾ"), tr(u8"ûѡļ"));
+ return;
+ }
+ else {
+
+ }
+
+ if (GPSPointsNumberEqualCheck(imageNet0Path, echoGPSDataPath)) {
+ }
+ else {
+ QMessageBox::warning(nullptr, u8"", u8"زGPSĿһ");
+ return;
+ }
+
+ bool checkflag= this->ui->checkBoxOverLap->isChecked();
+ if (checkflag) {
+ InterploateClipAtiByRefDEM(imageNet0Path, refRangeDEMPath, imageLLAPath, echoGPSDataPath);
+ QMessageBox::information(this, tr(u8"ʾ"), tr(u8""));
+ return;
+ }
+ else {
+ if (OverlapCheck(imageNet0Path, refRangeDEMPath)) { // ????DEM???
+ InterploateAtiByRefDEM(imageNet0Path, refRangeDEMPath, imageLLAPath, echoGPSDataPath);
+
+ QMessageBox::information(nullptr, u8"ʾ", u8"completed!!");
+ return;
+
+ }
+ else {
+ QMessageBox::warning(nullptr, u8"", u8"DEMӰСڳƽҪ");
+ return;
+ }
+ }
+}
+
+void ImagePlaneAtiInterpDialog::onbuttonBoxRejected()
+{
+ this->close();
+}
+
+
\ No newline at end of file
diff --git a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.h b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.h
new file mode 100644
index 0000000..5b37329
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.h
@@ -0,0 +1,36 @@
+#pragma once
+
+#ifndef __ImagePlaneAtiInterpDialog__HH__
+#define __ImagePlaneAtiInterpDialog__HH__
+
+#include
+
+namespace Ui {
+ class ImagePlaneAtiInterpDialogClass;
+}
+
+
+class ImagePlaneAtiInterpDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ ImagePlaneAtiInterpDialog(QWidget *parent = nullptr);
+ ~ImagePlaneAtiInterpDialog();
+
+public slots:
+
+ void onpushButtonImageNet0Select_clicked();
+ void onpushButtonEchoGPSPointSelect_clicked();
+ void onpushButtonRefRangeDEMSelect_clicked();
+ void onpushButtonImageLLASelect_clicked();
+ void onbuttonBoxAccepted();
+ void onbuttonBoxRejected();
+
+
+private:
+ Ui::ImagePlaneAtiInterpDialogClass* ui;
+};
+
+
+#endif
\ No newline at end of file
diff --git a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.ui b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.ui
new file mode 100644
index 0000000..db72143
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.ui
@@ -0,0 +1,201 @@
+
+
+ ImagePlaneAtiInterpDialogClass
+
+
+
+ 0
+ 0
+ 661
+ 305
+
+
+
+ 根据经纬度插值高程数据
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 成像网格(经纬度):
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 回波GPS点
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 参考DEM:
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 成像粗网格(高程):
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 强制采样
+
+
+
+
+
+
+
+
+
diff --git a/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.cpp b/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.cpp
new file mode 100644
index 0000000..45b5fce
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.cpp
@@ -0,0 +1,98 @@
+#include "InitCreateImageXYZDialog.h"
+#include "ui_InitCreateImageXYZDialog.h"
+#include
+#include
+#include "ImageNetOperator.h"
+
+InitCreateImageXYZDialog::InitCreateImageXYZDialog(QWidget *parent)
+ : QDialog(parent), ui(new Ui::InitCreateImageXYZDialogClass)
+{
+ ui->setupUi(this);
+ connect(ui->pushButtonEchoGPSDataSelect, SIGNAL(clicked()), this, SLOT(onpushButtonEchoGPSDataSelect_clicked()));
+ connect(ui->pushButtonImageXYZSelect, SIGNAL(clicked()), this, SLOT(onpushButtonImageXYZSelect_clicked()));
+ connect(ui->pushButtonImageLLSelect, SIGNAL(clicked()), this, SLOT(onpushButtonImageLLSelect_clicked()));
+ connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbuttonBox_accepted()));
+ connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbuttonBox_rejected()));
+}
+
+InitCreateImageXYZDialog::~InitCreateImageXYZDialog()
+{}
+
+void InitCreateImageXYZDialog::onpushButtonImageLLSelect_clicked()
+{
+ QString fileNamePath = QFileDialog::getSaveFileName(
+ this, //
+ tr(u8"澭γȳ"), //
+ QString(), // Ĭ·
+ tr(u8"ENVI Bin(*.bin);;ENVI Data(*.dat);;ENVI Data(*.data);;tiffӰ(*.tif);;tiffӰ(*.tiff)") // ļ
+ );
+ // ûѡļ
+ if (!fileNamePath.isEmpty()) {
+ QString message = "ѡļУ\n";
+ this->ui->lineEditImageLLPath->setText(fileNamePath);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ"));
+ }
+
+}
+
+void InitCreateImageXYZDialog::onpushButtonImageXYZSelect_clicked()
+{
+ QString fileNamePath = QFileDialog::getSaveFileName(
+ this, //
+ tr(u8"XYZ"), //
+ QString(), // Ĭ·
+ tr(u8"ENVI Bin(*.bin);;ENVI Data(*.dat);;ENVI Data(*.data);;tiffӰ(*.tif);;tiffӰ(*.tiff)") // ļ
+ );
+ // ûѡļ
+ if (!fileNamePath.isEmpty()) {
+ QString message = "ѡļУ\n";
+ this->ui->lineEditImageXYZPath->setText(fileNamePath);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ"));
+ }
+}
+
+void InitCreateImageXYZDialog::onpushButtonEchoGPSDataSelect_clicked()
+{
+
+ QString fileNames = QFileDialog::getOpenFileName(
+ this, //
+ tr(u8"ѡزGPSļ"), //
+ QString(), // Ĭ·
+ tr(u8"GPSļ(*.gpspos.data);;All Files(*.*)") // ļ
+ );
+ // ûѡļ
+ if (!fileNames.isEmpty()) {
+ QString message = "ѡļУ\n";
+ this->ui->lineEditEchoGPSDataPath->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ"));
+ }
+}
+
+void InitCreateImageXYZDialog::onbuttonBox_accepted()
+{
+ double NearRange = this->ui->doubleSpinBoxNearRange->value();
+ double RangeResolution = this->ui->doubleSpinBoxRangeResolution->value();
+ int64_t RangeNum = this->ui->spinBoxRangeNum->value();
+ QString imageLLPath = this->ui->lineEditImageLLPath->text().trimmed();
+ QString imageXYZPath = this->ui->lineEditImageXYZPath->text().trimmed();
+ QString echoGPSDataPath = this->ui->lineEditEchoGPSDataPath->text().trimmed();
+
+ InitCreateImageXYZProcess(imageLLPath, imageXYZPath, echoGPSDataPath, NearRange, RangeResolution, RangeNum);
+ if (imageLLPath.isEmpty() || imageXYZPath.isEmpty() || echoGPSDataPath.isEmpty()) {
+ QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ"));
+ return;
+ }
+ QMessageBox::information(this, tr(u8"ʾ"), tr(u8""));
+
+}
+
+void InitCreateImageXYZDialog::onbuttonBox_rejected()
+{
+ this->close();
+}
diff --git a/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.h b/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.h
new file mode 100644
index 0000000..d4fb229
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.h
@@ -0,0 +1,36 @@
+#pragma once
+#ifndef __InitCreateImageXYZDialog__HH__
+#define __InitCreateImageXYZDialog__HH__
+
+
+#include
+
+
+namespace Ui {
+ class InitCreateImageXYZDialogClass;
+}
+
+
+class InitCreateImageXYZDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ InitCreateImageXYZDialog(QWidget *parent = nullptr);
+ ~InitCreateImageXYZDialog();
+
+
+public slots :
+ void onpushButtonImageLLSelect_clicked();
+ void onpushButtonImageXYZSelect_clicked();
+ void onpushButtonEchoGPSDataSelect_clicked();
+ void onbuttonBox_accepted();
+ void onbuttonBox_rejected();
+
+
+private:
+ Ui::InitCreateImageXYZDialogClass* ui;
+};
+
+
+#endif
\ No newline at end of file
diff --git a/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.ui b/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.ui
new file mode 100644
index 0000000..38293bd
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.ui
@@ -0,0 +1,250 @@
+
+
+ InitCreateImageXYZDialogClass
+
+
+
+ 0
+ 0
+ 600
+ 403
+
+
+
+ 初始化成像平面网格
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 成像网格(XYZ):
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ D:\Programme\vs2022\RasterMergeTest\LAMPCAE_SCANE-all-scane\BPImage\GF3BPImage
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 成像网格(经纬度):
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 回波GPS轨道节点:
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ D:\Programme\vs2022\RasterMergeTest\LAMPCAE_SCANE-all-scane\GF3_Simulation.xml
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ D:\Programme\vs2022\RasterMergeTest\LAMPCAE_SCANE-all-scane\BPImage\GF3BPImage
+
+
+
+ -
+
+
+ true
+
+
+
+
+ 0
+ 0
+ 580
+ 239
+
+
+
+
-
+
+
+ 方位向参数
+
+
+
-
+
+
+ 方位向的像素数与回波GPS脉冲数一致
+
+
+
+
+
+
+ -
+
+
+ 距离向参数
+
+
+
-
+
+
+ 近斜距
+
+
+
+ -
+
+
+ 3
+
+
+ 1000000000000000000.000000000000000
+
+
+ 0.010000000000000
+
+
+
+ -
+
+
+ 5
+
+
+ 99999999999999991611392.000000000000000
+
+
+ 0.000100000000000
+
+
+
+ -
+
+
+ 距离向间隔
+
+
+
+ -
+
+
+ 距离向像素数
+
+
+
+ -
+
+
+ 999999999
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.cpp b/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.cpp
new file mode 100644
index 0000000..44f0859
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.cpp
@@ -0,0 +1,386 @@
+#include "QCreateInSARImagePlaneXYZRDialog.h"
+#include "ui_QCreateInSARImagePlaneXYZRDialog.h"
+#include
+#include
+
+#include "SatelliteOribtModel.h"
+#include "SARSimulationTaskSetting.h"
+#include "ImageOperatorBase.h"
+#include "FileOperator.h"
+#include "BaseConstVariable.h"
+#include "GPUTool.cuh"
+#include "LookTableSimulationComputer.cuh"
+#include
+
+#include "ImageShowDialogClass.h"
+#include "QToolProcessBarDialog.h"
+
+QCreateInSARImagePlaneXYZRDialog::QCreateInSARImagePlaneXYZRDialog(QWidget* parent)
+ : QDialog(parent), ui(new Ui::QCreateInSARImagePlaneXYZRDialogClass)
+{
+ ui->setupUi(this);
+ connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onaccepted()));
+ connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onrejected()));
+ connect(ui->pushButtonDEM, SIGNAL(clicked(bool)), this, SLOT(onpushButtonDEMClicked(bool)));
+ connect(ui->pushButtonSloper, SIGNAL(clicked(bool)), this, SLOT(onpushButtonSloperClicked(bool)));
+ connect(ui->pushButtonOrbitModel, SIGNAL(clicked(bool)), this, SLOT(onpushButtonOrbitModelClicked(bool)));
+ connect(ui->pushButtonOutDir, SIGNAL(clicked(bool)), this, SLOT(onpushButtonOutDirClicked(bool)));
+ connect(ui->pushButtonSataSetting, SIGNAL(clicked(bool)), this, SLOT(onpushButtonSataSettingClicked(bool)));
+
+
+
+}
+
+QCreateInSARImagePlaneXYZRDialog::~QCreateInSARImagePlaneXYZRDialog()
+{
+
+}
+
+void QCreateInSARImagePlaneXYZRDialog::onrejected()
+{
+ this->close();
+}
+
+void QCreateInSARImagePlaneXYZRDialog::onpushButtonOrbitModelClicked(bool)
+{
+ // ļѡԻѡһ .tif ļ
+ QString fileName = QFileDialog::getOpenFileName(this,
+ u8"GPS Orbit Model xml", // Ի
+ "", // ʼĿ¼Ϊ·
+ u8"xml Files (*.xml)"); // ļ
+
+ if (!fileName.isEmpty()) {
+ this->ui->OrbitModelPathLineEdit->setText(fileName);
+ }
+ else {
+ QMessageBox::information(this, u8"ûѡļ", u8"ûѡκļ");
+ }
+}
+
+void QCreateInSARImagePlaneXYZRDialog::onpushButtonSataSettingClicked(bool)
+{
+ // ļѡԻѡһ .tif ļ
+ QString fileName = QFileDialog::getOpenFileName(this,
+ u8"Satellite Params setting xml", // Ի
+ "", // ʼĿ¼Ϊ·
+ u8"xml Files (*.xml)"); // ļ
+
+ if (!fileName.isEmpty()) {
+ this->ui->SateSettingLineEdit->setText(fileName);
+ }
+ else {
+ QMessageBox::information(this, u8"ûѡļ", u8"ûѡκļ");
+ }
+}
+
+void QCreateInSARImagePlaneXYZRDialog::onpushButtonDEMClicked(bool)
+{
+ // ļѡԻѡһ .tif ļ
+ QString fileName = QFileDialog::getOpenFileName(this,
+ u8"DEM XYZ Raster Select", // Ի
+ "", // ʼĿ¼Ϊ·
+ u8"tiff Files (*.tiff);;tif Files (*.tif);;dat Files (*.dat);;All Files (*.*)"); // ļ
+
+ if (!fileName.isEmpty()) {
+ this->ui->DEMLineEdit->setText(fileName);
+ }
+ else {
+ QMessageBox::information(this, u8"ûѡļ", u8"ûѡκļ");
+ }
+}
+
+void QCreateInSARImagePlaneXYZRDialog::onpushButtonSloperClicked(bool)
+{
+ // ļѡԻѡһ .tif ļ
+ QString fileName = QFileDialog::getOpenFileName(this,
+ u8"DEM Sloper Raster Select", // Ի
+ "", // ʼĿ¼Ϊ·
+ u8"tiff Files (*.tiff);;tif Files (*.tif);;dat Files (*.dat);;All Files (*.*)"); // ļ
+
+ if (!fileName.isEmpty()) {
+ this->ui->SloperLineEdit->setText(fileName);
+ }
+ else {
+ QMessageBox::information(this, u8"ûѡļ", u8"ûѡκļ");
+ }
+}
+
+void QCreateInSARImagePlaneXYZRDialog::onpushButtonOutDirClicked(bool)
+{
+ // ļѡԻѡһ .tif ļ
+ QString fileName = QFileDialog::getExistingDirectory(this,
+ u8"DEM Raster Select", // Ի
+ "" // ʼĿ¼Ϊ·
+ );
+ if (!fileName.isEmpty()) {
+ this->ui->outDirLineEdit->setText(fileName);
+ }
+ else {
+ QMessageBox::information(this, u8"ûѡļ", u8"ûѡκļ");
+ }
+}
+
+void QCreateInSARImagePlaneXYZRDialog::LookTableSimualtionMainProcess(QString sateName, QString orbitpath, QString SatePath, QString DEMPath, QString outDirPath)
+{
+
+ if (!isExists(orbitpath)) {
+ qDebug() << "Orbit model file is not exist !!!";
+ return;
+ }
+ if (!isExists(SatePath)) {
+ qDebug() << "Satellite Model file is not exist !!!";
+ return;
+ }
+ if (!isExists(DEMPath)) {
+ qDebug() << "DEM file is not exist !!!";
+ return;
+ }
+
+ // ȡģ
+ qDebug() << "load orbit model params from xml :" << orbitpath;
+ PolyfitSatelliteOribtModel orbitmodel;
+ orbitmodel.loadFromXml(orbitpath);
+
+ //
+ long double OribtStartTime = orbitmodel.getOribtStartTime();
+ std::vector PolyfitPx = orbitmodel.getPolyfitPx();
+ std::vector PolyfitPy = orbitmodel.getPolyfitPy();
+ std::vector PolyfitPz = orbitmodel.getPolyfitPz();
+ std::vector PolyfitVx = orbitmodel.getPolyfitVx();
+ std::vector PolyfitVy = orbitmodel.getPolyfitVy();
+ std::vector PolyfitVz = orbitmodel.getPolyfitVz();
+
+
+ // ģ
+ qDebug() << "load simulation setting params from xml :" << orbitpath;
+ std::shared_ptr SARSetting = ReadSimulationSettingsXML(SatePath);
+
+ // ղ
+ double dopplerRefrenceTime = SARSetting->getDopplerParametersReferenceTime();
+ std::vector DopplerCentroidCoefficients = SARSetting->getDopplerCentroidCoefficients();
+ std::vector DopplerRateValuesCoefficient = SARSetting->getDopplerRateValuesCoefficients();
+
+ //
+ double startTime = SARSetting->getSARImageStartTime();
+ double endTime = SARSetting->getSARImageStartTime();
+
+ double PRF = SARSetting->getPRF();
+ double Fs = SARSetting->getFs();
+ double nearRange = SARSetting->getNearRange();
+ double farRange = SARSetting->getFarRange();
+ double lamda = SARSetting->getCenterLamda();
+ //
+ QString outLookTablePath = "";
+ QString outIncPath = "";
+ gdalImage demimg(DEMPath);
+
+
+ outLookTablePath = JoinPath(outDirPath, sateName + "_looktable.bin");
+
+ this->ui->label_tip->setText(u8"look table create...");
+
+ this->LookTableSimulationDopplerProcess(
+ DEMPath,
+ outLookTablePath,
+ OribtStartTime,
+ PolyfitPx, PolyfitPy, PolyfitPz,
+ PolyfitVx, PolyfitVy, PolyfitVz,
+ dopplerRefrenceTime,
+ DopplerCentroidCoefficients,
+ startTime,
+ endTime,
+ nearRange,
+ farRange,
+ PRF,
+ Fs,
+ lamda
+ );
+}
+
+void QCreateInSARImagePlaneXYZRDialog::LookTableSimulationDopplerProcess(QString DEMPath, QString outLookTablePath, long double OribtStartTime, std::vector PolyfitPx, std::vector PolyfitPy, std::vector PolyfitPz, std::vector PolyfitVx, std::vector PolyfitVy, std::vector PolyfitVz, double dopplerRefrenceTime, std::vector DopplerCentroidCoefficients, double starttime, double endtime, double nearRange, double farRange, double PRF, double Fs, double lamda)
+{
+ qDebug() << "generate look table ";
+ qDebug() << "DEMPath\t" << DEMPath;
+ qDebug() << "outLookTablePath\t" << outLookTablePath;
+
+ gdalImage demimg(DEMPath);
+ gdalImage outLookTable = CreategdalImageDouble( // ұ
+ outLookTablePath,
+ demimg.height, demimg.width, 4,
+ demimg.gt,
+ demimg.projection,
+ true,
+ true,
+ true
+ );
+
+
+ starttime = starttime - OribtStartTime; // ʱ
+ endtime = endtime - OribtStartTime;
+
+ // ģ
+ double Xp0 = 0, Yp0 = 0, Zp0 = 0, Xv0 = 0, Yv0 = 0, Zv0 = 0;
+ double Xp1 = 0, Yp1 = 0, Zp1 = 0, Xv1 = 0, Yv1 = 0, Zv1 = 0;
+ double Xp2 = 0, Yp2 = 0, Zp2 = 0, Xv2 = 0, Yv2 = 0, Zv2 = 0;
+ double Xp3 = 0, Yp3 = 0, Zp3 = 0, Xv3 = 0, Yv3 = 0, Zv3 = 0;
+ double Xp4 = 0, Yp4 = 0, Zp4 = 0, Xv4 = 0, Yv4 = 0, Zv4 = 0;
+ double Xp5 = 0, Yp5 = 0, Zp5 = 0, Xv5 = 0, Yv5 = 0, Zv5 = 0;
+ int degree = PolyfitPx.size();
+ switch (degree) {
+ case(6):
+ Xp5 = PolyfitPx[5];
+ Yp5 = PolyfitPy[5];
+ Zp5 = PolyfitPz[5];
+ Xv5 = PolyfitVx[5];
+ Yv5 = PolyfitVy[5];
+ Zv5 = PolyfitVz[5];
+ case(5):
+ Xp4 = PolyfitPx[4];
+ Yp4 = PolyfitPy[4];
+ Zp4 = PolyfitPz[4];
+ Xv4 = PolyfitVx[4];
+ Yv4 = PolyfitVy[4];
+ Zv4 = PolyfitVz[4];
+ case(4):
+ Xp3 = PolyfitPx[3];
+ Yp3 = PolyfitPy[3];
+ Zp3 = PolyfitPz[3];
+ Xv3 = PolyfitVx[3];
+ Yv3 = PolyfitVy[3];
+ Zv3 = PolyfitVz[3];
+ case(3):
+ Xp2 = PolyfitPx[2];
+ Yp2 = PolyfitPy[2];
+ Zp2 = PolyfitPz[2];
+ Xv2 = PolyfitVx[2];
+ Yv2 = PolyfitVy[2];
+ Zv2 = PolyfitVz[2];
+ case(2):
+ Xp1 = PolyfitPx[1];
+ Yp1 = PolyfitPy[1];
+ Zp1 = PolyfitPz[1];
+ Xv1 = PolyfitVx[1];
+ Yv1 = PolyfitVy[1];
+ Zv1 = PolyfitVz[1];
+ case(1):
+ Xp0 = PolyfitPx[0];
+ Yp0 = PolyfitPy[0];
+ Zp0 = PolyfitPz[0];
+ Xv0 = PolyfitVx[0];
+ Yv0 = PolyfitVy[0];
+ Zv0 = PolyfitVz[0];
+ default:
+ break;
+ }
+
+ // ղ
+ double r0 = 0, r1 = 0, r2 = 0, r3 = 0, r4 = 0;
+ degree = DopplerCentroidCoefficients.size();
+ switch (degree)
+ {
+ case(5):
+ r4 = DopplerCentroidCoefficients[4];
+ case(4):
+ r3 = DopplerCentroidCoefficients[3];
+ case(3):
+ r2 = DopplerCentroidCoefficients[2];
+ case(2):
+ r1 = DopplerCentroidCoefficients[1];
+ case(1):
+ r0 = DopplerCentroidCoefficients[0];
+ default:
+ break;
+ }
+
+
+
+ // ֿ
+ long GPUMemoryline = floor((Memory1MB * 2.0 / 8.0 / 3.0 / demimg.width * 2000));//2GB
+ GPUMemoryline = GPUMemoryline < 1 ? 1 : GPUMemoryline;
+
+ // ڴԤ
+
+ double fact_lamda = 1 / lamda;
+ for (long rid = 0; rid < demimg.height; rid = rid + GPUMemoryline) {
+ long rowcount = GPUMemoryline;
+ long colcount = demimg.width;
+ qDebug() << "computer read file : " << rid << "~" << rowcount + rid << "\t:" << demimg.height;
+ //double* tmep = new double[rowcount * colcount];
+ std::shared_ptr demX = readDataArr(demimg, rid, 0, rowcount, colcount, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);//
+ std::shared_ptr demY = readDataArr(demimg, rid, 0, rowcount, colcount, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
+ std::shared_ptr demZ = readDataArr(demimg, rid, 0, rowcount, colcount, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
+
+ //
+ std::shared_ptr host_R((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost);
+
+ std::shared_ptr device_R((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice);
+
+ //
+ std::shared_ptr host_demX((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost);
+ std::shared_ptr host_demY((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost);
+ std::shared_ptr host_demZ((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost);
+
+ std::shared_ptr device_demX((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice);
+ std::shared_ptr device_demY((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice);
+ std::shared_ptr device_demZ((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice);
+
+ // ݸ
+ memcpy(host_demX.get(), demX.get(), sizeof(double) * rowcount * colcount);
+ memcpy(host_demY.get(), demY.get(), sizeof(double) * rowcount * colcount);
+ memcpy(host_demZ.get(), demZ.get(), sizeof(double) * rowcount * colcount);
+
+ //ڴ->GPU
+ HostToDevice(host_demX.get(), device_demX.get(), sizeof(double) * rowcount * demimg.width);
+ HostToDevice(host_demY.get(), device_demY.get(), sizeof(double) * rowcount * demimg.width);
+ HostToDevice(host_demZ.get(), device_demZ.get(), sizeof(double) * rowcount * demimg.width);
+
+ qDebug() << "GPU computer start: " << rid << "~" << rowcount + rid << "\t:" << demimg.height;
+ RDProcess_dopplerGPU_InSARImagePlaneXYZR(
+ device_demX.get(), device_demY.get(), device_demZ.get(),
+ device_R.get(),
+ rowcount, colcount,
+ starttime, nearRange, farRange,
+ PRF, Fs,
+ fact_lamda,
+ Xp0, Yp0, Zp0, Xv0, Yv0, Zv0,
+ Xp1, Yp1, Zp1, Xv1, Yv1, Zv1,
+ Xp2, Yp2, Zp2, Xv2, Yv2, Zv2,
+ Xp3, Yp3, Zp3, Xv3, Yv3, Zv3,
+ Xp4, Yp4, Zp4, Xv4, Yv4, Zv4,
+ Xp5, Yp5, Zp5, Xv5, Yv5, Zv5,
+ dopplerRefrenceTime, r0, r1, r2, r3, r4);
+ // GPU -> ڴ
+ DeviceToHost(host_R.get(), device_R.get(), sizeof(double) * rowcount * demimg.width);
+ qDebug() << "GPU computer finished!!: " << rid << "~" << rowcount + rid << "\t:" << demimg.height;
+ //exit(-1);
+ // ݴ洢
+ outLookTable.saveImage(demX, rid, 0, rowcount, colcount, 1);
+ outLookTable.saveImage(demY, rid, 0, rowcount, colcount, 2);
+ outLookTable.saveImage(demZ, rid, 0, rowcount, colcount, 3);
+ outLookTable.saveImage(host_R, rid, 0, rowcount, colcount, 4);
+
+ qDebug() << "GPU computer result write finished: " << rid << " ~ " << rowcount + rid << "\t:" << demimg.height;
+
+ }
+
+ qDebug() << "look table computed finished!!!";
+ }
+
+void QCreateInSARImagePlaneXYZRDialog::onaccepted()
+{
+ QString orbitpath = this->ui->OrbitModelPathLineEdit->text();
+ QString SatePath = this->ui->SateSettingLineEdit->text();
+ QString DEMPath = this->ui->DEMLineEdit->text();
+ QString outDirPath = this->ui->outDirLineEdit->text();
+
+ QString simulationName = this->ui->lineEditLookName->text();
+ this->LookTableSimualtionMainProcess(
+ simulationName,
+ orbitpath, SatePath, DEMPath, outDirPath
+ );
+ QMessageBox::information(this, u8"info", u8"completed!!!");
+
+}
+
+
+
diff --git a/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.h b/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.h
new file mode 100644
index 0000000..d071ee9
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.h
@@ -0,0 +1,70 @@
+#pragma once
+
+#include
+
+
+namespace Ui {
+ class QCreateInSARImagePlaneXYZRDialogClass;
+}
+
+class QCreateInSARImagePlaneXYZRDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ QCreateInSARImagePlaneXYZRDialog(QWidget *parent = nullptr);
+ ~QCreateInSARImagePlaneXYZRDialog();
+
+private:
+ Ui::QCreateInSARImagePlaneXYZRDialogClass* ui;
+
+
+public slots:
+ void onaccepted();
+ void onrejected();
+
+ void onpushButtonOrbitModelClicked(bool);
+ void onpushButtonSataSettingClicked(bool);
+ void onpushButtonDEMClicked(bool);
+ void onpushButtonSloperClicked(bool);
+ void onpushButtonOutDirClicked(bool);
+
+
+
+private: // doppler
+ void LookTableSimualtionMainProcess(
+ QString sateName,
+ QString orbitpath, QString SatePath, QString DEMPath, QString outDirPath
+ );
+
+ void LookTableSimulationDopplerProcess(
+ QString DEMPath,
+ QString outLookTablePath,
+
+ // ʽ
+ long double OribtStartTime, // ģͲοʱ
+ std::vector PolyfitPx, // 50
+ std::vector PolyfitPy, // 50
+ std::vector PolyfitPz, // 50
+ std::vector PolyfitVx, // 50
+ std::vector PolyfitVy, // 50
+ std::vector PolyfitVz, // 50
+
+
+ // ղ
+ double dopplerRefrenceTime,
+ std::vector DopplerCentroidCoefficients,// d0 ~ d5
+
+ //
+ double starttime, // ʼʱ
+ double endtime, // ʱ
+ double nearRange, // б
+ double farRange, // Զб
+ double PRF, // ظƵ
+ double Fs, // Ƶ
+ double lamda
+ );
+
+
+
+};
diff --git a/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.ui b/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.ui
new file mode 100644
index 0000000..c90b83d
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.ui
@@ -0,0 +1,293 @@
+
+
+ QCreateInSARImagePlaneXYZRDialogClass
+
+
+
+ 0
+ 0
+ 763
+ 498
+
+
+
+ QCreateInSARImagePlaneXYZR
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ D:\FZSimulation\LT1A\L20250210\LT1A_DEM_20250210_resampleXYZ.dat
+
+
+
+ -
+
+
+ 采用多普勒参数
+
+
+ true
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 卫星仿真参数:
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ DEM文件(XYZ)
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 坡度法向文件(sloper)
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ D:\FZSimulation\LT1A\L20250210\LT1_Simulation_OrbitModel.xml
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ LT1A_20250210
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ D:\FZSimulation\LT1A\L20250210\Looktable
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 多项式轨道模型参数:
+
+
+
+ -
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ D:\FZSimulation\LT1A\L20250210\LT1A_DEM_20250210_resampleXYZ.dat
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 结果文件保存地址:
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 成像平面文件名
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ D:\FZSimulation\LT1A\L20250210\LT1_Simulation_Setting.xml
+
+
+
+
+
+
+
+
+
diff --git a/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.cpp b/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.cpp
new file mode 100644
index 0000000..88338e9
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.cpp
@@ -0,0 +1,114 @@
+#include "QL1ASARProcessDialog.h"
+#include "ui_QL1ASARProcessDialog.h"
+#include "BaseConstVariable.h"
+#include "BaseTool.h"
+#include "RasterToolBase.h"
+#include "LogInfoCls.h"
+#include
+#include
+#include "ImageNetOperator.h"
+#include "ImageOperatorBase.h"
+
+QL1ASARProcessDialog::QL1ASARProcessDialog(QWidget *parent)
+ : QDialog(parent)
+ ,ui(new Ui::QL1ASARProcessDialogClass)
+{
+ ui->setupUi(this);
+
+
+ connect(ui->pushButtonL1BSelect, SIGNAL(clicked()), this, SLOT(onpushButtonL1BSelect_clicked()));
+ connect(ui->pushButtonL1ASelect, SIGNAL(clicked()), this, SLOT(onpushButtonL1ASelect_clicked()));
+ connect(ui->pushButtonS1ASelect, SIGNAL(clicked()), this, SLOT(onpushButtonS1ASelect_clicked()));
+ connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbuttonBox_accepted()));
+ connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbuttonBox_rejected()));
+
+
+
+
+}
+
+QL1ASARProcessDialog::~QL1ASARProcessDialog()
+{
+
+
+
+}
+
+void QL1ASARProcessDialog::onpushButtonL1BSelect_clicked()
+{
+
+ QString fileNames = QFileDialog::getSaveFileName(
+ this, //
+ tr(u8"ѡL1Bļ"), //
+ QString(), // Ĭ·
+ tr(ENVI_FILE_FORMAT_FILTER) // ļ
+ );
+ // ûѡļ
+ if (!fileNames.isEmpty()) {
+ QString message = u8"ѡļУ\n";
+ this->ui->lineEditL1BDataPath->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ"));
+ }
+
+}
+
+void QL1ASARProcessDialog::onpushButtonL1ASelect_clicked()
+{
+ QString fileNames = QFileDialog::getOpenFileName(
+ this, //
+ tr(u8"ѡL1Aļ"), //
+ QString(), // Ĭ·
+ tr(ENVI_FILE_FORMAT_FILTER) // ļ
+ );
+ // ûѡļ
+ if (!fileNames.isEmpty()) {
+ QString message = u8"ѡļУ\n";
+ this->ui->lineEditL1ADataPath->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ"));
+ }
+}
+
+void QL1ASARProcessDialog::onpushButtonS1ASelect_clicked()
+{
+ QString fileNames = QFileDialog::getSaveFileName(
+ this, //
+ tr(u8"ѡбƷļ"), //
+ QString(), // Ĭ·
+ tr(ENVI_FILE_FORMAT_FILTER) // ļ
+ );
+ // ûѡļ
+ if (!fileNames.isEmpty()) {
+ QString message = u8"ѡļУ\n";
+ this->ui->lineSlAPath->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ"));
+ }
+}
+
+void QL1ASARProcessDialog::onbuttonBox_accepted()
+{
+ QString l1arasterpath = ui->lineEditL1ADataPath->text();
+ QString s1arasterpath = ui->lineSlAPath->text();
+ QString l1brasterpath = ui->lineEditL1BDataPath->text();
+
+ long nlaz = ui->spinBoxLNAz->value();
+ long nlra = ui->spinBoxLNRa->value();
+
+ qDebug() << u8"бิƷ ת бȲƷ";
+ Complex2AmpRaster(l1arasterpath, s1arasterpath);
+
+ qDebug() << u8"бȲƷ ת бȲƷ";
+ MultiLookRaster(s1arasterpath, l1brasterpath, nlaz, nlra);
+
+ QMessageBox::information(this, tr(u8"ʾ"), tr(u8"Ӵ"));
+}
+
+void QL1ASARProcessDialog::onbuttonBox_rejected()
+{
+ this->close();
+}
diff --git a/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.h b/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.h
new file mode 100644
index 0000000..3e27297
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.h
@@ -0,0 +1,30 @@
+#pragma once
+
+#include
+
+
+namespace Ui {
+ class QL1ASARProcessDialogClass;
+
+};
+
+class QL1ASARProcessDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ QL1ASARProcessDialog(QWidget *parent = nullptr);
+ ~QL1ASARProcessDialog();
+
+
+public slots:
+
+ void onpushButtonL1BSelect_clicked();
+ void onpushButtonL1ASelect_clicked();
+ void onpushButtonS1ASelect_clicked();
+ void onbuttonBox_accepted();
+ void onbuttonBox_rejected();
+
+private:
+ Ui::QL1ASARProcessDialogClass* ui;
+};
diff --git a/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.ui b/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.ui
new file mode 100644
index 0000000..b3957fd
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.ui
@@ -0,0 +1,232 @@
+
+
+ QL1ASARProcessDialogClass
+
+
+
+ 0
+ 0
+ 475
+ 354
+
+
+
+ QL1ASARProcessDialog
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 单视振幅产品:
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ L1B:
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ L1A产品:
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+
+
+
+
+ -
+
+
+ 多视参数
+
+
+
-
+
+
+
+ 0
+ 30
+
+
+
+
+ 100
+ 16777215
+
+
+
+ 方位向视数:
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+
+ 100
+ 16777215
+
+
+
+ 方位向视数:
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+
+
diff --git a/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.cpp b/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.cpp
new file mode 100644
index 0000000..4fbc603
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.cpp
@@ -0,0 +1,124 @@
+#include "QLonLatInterpAtiFromDEM.h"
+#include "ui_QLonLatInterpAtiFromDEM.h"
+#include "BaseConstVariable.h"
+#include "BaseTool.h"
+#include "RasterToolBase.h"
+#include "LogInfoCls.h"
+#include
+#include
+#include "ImageNetOperator.h"
+
+QLonLatInterpAtiFromDEM::QLonLatInterpAtiFromDEM(QWidget *parent)
+ : QDialog(parent)
+ ,ui(new Ui::QLonLatInterpAtiFromDEMClass)
+{
+ ui->setupUi(this);
+
+ connect(ui->pushButtonLonLatRasterSelect, SIGNAL(clicked()), this, SLOT(onpushButtonLonLatRasterSelect_clicked()));
+ connect(ui->pushButtonDEMRasterSelect, SIGNAL(clicked()), this, SLOT(onpushButtonDEMRasterSelect_clicked()));
+ connect(ui->pushButtonLLARasterSelect, SIGNAL(clicked()), this, SLOT(onpushButtonLLARasterSelect_clicked()));
+ connect(ui->pushButtonXYZRasterSelect, SIGNAL(clicked()), this, SLOT(onpushButtonXYZRasterSelect_clicked()));
+ connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbuttonBox_accepted()));
+ connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbuttonBox_rejected()));
+
+
+}
+
+QLonLatInterpAtiFromDEM::~QLonLatInterpAtiFromDEM()
+{
+
+}
+
+void QLonLatInterpAtiFromDEM::onpushButtonLonLatRasterSelect_clicked()
+{
+
+ QString fileNames = QFileDialog::getOpenFileName(
+ this, //
+ tr(u8"ѡļ"), //
+ QString(), // Ĭ·
+ tr(ENVI_FILE_FORMAT_FILTER) // ļ
+ );
+ // ûѡļ
+ if (!fileNames.isEmpty()) {
+ QString message = "ѡļУ\n";
+ this->ui->lineEditLonLatRasterPath->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ"));
+ }
+
+}
+
+void QLonLatInterpAtiFromDEM::onpushButtonDEMRasterSelect_clicked()
+{
+ QString fileNames = QFileDialog::getOpenFileName(
+ this, //
+ tr(u8"ѡDEMļ"), //
+ QString(), // Ĭ·
+ tr(ENVI_FILE_FORMAT_FILTER) // ļ
+ );
+ // ûѡļ
+ if (!fileNames.isEmpty()) {
+ QString message = "ѡļУ\n";
+ this->ui->lineEditDEMRasterPath->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ"));
+ }
+}
+
+void QLonLatInterpAtiFromDEM::onpushButtonLLARasterSelect_clicked()
+{
+ QString fileNames = QFileDialog::getSaveFileName(
+ this, //
+ tr(u8"ѡļ"), //
+ QString(), // Ĭ·
+ tr(ENVI_FILE_FORMAT_FILTER) // ļ
+ );
+ // ûѡļ
+ if (!fileNames.isEmpty()) {
+ QString message = "ѡļУ\n";
+ this->ui->lineEditLLARasterPath->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ"));
+ }
+}
+
+void QLonLatInterpAtiFromDEM::onpushButtonXYZRasterSelect_clicked()
+{
+ QString fileNames = QFileDialog::getSaveFileName(
+ this, //
+ tr(u8"ѡתļ"), //
+ QString(), // Ĭ·
+ tr(ENVI_FILE_FORMAT_FILTER) // ļ
+ );
+ // ûѡļ
+ if (!fileNames.isEmpty()) {
+ QString message = "ѡļУ\n";
+ this->ui->lineEditXYZRasterPath->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ"));
+ }
+}
+
+void QLonLatInterpAtiFromDEM::onbuttonBox_accepted()
+{
+ QString llrasterpath = ui->lineEditLonLatRasterPath->text();
+ QString demrasterpath = ui->lineEditDEMRasterPath->text();
+ QString llarasterpath = ui->lineEditLLARasterPath->text();
+ QString xyzrasterpath = ui->lineEditXYZRasterPath->text();
+
+ qDebug() << "DEM߳С";
+ InterpLookTableRfromDEM(llrasterpath, demrasterpath, llarasterpath);
+ qDebug() << "γתΪXYZС";
+ RangeLooktableLLA_2_RangeLooktableXYZ(llarasterpath, xyzrasterpath);
+ QMessageBox::information(this, tr(u8"ʾ"), tr(u8""));
+}
+
+void QLonLatInterpAtiFromDEM::onbuttonBox_rejected()
+{
+ this->close();
+}
+
diff --git a/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.h b/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.h
new file mode 100644
index 0000000..b728ef8
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.h
@@ -0,0 +1,29 @@
+#pragma once
+
+#include
+
+namespace Ui {
+ class QLonLatInterpAtiFromDEMClass;
+}
+
+class QLonLatInterpAtiFromDEM : public QDialog
+{
+ Q_OBJECT
+
+public:
+ QLonLatInterpAtiFromDEM(QWidget *parent = nullptr);
+ ~QLonLatInterpAtiFromDEM();
+
+
+public slots:
+ void onpushButtonLonLatRasterSelect_clicked();
+ void onpushButtonDEMRasterSelect_clicked();
+ void onpushButtonLLARasterSelect_clicked();
+ void onpushButtonXYZRasterSelect_clicked();
+ void onbuttonBox_accepted();
+ void onbuttonBox_rejected();
+
+
+private:
+ Ui::QLonLatInterpAtiFromDEMClass* ui;
+};
diff --git a/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.ui b/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.ui
new file mode 100644
index 0000000..4a31eca
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.ui
@@ -0,0 +1,191 @@
+
+
+ QLonLatInterpAtiFromDEMClass
+
+
+
+ 0
+ 0
+ 600
+ 400
+
+
+
+ QLonLatInterpAtiFromDEM
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 经纬度数据矩阵:
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 待采样DEM:
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 采样矩阵(LLA):
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 采样矩阵(XYZ):
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+
+
+
+
diff --git a/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp
new file mode 100644
index 0000000..5082835
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp
@@ -0,0 +1,124 @@
+#include "QSARSimulationComplexEchoDataDialog.h"
+#include "ui_QSARSimulationComplexEchoDataDialog.h"
+#include
+#include
+#include "BaseConstVariable.h"
+#include "BaseTool.h"
+#include "ImageNetOperator.h"
+#include
+#include "FileOperator.h"
+#include "ImageOperatorBase.h"
+
+
+QSARSimulationComplexEchoDataDialog::QSARSimulationComplexEchoDataDialog(QWidget *parent)
+ : QDialog(parent)
+ , ui(new Ui::QSARSimulationComplexEchoDataDialogClass)
+{
+ ui->setupUi(this);
+
+
+ connect(ui->pushButtonEchoDataSelect, SIGNAL(clicked()), this, SLOT(onpushButtonEchoDataSelect_clicked()));
+ connect(ui->pushButtonLookTableSelect, SIGNAL(clicked()), this, SLOT(onpushButtonLookTableSelect_clicked()));
+ connect(ui->pushButtonL1AEchoDataSelect, SIGNAL(clicked()), this, SLOT(onpushButtonL1AEchoDataSelect_clicked()));
+ connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbuttonBox_accepted()));
+ connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbuttonBox_rejected()));
+
+}
+
+QSARSimulationComplexEchoDataDialog::~QSARSimulationComplexEchoDataDialog()
+{
+
+
+}
+
+void QSARSimulationComplexEchoDataDialog::onpushButtonEchoDataSelect_clicked()
+{
+ QString fileNames = QFileDialog::getOpenFileName(
+ this, //
+ tr(u8"ѡؾļ"), //
+ QString(), // Ĭ·
+ tr(ENVI_FILE_FORMAT_FILTER) // ļ
+ );
+ // ûѡļ
+ if (!fileNames.isEmpty()) {
+ QString message = "ѡļУ\n";
+ this->ui->lineEditEchoDataPath->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ"));
+ }
+}
+
+void QSARSimulationComplexEchoDataDialog::onpushButtonLookTableSelect_clicked()
+{
+ QString fileNames = QFileDialog::getOpenFileName(
+ this, //
+ tr(u8"ѡұزļ"), //
+ QString(), // Ĭ·
+ tr(ENVI_FILE_FORMAT_FILTER) // ļ
+ );
+ // ûѡļ
+ if (!fileNames.isEmpty()) {
+ QString message = "ѡļУ\n";
+ this->ui->lineEditLookTablePath->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ"));
+ }
+}
+
+void QSARSimulationComplexEchoDataDialog::onpushButtonL1AEchoDataSelect_clicked()
+{
+ QString fileNames = QFileDialog::getSaveFileName(
+ this, //
+ tr(u8"ѡбļ"), //
+ QString(), // Ĭ·
+ tr(ENVI_FILE_FORMAT_FILTER) // ļ
+ );
+ // ûѡļ
+ if (!fileNames.isEmpty()) {
+ QString message = "ѡļУ\n";
+ this->ui->lineEditL1AEchoDataPath->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ"));
+ }
+}
+
+void QSARSimulationComplexEchoDataDialog::onbuttonBox_accepted()
+{
+ QString echoDataPath = this->ui->lineEditEchoDataPath->text().trimmed();
+ QString RangelookTablePath = this->ui->lineEditLookTablePath->text().trimmed();
+ QString l1AEchoDataPath = this->ui->lineEditL1AEchoDataPath->text().trimmed();
+
+ if (isExists(echoDataPath) && isExists(RangelookTablePath)) {
+ gdalImage echoData(echoDataPath);
+ gdalImage RangelookTable(RangelookTablePath);
+ if (echoData.getDataType() == GDT_CFloat32
+ ||echoData.getDataType()==GDT_CFloat64
+ || echoData.getDataType() == GDT_CInt16
+ || echoData.getDataType()==GDT_CInt32
+ ) {
+
+ CreategdalImageComplex(l1AEchoDataPath, RangelookTable.height, RangelookTable.width,1, RangelookTable.gt, RangelookTable.projection, true, true);
+
+
+ ResampleEChoDataFromGeoEcho(echoDataPath, RangelookTablePath, l1AEchoDataPath);
+ }
+ else {
+ CreategdalImage(l1AEchoDataPath, RangelookTable.height, RangelookTable.width, 1, RangelookTable.gt, RangelookTable.projection, true, true);
+ ResampleRangeDataFromGeoImage(echoDataPath, RangelookTablePath, l1AEchoDataPath);
+ }
+
+ QMessageBox::information(this, tr(u8"ʾ"), tr(u8""));
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ʾ"), tr(u8"ûѡκļ"));
+ }
+
+}
+
+void QSARSimulationComplexEchoDataDialog::onbuttonBox_rejected()
+{
+ this->close();
+}
diff --git a/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.h b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.h
new file mode 100644
index 0000000..b586769
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.h
@@ -0,0 +1,27 @@
+#pragma once
+
+#include
+
+namespace Ui
+{
+ class QSARSimulationComplexEchoDataDialogClass;
+}
+
+class QSARSimulationComplexEchoDataDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ QSARSimulationComplexEchoDataDialog(QWidget *parent = nullptr);
+ ~QSARSimulationComplexEchoDataDialog();
+
+
+public slots:
+ void onpushButtonEchoDataSelect_clicked();
+ void onpushButtonLookTableSelect_clicked();
+ void onpushButtonL1AEchoDataSelect_clicked();
+ void onbuttonBox_accepted();
+ void onbuttonBox_rejected();
+private:
+ Ui::QSARSimulationComplexEchoDataDialogClass* ui;
+};
diff --git a/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.ui b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.ui
new file mode 100644
index 0000000..6e3e09b
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.ui
@@ -0,0 +1,149 @@
+
+
+ QSARSimulationComplexEchoDataDialogClass
+
+
+
+ 0
+ 0
+ 916
+ 400
+
+
+
+ QSARSimulationComplexEchoDataDialog
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 地距文件:
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 查找表:
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 斜距文件:
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ 选择
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+
+
+
+
diff --git a/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.cpp b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.cpp
new file mode 100644
index 0000000..3fe90be
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.cpp
@@ -0,0 +1,193 @@
+#include "QSimulationBPImageMultiProduction.h"
+#include
+#include
+#include "TBPImageAlgCls.h"
+#include "EchoDataFormat.h"
+#include
+#include
+#include "ui_QSimulationBPImageMultiProduction.h"
+#include "ImageNetOperator.h"
+
+QSimulationBPImageMultiProduction::QSimulationBPImageMultiProduction(QWidget *parent)
+ : QDialog(parent),ui(new Ui::QSimulationBPImageMultiProductionClass)
+{
+ ui->setupUi(this);
+
+ QObject::connect(ui->pushButtonEchoSelect, SIGNAL(clicked()), this, SLOT(onpushButtonEchoSelectClicked()));
+ QObject::connect(ui->LookTableBtn, SIGNAL(clicked()), this, SLOT(onpushButtonLookTableBtnClicked()));
+ QObject::connect(ui->GridNetBtn, SIGNAL(clicked()), this, SLOT(onpushButtonGridNetBtnSelectClicked()));
+ QObject::connect(ui->L1ASelectBtn, SIGNAL(clicked()), this, SLOT(onpushButtonL1ASelectBtnClicked()));
+ QObject::connect(ui->L2SelectSelect, SIGNAL(clicked()), this, SLOT(onpushButtonL2SelectSelectClicked()));
+ QObject::connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbtnaccepted()));
+ QObject::connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbtnrejected()));
+
+
+
+
+
+}
+
+QSimulationBPImageMultiProduction::~QSimulationBPImageMultiProduction()
+{}
+
+void QSimulationBPImageMultiProduction::onpushButtonEchoSelectClicked()
+{
+ QString fileNames = QFileDialog::getOpenFileName(
+ this, //
+ tr(u8"ѡӰļ"), //
+ QString(), // Ĭ·
+ tr(u8"xml Files (*.xml);;All Files (*)") // ļ
+ );
+
+ // ûѡļ
+ if (!fileNames.isEmpty()) {
+ QString message = "ѡļУ\n";
+ this->ui->lineEditEchoPath->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ"));
+ }
+}
+
+
+void QSimulationBPImageMultiProduction::onpushButtonLookTableBtnClicked()
+{
+ QString fileNames = QFileDialog::getOpenFileName(
+ this, //
+ tr(u8"ѡұļ"), //
+ QString(), // Ĭ·
+ tr(u8"All Files(*)") // ļ
+ );
+
+ // ûѡļ
+ if (!fileNames.isEmpty()) {
+ this->ui->lineEditLookTablePath->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ"));
+ }
+}
+
+void QSimulationBPImageMultiProduction::onpushButtonGridNetBtnSelectClicked()
+{
+ QString fileNames = QFileDialog::getOpenFileName(
+ this, //
+ tr(u8"ѡļ"), //
+ QString(), // Ĭ·
+ tr(u8"All Files(*)") // ļ
+ );
+
+ // ûѡļ
+ if (!fileNames.isEmpty()) {
+ this->ui->lineEditImageNetPath->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ"));
+ }
+}
+
+void QSimulationBPImageMultiProduction::onpushButtonL1ASelectBtnClicked()
+{
+ QString fileNames = QFileDialog::getSaveFileName(
+ this, //
+ tr(u8"ѡӰļ"), //
+ QString(), // Ĭ·
+ tr(u8"All Files(*)") // ļ
+ );
+
+ // ûѡļ
+ if (!fileNames.isEmpty()) {
+ this->ui->lineEditL1AProductionPath->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ"));
+ }
+}
+
+void QSimulationBPImageMultiProduction::onpushButtonL2SelectSelectClicked()
+{
+ QString fileNames = QFileDialog::getSaveFileName(
+ this, //
+ tr(u8"ѡӰļ"), //
+ QString(), // Ĭ·
+ tr(u8"All Files(*)") // ļ
+ );
+
+ // ûѡļ
+ if (!fileNames.isEmpty()) {
+ this->ui->lineEditL2ProductionPath->setText(fileNames);
+ }
+ else {
+ QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ"));
+ }
+}
+
+void QSimulationBPImageMultiProduction::onbtnaccepted()
+{
+ QString L1ADataPath = this->ui->lineEditL1AProductionPath->text().trimmed();
+ QString L2DataPath = this->ui->lineEditL2ProductionPath->text().trimmed();
+ QString looktablePath = this->ui->lineEditLookTablePath->text().trimmed();
+ QString imgNetPath = this->ui->lineEditImageNetPath->text().trimmed();
+ QString echoDataPath = this->ui->lineEditEchoPath->text().trimmed();
+
+ this->hide();
+ QString echofile = echoDataPath;
+ QString outImageFolder = getParantFromPath(L2DataPath);
+ QString imagename = getFileNameFromPath(L2DataPath);
+ std::shared_ptr echoL0ds(new EchoL0Dataset);
+ echoL0ds->Open(echofile);
+
+ std::shared_ptr< SARSimulationImageL1Dataset> imagL1(new SARSimulationImageL1Dataset);
+ imagL1->setCenterAngle(echoL0ds->getCenterAngle());
+ imagL1->setCenterFreq(echoL0ds->getCenterFreq());
+ imagL1->setNearRange(echoL0ds->getNearRange());
+ imagL1->setRefRange((echoL0ds->getNearRange() + echoL0ds->getFarRange()) / 2);
+ imagL1->setFarRange(echoL0ds->getFarRange());
+ imagL1->setFs(echoL0ds->getFs());
+ imagL1->setLookSide(echoL0ds->getLookSide());
+
+ gdalImage imgxyzimg(imgNetPath);
+ imagL1->OpenOrNew(outImageFolder, imagename, imgxyzimg.height, imgxyzimg.width);
+
+ qDebug() << u8"";
+ TBPImageAlgCls TBPimag;
+ TBPimag.setEchoL0(echoL0ds);
+ TBPimag.setImageL1(imagL1);
+ long cpucore_num = std::thread::hardware_concurrency();
+ TBPimag.setGPU(true);
+ TBPimag.ProcessWithGridNet(cpucore_num, imgNetPath);
+ qDebug() << u8"ϵͳУ";
+
+ // ӳ
+ std::shared_ptr< SARSimulationImageL1Dataset> imagL2(new SARSimulationImageL1Dataset);
+ imagL2->setCenterAngle(echoL0ds->getCenterAngle());
+ imagL2->setCenterFreq(echoL0ds->getCenterFreq());
+ imagL2->setNearRange(echoL0ds->getNearRange());
+ imagL2->setRefRange((echoL0ds->getNearRange() + echoL0ds->getFarRange()) / 2);
+ imagL2->setFarRange(echoL0ds->getFarRange());
+ imagL2->setFs(echoL0ds->getFs());
+ imagL2->setLookSide(echoL0ds->getLookSide());
+
+
+ QString outL1AImageFolder = getParantFromPath(L1ADataPath);
+ QString L1Aimagename = getFileNameFromPath(L1ADataPath);
+
+ gdalImage Looktableimg(looktablePath);
+ imagL2->OpenOrNew(outL1AImageFolder, L1Aimagename, Looktableimg.height, Looktableimg.width);
+
+ QString L1AEchoDataPath =imagL2->getImageRasterPath();
+
+ ResampleEChoDataFromGeoEcho(imagL1->getImageRasterPath(), looktablePath, L1AEchoDataPath);
+
+
+ this->show();
+
+ QMessageBox::information(this,u8"",u8"");
+
+}
+
+void QSimulationBPImageMultiProduction::onbtnrejected()
+{
+ this->close();
+}
+
\ No newline at end of file
diff --git a/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.h b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.h
new file mode 100644
index 0000000..45222a6
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.h
@@ -0,0 +1,32 @@
+#pragma once
+#include "simulationsartool_global.h"
+#include
+
+namespace Ui {
+ class QSimulationBPImageMultiProductionClass;
+}
+
+
+
+class SIMULATIONSARTOOL_EXPORT QSimulationBPImageMultiProduction : public QDialog
+{
+ Q_OBJECT
+
+public:
+ QSimulationBPImageMultiProduction(QWidget *parent = nullptr);
+ ~QSimulationBPImageMultiProduction();
+
+
+public slots:
+ void onpushButtonEchoSelectClicked();
+ void onpushButtonLookTableBtnClicked();
+ void onpushButtonGridNetBtnSelectClicked();
+ void onpushButtonL1ASelectBtnClicked();
+ void onpushButtonL2SelectSelectClicked();
+ void onbtnaccepted();
+ void onbtnrejected();
+
+
+private:
+ Ui::QSimulationBPImageMultiProductionClass* ui;
+};
diff --git a/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.ui b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.ui
new file mode 100644
index 0000000..4712523
--- /dev/null
+++ b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.ui
@@ -0,0 +1,303 @@
+
+
+ QSimulationBPImageMultiProductionClass
+
+
+
+ 0
+ 0
+ 813
+ 400
+
+
+
+ 仿真图像TimeBP方法
+
+
+ -
+
+