Release-dev
chenzenghui 2025-04-29 19:31:44 +08:00
commit fa8395cdf2
113 changed files with 9682 additions and 2602 deletions

View File

@ -220,11 +220,13 @@
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration> <EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet> <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
<OpenMPSupport>true</OpenMPSupport> <OpenMPSupport>true</OpenMPSupport>
<LanguageStandard>stdcpp14</LanguageStandard> <LanguageStandard>stdcpp14</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C> <LanguageStandard_C>stdc11</LanguageStandard_C>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<WholeProgramOptimization>false</WholeProgramOptimization>
<Optimization>MaxSpeed</Optimization>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>

View File

@ -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; } void setZ(double iz) { z = iz; }
}; };
struct Point_3d {
double x;
double y;
double z;
};
struct DemBox { struct DemBox {
double min_lon; double min_lon;
double max_lon; double max_lon;
@ -154,7 +165,7 @@ struct Vector3_single {
/*********************************************** FEKO仿真参数 ********************************************************************/ /*********************************************** FEKO仿真参数 ********************************************************************/
struct SatellitePos { extern "C" struct SatellitePos {
double time; double time;
double Px ; double Px ;
double Py ; double Py ;
@ -165,7 +176,7 @@ struct SatellitePos {
}; };
struct SatelliteAntPos { extern "C" struct SatelliteAntPos {
double time; // 0 double time; // 0
double Px; double Px;
double Py; double Py;
@ -188,7 +199,7 @@ struct SatelliteAntPos {
}; };
struct PatternImageDesc { extern "C" struct PatternImageDesc {
long phinum; long phinum;
long thetanum; long thetanum;
double startTheta; double startTheta;

View File

@ -38,7 +38,10 @@
#include <xmmintrin.h> // 包含SSE指令集头文件 #include <xmmintrin.h> // 包含SSE指令集头文件
#include <emmintrin.h> // 包含SSE2指令集头文件 #include <emmintrin.h> // 包含SSE2指令集头文件
#include <omp.h> // 包含OpenMP头文件 #include <omp.h> // 包含OpenMP头文件
#include <iostream>
#include <string>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/date_time/posix_time/conversion.hpp>
QString longDoubleToQStringScientific(long double value) { QString longDoubleToQStringScientific(long double value) {
std::ostringstream stream; 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 };
}

View File

@ -31,7 +31,8 @@
#include <QDebug> #include <QDebug>
#include <iomanip> #include <iomanip>
#include <sstream> #include <sstream>
#include <QDatetime>
#include <boost/cstdint.hpp>
///////////////////////////////////// 基础数学函数 ///////////////////////////////////////////////////////////// ///////////////////////////////////// 基础数学函数 /////////////////////////////////////////////////////////////
@ -101,7 +102,7 @@ Eigen::Matrix3d BASECONSTVARIABLEAPI rotationMatrix(const Eigen::Vector3d& axis
long double BASECONSTVARIABLEAPI convertToMilliseconds(const std::string& dateTimeStr); long double BASECONSTVARIABLEAPI convertToMilliseconds(const std::string& dateTimeStr);
QDateTime BASECONSTVARIABLEAPI parseCustomDateTime(const QString& dateTimeStr);
/// <summary> /// <summary>
/// list 应该是按照从小到大的顺序排好 /// list 应该是按照从小到大的顺序排好
/// </summary> /// </summary>
@ -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 MuhlemanSigmaArray(Eigen::MatrixXd& eta_deg);
Eigen::MatrixXd BASECONSTVARIABLEAPI dB2Amp(Eigen::MatrixXd& sigma0); 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) { inline double calculate_MuhlemanSigma(double eta_deg) {

View File

@ -93,7 +93,8 @@ QString getFileNameFromPath(const QString& path)
QString getFileNameWidthoutExtend(QString path) QString getFileNameWidthoutExtend(QString path)
{ {
QFileInfo fileInfo(path); QFileInfo fileInfo(path);
QString fileNameWithoutExtension = fileInfo.baseName(); // 获取无后缀文件名 QString fileNameWithoutExtension = fileInfo.completeBaseName(); // 获取无后缀文件名
qDebug() << u8"File name without extension: " << fileNameWithoutExtension;
return fileNameWithoutExtension; return fileNameWithoutExtension;
} }

View File

@ -29,7 +29,7 @@ unsigned long BASECONSTVARIABLEAPI convertToULong(const QString& input);
/// <param name="folderpath"></param> /// <param name="folderpath"></param>
/// <param name="FilenameExtension"></param> /// <param name="FilenameExtension"></param>
/// <returns></returns> /// <returns></returns>
std::vector<QString> BASECONSTVARIABLEAPI getFilelist(const QString& folderpath, const QString& FilenameExtension = ".*",int (*logfun)(QString logtext,int value)=nullptr); std::vector<QString> BASECONSTVARIABLEAPI getFilelist(const QString& folderpath, const QString& FilenameExtension = ".*", int (*logfun)(QString logtext, int value) = nullptr);
QString BASECONSTVARIABLEAPI getParantFolderNameFromPath(const QString& path); QString BASECONSTVARIABLEAPI getParantFolderNameFromPath(const QString& path);

View File

@ -18,7 +18,9 @@
#include <fstream> #include <fstream>
#include <proj.h> #include <proj.h>
#include "GeoOperator.h" #include "GeoOperator.h"
#include <ogr_spatialref.h> // OGRSpatialReference 用于空间参考转换
#include <gdal_alg.h> // 用于 GDALWarp 操作
#include <ogr_spatialref.h>
Landpoint operator +(const Landpoint& p1, const Landpoint& p2) 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) double getAngle(const Landpoint& a, const Landpoint& b)
{ {
@ -408,3 +448,53 @@ double getlocalIncAngle(Vector3D& satepoint, Vector3D& landpoint, Vector3D& slop
return angle; 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;
}

View File

@ -30,6 +30,7 @@ Eigen::MatrixXd BASECONSTVARIABLEAPI LLA2XYZ(Eigen::MatrixXd landpoint);
/// <returns>经纬度--degree</returns> /// <returns>经纬度--degree</returns>
Landpoint BASECONSTVARIABLEAPI XYZ2LLA(const Landpoint& XYZ); 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); 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); 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 #endif

View File

@ -89,7 +89,7 @@ enum GDALREADARRCOPYMETHOD {
/// \param long 经度 /// \param long 经度
/// \param lat 纬度 /// \param lat 纬度
/// \return 对应投影坐标系统的 EPSG编码,-1 表示计算错误 /// \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); long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat_inStrip3(double lon, double lat);
@ -135,10 +135,10 @@ GDALDataType BASECONSTVARIABLEAPI getGDALDataType(QString fileptah);
struct RasterExtend { struct RasterExtend {
double min_x; //纬度 double min_x;
double min_y;//经度 double min_y;
double max_x;//纬度 double max_x;
double max_y;//经度 double max_y;
}; };
@ -174,8 +174,6 @@ public: // 方法
virtual void saveImage(std::shared_ptr<float>, int start_row, int start_col, int rowcount, int colcount, int band_ids); virtual void saveImage(std::shared_ptr<float>, int start_row, int start_col, int rowcount, int colcount, int band_ids);
virtual void saveImage(std::shared_ptr<int>, int start_row, int start_col, int rowcount, int colcount, int band_ids); virtual void saveImage(std::shared_ptr<int>, int start_row, int start_col, int rowcount, int colcount, int band_ids);
virtual void saveImage(); virtual void saveImage();
virtual void setNoDataValue(double nodatavalue, int band_ids); virtual void setNoDataValue(double nodatavalue, int band_ids);
virtual void setNoDataValuei(int nodatavalue, int band_ids); virtual void setNoDataValuei(int nodatavalue, int band_ids);
@ -197,6 +195,10 @@ public: // 方法
virtual RasterExtend getExtend(); virtual RasterExtend getExtend();
public: public:
QString img_path; // 图像文件 QString img_path; // 图像文件
int height; // 高 int height; // 高
@ -236,6 +238,10 @@ public:
Eigen::MatrixXcd data; 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 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); 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<void(long, long)> processBarShow = {}); void BASECONSTVARIABLEAPI CreateSARIntensityByLookTable(QString IntensityRasterPath, QString LookTableRasterPath, QString SARIntensityPath, long min_rid, long max_rid, long min_cid, long max_cid, std::function<void(long, long)> 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();
//--------------------- 图像文件读写 ------------------------------ //--------------------- 图像文件读写 ------------------------------

View File

@ -15,6 +15,8 @@
#include <QTextCodec> #include <QTextCodec>
#include <iostream> #include <iostream>
#include <QFile> #include <QFile>
#include "SARSimulationImageL1.h"
#include <QMessageBox>
namespace RasterToolBase { namespace RasterToolBase {
long getProjectEPSGCodeByLon_Lat(double lon, double lat, ProjectStripDelta stripState) long getProjectEPSGCodeByLon_Lat(double lon, double lat, ProjectStripDelta stripState)
@ -268,4 +270,7 @@ namespace RasterToolBase {
return CoordinateSystemType::UNKNOW; return CoordinateSystemType::UNKNOW;
} }
} }
} // namespace RasterToolBase }; // namespace RasterToolBase

View File

@ -12,40 +12,42 @@
#include "BaseConstVariable.h" #include "BaseConstVariable.h"
#include "gdal_priv.h" #include "gdal_priv.h"
#include <memory> #include <memory>
#include "LogInfoCls.h"
namespace RasterToolBase { namespace RasterToolBase {
static bool GDALAllRegisterEnable=false; static bool GDALAllRegisterEnable = false;
enum ProjectStripDelta{ enum ProjectStripDelta {
Strip_6, // 6度带 Strip_6, // 6度带
Strip_3 Strip_3
}; };
enum CoordinateSystemType{ // 坐标系类型 enum CoordinateSystemType { // 坐标系类型
GeoCoordinateSystem, GeoCoordinateSystem,
ProjectCoordinateSystem, ProjectCoordinateSystem,
UNKNOW UNKNOW
}; };
struct PointRaster{ // 影像坐标点 struct PointRaster { // 影像坐标点
double x; double x;
double y; double y;
double z; double z;
}; };
struct PointXYZ{ struct PointXYZ {
double x,y,z; double x, y, z;
}; };
struct PointGeo{ struct PointGeo {
double lon,lat,ati; double lon, lat, ati;
}; };
struct PointImage{ struct PointImage {
double pixel_x,pixel_y; double pixel_x, pixel_y;
}; };
/// 根据经纬度获取 /// 根据经纬度获取
@ -63,7 +65,7 @@ namespace RasterToolBase {
long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat_inStrip6(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); long BASECONSTVARIABLEAPI GetEPSGFromRasterFile(QString filepath);
@ -72,9 +74,23 @@ namespace RasterToolBase {
CoordinateSystemType BASECONSTVARIABLEAPI getCoordinateSystemTypeByEPSGCode(long EPSGCODE); CoordinateSystemType BASECONSTVARIABLEAPI getCoordinateSystemTypeByEPSGCode(long EPSGCODE);
};// namespace RasterProjectConvertor
// 遥感类常用数据
} // namespace RasterProjectConvertor
#endif // LAMPCAE_RASTERTOOLBASE_H #endif // LAMPCAE_RASTERTOOLBASE_H

View File

@ -106,7 +106,7 @@ ErrorCode SARSimulationImageL1Dataset::OpenOrNew(QString folder, QString filenam
this->saveToXml(); 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_lock_t lock;
omp_init_lock(&lock); omp_init_lock(&lock);
@ -122,7 +122,7 @@ ErrorCode SARSimulationImageL1Dataset::OpenOrNew(QString folder, QString filenam
omp_destroy_lock(&lock); 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; 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; omp_lock_t lock;
@ -150,11 +150,11 @@ ErrorCode SARSimulationImageL1Dataset::OpenOrNew(QString folder, QString filenam
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI"); GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI");
std::shared_ptr<GDALDataset> poDstDS(poDriver->Create(this->ImageRasterPath.toUtf8().constData(), colCount, rowCount, 1, GDT_CFloat32, NULL)); std::shared_ptr<GDALDataset> poDstDS(poDriver->Create(this->GPSPointFilePath.toUtf8().constData(), 19, rowCount, 1, GDT_Float64, NULL));
GDALFlushCache((GDALDatasetH)poDstDS.get()); GDALFlushCache((GDALDatasetH)poDstDS.get());
poDstDS.reset(); poDstDS.reset();
omp_unset_lock(&lock); // omp_unset_lock(&lock);
omp_destroy_lock(&lock); // omp_destroy_lock(&lock);
} }
@ -203,7 +203,7 @@ ErrorCode SARSimulationImageL1Dataset::Open(QString xmlPath)
QFileInfo fileInfo(xmlPath); QFileInfo fileInfo(xmlPath);
QString fileName = fileInfo.fileName(); // 获取文件名 QString fileName = fileInfo.fileName(); // 获取文件名
QString fileSuffix = fileInfo.suffix(); // 获取后缀名 QString fileSuffix = fileInfo.suffix(); // 获取后缀名
QString fileNameWithoutSuffix = fileInfo.baseName(); // »ñÈ¡²»´øºó׺µÄÎļþÃû QString fileNameWithoutSuffix = fileInfo.completeBaseName(); // »ñÈ¡²»´øºó׺µÄÎļþÃû
QString directoryPath = fileInfo.path(); // 获取文件夹路径 QString directoryPath = fileInfo.path(); // 获取文件夹路径
if (fileSuffix.toLower() == "xml" || fileSuffix.toLower() == ".xml") { if (fileSuffix.toLower() == "xml" || fileSuffix.toLower() == ".xml") {
return this->Open(directoryPath, fileNameWithoutSuffix); return this->Open(directoryPath, fileNameWithoutSuffix);
@ -246,12 +246,13 @@ void SARSimulationImageL1Dataset::saveToXml()
xmlWriter.writeTextElement("RowCount", QString::number(this->rowCount)); xmlWriter.writeTextElement("RowCount", QString::number(this->rowCount));
xmlWriter.writeTextElement("ColCount", QString::number(this->colCount)); xmlWriter.writeTextElement("ColCount", QString::number(this->colCount));
xmlWriter.writeTextElement("Rnear", QString::number(this->Rnear)); xmlWriter.writeTextElement("Rnear", QString::number(this->Rnear, 'e', 18));
xmlWriter.writeTextElement("Rfar", QString::number(this->Rfar)); xmlWriter.writeTextElement("Rfar", QString::number(this->Rfar, 'e', 18));
xmlWriter.writeTextElement("Rref", QString::number(this->Rref)); xmlWriter.writeTextElement("Rref", QString::number(this->Rref, 'e', 18));
xmlWriter.writeTextElement("CenterFreq", QString::number(this->centerFreq)); xmlWriter.writeTextElement("CenterFreq", QString::number(this->centerFreq, 'e', 18));
xmlWriter.writeTextElement("Fs", QString::number(this->Fs)); xmlWriter.writeTextElement("Fs", QString::number(this->Fs, 'e', 18));
xmlWriter.writeTextElement("CenterAngle", QString::number(this->CenterAngle)); xmlWriter.writeTextElement("PRF", QString::number(this->prf, 'e', 18));
xmlWriter.writeTextElement("CenterAngle", QString::number(this->CenterAngle, 'e', 18));
xmlWriter.writeTextElement("LookSide", this->LookSide); xmlWriter.writeTextElement("LookSide", this->LookSide);
// 保存sateantpos // 保存sateantpos
@ -259,60 +260,60 @@ void SARSimulationImageL1Dataset::saveToXml()
for (long i = 0; i < this->sateposes.count(); i++) { for (long i = 0; i < this->sateposes.count(); i++) {
xmlWriter.writeStartElement("AntPosParam"); xmlWriter.writeStartElement("AntPosParam");
xmlWriter.writeTextElement("time", QString::number(this->sateposes[i].time)); // time xmlWriter.writeTextElement("time", QString::number(this->sateposes[i].time, 'e', 18)); // time
xmlWriter.writeTextElement("Px", QString::number(this->sateposes[i].Px)); // Px xmlWriter.writeTextElement("Px", QString::number(this->sateposes[i].Px, 'e', 18)); // Px
xmlWriter.writeTextElement("Py", QString::number(this->sateposes[i].Py)); // Py xmlWriter.writeTextElement("Py", QString::number(this->sateposes[i].Py, 'e', 18)); // Py
xmlWriter.writeTextElement("Pz", QString::number(this->sateposes[i].Pz)); // Pz xmlWriter.writeTextElement("Pz", QString::number(this->sateposes[i].Pz, 'e', 18)); // Pz
xmlWriter.writeTextElement("Vx", QString::number(this->sateposes[i].Vx)); // Vx xmlWriter.writeTextElement("Vx", QString::number(this->sateposes[i].Vx, 'e', 18)); // Vx
xmlWriter.writeTextElement("Vy", QString::number(this->sateposes[i].Vy)); // Vy xmlWriter.writeTextElement("Vy", QString::number(this->sateposes[i].Vy, 'e', 18)); // Vy
xmlWriter.writeTextElement("Vz", QString::number(this->sateposes[i].Vz)); // Vz xmlWriter.writeTextElement("Vz", QString::number(this->sateposes[i].Vz, 'e', 18)); // Vz
xmlWriter.writeTextElement("AntDirectX", QString::number(this->sateposes[i].AntDirectX)); // AntDirectX xmlWriter.writeTextElement("AntDirectX", QString::number(this->sateposes[i].AntDirectX, 'e', 18)); // AntDirectX
xmlWriter.writeTextElement("AntDirectY", QString::number(this->sateposes[i].AntDirectY)); // AntDirectY xmlWriter.writeTextElement("AntDirectY", QString::number(this->sateposes[i].AntDirectY, 'e', 18)); // AntDirectY
xmlWriter.writeTextElement("AntDirectZ", QString::number(this->sateposes[i].AntDirectZ)); // AntDirectZ xmlWriter.writeTextElement("AntDirectZ", QString::number(this->sateposes[i].AntDirectZ, 'e', 18)); // AntDirectZ
xmlWriter.writeTextElement("AVx", QString::number(this->sateposes[i].AVx)); // AVx xmlWriter.writeTextElement("AVx", QString::number(this->sateposes[i].AVx, 'e', 18)); // AVx
xmlWriter.writeTextElement("AVy", QString::number(this->sateposes[i].AVy)); // AVy xmlWriter.writeTextElement("AVy", QString::number(this->sateposes[i].AVy, 'e', 18)); // AVy
xmlWriter.writeTextElement("AVz", QString::number(this->sateposes[i].AVz)); // AVz xmlWriter.writeTextElement("AVz", QString::number(this->sateposes[i].AVz, 'e', 18)); // AVz
xmlWriter.writeTextElement("lon", QString::number(this->sateposes[i].lon)); // lon xmlWriter.writeTextElement("lon", QString::number(this->sateposes[i].lon, 'e', 18)); // lon
xmlWriter.writeTextElement("lat", QString::number(this->sateposes[i].lat)); // lat xmlWriter.writeTextElement("lat", QString::number(this->sateposes[i].lat, 'e', 18)); // lat
xmlWriter.writeTextElement("ati", QString::number(this->sateposes[i].ati)); // ati xmlWriter.writeTextElement("ati", QString::number(this->sateposes[i].ati, 'e', 18)); // ati
xmlWriter.writeEndElement(); // 结束 <AntPosParam> xmlWriter.writeEndElement(); // 结束 <AntPosParam>
} }
xmlWriter.writeTextElement("ImageStartTime", QString::number(this->startImageTime)); xmlWriter.writeTextElement("ImageStartTime", QString::number(this->startImageTime, 'e', 18));
xmlWriter.writeTextElement("ImageEndTime", QString::number(this->EndImageTime)); xmlWriter.writeTextElement("ImageEndTime", QString::number(this->EndImageTime, 'e', 18));
xmlWriter.writeTextElement("incidenceAngleNearRange", QString::number(this->incidenceAngleNearRange)); xmlWriter.writeTextElement("incidenceAngleNearRange", QString::number(this->incidenceAngleNearRange, 'e', 18));
xmlWriter.writeTextElement("incidenceAngleFarRange", QString::number(this->incidenceAngleFarRange)); xmlWriter.writeTextElement("incidenceAngleFarRange", QString::number(this->incidenceAngleFarRange, 'e', 18));
xmlWriter.writeTextElement("TotalProcessedAzimuthBandWidth", QString::number(this->TotalProcessedAzimuthBandWidth)); xmlWriter.writeTextElement("TotalProcessedAzimuthBandWidth", QString::number(this->TotalProcessedAzimuthBandWidth, 'e', 18));
xmlWriter.writeTextElement("DopplerParametersReferenceTime", QString::number(this->DopplerParametersReferenceTime)); xmlWriter.writeTextElement("DopplerParametersReferenceTime", QString::number(this->DopplerParametersReferenceTime, 'e', 18));
xmlWriter.writeStartElement("DopplerCentroidCoefficients"); xmlWriter.writeStartElement("DopplerCentroidCoefficients");
xmlWriter.writeTextElement("d0", QString::number(this->d0)); xmlWriter.writeTextElement("d0", QString::number(this->d0, 'e', 18));
xmlWriter.writeTextElement("d1", QString::number(this->d1)); xmlWriter.writeTextElement("d1", QString::number(this->d1, 'e', 18));
xmlWriter.writeTextElement("d2", QString::number(this->d2)); xmlWriter.writeTextElement("d2", QString::number(this->d2, 'e', 18));
xmlWriter.writeTextElement("d3", QString::number(this->d3)); xmlWriter.writeTextElement("d3", QString::number(this->d3, 'e', 18));
xmlWriter.writeTextElement("d4", QString::number(this->d4)); xmlWriter.writeTextElement("d4", QString::number(this->d4, 'e', 18));
xmlWriter.writeEndElement(); // DopplerCentroidCoefficients xmlWriter.writeEndElement(); // DopplerCentroidCoefficients
xmlWriter.writeStartElement("DopplerRateValuesCoefficients"); xmlWriter.writeStartElement("DopplerRateValuesCoefficients");
xmlWriter.writeTextElement("r0", QString::number(this->r0)); xmlWriter.writeTextElement("r0", QString::number(this->r0, 'e', 18));
xmlWriter.writeTextElement("r1", QString::number(this->r1)); xmlWriter.writeTextElement("r1", QString::number(this->r1, 'e', 18));
xmlWriter.writeTextElement("r2", QString::number(this->r2)); xmlWriter.writeTextElement("r2", QString::number(this->r2, 'e', 18));
xmlWriter.writeTextElement("r3", QString::number(this->r3)); xmlWriter.writeTextElement("r3", QString::number(this->r3, 'e', 18));
xmlWriter.writeTextElement("r4", QString::number(this->r4)); xmlWriter.writeTextElement("r4", QString::number(this->r4, 'e', 18));
xmlWriter.writeEndElement(); // DopplerRateValuesCoefficients xmlWriter.writeEndElement(); // DopplerRateValuesCoefficients
xmlWriter.writeTextElement("latitude_center", QString::number(this->latitude_center)); xmlWriter.writeTextElement("latitude_center", QString::number(this->latitude_center, 'e', 18));
xmlWriter.writeTextElement("longitude_center", QString::number(this->longitude_center)); xmlWriter.writeTextElement("longitude_center", QString::number(this->longitude_center, 'e', 18));
xmlWriter.writeTextElement("latitude_topLeft", QString::number(this->latitude_topLeft)); xmlWriter.writeTextElement("latitude_topLeft", QString::number(this->latitude_topLeft, 'e', 18));
xmlWriter.writeTextElement("longitude_topLeft", QString::number(this->longitude_topLeft)); xmlWriter.writeTextElement("longitude_topLeft", QString::number(this->longitude_topLeft, 'e', 18));
xmlWriter.writeTextElement("latitude_topRight", QString::number(this->latitude_topRight)); xmlWriter.writeTextElement("latitude_topRight", QString::number(this->latitude_topRight, 'e', 18));
xmlWriter.writeTextElement("longitude_topRight", QString::number(this->longitude_topRight)); xmlWriter.writeTextElement("longitude_topRight", QString::number(this->longitude_topRight, 'e', 18));
xmlWriter.writeTextElement("latitude_bottomLeft", QString::number(this->latitude_bottomLeft)); xmlWriter.writeTextElement("latitude_bottomLeft", QString::number(this->latitude_bottomLeft, 'e', 18));
xmlWriter.writeTextElement("longitude_bottomLeft", QString::number(this->longitude_bottomLeft)); xmlWriter.writeTextElement("longitude_bottomLeft", QString::number(this->longitude_bottomLeft, 'e', 18));
xmlWriter.writeTextElement("latitude_bottomRight", QString::number(this->latitude_bottomRight)); xmlWriter.writeTextElement("latitude_bottomRight", QString::number(this->latitude_bottomRight, 'e', 18));
xmlWriter.writeTextElement("longitude_bottomRight", QString::number(this->longitude_bottomRight)); xmlWriter.writeTextElement("longitude_bottomRight", QString::number(this->longitude_bottomRight, 'e', 18));
xmlWriter.writeEndElement(); // Parameters xmlWriter.writeEndElement(); // Parameters
xmlWriter.writeEndDocument(); xmlWriter.writeEndDocument();
@ -371,6 +372,9 @@ ErrorCode SARSimulationImageL1Dataset::loadFromXml()
else if (xmlReader.name() == "Fs") { else if (xmlReader.name() == "Fs") {
this->Fs = xmlReader.readElementText().toDouble(); this->Fs = xmlReader.readElementText().toDouble();
} }
else if (xmlReader.name() == "PRF") {
this->prf = xmlReader.readElementText().toDouble();
}
else if(xmlReader.name() == "ImageStartTime"){ else if(xmlReader.name() == "ImageStartTime"){
this->startImageTime = xmlReader.readElementText().toDouble(); this->startImageTime = xmlReader.readElementText().toDouble();
} }
@ -873,6 +877,7 @@ QVector<double> SARSimulationImageL1Dataset::getDopplerParams()
result[2] = d2; result[2] = d2;
result[3] = d3; result[3] = d3;
result[4] = d4; result[4] = d4;
return result; return result;
} }
@ -888,11 +893,13 @@ void SARSimulationImageL1Dataset::setDopplerParams(double id0, double id1, doubl
QVector<double> SARSimulationImageL1Dataset::getDopplerCenterCoff() QVector<double> SARSimulationImageL1Dataset::getDopplerCenterCoff()
{ {
QVector<double> result(5); QVector<double> result(5);
result[0]=r0; result[0] = r0;
result[1]=r1; result[1] = r1;
result[2]=r2; result[2] = r2;
result[3]=r3; result[3] = r3;
result[4]=r4; result[4] = r4;
return result; return result;
} }

View File

@ -143,9 +143,11 @@ public:
double getDopplerParametersReferenceTime(); double getDopplerParametersReferenceTime();
void setDopplerParametersReferenceTime(double v); void setDopplerParametersReferenceTime(double v);
// 多普勒参数
QVector<double> getDopplerParams(); QVector<double> getDopplerParams();
void setDopplerParams(double d0, double d1, double d2, double d3, double d4); void setDopplerParams(double d0, double d1, double d2, double d3, double d4);
// 多普勒中心系数
QVector<double> getDopplerCenterCoff(); QVector<double> getDopplerCenterCoff();
void setDopplerCenterCoff(double r0, double r1, double r2, double r3, double r4); void setDopplerCenterCoff(double r0, double r1, double r2, double r3, double r4);
@ -208,3 +210,9 @@ private:
}; };

View File

@ -121,6 +121,9 @@ void gdalImageComplex::saveImage(Eigen::MatrixXcd data, int start_row, int start
int datarows = data.rows(); int datarows = data.rows();
int datacols = data.cols(); int datacols = data.cols();
if (this->getDataType() == GDT_CFloat64)
{
double* databuffer = new double[data.size() * 2]; double* databuffer = new double[data.size() * 2];
for (int i = 0; i < data.rows(); i++) { for (int i = 0; i < data.rows(); i++) {
for (int j = 0; j < data.cols(); j++) { for (int j = 0; j < data.cols(); j++) {
@ -135,6 +138,31 @@ void gdalImageComplex::saveImage(Eigen::MatrixXcd data, int start_row, int start
databuffer, datacols, datarows, GDT_CFloat64, 0, 0); databuffer, datacols, datarows, GDT_CFloat64, 0, 0);
GDALFlushCache(poDstDS); GDALFlushCache(poDstDS);
delete databuffer; 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");
}
GDALClose((GDALDatasetH)poDstDS); GDALClose((GDALDatasetH)poDstDS);
GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
omp_unset_lock(&lock); // omp_unset_lock(&lock); //
@ -265,24 +293,46 @@ Eigen::MatrixXcd gdalImageComplex::getDataComplex(int start_row, int start_col,
// 获取数据集的第一个波段 // 获取数据集的第一个波段
GDALRasterBand* poBand; GDALRasterBand* poBand;
poBand = poDataset->GetRasterBand(1); 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 nXSize = cols_count; poBand->GetXSize();
int nYSize = rows_count; poBand->GetYSize(); 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); // 使用Eigen的MatrixXcd Eigen::MatrixXcd rasterData(nYSize, nXSize); // 使用Eigen的MatrixXcd
for (size_t i = 0; i < nYSize; i++) { if (this->getDataType() == GDT_CFloat64)
for (size_t j = 0; j < nXSize; j++) { {
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<double>(databuffer[i * nXSize * 2 + j * 2], rasterData(i, j) = std::complex<double>(databuffer[i * nXSize * 2 + j * 2],
databuffer[i * nXSize * 2 + j * 2 + 1]); databuffer[i * nXSize * 2 + j * 2 + 1]);
} }
} }
delete[] databuffer; 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<double>(databuffer[i * nXSize * 2 + j * 2],
databuffer[i * nXSize * 2 + j * 2 + 1]);
}
}
delete[] databuffer;
}
return rasterData; return rasterData;
} }

View File

@ -1228,8 +1228,8 @@ RasterExtend gdalImage::getExtend()
double x1 = this->gt(0, 0); double x1 = this->gt(0, 0);
double y1 = this->gt(1, 0); double y1 = this->gt(1, 0);
double x2 = this->gt(0, 0) + (this->width - 1) * gt(0, 1) + (0) * gt(0, 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 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 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); 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, GDALDataset* poDstDS = poDriver->Create(img_path.toUtf8().constData(), width, height, band_num,
datetype, NULL); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> datetype, NULL); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (NULL == poDstDS)
{
qDebug() << "Create image failed!";
throw "Create image failed!";
exit(1);
}
if (need_gt) { if (need_gt) {
if (!projection.isEmpty()) { if (!projection.isEmpty()) {
poDstDS->SetProjection(projection.toUtf8().constData()); 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;
}

File diff suppressed because it is too large Load Diff

View File

@ -32,5 +32,10 @@ QString QToolAbstract::getToolName()
} }
void QToolAbstract::excute() void QToolAbstract::excute()
{
this->run();
}
void QToolAbstract::run()
{ {
} }

View File

@ -27,6 +27,8 @@ public slots:
public: public:
QVector<QString> toolPath; QVector<QString> toolPath;
QString toolname; QString toolname;
public:
virtual void run();
}; };
/* /*

View File

@ -20,13 +20,15 @@
/** CUDA 调用参数 ************************************************************************************/ /** CUDA 调用参数 ************************************************************************************/
#define BLOCK_SIZE 256 #define BLOCK_SIZE 256
#define SHAREMEMORY_BYTE 49152 #define SHAREMEMORY_BYTE 49152
#define SHAREMEMORY_FLOAT_HALF 6144 #define SHAREMEMORY_FLOAT_HALF_STEP 2
#define SHAREMEMORY_FLOAT_HALF_STEP 24 #define SHAREMEMORY_FLOAT_HALF 512
#define SHAREMEMORY_DEM_STEP 768 #define SHAREMEMORY_DEM_STEP 768
#define SHAREMEMORY_Reflect 612 #define SHAREMEMORY_Reflect 612
enum LAMPGPUDATETYPE { enum LAMPGPUDATETYPE {
LAMP_LONG, LAMP_LONG,
LAMP_FLOAT, LAMP_FLOAT,

View File

@ -38,10 +38,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RasterMainWidgetGUI", "Rast
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageshowTool", "ImageshowTool\ImageshowTool.vcxproj", "{8C8CA066-A93A-4098-9A46-B855EFEAADF2}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageshowTool", "ImageshowTool\ImageshowTool.vcxproj", "{8C8CA066-A93A-4098-9A46-B855EFEAADF2}"
EndProject 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}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pluginToolboxLibrary", "pluginToolboxLibrary\pluginToolboxLibrary.vcxproj", "{667625A5-8DE2-4373-99F0-8BAD2CCED011}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SPG4Tool", "SPG4Tool\SPG4Tool.vcxproj", "{80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM 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|x64.Build.0 = Release|x64
{8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Release|x86.ActiveCfg = Release|x64 {8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Release|x86.ActiveCfg = Release|x64
{8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Release|x86.Build.0 = 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.ActiveCfg = Debug|x64
{667625A5-8DE2-4373-99F0-8BAD2CCED011}.Debug|ARM.Build.0 = Debug|x64 {667625A5-8DE2-4373-99F0-8BAD2CCED011}.Debug|ARM.Build.0 = Debug|x64
{667625A5-8DE2-4373-99F0-8BAD2CCED011}.Debug|x64.ActiveCfg = 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|x64.Build.0 = Release|x64
{667625A5-8DE2-4373-99F0-8BAD2CCED011}.Release|x86.ActiveCfg = Release|Win32 {667625A5-8DE2-4373-99F0-8BAD2CCED011}.Release|x86.ActiveCfg = Release|Win32
{667625A5-8DE2-4373-99F0-8BAD2CCED011}.Release|x86.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -14,25 +14,15 @@
#include "FileOperator.h" #include "FileOperator.h"
#include "RasterWidgetMessageShow.h" #include "RasterWidgetMessageShow.h"
#include "ImageOperatorBase.h"
#pragma execution_character_set("utf-8") #pragma execution_character_set("utf-8")
namespace LAMPMainWidget { namespace LAMPMainWidget {
QString QHash<QString, MapLayer*>RasterMainWidget::mMaps{};
RasterMainWidget::tutorialUrl() {
return QString{R"(https://gitee.com/qizr_admin/LAMPMainWidget)"};
}
QString RasterMainWidget::RasterMainWidget(QWidget* parent)
RasterMainWidget::srcUrl() {
return QString{R"(https://gitee.com/qizr_admin/LAMPMainWidget)"};
}
QHash<QString, MapLayer *>RasterMainWidget::mMaps{};
RasterMainWidget::RasterMainWidget(QWidget *parent)
: mUi(new Ui::RasterMainWidget), : mUi(new Ui::RasterMainWidget),
mMapConvas(new MapCanvas), mMapConvas(new MapCanvas),
mScaleText(new QLineEdit), mScaleText(new QLineEdit),
@ -41,7 +31,7 @@ RasterMainWidget::RasterMainWidget(QWidget *parent)
mCenterLabel(new QLabel), mCenterLabel(new QLabel),
mZoomText(new QLineEdit), mZoomText(new QLineEdit),
mZoomLabel(new QLabel), mZoomLabel(new QLabel),
mMapActionGroup(new QActionGroup(dynamic_cast<QObject *>(this))), mMapActionGroup(new QActionGroup(dynamic_cast<QObject*>(this))),
mSetLeftTop(true), mSetLeftTop(true),
mLayerList(), mLayerList(),
mLeftTop(), mLeftTop(),
@ -55,34 +45,46 @@ RasterMainWidget::RasterMainWidget(QWidget *parent)
setupActions(); setupActions();
setRightToolbox(); setRightToolbox();
//mUi->panAction->trigger(); mUi->panAction->trigger();
//mUi->layerList->setCurrentItem(mLayerList.first()); mUi->layerList->setCurrentItem(mLayerList.first());
this->show();// 强制显示窗口
// 绑定消息显示
RasterMessageShow::RasterWidgetMessageShow* messageshow = RasterMessageShow::RasterWidgetMessageShow::getInstance(this);
messageshow->bandingTextBrowserMessage(this->mUi->textBrowserMessage);
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();
RasterMainWidget::~RasterMainWidget() { }
RasterMainWidget::~RasterMainWidget() {
delete mUi; delete mUi;
delete mMapConvas; delete mMapConvas;
delete mScaleText; delete mScaleText;
delete mScaleLabel; delete mScaleLabel;
delete mCenterText; delete mCenterText;
delete mCenterLabel; delete mCenterLabel;
} }
void void
RasterMainWidget::setupTaskWindow() { RasterMainWidget::setupTaskWindow() {
mUi->taskTable->setColumnCount(5); mUi->taskTable->setColumnCount(5);
mUi->taskTable->setHorizontalHeaderLabels(QStringList{ mUi->taskTable->setHorizontalHeaderLabels(QStringList{
"名称", "范围", "zoom值", "数据源", "进度" "名称", "范围", "zoom值", "数据源", "进度"
}); });
mUi->taskTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); mUi->taskTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
} }
void void
RasterMainWidget::setupActions() { RasterMainWidget::setupActions() {
mMapActionGroup->addAction(mUi->panAction); mMapActionGroup->addAction(mUi->panAction);
mMapActionGroup->addAction(mUi->zoomInAction); mMapActionGroup->addAction(mUi->zoomInAction);
mMapActionGroup->addAction(mUi->zoomOutAction); mMapActionGroup->addAction(mUi->zoomOutAction);
@ -93,16 +95,15 @@ RasterMainWidget::setupActions() {
QObject::connect(mUi->panAction, &QAction::triggered, this, &RasterMainWidget::panHandle); QObject::connect(mUi->panAction, &QAction::triggered, this, &RasterMainWidget::panHandle);
QObject::connect(mUi->zoomInAction, &QAction::triggered, this, &RasterMainWidget::zoomInHandle); QObject::connect(mUi->zoomInAction, &QAction::triggered, this, &RasterMainWidget::zoomInHandle);
QObject::connect(mUi->zoomOutAction, &QAction::triggered, this, &RasterMainWidget::zoomOutHandle); QObject::connect(mUi->zoomOutAction, &QAction::triggered, this, &RasterMainWidget::zoomOutHandle);
QObject::connect(mUi->tutorialAction, &QAction::triggered, this, &RasterMainWidget::tutorialHanle);
QObject::connect(mUi->srcAction, &QAction::triggered, this, &RasterMainWidget::srcHandle);
QObject::connect(mUi->refreshAction, &QAction::triggered, this, &RasterMainWidget::refreshHandle); QObject::connect(mUi->refreshAction, &QAction::triggered, this, &RasterMainWidget::refreshHandle);
QObject::connect(mUi->sponsorAction, &QAction::triggered, this, &RasterMainWidget::sponsorHandle); QObject::connect(mUi->sponsorAction, &QAction::triggered, this, &RasterMainWidget::sponsorHandle);
QObject::connect(mUi->selectAction, &QAction::triggered, this, &RasterMainWidget::selectHandle); QObject::connect(mUi->selectAction, &QAction::triggered, this, &RasterMainWidget::selectHandle);
QObject::connect(mUi->downloadAction, &QAction::triggered, this, &RasterMainWidget::createDownloadTask); QObject::connect(mUi->downloadAction, &QAction::triggered, this, &RasterMainWidget::createDownloadTask);
QObject::connect(mUi->drawlineAction, &QAction::triggered, this, &RasterMainWidget::drawlineHandle); QObject::connect(mUi->drawlineAction, &QAction::triggered, this, &RasterMainWidget::drawlineHandle);
} }
void RasterMainWidget::setupWindow() { void RasterMainWidget::setupWindow() {
mUi->mapCanvasLayout->addWidget(mMapConvas); mUi->mapCanvasLayout->addWidget(mMapConvas);
//setFixedSize(size()); //setFixedSize(size());
//setWindowFlags(windowFlags() | Qt::WindowMinMaxButtonsHint | Qt::WindowSystemMenuHint); //setWindowFlags(windowFlags() | Qt::WindowMinMaxButtonsHint | Qt::WindowSystemMenuHint);
@ -113,15 +114,9 @@ void RasterMainWidget::setupWindow() {
QObject::connect(mUi->layerList, &QListWidget::currentItemChanged, this, &RasterMainWidget::layerChanged); QObject::connect(mUi->layerList, &QListWidget::currentItemChanged, this, &RasterMainWidget::layerChanged);
QObject::connect(mUi->leftTopBtn, &QPushButton::clicked, this, &RasterMainWidget::leftTopClickedHandle); QObject::connect(mUi->leftTopBtn, &QPushButton::clicked, this, &RasterMainWidget::leftTopClickedHandle);
QObject::connect(mUi->rightBottomBtn, &QPushButton::clicked, this, &RasterMainWidget::rightBottomClickedHandle); QObject::connect(mUi->rightBottomBtn, &QPushButton::clicked, this, &RasterMainWidget::rightBottomClickedHandle);
}
void RasterMainWidget::setupStatusBar() {
RasterMessageShow::RasterWidgetMessageShow* messageshow = RasterMessageShow::RasterWidgetMessageShow::getInstance(this);
messageshow->bandingTextBrowserMessage(this->mUi->textBrowserMessage);
}
void RasterMainWidget::setupStatusBar() {
/// 比例尺 /// 比例尺
mScaleLabel->setText("比例尺"); mScaleLabel->setText("比例尺");
mScaleText->setText(QString("1cm : %1m").arg(mMapConvas->scale())); mScaleText->setText(QString("1cm : %1m").arg(mMapConvas->scale()));
@ -152,28 +147,28 @@ void RasterMainWidget::setupStatusBar() {
mCenterText->setReadOnly(true); mCenterText->setReadOnly(true);
mUi->statusbar->addWidget(mCenterLabel); mUi->statusbar->addWidget(mCenterLabel);
mUi->statusbar->addWidget(mCenterText); mUi->statusbar->addWidget(mCenterText);
} }
void RasterMainWidget::setupLayers() { void RasterMainWidget::setupLayers() {
initMaps(); initMaps();
auto i = mMaps.constBegin(); auto i = mMaps.constBegin();
for (; i != mMaps.constEnd(); ++i) { for (; i != mMaps.constEnd(); ++i) {
mLayerList.append(new QListWidgetItem(i.key(), mUi->layerList)); mLayerList.append(new QListWidgetItem(i.key(), mUi->layerList));
} }
} }
void void
RasterMainWidget::initMaps() { RasterMainWidget::initMaps() {
if (mMaps.isEmpty()) { if (false&&mMaps.isEmpty()) {
mMaps = QHash<QString, MapLayer *>{ mMaps = QHash<QString, MapLayer*>{
{"Openstreet地图", new TmsLayer(OSTNormalMap, "ostnormalmap", mMapConvas)}, {"Openstreet地图", new TmsLayer(OSTNormalMap, "ostnormalmap", mMapConvas)},
{"高德地图", new TmsLayer(GaodeNormapMap, "gaodenormalmap", mMapConvas)} {"高德地图", new TmsLayer(GaodeNormapMap, "gaodenormalmap", mMapConvas)}
}; };
} }
} }
void RasterMainWidget::setRightToolbox() void RasterMainWidget::setRightToolbox()
{ {
this->toolboxDockWidget = new QDockWidget(tr(u8"工具箱"), this); this->toolboxDockWidget = new QDockWidget(tr(u8"工具箱"), this);
toolboxDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); toolboxDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
toolBoxWidget = new ToolBoxWidget(this); toolBoxWidget = new ToolBoxWidget(this);
@ -181,115 +176,104 @@ void RasterMainWidget::setRightToolbox()
addDockWidget(Qt::LeftDockWidgetArea, toolboxDockWidget); addDockWidget(Qt::LeftDockWidgetArea, toolboxDockWidget);
setDockOptions(QMainWindow::AllowNestedDocks | QMainWindow::AllowTabbedDocks); setDockOptions(QMainWindow::AllowNestedDocks | QMainWindow::AllowTabbedDocks);
this->initToolbox(); this->initToolbox();
} }
void RasterMainWidget::initToolbox() void RasterMainWidget::initToolbox()
{ {
QString appPath = QCoreApplication::applicationDirPath(); QString appPath = QCoreApplication::applicationDirPath();
QString pluginPath = JoinPath(appPath, "Toolbox"); QString pluginPath = JoinPath(appPath, "Toolbox");
toolBoxWidget->initToolbox(pluginPath); toolBoxWidget->initToolbox(pluginPath);
} }
QWidget *RasterMainWidget::spacerWiget(int width) const { QWidget* RasterMainWidget::spacerWiget(int width) const {
auto spacer = new QWidget{}; auto spacer = new QWidget{};
spacer->setHidden(true); spacer->setHidden(true);
spacer->setVisible(true); spacer->setVisible(true);
spacer->setFixedWidth(width); spacer->setFixedWidth(width);
return spacer; return spacer;
} }
void void
RasterMainWidget::panHandle(bool checked) { RasterMainWidget::panHandle(bool checked) {
mMapConvas->selectTool(QString{"pan_tool"}); mMapConvas->selectTool(QString{ "pan_tool" });
} }
void void
RasterMainWidget::zoomInHandle(bool checked) { RasterMainWidget::zoomInHandle(bool checked) {
mMapConvas->selectTool(QString{"zoomin_tool"}); mMapConvas->selectTool(QString{ "zoomin_tool" });
} }
void void
RasterMainWidget::zoomOutHandle(bool checked) { RasterMainWidget::zoomOutHandle(bool checked) {
mMapConvas->selectTool(QString{"zoomout_tool"}); mMapConvas->selectTool(QString{ "zoomout_tool" });
} }
void RasterMainWidget::drawlineHandle(bool checked) void RasterMainWidget::drawlineHandle(bool checked)
{ {
mMapConvas->selectTool("drawline_tool"); mMapConvas->selectTool("drawline_tool");
}
void
RasterMainWidget::tutorialHanle(bool checked) {
if (!QDesktopServices::openUrl(tutorialUrl())) {
QMessageBox::critical(dynamic_cast<QWidget *>(this), "异常", "未能打开系统浏览器");
} }
}
void
RasterMainWidget::srcHandle(bool checked) {
if (!QDesktopServices::openUrl(srcUrl())) {
QMessageBox::critical(dynamic_cast<QWidget *>(this), "异常", "未能打开系统浏览器");
}
}
void
RasterMainWidget::sponsorHandle(bool checked) { void
auto *window = new SponsorWindow(dynamic_cast<QWidget *>(this)); RasterMainWidget::sponsorHandle(bool checked) {
auto* window = new SponsorWindow(dynamic_cast<QWidget*>(this));
window->exec(); window->exec();
window->deleteLater(); window->deleteLater();
} }
void void
RasterMainWidget::refreshHandle(bool checked) { RasterMainWidget::refreshHandle(bool checked) {
mMapConvas->refreshMap(); mMapConvas->refreshMap();
} }
void void
RasterMainWidget::selectHandle(bool checked) { RasterMainWidget::selectHandle(bool checked) {
mMapConvas->selectTool(QString{"select_tool"}); mMapConvas->selectTool(QString{ "select_tool" });
} }
void void
RasterMainWidget::centerChangedHandle(LAMPMainWidget::PointXY pos) { RasterMainWidget::centerChangedHandle(LAMPMainWidget::PointXY pos) {
mCenterText->setText(QString("lon:%1, lat:%2").arg(pos.x()).arg(pos.y())); mCenterText->setText(QString("lon:%1, lat:%2").arg(pos.x()).arg(pos.y()));
} }
void void
RasterMainWidget::zoomChangedHandle(int zoom) { RasterMainWidget::zoomChangedHandle(int zoom) {
mZoomText->setText(QString("%1").arg(zoom)); mZoomText->setText(QString("%1").arg(zoom));
mScaleText->setText(QString("1cm:%1m").arg(this->mMapConvas->scale())); mScaleText->setText(QString("1cm:%1m").arg(this->mMapConvas->scale()));
} }
void void
RasterMainWidget::clickedHandle(LAMPMainWidget::PointXY pos) { RasterMainWidget::clickedHandle(LAMPMainWidget::PointXY pos) {
QString posText = QString("%1, %2").arg(pos.x()).arg(pos.y()); QString posText = QString("%1, %2").arg(pos.x()).arg(pos.y());
if (mSetLeftTop) { if (mSetLeftTop) {
mUi->leftTopText->setText(posText); mUi->leftTopText->setText(posText);
mLeftTop = pos; mLeftTop = pos;
} else { }
else {
mUi->rightBottomText->setText(posText); mUi->rightBottomText->setText(posText);
mRightBottom = pos; mRightBottom = pos;
} }
} }
void void
RasterMainWidget::leftTopClickedHandle() { RasterMainWidget::leftTopClickedHandle() {
mSetLeftTop = true; mSetLeftTop = true;
mUi->selectAction->trigger(); mUi->selectAction->trigger();
} }
void void
RasterMainWidget::rightBottomClickedHandle() { RasterMainWidget::rightBottomClickedHandle() {
mSetLeftTop = false; mSetLeftTop = false;
mUi->selectAction->trigger(); mUi->selectAction->trigger();
} }
void void
RasterMainWidget::layerChanged(QListWidgetItem *current, QListWidgetItem *previous) { RasterMainWidget::layerChanged(QListWidgetItem* current, QListWidgetItem* previous) {
auto mapName = current->text(); auto mapName = current->text();
if (!mMaps.contains(mapName)) { if (!mMaps.contains(mapName)) {
qDebug() << mapName << "不支持"; qDebug() << mapName << "不支持";
@ -314,31 +298,36 @@ RasterMainWidget::layerChanged(QListWidgetItem *current, QListWidgetItem *previo
zoomChangedHandle(mMapConvas->zoomValue()); zoomChangedHandle(mMapConvas->zoomValue());
centerChangedHandle(mMapConvas->mapCenter()); centerChangedHandle(mMapConvas->mapCenter());
} }
void void
RasterMainWidget::createDownloadTask() { RasterMainWidget::createDownloadTask() {
auto taskWindow = new TaskWindow(dynamic_cast<QWidget *>(this)); auto taskWindow = new TaskWindow(dynamic_cast<QWidget*>(this));
taskWindow->exec(); taskWindow->exec();
taskWindow->deleteLater(); taskWindow->deleteLater();
} }
void void
RasterMainWidget::changeTaskTable(int row, int col, QString text) { RasterMainWidget::changeTaskTable(int row, int col, QString text) {
mUi->taskTable->takeItem(row, col); mUi->taskTable->takeItem(row, col);
mUi->taskTable->setItem(row, col, new QTableWidgetItem(text)); mUi->taskTable->setItem(row, col, new QTableWidgetItem(text));
} }
void RasterMainWidget::on_drawArea_triggered() void RasterMainWidget::on_drawArea_triggered()
{ {
mMapConvas->selectTool("drawarea_tool"); mMapConvas->selectTool("drawarea_tool");
} }
void RasterMainWidget::on_addPlaneaction_triggered() void RasterMainWidget::on_addPlaneaction_triggered()
{ {
mMapConvas->selectTool("addplane_tool"); mMapConvas->selectTool("addplane_tool");
}
void RasterMainWidget::onactioncloseAllRasterFile_triggered()
{
CloseAllGDALRaster();
} }
QTableWidget* RasterMainWidget::getTaskTable() QTableWidget* RasterMainWidget::getTaskTable()

View File

@ -52,8 +52,7 @@ namespace LAMPMainWidget {
void zoomInHandle(bool checked); void zoomInHandle(bool checked);
void zoomOutHandle(bool checked); void zoomOutHandle(bool checked);
void drawlineHandle(bool checked); void drawlineHandle(bool checked);
void tutorialHanle(bool checked);
void srcHandle(bool checked);
void sponsorHandle(bool checked); void sponsorHandle(bool checked);
void refreshHandle(bool checked); void refreshHandle(bool checked);
void selectHandle(bool checked); void selectHandle(bool checked);
@ -70,14 +69,10 @@ namespace LAMPMainWidget {
private: private:
QWidget* spacerWiget(int width) const; QWidget* spacerWiget(int width) const;
protected:
static QString tutorialUrl();
static QString srcUrl();
private slots: private slots:
void on_drawArea_triggered(); void on_drawArea_triggered();
void on_addPlaneaction_triggered(); void on_addPlaneaction_triggered();
void onactioncloseAllRasterFile_triggered();
private: private:
Ui::RasterMainWidget* mUi; Ui::RasterMainWidget* mUi;
MapCanvas* mMapConvas; MapCanvas* mMapConvas;

View File

@ -12,8 +12,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>906</width> <width>898</width>
<height>609</height> <height>580</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -84,8 +84,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>906</width> <width>898</width>
<height>23</height> <height>22</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="projectMenu"> <widget class="QMenu" name="projectMenu">
@ -122,8 +122,6 @@
<property name="title"> <property name="title">
<string>帮助</string> <string>帮助</string>
</property> </property>
<addaction name="tutorialAction"/>
<addaction name="srcAction"/>
<addaction name="separator"/> <addaction name="separator"/>
</widget> </widget>
<addaction name="projectMenu"/> <addaction name="projectMenu"/>
@ -136,6 +134,9 @@
</widget> </widget>
<widget class="QStatusBar" name="statusbar"/> <widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="toolBar"> <widget class="QToolBar" name="toolBar">
<property name="enabled">
<bool>false</bool>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>toolBar</string> <string>toolBar</string>
</property> </property>
@ -377,6 +378,85 @@ p, li { white-space: pre-wrap; }
</layout> </layout>
</widget> </widget>
</widget> </widget>
<widget class="QDockWidget" name="dockWidget_Map">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="windowTitle">
<string>地图窗口</string>
</property>
<attribute name="dockWidgetArea">
<number>1</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents_5">
<widget class="QTabWidget" name="tabWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>0</y>
<width>502</width>
<height>274</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="mapTab">
<attribute name="title">
<string>地图</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="mapCanvasLayout"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="taskTab">
<attribute name="title">
<string>任务</string>
</attribute>
<widget class="QWidget" name="gridLayoutWidget_5">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1431</width>
<height>871</height>
</rect>
</property>
<layout class="QGridLayout" name="taskLayout">
<item row="0" column="0">
<widget class="QTableWidget" name="taskTable"/>
</item>
</layout>
</widget>
</widget>
</widget>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>906</width>
<height>23</height>
</rect>
</property>
<widget class="QMenu" name="toolsMenu">
<property name="title">
<string>工具</string>
</property>
<addaction name="actioncloseAllRasterFile"/>
</widget>
<addaction name="toolsMenu"/>
</widget>
<action name="tutorialAction"> <action name="tutorialAction">
<property name="text"> <property name="text">
<string>使用教程</string> <string>使用教程</string>
@ -513,6 +593,11 @@ p, li { white-space: pre-wrap; }
<string>飞机</string> <string>飞机</string>
</property> </property>
</action> </action>
<action name="actioncloseAllRasterFile">
<property name="text">
<string>释放影像文件</string>
</property>
</action>
</widget> </widget>
<resources> <resources>
<include location="../RasterMainWidgetGUI.qrc"/> <include location="../RasterMainWidgetGUI.qrc"/>

View File

@ -4,17 +4,18 @@
namespace LAMPMainWidget { namespace LAMPMainWidget {
GaodeNormalProvider::GaodeNormalProvider(QObject *parent) GaodeNormalProvider::GaodeNormalProvider(QObject* parent)
: TmsProvider(parent) { : TmsProvider(parent) {
initCache(); initCache();
} }
QString QString
GaodeNormalProvider::tileUrl(const LAMPMainWidget::PointXY &pos, int zoom) const { GaodeNormalProvider::tileUrl(const LAMPMainWidget::PointXY& pos, int zoom) const {
QString urlFmt = {R"(http://wprd01.is.autonavi.com/appmaptile?style=6&x=%1&y=%2&z=%3)"};
QString urlFmt = { R"(http://wprd01.is.autonavi.com/appmaptile?style=6&x=%1&y=%2&z=%3)" };
return QString(urlFmt).arg(pos.x()).arg(pos.y()).arg(zoom); return QString(urlFmt).arg(pos.x()).arg(pos.y()).arg(zoom);
} }
//http://wprd01.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=1&style=6 //http://wprd01.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=1&style=6
} }

View File

@ -15,12 +15,12 @@
namespace LAMPMainWidget { namespace LAMPMainWidget {
PointXY PointXY
MapCanvas::defaultMapCenter() { MapCanvas::defaultMapCenter() {
return PointXY{116.4074, 39.9042}; return PointXY{ 116.4074, 39.9042 };
} }
MapCanvas::MapCanvas(QWidget *parent) MapCanvas::MapCanvas(QWidget* parent)
: QGraphicsView(parent), : QGraphicsView(parent),
mScene(nullptr), mScene(nullptr),
mMapExtent(), mMapExtent(),
@ -36,6 +36,7 @@ MapCanvas::MapCanvas(QWidget *parent)
mMapUpdateTimer(nullptr), mMapUpdateTimer(nullptr),
mCurrentTool(nullptr), mCurrentTool(nullptr),
mMapTools() { mMapTools() {
setAutoFillBackground(true); setAutoFillBackground(true);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@ -50,65 +51,65 @@ MapCanvas::MapCanvas(QWidget *parent)
mMapUpdateTimer->start(200); mMapUpdateTimer->start(200);
setupTools(); setupTools();
this->startTimer(1000); this->startTimer(1000);
} }
MapCanvas::~MapCanvas() { MapCanvas::~MapCanvas() {
mLayers.clear(); mLayers.clear();
delete mScene; delete mScene;
delete mCurrentLayer; delete mCurrentLayer;
delete mMapUpdateTimer; delete mMapUpdateTimer;
} }
void void
MapCanvas::mousePressEvent(QMouseEvent *event) { MapCanvas::mousePressEvent(QMouseEvent* event) {
if (mCurrentTool) { if (mCurrentTool) {
mCurrentTool->execute(event); mCurrentTool->execute(event);
} }
QGraphicsView::mousePressEvent(event); QGraphicsView::mousePressEvent(event);
} }
void void
MapCanvas::mouseReleaseEvent(QMouseEvent *event) { MapCanvas::mouseReleaseEvent(QMouseEvent* event) {
if (mCurrentTool) { if (mCurrentTool) {
mCurrentTool->execute(event); mCurrentTool->execute(event);
} }
QGraphicsView::mouseReleaseEvent(event); QGraphicsView::mouseReleaseEvent(event);
} }
void void
MapCanvas::wheelEvent(QWheelEvent *event) { MapCanvas::wheelEvent(QWheelEvent* event) {
int delta = event->angleDelta().y() / 120; int delta = event->angleDelta().y() / 120;
int zoom = zoomValue(); int zoom = zoomValue();
zoom += delta; zoom += delta;
setZoomValue(zoom); setZoomValue(zoom);
} }
void void
MapCanvas::resizeEvent(QResizeEvent *event) { MapCanvas::resizeEvent(QResizeEvent* event) {
updateViewExtent(true); updateViewExtent(true);
} }
void MapCanvas::mouseMoveEvent(QMouseEvent *event) void MapCanvas::mouseMoveEvent(QMouseEvent* event)
{ {
if (mCurrentTool) { if (mCurrentTool) {
mCurrentTool->execute(event); mCurrentTool->execute(event);
} }
QGraphicsView::mouseMoveEvent(event); QGraphicsView::mouseMoveEvent(event);
} }
void void
MapCanvas::refreshMap() { MapCanvas::refreshMap() {
QMapIterator<QString, MapLayer *> iterator(mLayers); QMapIterator<QString, MapLayer*> iterator(mLayers);
while (iterator.hasNext()) { while (iterator.hasNext()) {
iterator.next(); iterator.next();
iterator.value()->map()->setViewExtent(mViewExtent); iterator.value()->map()->setViewExtent(mViewExtent);
iterator.value()->update(); iterator.value()->update();
} }
mScene->update(); mScene->update();
} }
void void
MapCanvas::addLayer(MapLayer *const layer) { MapCanvas::addLayer(MapLayer* const layer) {
if (!layer) if (!layer)
return; return;
@ -123,15 +124,15 @@ MapCanvas::addLayer(MapLayer *const layer) {
} }
mScene->addItem(layer->map()); mScene->addItem(layer->map());
refreshMap(); refreshMap();
} }
void void
MapCanvas::setZoomValue(const int zoom) { MapCanvas::setZoomValue(const int zoom) {
mZoomValue = normalizeZoom(zoom); mZoomValue = normalizeZoom(zoom);
zoomChanged(mZoomValue); zoomChanged(mZoomValue);
/// 更新每个图层的zoom值 /// 更新每个图层的zoom值
QMapIterator<QString, MapLayer *> iterator(mLayers); QMapIterator<QString, MapLayer*> iterator(mLayers);
while (iterator.hasNext()) { while (iterator.hasNext()) {
iterator.next(); iterator.next();
iterator.value()->setZoomValue(mZoomValue); iterator.value()->setZoomValue(mZoomValue);
@ -139,10 +140,10 @@ MapCanvas::setZoomValue(const int zoom) {
/// 更新可视区域的内容 /// 更新可视区域的内容
updateViewExtent(true); updateViewExtent(true);
} }
void void
MapCanvas::updateViewExtent(bool reset) { MapCanvas::updateViewExtent(bool reset) {
if (!mCurrentLayer) { if (!mCurrentLayer) {
qDebug() << "未设置当前图层,视图区域无法更新"; qDebug() << "未设置当前图层,视图区域无法更新";
return; return;
@ -151,21 +152,23 @@ MapCanvas::updateViewExtent(bool reset) {
if (reset) { if (reset) {
/// 重置视图区域 /// 重置视图区域
mScene->setSceneRect(mCurrentLayer->extent()); mScene->setSceneRect(mCurrentLayer->extent());
QRectF testrect=mCurrentLayer->extent(); QRectF testrect = mCurrentLayer->extent();
mViewExtent.setRect(0, 0, 0, 0); mViewExtent.setRect(0, 0, 0, 0);
mViewExtent.setSize(size()); mViewExtent.setSize(size());
PointXY crsCenter = mCrs->forward(mMapCenter); PointXY crsCenter = mCrs->forward(mMapCenter);
QPointF mapCenter{crsCenter.x() / resolution(), crsCenter.y() / resolution()}; QPointF mapCenter{ crsCenter.x() / resolution(), crsCenter.y() / resolution() };
QPointF offset = mapCenter - mViewExtent.center(); QPointF offset = mapCenter - mViewExtent.center();
mViewExtent.translate(offset.x(), offset.y()); mViewExtent.translate(offset.x(), offset.y());
} else { }
else {
qDebug() << "视图区域更新 平移范围 x ,y "<<-mDragRect.width()<<" , "<<-mDragRect.height() ;
/// 视图偏移并重置偏移属性 /// 视图偏移并重置偏移属性
mViewExtent.translate(-mDragRect.width(), -mDragRect.height()); mViewExtent.translate(-mDragRect.width(), -mDragRect.height());
mDragRect.setRect(0, 0, 0, 0); mDragRect.setRect(0, 0, 0, 0);
/// 更新地图可视区域中心点 /// 更新地图可视区域中心点
QPointF mapCenter = mViewExtent.center(); QPointF mapCenter = mViewExtent.center();
PointXY crsCenter{mapCenter.x() * resolution(), mapCenter.y() * resolution()}; PointXY crsCenter{ mapCenter.x() * resolution(), mapCenter.y() * resolution() };
mMapCenter = mCrs->inverse(crsCenter); mMapCenter = mCrs->inverse(crsCenter);
mapCenterChanged(mMapCenter); mapCenterChanged(mMapCenter);
} }
@ -173,17 +176,17 @@ MapCanvas::updateViewExtent(bool reset) {
/// 刷新地图 /// 刷新地图
centerOn(mViewExtent.center()); centerOn(mViewExtent.center());
refreshMap(); refreshMap();
} }
void void
MapCanvas::setCrs(const CRS *const crs) { MapCanvas::setCrs(const CRS* const crs) {
mCrs = crs; mCrs = crs;
crsChanged(); crsChanged();
updateViewExtent(true); updateViewExtent(true);
} }
void void
MapCanvas::setCurrentLayer(const QString &id) { MapCanvas::setCurrentLayer(const QString& id) {
if (!mLayers.contains(id)) { if (!mLayers.contains(id)) {
qWarning() << "未添加图层=>" << id; qWarning() << "未添加图层=>" << id;
return; return;
@ -193,58 +196,60 @@ MapCanvas::setCurrentLayer(const QString &id) {
setCrs(&mCurrentLayer->crs()); setCrs(&mCurrentLayer->crs());
} }
updateViewExtent(true); updateViewExtent(true);
} }
double double
MapCanvas::scale() const { MapCanvas::scale() const {
return logicalDpiX() * resolution() * 39.37 / 100;; return logicalDpiX() * resolution() * 39.37 / 100;;
} }
double double
MapCanvas::resolution() const { MapCanvas::resolution() const {
if (!mCurrentLayer) { if (!mCurrentLayer) {
qWarning() << "未设置当前图层,无法获取分辨率"; qWarning() << "未设置当前图层,无法获取分辨率";
return 0; return 0;
} }
return mCurrentLayer->resolution(); return mCurrentLayer->resolution();
} }
int int
MapCanvas::zoomValue() const { MapCanvas::zoomValue() const {
if (!mCurrentLayer) { if (!mCurrentLayer) {
qWarning() << "未设置当前图层默认返回zoom值为0"; qWarning() << "未设置当前图层默认返回zoom值为0";
return 0; return 0;
} }
return mCurrentLayer->zoomValue(); return mCurrentLayer->zoomValue();
} }
int int
MapCanvas::normalizeZoom(const int zoom) const { MapCanvas::normalizeZoom(const int zoom) const {
int z{}; int z{};
if (zoom <= kMinZoomValue) { if (zoom <= kMinZoomValue) {
z = kMinZoomValue; z = kMinZoomValue;
} else if (z >= kMaxZoomValue) { }
else if (z >= kMaxZoomValue) {
z = kMaxZoomValue; z = kMaxZoomValue;
} else { }
else {
z = zoom; z = zoom;
} }
return z; return z;
} }
PointXY PointXY
MapCanvas::pixel2Lonlat(const QPointF &point) const { MapCanvas::pixel2Lonlat(const QPointF& point) const {
QPointF scenePoint = mapToScene(QPoint{static_cast<int>(point.x()), static_cast<int>(point.y())}); QPointF scenePoint = mapToScene(QPoint{ static_cast<int>(point.x()), static_cast<int>(point.y()) });
QPointF mapPoint{scenePoint.x() * resolution(), scenePoint.y() * resolution()}; QPointF mapPoint{ scenePoint.x() * resolution(), scenePoint.y() * resolution() };
PointXY crsPoint = mCrs->inverse(PointXY{mapPoint}); PointXY crsPoint = mCrs->inverse(PointXY{ mapPoint });
qDebug() << "坐标装换=>{" << point << "=>" << crsPoint << "}"; qDebug() << "坐标装换=>{" << point << "=>" << crsPoint << "}";
return crsPoint; return crsPoint;
} }
bool bool
MapCanvas::selectTool(const QString &tool) { MapCanvas::selectTool(const QString& tool) {
if (!mMapTools.contains(tool)) { if (!mMapTools.contains(tool)) {
qWarning() << QString("%1工具不存在").arg(tool); qWarning() << QString("%1工具不存在").arg(tool);
return false; return false;
@ -258,19 +263,19 @@ MapCanvas::selectTool(const QString &tool) {
toolPtr->setup(); toolPtr->setup();
return true; return true;
} }
void MapCanvas::timerEvent(QTimerEvent *event) void MapCanvas::timerEvent(QTimerEvent* event)
{ {
MapToolAddplane *maptoolAddplane=dynamic_cast<MapToolAddplane*>(mMapTools["addplane_tool"]); MapToolAddplane* maptoolAddplane = dynamic_cast<MapToolAddplane*>(mMapTools["addplane_tool"]);
QList<MapAutoplane*> planes=maptoolAddplane->getPlanes(); QList<MapAutoplane*> planes = maptoolAddplane->getPlanes();
foreach(MapAutoplane *plane,planes){ foreach(MapAutoplane * plane, planes) {
plane->updatePos(); plane->updatePos();
} }
} }
void void
MapCanvas::setupTools() { MapCanvas::setupTools() {
auto panTool = new MapToolPan(this); auto panTool = new MapToolPan(this);
mMapTools.insert(panTool->id(), panTool); mMapTools.insert(panTool->id(), panTool);
@ -283,19 +288,19 @@ MapCanvas::setupTools() {
auto selectTool = new MapToolSelect(this); auto selectTool = new MapToolSelect(this);
mMapTools.insert(selectTool->id(), selectTool); mMapTools.insert(selectTool->id(), selectTool);
auto drawlineTool=new MapToolDrawline(this); auto drawlineTool = new MapToolDrawline(this);
mMapTools.insert(drawlineTool->id(),drawlineTool); mMapTools.insert(drawlineTool->id(), drawlineTool);
auto drawareTool=new MapToolDrawarea(this); auto drawareTool = new MapToolDrawarea(this);
mMapTools.insert(drawareTool->id(),drawareTool); mMapTools.insert(drawareTool->id(), drawareTool);
auto addplaneTool=new MapToolAddplane(this); auto addplaneTool = new MapToolAddplane(this);
mMapTools.insert(addplaneTool->id(),addplaneTool); mMapTools.insert(addplaneTool->id(), addplaneTool);
} }
} }

View File

@ -20,13 +20,13 @@
#include <maptool.h> #include <maptool.h>
namespace LAMPMainWidget { namespace LAMPMainWidget {
class MapLayer; class MapLayer;
class MapTool; class MapTool;
/** /**
* QGraphicsView * QGraphicsView
* Qt GraphicsView Framework * Qt GraphicsView Framework
*/ */
class MapCanvas : public QGraphicsView { class MapCanvas : public QGraphicsView {
Q_OBJECT Q_OBJECT
signals: signals:
@ -41,7 +41,7 @@ class MapCanvas : public QGraphicsView {
friend class MapToolSelect; friend class MapToolSelect;
public: public:
explicit MapCanvas(QWidget *parent = nullptr); explicit MapCanvas(QWidget* parent = nullptr);
~MapCanvas() override; ~MapCanvas() override;
public: public:
@ -54,7 +54,7 @@ class MapCanvas : public QGraphicsView {
* 使 * 使
* @param layer * @param layer
*/ */
void addLayer(MapLayer *layer); void addLayer(MapLayer* layer);
/** /**
* *
@ -84,48 +84,48 @@ class MapCanvas : public QGraphicsView {
* *
* @return * @return
*/ */
const QRectF &viewExtent() const { return mViewExtent; } const QRectF& viewExtent() const { return mViewExtent; }
/** /**
* *
* *
* @param crs * @param crs
*/ */
void setCrs(const CRS *crs); void setCrs(const CRS* crs);
/** /**
* *
* @return * @return
*/ */
const CRS &crs() const { return *mCrs; } const CRS& crs() const { return *mCrs; }
/** /**
* *
* @param id id * @param id id
*/ */
void setCurrentLayer(const QString &id); void setCurrentLayer(const QString& id);
/** /**
* *
* @return * @return
*/ */
const MapLayer *currentLayer() { return mCurrentLayer; } const MapLayer* currentLayer() { return mCurrentLayer; }
/** /**
* *
* @return * @return
*/ */
const PointXY &mapCenter() const { return mMapCenter; } const PointXY& mapCenter() const { return mMapCenter; }
/** /**
* *
* @param tool * @param tool
* @return * @return
*/ */
bool selectTool(const QString &tool); bool selectTool(const QString& tool);
void timerEvent(QTimerEvent *event); void timerEvent(QTimerEvent* event);
protected: protected:
/** /**
@ -139,7 +139,7 @@ class MapCanvas : public QGraphicsView {
* @param point * @param point
* @return * @return
*/ */
PointXY pixel2Lonlat(const QPointF &point) const; PointXY pixel2Lonlat(const QPointF& point) const;
/** /**
* *
@ -155,35 +155,36 @@ class MapCanvas : public QGraphicsView {
int normalizeZoom(int zoom) const; int normalizeZoom(int zoom) const;
protected: protected:
void mousePressEvent(QMouseEvent *event) override; void mousePressEvent(QMouseEvent* event) override;
void mouseReleaseEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent* event) override;
void wheelEvent(QWheelEvent *event) override; void wheelEvent(QWheelEvent* event) override;
void resizeEvent(QResizeEvent *event) override; void resizeEvent(QResizeEvent* event) override;
void mouseMoveEvent(QMouseEvent *event) override; void mouseMoveEvent(QMouseEvent* event) override;
protected: protected:
QGraphicsScene *mScene; QGraphicsScene* mScene;
QRectF mMapExtent; QRectF mMapExtent;
QRectF mViewExtent; QRectF mViewExtent;
QRectF mDragRect; QRectF mDragRect;
bool mIsDragging; bool mIsDragging;
QMap<QString, MapLayer *> mLayers; QMap<QString, MapLayer*> mLayers;
MapLayer *mCurrentLayer; MapLayer* mCurrentLayer;
const CRS *mCrs; const CRS* mCrs;
PointXY mMapCenter; PointXY mMapCenter;
int mZoomValue; int mZoomValue;
PointXY mLastXY; PointXY mLastXY;
QTimer *mMapUpdateTimer; QTimer* mMapUpdateTimer;
MapTool *mCurrentTool; MapTool* mCurrentTool;
QHash<QString, MapTool *> mMapTools; QHash<QString, MapTool*> mMapTools;
private: private:
const static int kDefaultZoomValue{8}; const static int kDefaultZoomValue{ 8 };
static const int kMaxZoomValue{20}; static const int kMaxZoomValue{ 20 };
static const int kMinZoomValue{1}; static const int kMinZoomValue{ 1 };
protected: protected:
// 设置默认地图中心点
static PointXY defaultMapCenter(); static PointXY defaultMapCenter();
}; };
} }

View File

@ -10,28 +10,28 @@
namespace LAMPMainWidget { namespace LAMPMainWidget {
void void
MapCanvasMap::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { MapCanvasMap::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) {
if (!mLayer->provider().hasContent()) { if (!mLayer->provider().hasContent()) {
return; return;
} }
painter->drawImage(mViewExtent.topLeft(), mLayer->provider().preparedImage()); painter->drawImage(mViewExtent.topLeft(), mLayer->provider().preparedImage());
} }
QRectF QRectF
MapCanvasMap::boundingRect() const { MapCanvasMap::boundingRect() const {
auto width = mViewExtent.size().width(); auto width = mViewExtent.size().width();
auto height = mViewExtent.size().height(); auto height = mViewExtent.size().height();
return mViewExtent + QMarginsF(1024, 1024, 1024, 1024); return mViewExtent + QMarginsF(1024, 1024, 1024, 1024);
} }
void MapCanvasMap::setViewExtent(const QRectF &rect) { void MapCanvasMap::setViewExtent(const QRectF& rect) {
//qDebug() << "更新图层显示对象边界=>" << rect; //qDebug() << "更新图层显示对象边界=>" << rect;
if (rect != mViewExtent) { if (rect != mViewExtent) {
prepareGeometryChange(); prepareGeometryChange();
mViewExtent = rect; mViewExtent = rect;
} }
} }
} }

View File

@ -7,10 +7,10 @@
namespace LAMPMainWidget { namespace LAMPMainWidget {
MapLayer::MapLayer( MapLayer::MapLayer(
const QString &id, const QString& id,
LAMPMainWidget::CRS *crs, LAMPMainWidget::CRS* crs,
LAMPMainWidget::MapCanvas *mapCanvas) LAMPMainWidget::MapCanvas* mapCanvas)
: mId(id), : mId(id),
mCrs(crs), mCrs(crs),
mZValue(-1), mZValue(-1),
@ -19,21 +19,21 @@ MapLayer::MapLayer(
mMapCanvasMap(new MapCanvasMap(this)), mMapCanvasMap(new MapCanvasMap(this)),
mMapCanvas(mapCanvas) { mMapCanvas(mapCanvas) {
} }
MapLayer::~MapLayer() { MapLayer::~MapLayer() {
delete mCrs; delete mCrs;
delete mProvider; delete mProvider;
} }
MapLayer::MapLayer(const MapLayer &other) { MapLayer::MapLayer(const MapLayer& other) {
mId = other.mId; mId = other.mId;
mZValue = other.mZValue; mZValue = other.mZValue;
mCrs = other.mCrs; mCrs = other.mCrs;
mMapCanvas = other.mMapCanvas; mMapCanvas = other.mMapCanvas;
} }
MapLayer::MapLayer(MapLayer &&other) noexcept { MapLayer::MapLayer(MapLayer&& other) noexcept {
mId = other.mId; mId = other.mId;
mZValue = other.mZValue; mZValue = other.mZValue;
mCrs = other.mCrs; mCrs = other.mCrs;
@ -43,10 +43,10 @@ MapLayer::MapLayer(MapLayer &&other) noexcept {
other.mCrs = nullptr; other.mCrs = nullptr;
other.mZValue = 0; other.mZValue = 0;
other.mMapCanvas = nullptr; other.mMapCanvas = nullptr;
} }
MapLayer & MapLayer&
MapLayer::operator=(const MapLayer &other) { MapLayer::operator=(const MapLayer& other) {
if (this != &other) { if (this != &other) {
mId = other.mId; mId = other.mId;
mZValue = other.mZValue; mZValue = other.mZValue;
@ -55,10 +55,10 @@ MapLayer::operator=(const MapLayer &other) {
} }
return *this; return *this;
} }
MapLayer & MapLayer&
MapLayer::operator=(MapLayer &&other) noexcept { MapLayer::operator=(MapLayer&& other) noexcept {
if (this != &other) { if (this != &other) {
mId = other.mId; mId = other.mId;
mZValue = other.mZValue; mZValue = other.mZValue;
@ -72,11 +72,11 @@ MapLayer::operator=(MapLayer &&other) noexcept {
} }
return *this; return *this;
} }
void void
MapLayer::update() { MapLayer::update() {
if(!isVisible()){ if (!isVisible()) {
qDebug() << id() << "=>图层不显示,跳过刷新操作"; qDebug() << id() << "=>图层不显示,跳过刷新操作";
mMapCanvasMap->hide(); mMapCanvasMap->hide();
return; return;
@ -84,7 +84,7 @@ MapLayer::update() {
//qDebug() << "刷新图层内容=>" << mMapCanvas->viewExtent()<<QDateTime::currentDateTime()<<"zoom"<<mZoomValue; //qDebug() << "刷新图层内容=>" << mMapCanvas->viewExtent()<<QDateTime::currentDateTime()<<"zoom"<<mZoomValue;
mProvider->createTask(mMapCanvas->viewExtent(), mZoomValue); mProvider->createTask(mMapCanvas->viewExtent(), mZoomValue);
mMapCanvasMap->show(); mMapCanvasMap->show();
} }
} }

View File

@ -9,26 +9,26 @@
#include <mapcanvasmap.h> #include <mapcanvasmap.h>
namespace LAMPMainWidget { namespace LAMPMainWidget {
class MapCanvas; class MapCanvas;
/* /*
* *
*/ */
class MapLayer { class MapLayer {
public: public:
MapLayer(const QString &id, CRS *crs, MapCanvas *mapCanvas); MapLayer(const QString& id, CRS* crs, MapCanvas* mapCanvas);
MapLayer(const MapLayer &other); MapLayer(const MapLayer& other);
MapLayer(MapLayer &&other) noexcept; MapLayer(MapLayer&& other) noexcept;
virtual ~MapLayer(); virtual ~MapLayer();
MapLayer &operator=(const MapLayer &other); MapLayer& operator=(const MapLayer& other);
MapLayer &operator=(MapLayer &&other) noexcept; MapLayer& operator=(MapLayer&& other) noexcept;
public: public:
/* /*
* id * id
* @return id * @return id
*/ */
const QString &id() const { return mId; } const QString& id() const { return mId; }
/* /*
* z * z
@ -40,25 +40,25 @@ class MapLayer {
* *
* @return * @return
*/ */
const CRS &crs() const { return *mCrs; } const CRS& crs() const { return *mCrs; }
/* /*
* map * map
* @return map * @return map
*/ */
const MapCanvas &mapCanvas() const { return *mMapCanvas; } const MapCanvas& mapCanvas() const { return *mMapCanvas; }
/* /*
* *
* @return * @return
*/ */
const LayerProvider &provider() const { return *mProvider; } const LayerProvider& provider() const { return *mProvider; }
/* /*
* id * id
* @param id id * @param id id
*/ */
void setId(const QString &id) { mId = id; } void setId(const QString& id) { mId = id; }
/* /*
* z * z
@ -70,13 +70,13 @@ class MapLayer {
* *
* @param crs * @param crs
*/ */
void setCrs(CRS *const crs) { mCrs = crs; } void setCrs(CRS* const crs) { mCrs = crs; }
/* /*
* *
* @param provider * @param provider
*/ */
void setProvider(LayerProvider *const provider) { mProvider = provider; } void setProvider(LayerProvider* const provider) { mProvider = provider; }
/* /*
* pixel:m * pixel:m
@ -106,25 +106,25 @@ class MapLayer {
* *
* @param map * @param map
*/ */
void setMap(MapCanvasMap *map) { mMapCanvasMap = map; } void setMap(MapCanvasMap* map) { mMapCanvasMap = map; }
/* /*
* *
* @return * @return
*/ */
MapCanvasMap *map() const { return mMapCanvasMap; } MapCanvasMap* map() const { return mMapCanvasMap; }
/* /*
* *
* @return truefalse * @return truefalse
*/ */
bool isVisible() const {return mIsVisible;} bool isVisible() const { return mIsVisible; }
/* /*
* *
* @param visible truefalse * @param visible truefalse
*/ */
void setVisiblity(bool visible) {mIsVisible = visible;} void setVisiblity(bool visible) { mIsVisible = visible; }
/* /*
* *
@ -134,16 +134,16 @@ class MapLayer {
protected: protected:
QString mId; QString mId;
CRS *mCrs; CRS* mCrs;
int mZValue; int mZValue;
int mZoomValue; int mZoomValue;
LayerProvider *mProvider; LayerProvider* mProvider;
MapCanvasMap *mMapCanvasMap; MapCanvasMap* mMapCanvasMap;
const MapCanvas *mMapCanvas; const MapCanvas* mMapCanvas;
bool mIsVisible{false}; bool mIsVisible{ false };
private: private:
const static int kDefaultZoomValue{10}; const static int kDefaultZoomValue{ 10 };
}; };
} }

View File

@ -3,13 +3,13 @@
#include <QtGui/QMouseEvent> #include <QtGui/QMouseEvent>
namespace LAMPMainWidget { namespace LAMPMainWidget {
class MapCanvas; class MapCanvas;
/** /**
* *
*/ */
class MapTool { class MapTool {
public: public:
MapTool(MapCanvas *mapCanvas) : mMapCanvas(mapCanvas) {} MapTool(MapCanvas* mapCanvas) : mMapCanvas(mapCanvas) {}
virtual ~MapTool(); virtual ~MapTool();
public: public:
@ -17,7 +17,7 @@ class MapTool {
* *
* @param event * @param event
*/ */
virtual void execute(QMouseEvent *event) = 0; virtual void execute(QMouseEvent* event) = 0;
/** /**
* 使 * 使
@ -36,7 +36,7 @@ class MapTool {
virtual QString id() = 0; virtual QString id() = 0;
protected: protected:
MapCanvas *mMapCanvas; MapCanvas* mMapCanvas;
}; };
} }

View File

@ -6,9 +6,9 @@
namespace LAMPMainWidget { namespace LAMPMainWidget {
void void
MapToolPan::execute(QMouseEvent *event) { MapToolPan::execute(QMouseEvent* event) {
if(!(event->button() & Qt::LeftButton)){ if (!(event->button() & Qt::LeftButton)) {
return; return;
} }
@ -19,26 +19,26 @@ MapToolPan::execute(QMouseEvent *event) {
if (QEvent::MouseButtonRelease == type) { if (QEvent::MouseButtonRelease == type) {
mDragEndPos = event->pos(); mDragEndPos = event->pos();
QRectF dragRect{mDragStartPos, mDragEndPos}; QRectF dragRect{ mDragStartPos, mDragEndPos };
mMapCanvas->mDragRect = dragRect; mMapCanvas->mDragRect = dragRect;
mMapCanvas->updateViewExtent(); mMapCanvas->updateViewExtent();
} }
} }
void void
MapToolPan::setup() { MapToolPan::setup() {
mMapCanvas->setDragMode(MapCanvas::DragMode::ScrollHandDrag); mMapCanvas->setDragMode(MapCanvas::DragMode::ScrollHandDrag);
} }
QString QString
MapToolPan::id() { MapToolPan::id() {
return QString{"pan_tool"}; return QString{ "pan_tool" };
} }
void void
MapToolPan::deSetup() { MapToolPan::deSetup() {
mMapCanvas->setDragMode(MapCanvas::DragMode::NoDrag); mMapCanvas->setDragMode(MapCanvas::DragMode::NoDrag);
} }
} }

View File

@ -10,8 +10,8 @@ OSTNormalProvider::OSTNormalProvider(QObject *parent)
} }
QString QString
OSTNormalProvider::tileUrl(const LAMPMainWidget::PointXY &pos, int zoom) const { OSTNormalProvider::tileUrl(const LAMPMainWidget::PointXY& pos, int zoom) const {
QString urlFmt = {"https://tile.openstreetmap.org/%1/%2/%3.png"}; QString urlFmt = { "https://tile.openstreetmap.org/%1/%2/%3.png" };
return QString(urlFmt).arg(zoom).arg(pos.y()).arg(pos.x()); return QString(urlFmt).arg(zoom).arg(pos.y()).arg(pos.x());
} }
//https://tile.openstreetmap.org/{z}/{x}/{y}.png //https://tile.openstreetmap.org/{z}/{x}/{y}.png

View File

@ -20,7 +20,7 @@ namespace LAMPMainWidget
void void
DownloadTask::run() DownloadTask::run()
{ {
auto currentLayer = dynamic_cast<const TmsLayer *>(mTaskInfo.layer); auto currentLayer = dynamic_cast<const TmsLayer*>(mTaskInfo.layer);
auto provider = dynamic_cast<const TmsProvider*>(&currentLayer->provider()); auto provider = dynamic_cast<const TmsProvider*>(&currentLayer->provider());
auto tileSize = provider->tileSize(); auto tileSize = provider->tileSize();
@ -33,12 +33,12 @@ namespace LAMPMainWidget
} }
generateSuccessRow(); generateSuccessRow();
ImgWriter imgWriter{mTaskInfo.taskPath, imgSize}; ImgWriter imgWriter{ mTaskInfo.taskPath, imgSize };
QByteArray tileData{}; QByteArray tileData{};
Network web{}; Network web{};
auto item = tiles.constBegin(); auto item = tiles.constBegin();
auto count = tiles.count(); auto count = tiles.count();
int completed{0}; int completed{ 0 };
for (; item != tiles.constEnd(); ++item) { for (; item != tiles.constEnd(); ++item) {
tileData = web.httpsRequest(item.value()); tileData = web.httpsRequest(item.value());
if (tileData.isEmpty()) { if (tileData.isEmpty()) {
@ -53,8 +53,7 @@ namespace LAMPMainWidget
double progress = static_cast<double>(completed) / count; double progress = static_cast<double>(completed) / count;
auto progessStr = QString("%1").arg(progress * 100); auto progessStr = QString("%1").arg(progress * 100);
mTaskInfo.display->takeItem(mRowId, 4); mTaskInfo.display->takeItem(mRowId, 4);
mTaskInfo.display->setItem(mRowId, 4, mTaskInfo.display->setItem(mRowId, 4,new QTableWidgetItem(QString("%1").arg(progress * 100)));
new QTableWidgetItem(QString("%1").arg(progress * 100)));
// mTaskInfo.display->resizeColumnsToContents(); // mTaskInfo.display->resizeColumnsToContents();
// mTaskInfo.display->horizontalHeader()->setStretchLastSection(true); // mTaskInfo.display->horizontalHeader()->setStretchLastSection(true);
} }
@ -99,7 +98,7 @@ namespace LAMPMainWidget
TaskWindow::TaskWindow(QWidget* parent) TaskWindow::TaskWindow(QWidget* parent)
: mUi(new Ui::TaskWindow), : mUi(new Ui::TaskWindow),
mParent(dynamic_cast<RasterMainWidget *>(parent)), mParent(dynamic_cast<RasterMainWidget*>(parent)),
mSavePath(), mSavePath(),
QDialog(parent) QDialog(parent)
{ {
@ -117,7 +116,7 @@ namespace LAMPMainWidget
TaskWindow::setupWindow() TaskWindow::setupWindow()
{ {
setFixedSize(size()); setFixedSize(size());
auto currentLayer = dynamic_cast<const TmsLayer *>(mParent->mMapConvas->currentLayer()); auto currentLayer = dynamic_cast<const TmsLayer*>(mParent->mMapConvas->currentLayer());
auto minZoom = currentLayer->minZoom(); auto minZoom = currentLayer->minZoom();
auto maxZoom = currentLayer->maxZoom(); auto maxZoom = currentLayer->maxZoom();
@ -156,7 +155,7 @@ namespace LAMPMainWidget
mZoomValue, mZoomValue,
mParent->mMapConvas->currentLayer(), mParent->mMapConvas->currentLayer(),
mParent->getTaskTable() mParent->getTaskTable()
/*mParent->mUi->taskTable*/}; /*mParent->mUi->taskTable*/ };
auto task = new DownloadTask(tileInfo); auto task = new DownloadTask(tileInfo);
QThreadPool::globalInstance()->start(task); QThreadPool::globalInstance()->start(task);
@ -166,7 +165,7 @@ namespace LAMPMainWidget
void void
TaskWindow::setupSaveDir() TaskWindow::setupSaveDir()
{ {
auto saveDir = QFileDialog::getExistingDirectory(dynamic_cast<QWidget *>(this), "存储路径选择"); auto saveDir = QFileDialog::getExistingDirectory(dynamic_cast<QWidget*>(this), "存储路径选择");
if (saveDir.isEmpty()) { if (saveDir.isEmpty()) {
qWarning() << "未选择存储路径"; qWarning() << "未选择存储路径";
return; return;
@ -187,12 +186,12 @@ namespace LAMPMainWidget
TaskWindow::taskInfoCheck() TaskWindow::taskInfoCheck()
{ {
if (mTaskName.isEmpty()) { if (mTaskName.isEmpty()) {
QMessageBox::critical(dynamic_cast<QWidget *>(this), "错误", "任务名称为空"); QMessageBox::critical(dynamic_cast<QWidget*>(this), "错误", "任务名称为空");
return false; return false;
} }
if (mSavePath.isEmpty()) { if (mSavePath.isEmpty()) {
QMessageBox::critical(dynamic_cast<QWidget *>(this), "错误", "存储路径为空"); QMessageBox::critical(dynamic_cast<QWidget*>(this), "错误", "存储路径为空");
return false; return false;
} }

View File

@ -10,17 +10,17 @@
namespace LAMPMainWidget { namespace LAMPMainWidget {
TmsLayer::TmsLayer(LAMPMainWidget::TmsProviders provider, TmsLayer::TmsLayer(LAMPMainWidget::TmsProviders provider,
const QString &id, const QString& id,
LAMPMainWidget::MapCanvas *mapCanvas, LAMPMainWidget::MapCanvas* mapCanvas,
LAMPMainWidget::CRS *crs) LAMPMainWidget::CRS* crs)
: MapLayer(id, crs, mapCanvas) { : MapLayer(id, crs, mapCanvas) {
setProvider(TmsProviderFactory::create(provider)); setProvider(TmsProviderFactory::create(provider));
} }
double double
TmsLayer::resolution() const { TmsLayer::resolution() const {
auto pd = dynamic_cast<const TmsProvider *>(&provider()); auto pd = dynamic_cast<const TmsProvider*>(&provider());
auto sz = pd->tileSize(); auto sz = pd->tileSize();
double length = crs().extent().width(); double length = crs().extent().width();
double result = length / ((power2(zoomValue())) * sz.width()); double result = length / ((power2(zoomValue())) * sz.width());
@ -30,40 +30,43 @@ TmsLayer::resolution() const {
#endif #endif
return result; return result;
} }
QRectF QRectF
TmsLayer::extent() const { TmsLayer::extent() const {
auto pd = dynamic_cast<const TmsProvider *>(&provider()); auto pd = dynamic_cast<const TmsProvider*>(&provider());
QSize sz = pd->tileSize(); QSize sz = pd->tileSize();
int width = power2(zoomValue()) * sz.width(); int width = power2(zoomValue()) * sz.width();
int height = power2(zoomValue()) * sz.height(); int height = power2(zoomValue()) * sz.height();
//#ifdef DEBUG //#ifdef DEBUG
// qDebug() << "layer extent=>{width:" << width << ", height:" << height << "}"; // qDebug() << "layer extent=>{width:" << width << ", height:" << height << "}";
//#endif //#endif
return {0, 0, static_cast<qreal>(width), static_cast<qreal>(height)}; return { 0, 0, static_cast<qreal>(width), static_cast<qreal>(height) };
} }
void void
TmsLayer::setZoomValue(int zoom) { TmsLayer::setZoomValue(int zoom) {
int zoomValue{}; int zoomValue{};
if (zoom <= minZoom()) { if (zoom <= minZoom()) {
zoomValue = minZoom(); zoomValue = minZoom();
} else if (zoom >= maxZoom()) { }
else if (zoom >= maxZoom()) {
zoomValue = maxZoom(); zoomValue = maxZoom();
} else { }
else {
zoomValue = zoom; zoomValue = zoom;
} }
mZoomValue = zoomValue; mZoomValue = zoomValue;
} }
bool bool
TmsLayer::parseTiles(const QRectF &rect, int zoom, QHash<QPoint, QString> &tiles, QSize &size) const { TmsLayer::parseTiles(const QRectF& rect, int zoom, QHash<QPoint, QString>& tiles, QSize& size) const {
auto pd = dynamic_cast<const TmsProvider *>(&provider());
auto pd = dynamic_cast<const TmsProvider*>(&provider());
auto tileSize = pd->tileSize(); auto tileSize = pd->tileSize();
auto resolution = mCrs->extent().width() / ((power2(zoom)) * tileSize.width()); auto resolution = mCrs->extent().width() / ((power2(zoom)) * tileSize.width());
@ -76,7 +79,7 @@ TmsLayer::parseTiles(const QRectF &rect, int zoom, QHash<QPoint, QString> &tiles
auto xMax = qFloor(mapRightBottom.x() / tileSize.width()); auto xMax = qFloor(mapRightBottom.x() / tileSize.width());
auto yMin = qFloor(mapLeftTop.y() / tileSize.height()); auto yMin = qFloor(mapLeftTop.y() / tileSize.height());
auto yMax = qFloor(mapRightBottom.y() / tileSize.height()); auto yMax = qFloor(mapRightBottom.y() / tileSize.height());
if((xMin > xMax) || (yMin > yMax)){ if ((xMin > xMax) || (yMin > yMax)) {
qDebug() << "下载区边界错误"; qDebug() << "下载区边界错误";
return false; return false;
} }
@ -92,6 +95,6 @@ TmsLayer::parseTiles(const QRectF &rect, int zoom, QHash<QPoint, QString> &tiles
} }
return true; return true;
} }
} }

View File

@ -31,7 +31,7 @@ namespace LAMPMainWidget
mImage(nullptr) mImage(nullptr)
{ {
if (!QFile::exists(mDbName)) { if (!QFile::exists(mDbName)) {
QFile dbFile{mDbName}; QFile dbFile{ mDbName };
dbFile.open(QIODevice::ReadWrite); dbFile.open(QIODevice::ReadWrite);
dbFile.close(); dbFile.close();
} }
@ -52,7 +52,7 @@ namespace LAMPMainWidget
return false; return false;
} }
QSqlQuery sql{mDbConn}; QSqlQuery sql{ mDbConn };
if (!mDbConn.tables().contains(mTableName)) { if (!mDbConn.tables().contains(mTableName)) {
sql.prepare(QString("create table %1 (" sql.prepare(QString("create table %1 ("
"id integer primary key autoincrement," "id integer primary key autoincrement,"
@ -76,7 +76,7 @@ namespace LAMPMainWidget
{ {
QByteArray res{}; QByteArray res{};
mDbConn.open(); mDbConn.open();
QSqlQuery select{mDbConn}; QSqlQuery select{ mDbConn };
select.prepare(QString("select data from %1 " select.prepare(QString("select data from %1 "
"where provider = :provider " "where provider = :provider "
"and zoom = :zoom " "and zoom = :zoom "
@ -109,7 +109,7 @@ namespace LAMPMainWidget
return false; return false;
} }
mDbConn.open(); mDbConn.open();
QSqlQuery sql{mDbConn}; QSqlQuery sql{ mDbConn };
sql.prepare(QString{ sql.prepare(QString{
"insert into %1 (provider, zoom, position, data)" "insert into %1 (provider, zoom, position, data)"
"values( :provider, :zoom, :position, :data)" "values( :provider, :zoom, :position, :data)"
@ -153,11 +153,11 @@ namespace LAMPMainWidget
for (int i = xMin; i <= xMax; ++i) { for (int i = xMin; i <= xMax; ++i) {
for (int j = yMin; j <= yMax; ++j) { for (int j = yMin; j <= yMax; ++j) {
TileInfo tile{}; TileInfo tile{};
tile.index = QPointF{i - xMin - xOffset, j - yMin - yOffset}; tile.index = QPointF{ i - xMin - xOffset, j - yMin - yOffset };
tile.position = QPoint{i, j}; tile.position = QPoint{ i, j };
tile.zoom = zoom; tile.zoom = zoom;
tile.coord = QPoint{i - xMin, j - yMin}; tile.coord = QPoint{ i - xMin, j - yMin };
tile.url = tileUrl(PointXY{static_cast<double>(i), static_cast<double>(j)}, zoom); tile.url = tileUrl(PointXY{ static_cast<double>(i), static_cast<double>(j) }, zoom);
auto tileData = getCache(tile.position, tile.zoom); auto tileData = getCache(tile.position, tile.zoom);
if (!tileData.isEmpty()) { if (!tileData.isEmpty()) {
tile.data = tileData; tile.data = tileData;
@ -178,7 +178,7 @@ namespace LAMPMainWidget
if (!cacheContains(tile.position, tile.zoom)) { if (!cacheContains(tile.position, tile.zoom)) {
addCache(tile.position, tile.zoom, tile.data); addCache(tile.position, tile.zoom, tile.data);
} }
QPainter painter{mImage}; QPainter painter{ mImage };
QImage img = QImage::fromData(tile.data); QImage img = QImage::fromData(tile.data);
if (img.isNull()) { if (img.isNull()) {
return; return;
@ -193,7 +193,7 @@ namespace LAMPMainWidget
void void
TmsProvider::newImage(const QRectF& rect) TmsProvider::newImage(const QRectF& rect)
{ {
QSize imgSize{int(rect.width()), int(rect.height())}; QSize imgSize{ int(rect.width()), int(rect.height()) };
if (!mImage || imgSize != mImage->size()) { if (!mImage || imgSize != mImage->size()) {
mImage = new QImage(imgSize, QImage::Format_RGB32); mImage = new QImage(imgSize, QImage::Format_RGB32);
} }

View File

@ -5,16 +5,17 @@
namespace LAMPMainWidget { namespace LAMPMainWidget {
QHash<TmsProviders, LayerProvider *> TmsProviderFactory::mProviders{}; QHash<TmsProviders, LayerProvider*> TmsProviderFactory::mProviders{};
LayerProvider * LayerProvider*
TmsProviderFactory::create(LAMPMainWidget::TmsProviders provider) { TmsProviderFactory::create(LAMPMainWidget::TmsProviders provider) {
LayerProvider *result = nullptr; LayerProvider* result = nullptr;
switch (provider) { switch (provider) {
case OSTNormalMap: case OSTNormalMap:
if (mProviders.contains(OSTNormalMap)) { if (mProviders.contains(OSTNormalMap)) {
result = mProviders.value(OSTNormalMap); result = mProviders.value(OSTNormalMap);
} else { }
else {
result = new OSTNormalProvider(); result = new OSTNormalProvider();
mProviders.insert(OSTNormalMap, result); mProviders.insert(OSTNormalMap, result);
} }
@ -22,7 +23,8 @@ TmsProviderFactory::create(LAMPMainWidget::TmsProviders provider) {
case GaodeNormapMap: case GaodeNormapMap:
if (mProviders.contains(GaodeNormapMap)) { if (mProviders.contains(GaodeNormapMap)) {
result = mProviders.value(GaodeNormapMap); result = mProviders.value(GaodeNormapMap);
} else { }
else {
result = new GaodeNormalProvider(); result = new GaodeNormalProvider();
mProviders.insert(GaodeNormapMap, result); mProviders.insert(GaodeNormapMap, result);
} }
@ -31,7 +33,7 @@ TmsProviderFactory::create(LAMPMainWidget::TmsProviders provider) {
} }
return result; return result;
} }
} }

View File

@ -106,6 +106,7 @@
<IncludePath>.;.\RasterMainWidget;..\RasterProcessToolWidget;..\RasterProcessToolWidget\ToolBoxManager;..\BaseCommonLibrary;..\BaseCommonLibrary\BaseTool;..\BaseCommonLibrary\ToolAbstract;..\GPUBaseLib\GPUTool;..\GPUBaseLib;..\RasterMainWidgetGUI;..\RasterMainWidgetGUI\RasterMainWidget;$(IncludePath)</IncludePath> <IncludePath>.;.\RasterMainWidget;..\RasterProcessToolWidget;..\RasterProcessToolWidget\ToolBoxManager;..\BaseCommonLibrary;..\BaseCommonLibrary\BaseTool;..\BaseCommonLibrary\ToolAbstract;..\GPUBaseLib\GPUTool;..\GPUBaseLib;..\RasterMainWidgetGUI;..\RasterMainWidgetGUI\RasterMainWidget;$(IncludePath)</IncludePath>
<CopyLocalProjectReference>true</CopyLocalProjectReference> <CopyLocalProjectReference>true</CopyLocalProjectReference>
<CopyCppRuntimeToOutputDir>true</CopyCppRuntimeToOutputDir> <CopyCppRuntimeToOutputDir>true</CopyCppRuntimeToOutputDir>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<IncludePath>.;.\RasterMainWidget;..\RasterProcessToolWidget;..\RasterProcessToolWidget\ToolBoxManager;..\BaseCommonLibrary;..\BaseCommonLibrary\BaseTool;..\BaseCommonLibrary\ToolAbstract;..\GPUBaseLib\GPUTool;..\GPUBaseLib;..\RasterMainWidgetGUI;..\RasterMainWidgetGUI\RasterMainWidget;$(IncludePath)</IncludePath> <IncludePath>.;.\RasterMainWidget;..\RasterProcessToolWidget;..\RasterProcessToolWidget\ToolBoxManager;..\BaseCommonLibrary;..\BaseCommonLibrary\BaseTool;..\BaseCommonLibrary\ToolAbstract;..\GPUBaseLib\GPUTool;..\GPUBaseLib;..\RasterMainWidgetGUI;..\RasterMainWidgetGUI\RasterMainWidget;$(IncludePath)</IncludePath>
@ -115,6 +116,10 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING;RASTERMAINWIDGETGUI_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING;RASTERMAINWIDGETGUI_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<OpenMPSupport>true</OpenMPSupport>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<WholeProgramOptimization>false</WholeProgramOptimization>
<Optimization>Disabled</Optimization>
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">

View File

@ -21,6 +21,9 @@
<UniqueIdentifier>{639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}</UniqueIdentifier> <UniqueIdentifier>{639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}</UniqueIdentifier>
<Extensions>ts</Extensions> <Extensions>ts</Extensions>
</Filter> </Filter>
<Filter Include="RasterLayer">
<UniqueIdentifier>{1a65f538-c16c-4824-895f-105eb2fc502e}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<QtRcc Include="RasterMainWidgetGUI.qrc"> <QtRcc Include="RasterMainWidgetGUI.qrc">

View File

@ -7,6 +7,7 @@ namespace RasterMessageShow {
RasterWidgetMessageShow::RasterWidgetMessageShow(QObject* parant):QObject(parant) RasterWidgetMessageShow::RasterWidgetMessageShow(QObject* parant):QObject(parant)
{ {
this->textBrowserMessage = nullptr;
QObject::connect(this, SIGNAL(ShowMessage(QString)), this, SLOT(ShowMessageInfo(QString))); QObject::connect(this, SIGNAL(ShowMessage(QString)), this, SLOT(ShowMessageInfo(QString)));
} }
@ -26,12 +27,12 @@ namespace RasterMessageShow {
void RasterWidgetMessageShow::ShowMessageInfo(QString Message) void RasterWidgetMessageShow::ShowMessageInfo(QString Message)
{ {
std::cout << Message.toLocal8Bit().constData() << std::endl;
if (nullptr != this->textBrowserMessage) { if (nullptr != this->textBrowserMessage) {
this->textBrowserMessage->append(Message); this->textBrowserMessage->append(Message);
this->textBrowserMessage->moveCursor(QTextCursor::MoveOperation::End); this->textBrowserMessage->moveCursor(QTextCursor::MoveOperation::End);
this->textBrowserMessage->repaint(); this->textBrowserMessage->repaint();
std::cout << Message.toLocal8Bit().constData() << std::endl; std::cout << Message.toLocal8Bit().constData() << std::endl;
} }
else {} else {}
} }

View File

@ -1,6 +1,8 @@
#include "LAMPMainWidgetRunProgram.h" #include "LAMPMainWidgetRunProgram.h"
#include <QtWidgets/QApplication> #include <QtWidgets/QApplication>
// 这个项目是基于easygis项目原项目地址 https://gitee.com/stormeye2020/easygis.git
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication a(argc, argv); QApplication a(argc, argv);

View File

@ -25,6 +25,7 @@ ToolBoxWidget::ToolBoxWidget(LAMPMainWidget::RasterMainWidget* mainWindows, QWid
ui->setupUi(this); ui->setupUi(this);
setContextMenuPolicy(Qt::CustomContextMenu); // <20>零塘숩우쌥꽉데 setContextMenuPolicy(Qt::CustomContextMenu); // <20>零塘숩우쌥꽉데
QObject::connect(this, SIGNAL(addBoxToolItemSIGNAL(QToolAbstract*)), this, SLOT(addBoxToolItemSLOT(QToolAbstract*))); QObject::connect(this, SIGNAL(addBoxToolItemSIGNAL(QToolAbstract*)), this, SLOT(addBoxToolItemSLOT(QToolAbstract*)));
QObject::connect(this, SIGNAL(addBoxToolItemInPathSIGNAL(QVector<QString> , QToolAbstract* )), this, SLOT(addBoxToolItemInPathSLOT(QVector<QString>, QToolAbstract * )));
} }
@ -122,6 +123,37 @@ void ToolBoxWidget::addBoxToolItemSLOT(QToolAbstract* item)
} }
void ToolBoxWidget::addBoxToolItemInPathSLOT(QVector<QString> 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<QString>& path) { QTreeWidgetItem* ToolBoxWidget::findOrCreateParentItem( QVector<QString>& path) {
QTreeWidgetItem* currentItem = nullptr; QTreeWidgetItem* currentItem = nullptr;
@ -171,7 +203,17 @@ QTreeWidgetItem* ToolBoxWidget::findChildItemByName(QTreeWidgetItem* parentItem,
return childItem; 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() void ToolBoxWidget::OpenToolboxManagerWidget()

View File

@ -49,9 +49,11 @@ private:
signals: signals:
void addBoxToolItemSIGNAL(QToolAbstract* item); void addBoxToolItemSIGNAL(QToolAbstract* item);
void addBoxToolItemInPathSIGNAL(QVector<QString> xnodepath, QToolAbstract* item);
public slots: public slots:
void addBoxToolItemSLOT(QToolAbstract* item); void addBoxToolItemSLOT(QToolAbstract* item);
void addBoxToolItemInPathSLOT(QVector<QString> xnodepath, QToolAbstract* item);
QTreeWidgetItem* findOrCreateParentItem( QVector<QString>& path); QTreeWidgetItem* findOrCreateParentItem( QVector<QString>& path);
QTreeWidgetItem* findOrCreateTopLevelItem( QString& name); QTreeWidgetItem* findOrCreateTopLevelItem( QString& name);
QTreeWidgetItem* findChildItemByName(QTreeWidgetItem* parentItem, QString& name); QTreeWidgetItem* findChildItemByName(QTreeWidgetItem* parentItem, QString& name);

View File

@ -13,6 +13,9 @@
#include "QResampleRefrenceRaster.h" #include "QResampleRefrenceRaster.h"
#include "QtLookTableCorrectOffsetDialog.h" #include "QtLookTableCorrectOffsetDialog.h"
#include "QtCreateGPSPointsDialog.h" #include "QtCreateGPSPointsDialog.h"
#include "RasterVRT2ENVIdataDialog.h"
#include "SARSatalliteSimulationWorkflow.h" // 大场景仿真
GF3ImportDataToolButton::GF3ImportDataToolButton(QWidget* parent) :QToolAbstract(parent) 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 QResampleRefrenceRasterToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new QLookTableCorrectOffsetToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new QLookTableCorrectOffsetToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new QCreateGPSPointsToolButton(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) QDEMResampleDialogToolButton::QDEMResampleDialogToolButton(QWidget* parent)
@ -216,3 +232,20 @@ void QCreateGPSPointsToolButton::excute()
QtCreateGPSPointsDialog* dialog = new QtCreateGPSPointsDialog; QtCreateGPSPointsDialog* dialog = new QtCreateGPSPointsDialog;
dialog->show(); dialog->show();
} }
RasterVRT2ENVIdataDialogToolButton::RasterVRT2ENVIdataDialogToolButton(QWidget* parent)
{
this->toolPath = QVector<QString>(0);
this->toolPath.push_back(u8"基础处理");
this->toolname = QString(u8"vrt文件转换envi数据格式");
}
RasterVRT2ENVIdataDialogToolButton::~RasterVRT2ENVIdataDialogToolButton()
{
}
void RasterVRT2ENVIdataDialogToolButton::run()
{
RasterVRT2ENVIdataDialog* dialog = new RasterVRT2ENVIdataDialog;
dialog->show();
}

View File

@ -10,6 +10,8 @@ namespace LAMPMainWidget {
class ToolBoxWidget; class ToolBoxWidget;
extern "C" BASETOOLBOX_EXPORT void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox);
class BASETOOLBOX_EXPORT GF3ImportDataToolButton : public QToolAbstract { class BASETOOLBOX_EXPORT GF3ImportDataToolButton : public QToolAbstract {
Q_OBJECT Q_OBJECT
public: 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;
};

View File

@ -60,12 +60,12 @@
</ImportGroup> </ImportGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings">
<QtInstall>tools_qt5</QtInstall> <QtInstall>tools_qt5</QtInstall>
<QtModules>core</QtModules> <QtModules>core;gui;widgets</QtModules>
<QtBuildConfig>debug</QtBuildConfig> <QtBuildConfig>debug</QtBuildConfig>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="QtSettings"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="QtSettings">
<QtInstall>tools_qt5</QtInstall> <QtInstall>tools_qt5</QtInstall>
<QtModules>core</QtModules> <QtModules>core;gui;widgets</QtModules>
<QtBuildConfig>debug</QtBuildConfig> <QtBuildConfig>debug</QtBuildConfig>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="QtSettings"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="QtSettings">
@ -122,6 +122,7 @@
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration> <EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<LanguageStandard>stdcpp14</LanguageStandard> <LanguageStandard>stdcpp14</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C> <LanguageStandard_C>stdc11</LanguageStandard_C>
<Optimization>Disabled</Optimization>
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
@ -207,10 +208,13 @@
<ClCompile Include="BaseToolbox\QResampleRefrenceRaster.cpp" /> <ClCompile Include="BaseToolbox\QResampleRefrenceRaster.cpp" />
<ClCompile Include="BaseToolbox\QtCreateGPSPointsDialog.cpp" /> <ClCompile Include="BaseToolbox\QtCreateGPSPointsDialog.cpp" />
<ClCompile Include="BaseToolbox\QtLookTableCorrectOffsetDialog.cpp" /> <ClCompile Include="BaseToolbox\QtLookTableCorrectOffsetDialog.cpp" />
<ClCompile Include="BaseToolbox\RasterVRT2ENVIdataDialog.cpp" />
<ClCompile Include="BaseToolbox\SatelliteGF3xmlParser.cpp" /> <ClCompile Include="BaseToolbox\SatelliteGF3xmlParser.cpp" />
<ClCompile Include="BaseToolbox\SateOrbit.cpp" /> <ClCompile Include="BaseToolbox\SateOrbit.cpp" />
<ClCompile Include="BaseToolbox\simptsn.cpp" /> <ClCompile Include="BaseToolbox\simptsn.cpp" />
<ClCompile Include="BaseToolbox\WGS84_J2000.cpp" /> <ClCompile Include="BaseToolbox\WGS84_J2000.cpp" />
<ClCompile Include="SARSatalliteSimulationWorkflow.cpp" />
<QtMoc Include="SARSatalliteSimulationWorkflow.h" />
<QtMoc Include="BaseToolbox\DEMLLA2XYZTool.h" /> <QtMoc Include="BaseToolbox\DEMLLA2XYZTool.h" />
<ClInclude Include="BaseToolbox\GF3CalibrationAndGeocodingClass.h" /> <ClInclude Include="BaseToolbox\GF3CalibrationAndGeocodingClass.h" />
<ClInclude Include="BaseToolbox\GF3PSTNClass.h" /> <ClInclude Include="BaseToolbox\GF3PSTNClass.h" />
@ -225,6 +229,7 @@
<QtMoc Include="BaseToolbox\QResampleRefrenceRaster.h" /> <QtMoc Include="BaseToolbox\QResampleRefrenceRaster.h" />
<QtMoc Include="BaseToolbox\QtLookTableCorrectOffsetDialog.h" /> <QtMoc Include="BaseToolbox\QtLookTableCorrectOffsetDialog.h" />
<QtMoc Include="BaseToolbox\QtCreateGPSPointsDialog.h" /> <QtMoc Include="BaseToolbox\QtCreateGPSPointsDialog.h" />
<QtMoc Include="BaseToolbox\RasterVRT2ENVIdataDialog.h" />
<ClInclude Include="BaseToolbox\SatelliteGF3xmlParser.h" /> <ClInclude Include="BaseToolbox\SatelliteGF3xmlParser.h" />
<ClInclude Include="BaseToolbox\SateOrbit.h" /> <ClInclude Include="BaseToolbox\SateOrbit.h" />
<ClInclude Include="BaseToolbox\simptsn.h" /> <ClInclude Include="BaseToolbox\simptsn.h" />
@ -246,6 +251,7 @@
<QtUic Include="BaseToolbox\QResampleRefrenceRaster.ui" /> <QtUic Include="BaseToolbox\QResampleRefrenceRaster.ui" />
<QtUic Include="BaseToolbox\QtCreateGPSPointsDialog.ui" /> <QtUic Include="BaseToolbox\QtCreateGPSPointsDialog.ui" />
<QtUic Include="BaseToolbox\QtLookTableCorrectOffsetDialog.ui" /> <QtUic Include="BaseToolbox\QtLookTableCorrectOffsetDialog.ui" />
<QtUic Include="BaseToolbox\RasterVRT2ENVIdataDialog.ui" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\BaseCommonLibrary\BaseCommonLibrary.vcxproj"> <ProjectReference Include="..\..\BaseCommonLibrary\BaseCommonLibrary.vcxproj">

View File

@ -106,6 +106,12 @@
<ClCompile Include="BaseToolbox\QtCreateGPSPointsDialog.cpp"> <ClCompile Include="BaseToolbox\QtCreateGPSPointsDialog.cpp">
<Filter>BaseToolbox</Filter> <Filter>BaseToolbox</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="BaseToolbox\RasterVRT2ENVIdataDialog.cpp">
<Filter>BaseToolbox</Filter>
</ClCompile>
<ClCompile Include="SARSatalliteSimulationWorkflow.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<QtMoc Include="BaseToolbox\DEMLLA2XYZTool.h"> <QtMoc Include="BaseToolbox\DEMLLA2XYZTool.h">
@ -147,6 +153,12 @@
<QtMoc Include="BaseToolbox\QtCreateGPSPointsDialog.h"> <QtMoc Include="BaseToolbox\QtCreateGPSPointsDialog.h">
<Filter>BaseToolbox</Filter> <Filter>BaseToolbox</Filter>
</QtMoc> </QtMoc>
<QtMoc Include="BaseToolbox\RasterVRT2ENVIdataDialog.h">
<Filter>BaseToolbox</Filter>
</QtMoc>
<QtMoc Include="SARSatalliteSimulationWorkflow.h">
<Filter>Header Files</Filter>
</QtMoc>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<QtUic Include="BaseToolbox\DEMLLA2XYZTool.ui"> <QtUic Include="BaseToolbox\DEMLLA2XYZTool.ui">
@ -185,5 +197,8 @@
<QtUic Include="BaseToolbox\QtCreateGPSPointsDialog.ui"> <QtUic Include="BaseToolbox\QtCreateGPSPointsDialog.ui">
<Filter>BaseToolbox</Filter> <Filter>BaseToolbox</Filter>
</QtUic> </QtUic>
<QtUic Include="BaseToolbox\RasterVRT2ENVIdataDialog.ui">
<Filter>BaseToolbox</Filter>
</QtUic>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -26,7 +26,7 @@ ErrorCode GF3CalibrationRaster(QString inRasterPath, QString outRasterPath, doub
double quayCoff = Qualifyvalue * 1.0 / 32767; double quayCoff = Qualifyvalue * 1.0 / 32767;
double caliCoff = std::pow(10.0, (calibrationConst * 1.0 / 20)); double caliCoff = std::pow(10.0, (calibrationConst * 1.0 / 20));
qDebug() << "定标系数:\t" << quayCoff / caliCoff; qDebug() << u8"定标系数:\t" << quayCoff / caliCoff;
long startrow = 0; long startrow = 0;
for (startrow = 0; startrow < imgraster.height; startrow = startrow + blocklines) { 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; imgArr.imag() = imgArrb2.array() * quayCoff / caliCoff;
outraster.saveImage(imgArr, startrow, 0, 1); outraster.saveImage(imgArr, startrow, 0, 1);
} }
qDebug() << "影像写入到:" << outRasterPath; qDebug() << u8"影像写入到:" << outRasterPath;
return ErrorCode::SUCCESS; return ErrorCode::SUCCESS;
} }
@ -80,29 +80,29 @@ ErrorCode ImportGF3L1ARasterToWorkspace(QString inMetaxmlPath, QString inRasterP
QString outRasterpath = l1dataset.getImageRasterPath(); QString outRasterpath = l1dataset.getImageRasterPath();
ErrorCode errorcode = ErrorCode::SUCCESS; ErrorCode errorcode = ErrorCode::SUCCESS;
qDebug() << "导入数据:\t" << inRasterPath; qDebug() << u8"导入数据:\t" << inRasterPath;
switch (polsartype) switch (polsartype)
{ {
case POLARHH: case POLARHH:
qDebug() << "极化HH"; qDebug() << u8"极化HH";
errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.HH_QualifyValue, gf3xml.HH_CalibrationConst); errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.HH_QualifyValue, gf3xml.HH_CalibrationConst);
break; break;
case POLARHV: case POLARHV:
qDebug() << "极化HH"; qDebug() << u8"极化HH";
errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.HV_QualifyValue, gf3xml.HV_CalibrationConst); errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.HV_QualifyValue, gf3xml.HV_CalibrationConst);
break; break;
case POLARVH: case POLARVH:
qDebug() << "极化VH"; qDebug() << u8"极化VH";
errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.VH_QualifyValue, gf3xml.VH_CalibrationConst); errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.VH_QualifyValue, gf3xml.VH_CalibrationConst);
break; break;
case POLARVV: case POLARVV:
qDebug() << "极化VV"; qDebug() << u8"极化VV";
errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.VV_QualifyValue, gf3xml.VV_CalibrationConst); errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.VV_QualifyValue, gf3xml.VV_CalibrationConst);
break; break;
default: default:
break; break;
} }
qDebug() << "导入数据状态:\t" << QString::fromStdString(errorCode2errInfo(errorcode)); qDebug() << u8"导入数据状态:\t" << QString::fromStdString(errorCode2errInfo(errorcode));
return errorcode; return errorcode;
} }
@ -115,7 +115,7 @@ QVector<QString> SearchGF3DataTiff(QString inMetaxmlPath)
// 获取路径所在的目录 // 获取路径所在的目录
QDir directory(absPath); QDir directory(absPath);
if (!directory.exists()) { if (!directory.exists()) {
qDebug() << "Directory does not exist:" << directory.absolutePath(); qDebug() << u8"Directory does not exist:" << directory.absolutePath();
return QVector<QString>(0); return QVector<QString>(0);
} }
@ -124,7 +124,7 @@ QVector<QString> SearchGF3DataTiff(QString inMetaxmlPath)
filters << "*.tif" << "*.TIF" << "*.tiff" << "*.TIFF"; filters << "*.tif" << "*.TIF" << "*.tiff" << "*.TIFF";
QStringList files = directory.entryList(filters, QDir::Files); 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<QString> filepath(0); QVector<QString> filepath(0);
for (long i = 0; i < files.count(); i++) { for (long i = 0; i < files.count(); i++) {
@ -144,7 +144,7 @@ POLARTYPEENUM getDatasetGF3FilePolsarType(QString fileName)
if (match.hasMatch()) { if (match.hasMatch()) {
polarization = match.captured(1); polarization = match.captured(1);
polarization = polarization.toLower().replace("_", ""); polarization = polarization.toLower().replace("_", "");
qDebug() << "Polarization extracted:" << polarization; qDebug() << u8"Polarization extracted:" << polarization;
if (polarization == "hh") { if (polarization == "hh") {
return POLARTYPEENUM::POLARHH; return POLARTYPEENUM::POLARHH;
} }
@ -162,7 +162,7 @@ POLARTYPEENUM getDatasetGF3FilePolsarType(QString fileName)
} }
} }
else { else {
qDebug() << "No polarization found in the path."; qDebug() << u8"No polarization found in the path.";
return POLARTYPEENUM::POLARUNKOWN; return POLARTYPEENUM::POLARUNKOWN;
} }
@ -199,7 +199,7 @@ ErrorCode ImportGF3L1AProcess(QString inMetaxmlPath, QString outWorkDirPath)
break; break;
} }
if (errorcode == ErrorCode::SUCCESS) { if (errorcode == ErrorCode::SUCCESS) {
return errorcode; continue;
} }
else { else {
QMessageBox::warning(nullptr, u8"错误", u8"数据导入错误"); QMessageBox::warning(nullptr, u8"错误", u8"数据导入错误");
@ -209,94 +209,10 @@ ErrorCode ImportGF3L1AProcess(QString inMetaxmlPath, QString outWorkDirPath)
return errorcode; 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"请输入WGS84坐标的DEM影像");
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) 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; double inct = 0;
bool antfalg = false; bool antfalg = false;
double timeR2 = 0; 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++) { for (int i = 0; i < 50; i++) {
polyfitmodel.getSatelliteOribtNode(timeR, node, antfalg); 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)); 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); //dplerTheory1 = (-2 / lamda / R1) * ((node.Px - tx) * (node.Vx + EARTHWE * ty) + (node.Py - ty) * (node.Vy - EARTHWE * tx) + (node.Pz - tz) * (node.Vz - 0));
dplerR = (R1 - refrange) * 1e6 / LIGHTSPEED; 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; dplerNumber1 = d0 + dplerR * d1 + std::pow(dplerR, 2) * d2 + std::pow(dplerR, 3) * d3 + std::pow(dplerR, 4) * d4;
timeR2 = timeR + dt; timeR2 = timeR + dt;
polyfitmodel.getSatelliteOribtNode(timeR2, node, antfalg); 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)); 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); //dplerTheory2 = (-2 / lamda/R2) * ((node.Px - tx) * (node.Vx + EARTHWE * ty) + (node.Py - ty) * (node.Vy - EARTHWE * tx) + (node.Pz - tz) * (node.Vz - 0));
dplerR = (R2 - refrange) * 1e6 / LIGHTSPEED; dplerTheory2 = (-2 / lamda/R2) * ((node.Px - tx) * (node.Vx +0) + (node.Py - ty) * (node.Vy -0) + (node.Pz - tz) * (node.Vz - 0));
dplerNumber2 = d0 + dplerR * d1 + std::pow(dplerR, 2) * d2 + std::pow(dplerR, 3) * d3 + std::pow(dplerR, 4) * d4; //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) / (dplerTheory1 - dplerTheory2); inct = dt*(dplerTheory2-dplerNumber1) / (dplerTheory2 - dplerTheory1);
if (std::abs(dplerTheory1 - dplerTheory2) < 1e-9 || std::abs(inct) < dt) { if (std::abs(dplerNumber1 - dplerTheory2) < 1e-6 || std::abs(inct) < 1.0e-4) {
break; break;
} }
inct = std::abs(inct) < 10 ?inct:inct*1e-2;
timeR = timeR - inct; timeR = timeR - inct;
} }
R = R1; // 斜距 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 rasterRC = CreategdalImage(outlooktablePath, demxyz.height, demxyz.width, 2, demxyz.gt, demxyz.projection, true, true);// X,Y,Z
gdalImage localincangleRaster; gdalImage localincangleRaster;
if (localincAngleFlag) { 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,19 +282,38 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out
double d3 = dopplers[3]; double d3 = dopplers[3];
double d4 = dopplers[4]; double d4 = dopplers[4];
double fs = l1dataset.getFs();// Fs采样 double fs = l1dataset.getFs()*1e6;// Fs采样
double prf = (l1dataset.getEndImageTime() - l1dataset.getStartImageTime()) / (l1dataset.getrowCount() - 1);// PRF 采样 double prf = l1dataset.getPRF();// PRF 采样
double nearRange = l1dataset.getNearRange(); double nearRange = l1dataset.getNearRange();
double imagestarttime = l1dataset.getStartImageTime(); double imagestarttime = l1dataset.getStartImageTime();
double imageendtime = l1dataset.getEndImageTime();
double refrange = l1dataset.getRefRange(); 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; GF3PolyfitSatelliteOribtModel polyfitmodel;
QVector < SatelliteAntPos > antposes = l1dataset.getXmlSateAntPos(); QVector < SatelliteAntPos > antposes = l1dataset.getXmlSateAntPos();
polyfitmodel.setSatelliteOribtStartTime(imagestarttime); polyfitmodel.setSatelliteOribtStartTime((imagestarttime+imageendtime)/2);
for (long i = 0; i < antposes.size(); i++) { for (long i = 0; i < antposes.size(); i++) {
if (antposes[i].time > imagestarttime - 5 && antposes[i].time < imageendtime + 5) {
SatelliteOribtNode node; SatelliteOribtNode node;
node.time = antposes[i].time; node.time = antposes[i].time;
node.Px = antposes[i].Px; node.Px = antposes[i].Px;
@ -386,21 +324,22 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out
node.Vz = antposes[i].Vz; node.Vz = antposes[i].Vz;
polyfitmodel.addOribtNode(node); polyfitmodel.addOribtNode(node);
} }
}
polyfitmodel.polyFit(3, false); polyfitmodel.polyFit(3, false);
qDebug() << "-----------------------------------"; qDebug() << "-----------------------------------";
qDebug() << "satellite polyfit model params:\n"; qDebug() << u8"satellite polyfit model params:\n";
qDebug() << polyfitmodel.getSatelliteOribtModelParamsString(); qDebug() << polyfitmodel.getSatelliteOribtModelParamsString();
qDebug() << "-----------------------------------"; qDebug() << "-----------------------------------";
// 开始计算查找表 // 开始计算查找表
//1.计算分块 //1.计算分块
long cpucore_num = std::thread::hardware_concurrency(); long cpucore_num = std::thread::hardware_concurrency();
long blockline = Memory1MB * 500 / 8 / cpucore_num / 4 / l1dataset.getcolCount(); long blocklineinit = Memory1MB / 8 / cpucore_num / 4 / l1dataset.getcolCount() * 8000;
blockline = blockline < 50 ? 50 : blockline; blocklineinit = blocklineinit < 50 ? 50 : blocklineinit;
//2.迭代计算 //2.迭代计算
long colcount = l1dataset.getcolCount(); long colcount = rasterRC.width;//l1dataset.getcolCount();
long rowcount = l1dataset.getrowCount(); long rowcount = rasterRC.height;//l1dataset.getrowCount();
long startRId = 0; long startRId = 0;
long processNumber = 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_r = rasterRC.getData(startRId, 0, blockline, colcount, 1);
Eigen::MatrixXd sar_c = rasterRC.getData(startRId, 0, blockline, colcount, 2); 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_x = demxyz.getData(startRId, 0, blockline, colcount, 1);
Eigen::MatrixXd dem_y = demxyz.getData(startRId, 0, blockline, colcount, 2); Eigen::MatrixXd dem_y = demxyz.getData(startRId, 0, blockline, colcount, 2);
Eigen::MatrixXd dem_z = demxyz.getData(startRId, 0, blockline, colcount, 3); Eigen::MatrixXd dem_z = demxyz.getData(startRId, 0, blockline, colcount, 3);
// 逐像素迭代计算
double timeR = 0;
long blockrows = sar_r.rows(); long blockrows = sar_r.rows();
long blockcols = sar_r.cols(); long blockcols = sar_r.cols();
#pragma omp parallel for
for (long i = 0; i < blockrows; i++) {
// 逐像素迭代计算
double timeR = 0;
double tx = 0; double tx = 0;
double ty = 0; double ty = 0;
double tz = 0; double tz = 0;
double R = 0; double R = 0;
double slopex=0, slopey=0, slopez=0; double slopex = 0, slopey = 0, slopez = 0;
SatelliteOribtNode node{0,0,0,0,0,0,0,0}; SatelliteOribtNode node{ 0,0,0,0,0,0,0,0 };
bool antflag = false; bool antflag = false;
for (long i = 0; i < blockrows; i++) {
for (long j = 0; j < blockcols; j++) { for (long j = 0; j < blockcols; j++) {
tx = dem_x(i, j); tx = dem_x(i, j);
ty = dem_y(i, j); ty = dem_y(i, j);
tz = dem_z(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) { 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_r(i, j) =( timeR+ (imagestarttime + imageendtime) / 2 -imagestarttime) * prf;
sar_c(i, j) = ((R - nearRange) / 2 / LIGHTSPEED) * fs; sar_c(i, j) = ((R - nearRange) * 2 / LIGHTSPEED) * fs;
} }
else { else {
sar_r(i, j) = -1; 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; Eigen::MatrixXd Angle_Arr = Eigen::MatrixXd::Zero(dem_x.rows(),dem_x.cols()).array()+181;
if (localincAngleFlag) { if (localincAngleFlag) {
Eigen::MatrixXd demslope_x = demslope.getData(startRId, 0, blockline, colcount, 1); 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 Rst_x = 0, Rst_y = 0, Rst_z = 0, localangle = 0;
double slopeR = 0; double slopeR = 0;
#pragma omp parallel for
for (long i = 0; i < blockrows; i++) { 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++) { for (long j = 0; j < blockcols; j++) {
timeR = sar_r(i, j) / prf; timeR = sar_r(i, j) / prf;
slopex = demslope_x(i, j); slopex = demslope_x(i, j);
@ -482,18 +450,25 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out
Angle_Arr(i, j) = localangle; Angle_Arr(i, j) = localangle;
} }
} }
}
// 保存结果 // 保存结果
omp_set_lock(&lock); omp_set_lock(&lock);
rasterRC.saveImage(sar_r, startRId, 0, 1);
rasterRC.saveImage(sar_c, startRId, 0, 2);
if (localincAngleFlag) { if (localincAngleFlag) {
localincangleRaster.saveImage(Angle_Arr, startRId, 0, 1); localincangleRaster.saveImage(Angle_Arr, startRId, 0, 1);
} }
else {} else {}
omp_unset_lock(&lock);
}
// 保存结果
omp_set_lock(&lock);
processNumber = processNumber + blockrows; 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) { if (progressDialog.maximum() <= processNumber) {
processNumber = progressDialog.maximum() - 1; processNumber = progressDialog.maximum() - 1;
} }
@ -511,16 +486,17 @@ ErrorCode GF3OrthSLC( QString inRasterPath, QString inlooktablePath, QString out
gdalImage slcRaster(inRasterPath);// gdalImage slcRaster(inRasterPath);//
gdalImage looktableRaster(inlooktablePath);// 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) { if (outRaster.height != looktableRaster.height || outRaster.width != looktableRaster.width) {
qDebug() << "look table size is not same as outRaster size"<< looktableRaster.height <<"!="<<outRaster.height<<" "<<looktableRaster.width<<"!="<<outRaster.width; qDebug() << u8"look table size is not same as outRaster size"<< looktableRaster.height <<"!="<<outRaster.height<<" "<<looktableRaster.width<<"!="<<outRaster.width;
return ErrorCode::FAIL; return ErrorCode::FAIL;
} }
Eigen::MatrixXd slcImg = slcRaster.getData(0, 0, slcRaster.height, slcRaster.width, 1); Eigen::MatrixXd slcImg = slcRaster.getData(0, 0, slcRaster.height, slcRaster.width, 1);
Eigen::MatrixXd sar_r = looktableRaster.getData(0, 0, looktableRaster.height, looktableRaster.width, 1); Eigen::MatrixXd sar_r = looktableRaster.getData(0, 0, looktableRaster.height, looktableRaster.width, 1);
Eigen::MatrixXd sar_c = looktableRaster.getData(0, 0, looktableRaster.height, looktableRaster.width, 1); Eigen::MatrixXd sar_c = looktableRaster.getData(0, 0, looktableRaster.height, looktableRaster.width, 2);
Eigen::MatrixXd outImg = outRaster.getData(0, 0, outRaster.height, outRaster.width, 1); Eigen::MatrixXd outImg = outRaster.getData(0, 0, outRaster.height, outRaster.width, 1);
long lookRows = sar_r.rows(); long lookRows = sar_r.rows();
@ -549,7 +525,7 @@ ErrorCode GF3OrthSLC( QString inRasterPath, QString inlooktablePath, QString out
for (long i = 0; i < lookRows; i++) { for (long i = 0; i < lookRows; i++) {
for (long j = 0; j < lookCols; j++) { for (long j = 0; j < lookCols; j++) {
p0 = {sar_r(i,j),sar_c(i,j),0};
lastr = std::floor(sar_r(i, j)); lastr = std::floor(sar_r(i, j));
nextr = std::ceil(sar_r(i, j)); nextr = std::ceil(sar_r(i, j));
lastc = std::floor(sar_c(i, j)); lastc = std::floor(sar_c(i, j));
@ -557,11 +533,13 @@ ErrorCode GF3OrthSLC( QString inRasterPath, QString inlooktablePath, QString out
if (lastr < 0 || lastc < 0 || nextr >= slcRows || nextc >= slcCols) { if (lastr < 0 || lastc < 0 || nextr >= slcRows || nextc >= slcCols) {
continue; 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) }; p11 = Landpoint{ 0,0,slcImg(lastr,lastc) };
p21 = Landpoint{ 0,1,slcImg(nextr,lastc) }; p21 = Landpoint{ 0,1,slcImg(nextr,lastc) };
p12 = Landpoint{ 1,0,slcImg(lastr,nextc) }; p12 = Landpoint{ 1,0,slcImg(lastr,nextc) };
p22 = Landpoint{ 1,1,slcImg(nextr,nextc) }; p22 = Landpoint{ 1,1,slcImg(nextr,nextc) };
Bileanervalue = Bilinear_interpolation(p0, p11, p21, p12, p22); Bileanervalue = Bilinear_interpolation(p0, p11, p21, p12, p22);
outImg(i, j) = Bileanervalue; outImg(i, j) = Bileanervalue;
} }
@ -585,6 +563,35 @@ ErrorCode GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir,
double minlon = box.min_lon - dlon; double minlon = box.min_lon - dlon;
double maxlat = box.max_lat + dlat; double maxlat = box.max_lat + dlat;
double maxlon = box.max_lon + dlon; 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"输入分辨率:"<<gridx<<" \t" << gridy;
qDebug() << u8"影像分辨率:\t" << grid_resolution;
qDebug() << u8"分辨率转换为经纬度:\t" << degreePerPixelX << "\t" << degreePerPixelY;
// 计算DEM的分辨率
// 裁剪DEM // 裁剪DEM
QString filename = getFileNameWidthoutExtend(l1dataset.getxmlFilePath()); QString filename = getFileNameWidthoutExtend(l1dataset.getxmlFilePath());
@ -592,7 +599,7 @@ ErrorCode GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir,
QString clipDEMPath = JoinPath(outworkdir, getFileNameWidthoutExtend(indemPath) + filename + "_clip.tif"); QString clipDEMPath = JoinPath(outworkdir, getFileNameWidthoutExtend(indemPath) + filename + "_clip.tif");
cropRasterByLatLon(indemPath.toUtf8().constData(), clipDEMPath.toUtf8().constData(), minlon, maxlon, minlat, maxlat); cropRasterByLatLon(indemPath.toUtf8().constData(), clipDEMPath.toUtf8().constData(), minlon, maxlon, minlat, maxlat);
QString resampleDEMPath = JoinPath(outworkdir, getFileNameWidthoutExtend(indemPath) + filename + "_clip_resample.tif"); QString resampleDEMPath = JoinPath(outworkdir, getFileNameWidthoutExtend(indemPath) + filename + "_clip_resample.tif");
resampleRaster(clipDEMPath.toUtf8().constData(), resampleDEMPath.toUtf8().constData(), gridx, gridy); resampleRaster(clipDEMPath.toUtf8().constData(), resampleDEMPath.toUtf8().constData(), degreePerPixelX, degreePerPixelY);
QString outlooktablePath = JoinPath(outworkdir, getFileNameWidthoutExtend(l1dataset.getxmlFilePath()) + "_looktable.tif"); QString outlooktablePath = JoinPath(outworkdir, getFileNameWidthoutExtend(l1dataset.getxmlFilePath()) + "_looktable.tif");
@ -600,12 +607,8 @@ ErrorCode GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir,
QString outOrthPath=JoinPath(outworkdir, getFileNameWidthoutExtend(l1dataset.getxmlFilePath()) + "_orth.tif"); QString outOrthPath=JoinPath(outworkdir, getFileNameWidthoutExtend(l1dataset.getxmlFilePath()) + "_orth.tif");
if (GF3RDCreateLookTable(inxmlPath, resampleDEMPath, outworkdir, outlooktablePath, outlocalAnglePath,true) != ErrorCode::SUCCESS) { if (GF3RDCreateLookTable(inxmlPath, resampleDEMPath, outworkdir, outlooktablePath, outlocalAnglePath,true) != ErrorCode::SUCCESS) {
qDebug() << "查找表生成错误:\t" + getFileNameWidthoutExtend(inxmlPath); qDebug() << u8"查找表生成错误:\t" + getFileNameWidthoutExtend(inxmlPath);
return ErrorCode::FAIL; return ErrorCode::FAIL;
} }
return ErrorCode::SUCCESS; return ErrorCode::SUCCESS;
} }

View File

@ -17,14 +17,7 @@ QVector<QString> SearchGF3DataTiff(QString inMetaxmlPath);
POLARTYPEENUM getDatasetGF3FilePolsarType(QString fileName); POLARTYPEENUM getDatasetGF3FilePolsarType(QString fileName);
ErrorCode ImportGF3L1AProcess(QString inMetaxmlPath, QString outWorkDirPath); 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 Ëã·¨Àà // 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); 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); ErrorCode GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir, double gridx, double gridy);

View File

@ -66,7 +66,7 @@ QString GF3PolyfitSatelliteOribtModel::getSatelliteOribtModelParamsString()
result += QString::number(this->polyfitVz[i], 'e', 6) + "\n"; result += QString::number(this->polyfitVz[i], 'e', 6) + "\n";
} }
result += "------------------------------------------------------\n"; result += "------------------------------------------------------\n";
printf("%s\n", result.toUtf8().constData());
return result; return result;
} }

View File

@ -5,6 +5,7 @@
#include "BaseTool.h" #include "BaseTool.h"
#include "SARSimulationImageL1.h" #include "SARSimulationImageL1.h"
#include "GF3CalibrationAndGeocodingClass.h" #include "GF3CalibrationAndGeocodingClass.h"
#include "RasterToolBase.h"
QComplex2AmpPhase::QComplex2AmpPhase(QWidget *parent) QComplex2AmpPhase::QComplex2AmpPhase(QWidget *parent)
: QDialog(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.radioButtonAmp,SIGNAL(toggled(bool)),this,SLOT(radioButtonAmptoggled(bool)));
QObject::connect(ui.radioButtonPhase, SIGNAL(toggled(bool)), this, SLOT(radioButtonPhasetoggled(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.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())); QObject::connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(onreject()));
//toggled(bool ) //toggled(bool )
} }
@ -46,19 +48,19 @@ void QComplex2AmpPhase::onaccept()
slcl1.Open(folderpath, filename); slcl1.Open(folderpath, filename);
QString l2bfilename = filename + ui.lineEditHZ->text(); QString l2bfilename = filename + ui.lineEditHZ->text();
SARSimulationImageL1Dataset l1B(RasterLevel::RasterL1B); 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 srcxmlpath = slcl1.getxmlFilePath();
QString tarxmlpath = l1B.getxmlFilePath(); QString tarxmlpath = l1B.getxmlFilePath();
copyAndReplaceFile(srcxmlpath, tarxmlpath); copyAndReplaceFile(srcxmlpath, tarxmlpath);
l1B.loadFromXml(); l1B.loadFromXml();
if (ui.radioButtonAmp->isChecked()) { if (ui.radioButtonAmp->isChecked()) {
Complex2AmpRaster(imgfilepath, slcl1.getImageRasterPath()); Complex2AmpRaster(imgfilepath, l1B.getImageRasterPath());
} }
else if (ui.radioButtonPhase->isChecked()) { else if (ui.radioButtonPhase->isChecked()) {
Complex2PhaseRaster(imgfilepath, slcl1.getImageRasterPath()); Complex2PhaseRaster(imgfilepath, l1B.getImageRasterPath());
} }
else if (ui.radioButtonSigma0->isChecked()) { else if (ui.radioButtonSigma0->isChecked()) {
Complex2dBRaster(imgfilepath, slcl1.getImageRasterPath()); Complex2dBRaster(imgfilepath, l1B.getImageRasterPath());
} }
progressDialog.setValue(i); progressDialog.setValue(i);
} }

View File

@ -7,10 +7,9 @@ QImportGF3StripL1ADataset::QImportGF3StripL1ADataset(QWidget *parent)
{ {
ui.setupUi(this); ui.setupUi(this);
QListWidget* listWidgetMetaxml; QObject::connect(ui.pushButtonAdd,SIGNAL(clicked(bool)),this,SLOT(onpushButtonAddClicked(bool)));
QObject::connect(ui.pushButtonAdd,SIGNAL(clicked(clicked)),this,SLOT(onpushButtonAddClicked(bool))); QObject::connect(ui.pushButtonRemove, SIGNAL(clicked(bool)), this, SLOT(onpushButtonRemoveClicked(bool)));
QObject::connect(ui.pushButtonRemove, SIGNAL(clicked(clicked)), this, SLOT(onpushButtonRemoveClicked(bool))); QObject::connect(ui.pushButtonWorkSpace, SIGNAL(clicked(bool)), this, SLOT(onpushButtonWorkSpaceClicked(bool)));
QObject::connect(ui.pushButtonWorkSpace, SIGNAL(clicked(clicked)), this, SLOT(onpushButtonWorkSpaceClicked(bool)));
QObject::connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(onreject())); QObject::connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(onreject()));
QObject::connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(onaccept())); QObject::connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(onaccept()));

View File

@ -14,10 +14,10 @@ QOrthSlrRaster::QOrthSlrRaster(QWidget *parent)
connect(ui.pushButtonAdd, SIGNAL(clicked(bool)), this, SLOT(onpushButtonAddClicked(bool))); connect(ui.pushButtonAdd, SIGNAL(clicked(bool)), this, SLOT(onpushButtonAddClicked(bool)));
connect(ui.pushButtonRemove, SIGNAL(clicked(bool)), this, SLOT(onpushButtonRemoveClicked(bool))); connect(ui.pushButtonRemove, SIGNAL(clicked(bool)), this, SLOT(onpushButtonRemoveClicked(bool)));
connect(ui.pushButtonDEMSelect, SIGNAL(clicked(bool)), this, SLOT(onpushButtonWorkSpaceClicked(bool))); connect(ui.pushButtonDEMSelect, SIGNAL(clicked(bool)), this, SLOT(pushButtonDEMSelectClicked(bool)));
connect(ui.pushButtonWorkSpace, 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(rejected()), this, SLOT(onreject()));
QObject::connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(onreject())); QObject::connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(onaccept()));
} }
QOrthSlrRaster::~QOrthSlrRaster() QOrthSlrRaster::~QOrthSlrRaster()
@ -61,7 +61,7 @@ void QOrthSlrRaster::onpushButtonAddClicked(bool)
this, // 父窗口 this, // 父窗口
tr(u8"选择xml文件"), // 标题 tr(u8"选择xml文件"), // 标题
QString(), // 默认路径 QString(), // 默认路径
tr(u8"xml Files (*.xml);;All Files (*)") // Îļþ¹ýÂËÆ÷ tr(ENVI_FILE_FORMAT_FILTER) // 文件过滤器
); );
// 如果用户选择了文件 // 如果用户选择了文件

View File

@ -10,8 +10,8 @@ QRDOrthProcessClass::QRDOrthProcessClass(QWidget *parent)
connect(ui.pushButtonAdd,SIGNAL(clicked(bool)),this,SLOT(onpushButtonAddClicked(bool))); connect(ui.pushButtonAdd,SIGNAL(clicked(bool)),this,SLOT(onpushButtonAddClicked(bool)));
connect(ui.pushButtonRemove,SIGNAL(clicked(bool)),this,SLOT(onpushButtonRemoveClicked(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(onpushButtonWorkSpaceClicked(bool)));
connect(ui.pushButtonWorkSpace, SIGNAL(clicked(bool)), this, SLOT(pushButtonDEMSelectClicked(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(rejected()), this, SLOT(onreject()));
QObject::connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(onaccept())); QObject::connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(onaccept()));
// QDialogButtonBox* buttonBox; // QDialogButtonBox* buttonBox;

View File

@ -0,0 +1,77 @@
#include "RasterVRT2ENVIdataDialog.h"
#include "ui_RasterVRT2ENVIdataDialog.h"
#include "BaseConstVariable.h"
#include "BaseTool.h"
#include "RasterToolBase.h"
#include "LogInfoCls.h"
#include <QMessageBox>
#include <QFileDialog>
#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();
}

View File

@ -0,0 +1,26 @@
#pragma once
#include <QDialog>
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;
};

View File

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>RasterVRT2ENVIdataDialogClass</class>
<widget class="QDialog" name="RasterVRT2ENVIdataDialogClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>396</width>
<height>156</height>
</rect>
</property>
<property name="windowTitle">
<string>RasterVRT2ENVIdataDialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonVRTSelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditENVIDatPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditVRTPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonENVIDatSelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>vrt文件地址</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>输出dat地址</string>
</property>
</widget>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -5,24 +5,41 @@
bool SatelliteGF3xmlParser::loadFile(const QString& filename) { bool SatelliteGF3xmlParser::loadFile(const QString& filename) {
QFile file(filename); QFile file(filename);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
qWarning() << "Cannot open file:" << filename; qWarning() << u8"Cannot open file:" << filename;
return false; return false;
} }
QDomDocument doc; QDomDocument doc;
if (!doc.setContent(&file)) { if (!doc.setContent(&file)) {
file.close(); 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; return false;
} }
file.close(); file.close();
xml = doc; 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; return true;
} }
void SatelliteGF3xmlParser::parsePlatform() { void SatelliteGF3xmlParser::parsePlatform() {
QDomElement platform = xml.firstChildElement("root").firstChildElement("platform"); QDomElement platform = xml.firstChildElement("product").firstChildElement("platform");
if (!platform.isNull()) { if (!platform.isNull()) {
CenterTime = platform.firstChildElement("CenterTime").text(); CenterTime = platform.firstChildElement("CenterTime").text();
Rs = platform.firstChildElement("Rs").text().toDouble(); Rs = platform.firstChildElement("Rs").text().toDouble();
@ -37,24 +54,24 @@ void SatelliteGF3xmlParser::parsePlatform() {
Vys = platform.firstChildElement("Vys").text().toDouble(); Vys = platform.firstChildElement("Vys").text().toDouble();
Vzs = platform.firstChildElement("Vzs").text().toDouble(); Vzs = platform.firstChildElement("Vzs").text().toDouble();
qDebug() << "Platform Data:"; qDebug() << u8"Platform Data:";
qDebug() << "CenterTime:" << CenterTime; qDebug() << u8"CenterTime:" << CenterTime;
qDebug() << "Rs:" << Rs; qDebug() << u8"Rs:" << Rs;
qDebug() << "satVelocity:" << satVelocity; qDebug() << u8"satVelocity:" << satVelocity;
qDebug() << "RollAngle:" << RollAngle; qDebug() << u8"RollAngle:" << RollAngle;
qDebug() << "PitchAngle:" << PitchAngle; qDebug() << u8"PitchAngle:" << PitchAngle;
qDebug() << "YawAngle:" << YawAngle; qDebug() << u8"YawAngle:" << YawAngle;
qDebug() << "Xs:" << Xs; qDebug() << u8"Xs:" << Xs;
qDebug() << "Ys:" << Ys; qDebug() << u8"Ys:" << Ys;
qDebug() << "Zs:" << Zs; qDebug() << u8"Zs:" << Zs;
qDebug() << "Vxs:" << Vxs; qDebug() << u8"Vxs:" << Vxs;
qDebug() << "Vys:" << Vys; qDebug() << u8"Vys:" << Vys;
qDebug() << "Vzs:" << Vzs; qDebug() << u8"Vzs:" << Vzs;
} }
} }
void SatelliteGF3xmlParser::parseGPS() { void SatelliteGF3xmlParser::parseGPS() {
QDomElement GPS = xml.firstChildElement("root").firstChildElement("GPS"); QDomElement GPS = xml.firstChildElement("product").firstChildElement("GPS");
if (!GPS.isNull()) { if (!GPS.isNull()) {
QDomNodeList GPSParams = GPS.elementsByTagName("GPSParam"); QDomNodeList GPSParams = GPS.elementsByTagName("GPSParam");
for (int i = 0; i < GPSParams.count(); ++i) { for (int i = 0; i < GPSParams.count(); ++i) {
@ -69,8 +86,9 @@ void SatelliteGF3xmlParser::parseGPS() {
QString yVelocity = GPSParam.firstChildElement("yVelocity").text(); QString yVelocity = GPSParam.firstChildElement("yVelocity").text();
QString zVelocity = GPSParam.firstChildElement("zVelocity").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; TimestampMicroseconds dateTime = parseAndConvert(TimeStamp.toStdString());
satepos.time = dateTime.msecsSinceEpoch / 1000.0 + dateTime.microseconds / 100000.0;
satepos.Px = xPosition.toDouble(); satepos.Px = xPosition.toDouble();
satepos.Py = yPosition.toDouble(); satepos.Py = yPosition.toDouble();
satepos.Pz = zPosition.toDouble(); satepos.Pz = zPosition.toDouble();
@ -80,25 +98,39 @@ void SatelliteGF3xmlParser::parseGPS() {
this->antposs.append(satepos); this->antposs.append(satepos);
qDebug() << "\nGPS Param Data:"; qDebug() << u8"\nGPS Param Data:";
qDebug() << "TimeStamp:" << TimeStamp; qDebug() << u8"TimeStamp:" << TimeStamp;
qDebug() << "xPosition:" << xPosition; qDebug() << u8"xPosition:" << xPosition;
qDebug() << "yPosition:" << yPosition; qDebug() << u8"yPosition:" << yPosition;
qDebug() << "zPosition:" << zPosition; qDebug() << u8"zPosition:" << zPosition;
qDebug() << "xVelocity:" << xVelocity; qDebug() << u8"xVelocity:" << xVelocity;
qDebug() << "yVelocity:" << yVelocity; qDebug() << u8"yVelocity:" << yVelocity;
qDebug() << "zVelocity:" << zVelocity; qDebug() << u8"zVelocity:" << zVelocity;
} }
} }
} }
void SatelliteGF3xmlParser::parseImageInfo() { void SatelliteGF3xmlParser::parseImageInfo() {
QDomElement imageinfo = xml.firstChildElement("root").firstChildElement("imageinfo"); QDomElement imageinfo = xml.firstChildElement("product").firstChildElement("imageinfo");
if (!imageinfo.isNull()) { if (!imageinfo.isNull()) {
QDomElement imagingTime = imageinfo.firstChildElement("imagingTime"); QDomElement imagingTime = imageinfo.firstChildElement("imagingTime");
;
start = QDateTime::fromString(imagingTime.firstChildElement("start").text(), "yyyy-MM-dd HH:mm:ss.zzzzzz").toMSecsSinceEpoch()/1000.0; QString starttimestr = imagingTime.firstChildElement("start").text().trimmed();
end = QDateTime::fromString(imagingTime.firstChildElement("end").text(), "yyyy-MM-dd HH:mm:ss.zzzzzz").toMSecsSinceEpoch() / 1000.0; 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(); nearRange = imageinfo.firstChildElement("nearRange").text().toDouble();
refRange = imageinfo.firstChildElement("refRange").text().toDouble(); refRange = imageinfo.firstChildElement("refRange").text().toDouble();
@ -154,35 +186,36 @@ void SatelliteGF3xmlParser::parseImageInfo() {
incidenceAngleNearRange = imageinfo.firstChildElement("incidenceAngleNearRange").text().toDouble(); incidenceAngleNearRange = imageinfo.firstChildElement("incidenceAngleNearRange").text().toDouble();
incidenceAngleFarRange = imageinfo.firstChildElement("incidenceAngleFarRange").text().toDouble(); incidenceAngleFarRange = imageinfo.firstChildElement("incidenceAngleFarRange").text().toDouble();
qDebug() << "\nImage Info Data:"; qDebug() << u8"\nImage Info Data:";
qDebug() << "Start:" << start; qDebug() << u8"Start:" << start;
qDebug() << "End:" << end; qDebug() << u8"End:" << end;
qDebug() << "Near Range:" << nearRange; qDebug() << u8"Near Range:" << nearRange;
qDebug() << "Ref Range:" << refRange; qDebug() << u8"Ref Range:" << refRange;
qDebug() << "Eqv Fs:" << eqvFs; qDebug() << u8"Eqv Fs:" << eqvFs;
qDebug() << "Eqv PRF:" << eqvPRF; qDebug() << u8"Eqv PRF:" << eqvPRF;
qDebug() << "Center Latitude:" << latitude_center << ", Longitude:" << longitude_center; qDebug() << u8"Center Latitude:" << latitude_center << ", Longitude:" << longitude_center;
qDebug() << "Top Left Corner Latitude:" << latitude_topLeft << ", Longitude:" << longitude_topLeft; qDebug() << u8"Top Left Corner Latitude:" << latitude_topLeft << ", Longitude:" << longitude_topLeft;
qDebug() << "Top Right Corner Latitude:" << latitude_topRight << ", Longitude:" << longitude_topRight; qDebug() << u8"Top Right Corner Latitude:" << latitude_topRight << ", Longitude:" << longitude_topRight;
qDebug() << "Bottom Left Corner Latitude:" << latitude_bottomLeft << ", Longitude:" << longitude_bottomLeft; qDebug() << u8"Bottom Left Corner Latitude:" << latitude_bottomLeft << ", Longitude:" << longitude_bottomLeft;
qDebug() << "Bottom Right Corner Latitude:" << latitude_bottomRight << ", Longitude:" << longitude_bottomRight; qDebug() << u8"Bottom Right Corner Latitude:" << latitude_bottomRight << ", Longitude:" << longitude_bottomRight;
qDebug() << "Width:" << width; qDebug() << u8"Width:" << width;
qDebug() << "Height:" << height; qDebug() << u8"Height:" << height;
qDebug() << "Width Space:" << widthspace; qDebug() << u8"Width Space:" << widthspace;
qDebug() << "Height Space:" << heightspace; qDebug() << u8"Height Space:" << heightspace;
qDebug() << "Scene Shift:" << sceneShift; qDebug() << u8"Scene Shift:" << sceneShift;
qDebug() << "Image Bit:" << imagebit; qDebug() << u8"Image Bit:" << imagebit;
qDebug() << "HH Qualify Value:" << HH_QualifyValue; qDebug() << u8"HH Qualify Value:" << HH_QualifyValue;
qDebug() << "HV Qualify Value:" << HV_QualifyValue; qDebug() << u8"HV Qualify Value:" << HV_QualifyValue;
qDebug() << "HH Echo Saturation:" << HH_echoSaturation; qDebug() << u8"HH Echo Saturation:" << HH_echoSaturation;
qDebug() << "HV Echo Saturation:" << HV_echoSaturation; qDebug() << u8"HV Echo Saturation:" << HV_echoSaturation;
qDebug() << "incidenceAngleNearRange:" << incidenceAngleNearRange; qDebug() << u8"incidenceAngleNearRange:" << incidenceAngleNearRange;
qDebug() << "incidenceAngleFarRange:" << incidenceAngleFarRange; qDebug() << u8"incidenceAngleFarRange:" << incidenceAngleFarRange;
} }
} }
void SatelliteGF3xmlParser::parseAdditionalData() { 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()) { if (!calibrationConst.isNull()) {
bool HH_CalibrationConstISNULL=false; bool HH_CalibrationConstISNULL=false;
@ -201,50 +234,50 @@ void SatelliteGF3xmlParser::parseAdditionalData() {
qDebug() << "\nCalibration Const Data:"; qDebug() << u8"\nCalibration Const Data:";
qDebug() << "HH Calibration Const:" << HH_CalibrationConst; qDebug() << u8"HH Calibration Const:" << HH_CalibrationConst;
qDebug() << "HV Calibration Const:" << HV_CalibrationConst; qDebug() << u8"HV Calibration Const:" << HV_CalibrationConst;
qDebug() << "VH Calibration Const:" << VH_CalibrationConst; qDebug() << u8"VH Calibration Const:" << VH_CalibrationConst;
qDebug() << "VV Calibration Const:" << VV_CalibrationConst; qDebug() << u8"VV Calibration Const:" << VV_CalibrationConst;
} }
AzFdc0 = xml.firstChildElement("root").firstChildElement("AzFdc0").text().toDouble(); AzFdc0 = processinfo.firstChildElement("AzFdc0").text().toDouble();
AzFdc1 = xml.firstChildElement("root").firstChildElement("AzFdc1").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(); TotalProcessedAzimuthBandWidth = processinfo.firstChildElement("TotalProcessedAzimuthBandWidth").text().toDouble();
imagingMode = xml.firstChildElement("root").firstChildElement("imagingMode").text(); DopplerParametersReferenceTime = processinfo.firstChildElement("DopplerParametersReferenceTime").text().toDouble();
lamda = xml.firstChildElement("root").firstChildElement("lamda").text().toDouble();
RadarCenterFrequency = xml.firstChildElement("root").firstChildElement("RadarCenterFrequency").text().toDouble();
TotalProcessedAzimuthBandWidth = xml.firstChildElement("root").firstChildElement("TotalProcessedAzimuthBandWidth").text().toDouble(); QDomElement dopplerCentroidCoefficients = processinfo.firstChildElement("DopplerCentroidCoefficients");
DopplerParametersReferenceTime = xml.firstChildElement("root").firstChildElement("DopplerParametersReferenceTime").text().toDouble();
QDomElement dopplerCentroidCoefficients = xml.firstChildElement("root").firstChildElement("DopplerCentroidCoefficients");
d0 = dopplerCentroidCoefficients.firstChildElement("d0").text().toDouble(); d0 = dopplerCentroidCoefficients.firstChildElement("d0").text().toDouble();
d1 = dopplerCentroidCoefficients.firstChildElement("d1").text().toDouble(); d1 = dopplerCentroidCoefficients.firstChildElement("d1").text().toDouble();
d2 = dopplerCentroidCoefficients.firstChildElement("d2").text().toDouble(); d2 = dopplerCentroidCoefficients.firstChildElement("d2").text().toDouble();
d3 = dopplerCentroidCoefficients.firstChildElement("d3").text().toDouble(); d3 = dopplerCentroidCoefficients.firstChildElement("d3").text().toDouble();
d4 = dopplerCentroidCoefficients.firstChildElement("d4").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(); r0 = dopplerRateValuesCoefficients.firstChildElement("r0").text().toDouble();
r1 = dopplerRateValuesCoefficients.firstChildElement("r1").text().toDouble(); r1 = dopplerRateValuesCoefficients.firstChildElement("r1").text().toDouble();
r2 = dopplerRateValuesCoefficients.firstChildElement("r2").text().toDouble(); r2 = dopplerRateValuesCoefficients.firstChildElement("r2").text().toDouble();
r3 = dopplerRateValuesCoefficients.firstChildElement("r3").text().toDouble(); r3 = dopplerRateValuesCoefficients.firstChildElement("r3").text().toDouble();
r4 = dopplerRateValuesCoefficients.firstChildElement("r4").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() << u8"\nAdditional Data:";
qDebug() << "AzFdc0:" << AzFdc0; qDebug() << u8"AzFdc0:" << AzFdc0;
qDebug() << "AzFdc1:" << AzFdc1; qDebug() << u8"AzFdc1:" << AzFdc1;
qDebug() << "Sensor ID:" << sensorID; qDebug() << u8"Sensor ID:" << sensorID;
qDebug() << "Imaging Mode:" << imagingMode; qDebug() << u8"Imaging Mode:" << imagingMode;
qDebug() << "Lambda:" << lamda; qDebug() << u8"Lambda:" << lamda;
qDebug() << "Radar Center Frequency:" << RadarCenterFrequency; qDebug() << u8"Radar Center Frequency:" << RadarCenterFrequency;
qDebug() << "Total Processed Azimuth Band Width:" << TotalProcessedAzimuthBandWidth; qDebug() << u8"Total Processed Azimuth Band Width:" << TotalProcessedAzimuthBandWidth;
qDebug() << "Doppler Parameters Reference Time:" << DopplerParametersReferenceTime; qDebug() << u8"Doppler Parameters Reference Time:" << DopplerParametersReferenceTime;
qDebug() << "Doppler Centroid Coefficients: d0=" << d0 << ", d1=" << d1 << ", d2=" << d2 << ", d3=" << d3 << ", d4=" << d4; qDebug() << u8"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() << u8"Doppler Rate Values Coefficients: r0=" << r0 << ", r1=" << r1 << ", r2=" << r2 << ", r3=" << r3 << ", r4=" << r4;
qDebug() << "DEM:" << DEM; qDebug() << u8"DEM:" << DEM;
} }

View File

@ -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<QString>{u8"大场景仿真流程", u8"GF3B仿真流程"}, new TLE2SatePositionVelocityToolButton(toolbox));
emit toolbox->addBoxToolItemInPathSIGNAL(QVector<QString>{u8"大场景仿真流程", u8"GF3C仿真流程"}, new TLE2SatePositionVelocityToolButton(toolbox));
emit toolbox->addBoxToolItemInPathSIGNAL(QVector<QString>{u8"大场景仿真流程", u8"LT1A仿真流程"}, new TLE2SatePositionVelocityToolButton(toolbox));
emit toolbox->addBoxToolItemInPathSIGNAL(QVector<QString>{u8"大场景仿真流程", u8"LT1B仿真流程"}, new TLE2SatePositionVelocityToolButton(toolbox));
emit toolbox->addBoxToolItemInPathSIGNAL(QVector<QString>{u8"大场景仿真流程", u8"HJ2E仿真流程"}, new TLE2SatePositionVelocityToolButton(toolbox));
emit toolbox->addBoxToolItemInPathSIGNAL(QVector<QString>{u8"大场景仿真流程", u8"HJ2F仿真流程"}, new TLE2SatePositionVelocityToolButton(toolbox));
emit toolbox->addBoxToolItemInPathSIGNAL(QVector<QString>{u8"大场景仿真流程", u8"LT04仿真流程"}, new TLE2SatePositionVelocityToolButton(toolbox));
// 3. 对齐地类与地形影像
emit toolbox->addBoxToolItemInPathSIGNAL(QVector<QString>{u8"大场景仿真流程", u8"GF3B仿真流程"}, new QAligendLandClsAndDEMToolButton(toolbox));
emit toolbox->addBoxToolItemInPathSIGNAL(QVector<QString>{u8"大场景仿真流程", u8"GF3C仿真流程"}, new QAligendLandClsAndDEMToolButton(toolbox));
emit toolbox->addBoxToolItemInPathSIGNAL(QVector<QString>{u8"大场景仿真流程", u8"LT1A仿真流程"}, new QAligendLandClsAndDEMToolButton(toolbox));
emit toolbox->addBoxToolItemInPathSIGNAL(QVector<QString>{u8"大场景仿真流程", u8"LT1B仿真流程"}, new QAligendLandClsAndDEMToolButton(toolbox));
emit toolbox->addBoxToolItemInPathSIGNAL(QVector<QString>{u8"大场景仿真流程", u8"HJ2E仿真流程"}, new QAligendLandClsAndDEMToolButton(toolbox));
emit toolbox->addBoxToolItemInPathSIGNAL(QVector<QString>{u8"大场景仿真流程", u8"HJ2F仿真流程"}, new QAligendLandClsAndDEMToolButton(toolbox));
emit toolbox->addBoxToolItemInPathSIGNAL(QVector<QString>{u8"大场景仿真流程", u8"LT04仿真流程"}, new QAligendLandClsAndDEMToolButton(toolbox));
// 4. 计算地固坐标与坡面矢量影像
emit toolbox->addBoxToolItemInPathSIGNAL(QVector<QString>{u8"大场景仿真流程", u8"GF3B仿真流程"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox));
emit toolbox->addBoxToolItemInPathSIGNAL(QVector<QString>{u8"大场景仿真流程", u8"GF3C仿真流程"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox));
emit toolbox->addBoxToolItemInPathSIGNAL(QVector<QString>{u8"大场景仿真流程", u8"LT1A仿真流程"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox));
emit toolbox->addBoxToolItemInPathSIGNAL(QVector<QString>{u8"大场景仿真流程", u8"LT1B仿真流程"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox));
emit toolbox->addBoxToolItemInPathSIGNAL(QVector<QString>{u8"大场景仿真流程", u8"HJ2E仿真流程"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox));
emit toolbox->addBoxToolItemInPathSIGNAL(QVector<QString>{u8"大场景仿真流程", u8"HJ2F仿真流程"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox));
emit toolbox->addBoxToolItemInPathSIGNAL(QVector<QString>{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();
}

View File

@ -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

View File

@ -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( void RDProcess_dopplerGPU(
@ -185,6 +266,51 @@ void RDProcess_dopplerGPU(
cudaDeviceSynchronize(); 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 << <numBlocks, BLOCK_SIZE >> > (
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) { __device__ double calculateIncidenceAngle(double Rx, double Ry, double Rz, double Sx, double Sy, double Sz) {
double dotProduct = Rx * Sx + Ry * Sy + Rz * Sz; double dotProduct = Rx * Sx + Ry * Sy + Rz * Sz;
double magnitudeR = sqrt(Rx * Rx + Ry * Ry + Rz * Rz); double magnitudeR = sqrt(Rx * Rx + Ry * Ry + Rz * Rz);

View File

@ -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
);

View File

@ -0,0 +1,95 @@
#include "QLookTableResampleFromWGS84ToRange.h"
#include "BaseConstVariable.h"
#include "BaseTool.h"
#include <QMessageBox>
#include <QFileDialog>
#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"没有选中文件"));
}
}

View File

@ -0,0 +1,30 @@
#pragma once
#include <QDialog>
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;
};

View File

@ -0,0 +1,201 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QLookTableResampleFromWGS84ToRangeClass</class>
<widget class="QDialog" name="QLookTableResampleFromWGS84ToRangeClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>747</width>
<height>293</height>
</rect>
</property>
<property name="windowTitle">
<string>QLookTableResampleFromWGS84ToRange</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditLookTableWGS84Path">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditLookTableCountPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonLookTableWGS84Select">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>行数</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>查找表(斜距)</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonLookTableRangeSelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>查找表WGS84)</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>查找表采样点数</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pushButtonLookTableCountSelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditLookTableRangePath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_5">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>列数</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="spinBoxRowCount">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="maximum">
<number>999999999</number>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="spinBoxColCount">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="maximum">
<number>999999999</number>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,204 @@
#include "GPUBaseTool.h"
#include "GPUBPTool.cuh"
#include <iostream>
#include <memory>
#include <cmath>
#include <complex>
#include <device_launch_parameters.h>
#include <cuda_runtime.h>
#include <cublas_v2.h>
#include <cuComplex.h>
#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 << <grid_size, BLOCK_SIZE >> > (
antPx, antPy, antPz,
antDirx, antDiry, antDirz,
imgx, imgy, imgz,
prfcount, freqpoints, meanH,
Rnear, dx);
PrintLasterError("TIMEBPCreateImageGrid");
cudaDeviceSynchronize();
}

View File

@ -0,0 +1,28 @@
#ifndef __GPUBPIMAGENET_CUH___
#define __GPUBPIMAGENET_CUH___
#include "BaseConstVariable.h"
#include "GPUTool.cuh"
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
#include <cublas_v2.h>
#include <cuComplex.h>
#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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,28 @@
#pragma once
#ifndef __ImageNetOperator__H_
#define __ImageNetOperator__H_
#include "BaseConstVariable.h"
#include <QString>
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

View File

@ -0,0 +1,146 @@
#include "ImagePlaneAtiInterpDialog.h"
#include "ui_ImagePlaneAtiInterpDialog.h"
#include <QFileDialog>
#include <QMessageBox>
#include <QCheckBox>
#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();
}

View File

@ -0,0 +1,36 @@
#pragma once
#ifndef __ImagePlaneAtiInterpDialog__HH__
#define __ImagePlaneAtiInterpDialog__HH__
#include <QDialog>
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

View File

@ -0,0 +1,201 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ImagePlaneAtiInterpDialogClass</class>
<widget class="QDialog" name="ImagePlaneAtiInterpDialogClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>661</width>
<height>305</height>
</rect>
</property>
<property name="windowTitle">
<string>根据经纬度插值高程数据</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>成像网格(经纬度):</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonEchoGPSPointDataSelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>回波GPS点</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>参考DEM</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonImageNet0Select">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditRefRangeDEMPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="7" column="0" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEditImageLLAPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditGPSPointsPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pushButtonImageLLASelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pushButtonRefRangeDEMSelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>成像粗网格(高程):</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditImageNet0Path">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="checkBoxOverLap">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>强制采样</string>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,98 @@
#include "InitCreateImageXYZDialog.h"
#include "ui_InitCreateImageXYZDialog.h"
#include <QFileDialog>
#include <QMessageBox>
#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();
}

View File

@ -0,0 +1,36 @@
#pragma once
#ifndef __InitCreateImageXYZDialog__HH__
#define __InitCreateImageXYZDialog__HH__
#include <QDialog>
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

View File

@ -0,0 +1,250 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>InitCreateImageXYZDialogClass</class>
<widget class="QDialog" name="InitCreateImageXYZDialogClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>403</height>
</rect>
</property>
<property name="windowTitle">
<string>初始化成像平面网格</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>成像网格XYZ</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pushButtonImageLLSelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonImageXYZSelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditImageXYZPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:\Programme\vs2022\RasterMergeTest\LAMPCAE_SCANE-all-scane\BPImage\GF3BPImage</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>成像网格(经纬度):</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>回波GPS轨道节点</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditEchoGPSDataPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:\Programme\vs2022\RasterMergeTest\LAMPCAE_SCANE-all-scane\GF3_Simulation.xml</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonEchoGPSDataSelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditImageLLPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:\Programme\vs2022\RasterMergeTest\LAMPCAE_SCANE-all-scane\BPImage\GF3BPImage</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>580</width>
<height>239</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>方位向参数</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>方位向的像素数与回波GPS脉冲数一致</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>距离向参数</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>近斜距</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxRangeResolution">
<property name="decimals">
<number>3</number>
</property>
<property name="maximum">
<double>1000000000000000000.000000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxNearRange">
<property name="decimals">
<number>5</number>
</property>
<property name="maximum">
<double>99999999999999991611392.000000000000000</double>
</property>
<property name="singleStep">
<double>0.000100000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>距离向间隔</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>距离向像素数</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="spinBoxRangeNum">
<property name="maximum">
<number>999999999</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,386 @@
#include "QCreateInSARImagePlaneXYZRDialog.h"
#include "ui_QCreateInSARImagePlaneXYZRDialog.h"
#include <QFileDialog>
#include <QMessageBox>
#include "SatelliteOribtModel.h"
#include "SARSimulationTaskSetting.h"
#include "ImageOperatorBase.h"
#include "FileOperator.h"
#include "BaseConstVariable.h"
#include "GPUTool.cuh"
#include "LookTableSimulationComputer.cuh"
#include <QDebug>
#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<double> PolyfitPx = orbitmodel.getPolyfitPx();
std::vector<double> PolyfitPy = orbitmodel.getPolyfitPy();
std::vector<double> PolyfitPz = orbitmodel.getPolyfitPz();
std::vector<double> PolyfitVx = orbitmodel.getPolyfitVx();
std::vector<double> PolyfitVy = orbitmodel.getPolyfitVy();
std::vector<double> PolyfitVz = orbitmodel.getPolyfitVz();
// 参数模型
qDebug() << "load simulation setting params from xml :" << orbitpath;
std::shared_ptr<AbstractSARSatelliteModel> SARSetting = ReadSimulationSettingsXML(SatePath);
// 多普勒参数
double dopplerRefrenceTime = SARSetting->getDopplerParametersReferenceTime();
std::vector<double> DopplerCentroidCoefficients = SARSetting->getDopplerCentroidCoefficients();
std::vector<double> 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<double> PolyfitPx, std::vector<double> PolyfitPy, std::vector<double> PolyfitPz, std::vector<double> PolyfitVx, std::vector<double> PolyfitVy, std::vector<double> PolyfitVz, double dopplerRefrenceTime, std::vector<double> 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<double> demX = readDataArr<double>(demimg, rid, 0, rowcount, colcount, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);// 行列数修改
std::shared_ptr<double> demY = readDataArr<double>(demimg, rid, 0, rowcount, colcount, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
std::shared_ptr<double> demZ = readDataArr<double>(demimg, rid, 0, rowcount, colcount, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
//
std::shared_ptr<double> host_R((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost);
std::shared_ptr<double> device_R((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice);
//
std::shared_ptr<double> host_demX((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost);
std::shared_ptr<double> host_demY((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost);
std::shared_ptr<double> host_demZ((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost);
std::shared_ptr<double> device_demX((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice);
std::shared_ptr<double> device_demY((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice);
std::shared_ptr<double> 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!!!");
}

View File

@ -0,0 +1,70 @@
#pragma once
#include <QDialog>
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<double> PolyfitPx, // 5次项空余填0
std::vector<double> PolyfitPy, // 5次项空余填0
std::vector<double> PolyfitPz, // 5次项空余填0
std::vector<double> PolyfitVx, // 5次项空余填0
std::vector<double> PolyfitVy, // 5次项空余填0
std::vector<double> PolyfitVz, // 5次项空余填0
// 多普勒参数
double dopplerRefrenceTime,
std::vector<double> DopplerCentroidCoefficients,// d0 ~ d5 空余填零
// 其他成像参数
double starttime, // 成像开始时间
double endtime, // 成像结束时间
double nearRange, // 近斜距
double farRange, // 远斜距
double PRF, // 脉冲重复采样频率
double Fs, // 距离采样频率
double lamda
);
};

View File

@ -0,0 +1,293 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QCreateInSARImagePlaneXYZRDialogClass</class>
<widget class="QDialog" name="QCreateInSARImagePlaneXYZRDialogClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>763</width>
<height>498</height>
</rect>
</property>
<property name="windowTitle">
<string>QCreateInSARImagePlaneXYZR</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="7" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="pushButtonSloper">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pushButtonDEM">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="SloperLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:\FZSimulation\LT1A\L20250210\LT1A_DEM_20250210_resampleXYZ.dat</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="checkBoxDoppler">
<property name="text">
<string>采用多普勒参数</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>卫星仿真参数:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonSataSetting">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>DEM文件(XYZ)</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_4">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>坡度法向文件(sloper)</string>
</property>
</widget>
</item>
<item row="7" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="OrbitModelPathLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:\FZSimulation\LT1A\L20250210\LT1_Simulation_OrbitModel.xml</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="lineEditLookName">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>LT1A_20250210</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="outDirLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:\FZSimulation\LT1A\L20250210\Looktable</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_tip">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonOrbitModel">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>多项式轨道模型参数:</string>
</property>
</widget>
</item>
<item row="10" column="0" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="DEMLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:\FZSimulation\LT1A\L20250210\LT1A_DEM_20250210_resampleXYZ.dat</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_9">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>结果文件保存地址:</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>成像平面文件名</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QPushButton" name="pushButtonOutDir">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="SateSettingLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:\FZSimulation\LT1A\L20250210\LT1_Simulation_Setting.xml</string>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,114 @@
#include "QL1ASARProcessDialog.h"
#include "ui_QL1ASARProcessDialog.h"
#include "BaseConstVariable.h"
#include "BaseTool.h"
#include "RasterToolBase.h"
#include "LogInfoCls.h"
#include <QMessageBox>
#include <QFileDialog>
#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();
}

View File

@ -0,0 +1,30 @@
#pragma once
#include <QDialog>
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;
};

View File

@ -0,0 +1,232 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QL1ASARProcessDialogClass</class>
<widget class="QDialog" name="QL1ASARProcessDialogClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>475</width>
<height>354</height>
</rect>
</property>
<property name="windowTitle">
<string>QL1ASARProcessDialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditL1ADataPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineSlAPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="5" column="0" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>单视振幅产品:</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pushButtonL1BSelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>L1B</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>L1A产品</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonL1ASelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditL1BDataPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>多视参数</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>方位向视数:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="spinBoxLNAz">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>方位向视数:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBoxLNRa">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonS1ASelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,124 @@
#include "QLonLatInterpAtiFromDEM.h"
#include "ui_QLonLatInterpAtiFromDEM.h"
#include "BaseConstVariable.h"
#include "BaseTool.h"
#include "RasterToolBase.h"
#include "LogInfoCls.h"
#include <QMessageBox>
#include <QFileDialog>
#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();
}

View File

@ -0,0 +1,29 @@
#pragma once
#include <QDialog>
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;
};

View File

@ -0,0 +1,191 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QLonLatInterpAtiFromDEMClass</class>
<widget class="QDialog" name="QLonLatInterpAtiFromDEMClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle">
<string>QLonLatInterpAtiFromDEM</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>经纬度数据矩阵:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditLonLatRasterPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonLonLatRasterSelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>待采样DEM</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditDEMRasterPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonDEMRasterSelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>采样矩阵LLA</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditLLARasterPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pushButtonLLARasterSelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>采样矩阵XYZ</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEditXYZRasterPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pushButtonXYZRasterSelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,124 @@
#include "QSARSimulationComplexEchoDataDialog.h"
#include "ui_QSARSimulationComplexEchoDataDialog.h"
#include <QFileDialog>
#include <QMessageBox>
#include "BaseConstVariable.h"
#include "BaseTool.h"
#include "ImageNetOperator.h"
#include <QDebug>
#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();
}

View File

@ -0,0 +1,27 @@
#pragma once
#include <QDialog>
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;
};

View File

@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QSARSimulationComplexEchoDataDialogClass</class>
<widget class="QDialog" name="QSARSimulationComplexEchoDataDialogClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>916</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle">
<string>QSARSimulationComplexEchoDataDialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>地距文件:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditEchoDataPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonEchoDataSelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>查找表:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditLookTablePath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonLookTableSelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>斜距文件:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditL1AEchoDataPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pushButtonL1AEchoDataSelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,193 @@
#include "QSimulationBPImageMultiProduction.h"
#include <QFileDialog>
#include <QMessageBox>
#include "TBPImageAlgCls.h"
#include "EchoDataFormat.h"
#include <boost/thread.hpp>
#include <thread>
#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<EchoL0Dataset> 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();
}

View File

@ -0,0 +1,32 @@
#pragma once
#include "simulationsartool_global.h"
#include <QDialog>
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;
};

View File

@ -0,0 +1,303 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QSimulationBPImageMultiProductionClass</class>
<widget class="QDialog" name="QSimulationBPImageMultiProductionClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>813</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle">
<string>仿真图像TimeBP方法</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>回波地址: </string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditEchoPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:/FZSimulation/LTDQ/Input/xml/xml/165665/echodata/LT1B_DQ_165665_Simulation.xml</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonEchoSelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_3">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>成像区域网格:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditImageNetPath">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:/FZSimulation/LTDQ/Input/xml/xml/165665/InSARImageXYZ/LT1A_165665_InSAR_ImageXYZ_looktable.bin</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="GridNetBtn">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_4">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>查找表: </string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditLookTablePath">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:/FZSimulation/LTDQ/Input/DEM1/looktable165665/LT1A_65665_looktable_Range.bin</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="LookTableBtn">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_5">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>1级产品 </string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditL1AProductionPath">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:/FZSimulation/LTDQ/Input/xml/xml/165665/TBPImageProduction/L1/LT1A_165665_L1A</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="L1ASelectBtn">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>2级产品 </string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditL2ProductionPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:/FZSimulation/LTDQ/Input/xml/xml/165665/TBPImageProduction/L2/LT1A_165665_L2</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="L2SelectSelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -56,7 +56,7 @@ __global__ void fftshiftKernel(cufftComplex* data, int Nfft, int Np) {
__global__ void processPulseKernel( __global__ void processPulseKernel(
long prfid, long prfid,
int nx, int ny, int nx, int ny,
const double* x_mat, const double* y_mat, const double* z_mat, const double* x_mat, const double* y_mat, const double* z_mat,const double* R_mat,
double AntX, double AntY, double AntZ, double AntX, double AntY, double AntZ,
double R0, double minF, double R0, double minF,
const cufftComplex* rc_pulse, const cufftComplex* rc_pulse,
@ -65,9 +65,9 @@ __global__ void processPulseKernel(
) { ) {
// //
long long idx = blockIdx.x * blockDim.x + threadIdx.x; int64_t idx = int64_t(blockIdx.x) * int64_t(blockDim.x) + int64_t(threadIdx.x);
long long pixelcount = nx * ny; int64_t pixelcount = int64_t(nx) * int64_t(ny);
if (idx >= pixelcount) return; if (idx >= pixelcount) { return; }
//printf("processPulseKernel start!!\n"); //printf("processPulseKernel start!!\n");
@ -78,9 +78,11 @@ __global__ void processPulseKernel(
double dx = AntX - x_mat[idx]; double dx = AntX - x_mat[idx];
double dy = AntY - y_mat[idx]; double dy = AntY - y_mat[idx];
double dz = AntZ - z_mat[idx]; double dz = AntZ - z_mat[idx];
double initR = R_mat[idx];
//printf("processPulseKernel xmat !!\n"); //printf("processPulseKernel xmat !!\n");
double R = sqrt(dx * dx + dy * dy + dz * dz); double R = sqrt(dx * dx + dy * dy + dz * dz);
double ampcorrect = (powf(4 * LAMP_CUDA_PI, 2) * powf(R, 4));
double dR = R - R0; double dR = R - R0;
if (dR < r_start || dR >= (r_start + dr * (nR - 1))) return; if (dR < r_start || dR >= (r_start + dr * (nR - 1))) return;
@ -98,7 +100,7 @@ __global__ void processPulseKernel(
rc_interp.y = rc_low.y * (1 - weight) + rc_high.y * weight; rc_interp.y = rc_low.y * (1 - weight) + rc_high.y * weight;
// Phase correction // Phase correction
double phase = 4 * PI * minF / c * dR; double phase = 4 * PI * minF / c * (dR- initR); // ²¹³äµ±Ç°µãµÄ²Î¿¼¾àÀë
double cos_phase = cos(phase); double cos_phase = cos(phase);
double sin_phase = sin(phase); double sin_phase = sin(phase);
@ -106,9 +108,15 @@ __global__ void processPulseKernel(
phCorr.x = rc_interp.x * cos_phase - rc_interp.y * sin_phase; phCorr.x = rc_interp.x * cos_phase - rc_interp.y * sin_phase;
phCorr.y = rc_interp.x * sin_phase + rc_interp.y * cos_phase; phCorr.y = rc_interp.x * sin_phase + rc_interp.y * cos_phase;
// amp correction
//phCorr.x = ampcorrect * phCorr.x;
//phCorr.y = ampcorrect * phCorr.y;
// Accumulate // Accumulate
im_final[idx].x += phCorr.x; im_final[idx].x += phCorr.x;
im_final[idx].y += phCorr.y; im_final[idx].y += phCorr.y;
//printf("r_start=%e;dr=%e;nR=%d\n", r_start, dr, nR); //printf("r_start=%e;dr=%e;nR=%d\n", r_start, dr, nR);
//if (abs(phCorr.x) > 1e-100 || abs(phCorr.y > 1e-100)) { //if (abs(phCorr.x) > 1e-100 || abs(phCorr.y > 1e-100)) {
//printf( //printf(
@ -162,12 +170,11 @@ void bpBasic0CUDA(GPUDATA& data, int flag,double* h_R) {
// ͼÏñÖØ½¨ // ͼÏñÖØ½¨
double r_start = data.r_vec[0]; double r_start = data.r_vec[0];
double dr = (data.r_vec[data.Nfft - 1] - r_start) / (data.Nfft - 1); double dr = (data.r_vec[data.Nfft - 1] - r_start) / (data.Nfft - 1);
printfinfo("dr = %f\n",dr); printfinfo("dr = %f\n",dr);
long pixelcount = data.nx* data.ny; int64_t pixelcount = int64_t(data.nx)* int64_t(data.ny);
long grid_size = (pixelcount + BLOCK_SIZE - 1) / BLOCK_SIZE; int64_t grid_size = (pixelcount + BLOCK_SIZE - 1) / BLOCK_SIZE;
printfinfo("grid finished!!\n"); printfinfo("grid finished!!\n");
//double* d_R = (double*)mallocCUDADevice(sizeof(double) * data.nx * data.ny); //double* d_R = (double*)mallocCUDADevice(sizeof(double) * data.nx * data.ny);
@ -177,7 +184,7 @@ void bpBasic0CUDA(GPUDATA& data, int flag,double* h_R) {
processPulseKernel << <grid_size, BLOCK_SIZE >> > ( processPulseKernel << <grid_size, BLOCK_SIZE >> > (
ii, ii,
data.nx, data.ny, data.nx, data.ny,
data.x_mat, data.y_mat, data.z_mat, data.x_mat, data.y_mat, data.z_mat,data.R_mat,
data.AntX[ii], data.AntY[ii], data.AntZ[ii], data.AntX[ii], data.AntY[ii], data.AntZ[ii],
data.R0, data.minF[ii], data.R0, data.minF[ii],
data.phdata, data.phdata,
@ -206,6 +213,7 @@ void initGPUData(GPUDATA& h_data, GPUDATA& d_data) {
d_data.x_mat = (double*)mallocCUDADevice(sizeof(double) * h_data.nx * h_data.ny); d_data.x_mat = (double*)mallocCUDADevice(sizeof(double) * h_data.nx * h_data.ny);
d_data.y_mat = (double*)mallocCUDADevice(sizeof(double) * h_data.nx * h_data.ny); d_data.y_mat = (double*)mallocCUDADevice(sizeof(double) * h_data.nx * h_data.ny);
d_data.z_mat = (double*)mallocCUDADevice(sizeof(double) * h_data.nx * h_data.ny); d_data.z_mat = (double*)mallocCUDADevice(sizeof(double) * h_data.nx * h_data.ny);
d_data.R_mat = (double*)mallocCUDADevice(sizeof(double) * h_data.nx * h_data.ny);
d_data.r_vec = h_data.r_vec;// (double*)mallocCUDADevice(sizeof(double) * h_data.Nfft); d_data.r_vec = h_data.r_vec;// (double*)mallocCUDADevice(sizeof(double) * h_data.Nfft);
d_data.Freq = (double*)mallocCUDADevice(sizeof(double) * h_data.Nfft); d_data.Freq = (double*)mallocCUDADevice(sizeof(double) * h_data.Nfft);
d_data.phdata = (cuComplex*)mallocCUDADevice(sizeof(cuComplex) * h_data.Nfft * h_data.Np); d_data.phdata = (cuComplex*)mallocCUDADevice(sizeof(cuComplex) * h_data.Nfft * h_data.Np);
@ -218,6 +226,7 @@ void initGPUData(GPUDATA& h_data, GPUDATA& d_data) {
HostToDevice(h_data.x_mat, d_data.x_mat,sizeof(double) * h_data.nx * h_data.ny); printf("image X Copy finished!!!\n"); HostToDevice(h_data.x_mat, d_data.x_mat,sizeof(double) * h_data.nx * h_data.ny); printf("image X Copy finished!!!\n");
HostToDevice(h_data.y_mat, d_data.y_mat,sizeof(double) * h_data.nx * h_data.ny); printf("image Y Copy finished!!!\n"); HostToDevice(h_data.y_mat, d_data.y_mat,sizeof(double) * h_data.nx * h_data.ny); printf("image Y Copy finished!!!\n");
HostToDevice(h_data.z_mat, d_data.z_mat, sizeof(double) * h_data.nx * h_data.ny); printf("image Z Copy finished!!!\n"); HostToDevice(h_data.z_mat, d_data.z_mat, sizeof(double) * h_data.nx * h_data.ny); printf("image Z Copy finished!!!\n");
HostToDevice(h_data.R_mat, d_data.R_mat, sizeof(double) * h_data.nx * h_data.ny); printf("image R Copy finished!!!\n");
HostToDevice(h_data.Freq, d_data.Freq, sizeof(double) * h_data.Nfft); HostToDevice(h_data.Freq, d_data.Freq, sizeof(double) * h_data.Nfft);
//HostToDevice(h_data.r_vec, d_data.r_vec, sizeof(double) * h_data.Nfft); //HostToDevice(h_data.r_vec, d_data.r_vec, sizeof(double) * h_data.Nfft);
HostToDevice(h_data.phdata, d_data.phdata, sizeof(cuComplex) * h_data.Nfft * h_data.Np); printf("image echo Copy finished!!!\n"); HostToDevice(h_data.phdata, d_data.phdata, sizeof(cuComplex) * h_data.Nfft * h_data.Np); printf("image echo Copy finished!!!\n");
@ -242,6 +251,7 @@ void freeGPUData(GPUDATA& d_data) {
FreeCUDADevice((d_data.x_mat)); FreeCUDADevice((d_data.x_mat));
FreeCUDADevice((d_data.y_mat)); FreeCUDADevice((d_data.y_mat));
FreeCUDADevice((d_data.z_mat)); FreeCUDADevice((d_data.z_mat));
FreeCUDADevice((d_data.R_mat));
//FreeCUDADevice((d_data.r_vec)); //FreeCUDADevice((d_data.r_vec));
FreeCUDADevice((d_data.Freq)); FreeCUDADevice((d_data.Freq));
FreeCUDADevice((d_data.phdata)); FreeCUDADevice((d_data.phdata));

View File

@ -21,7 +21,7 @@
struct GPUDATA { struct GPUDATA {
long Nfft, K, Np, nx, ny; // 傅里叶点数、频点数、脉冲数、图像列、图像行 long Nfft, K, Np, nx, ny; // 傅里叶点数、频点数、脉冲数、图像列、图像行
double* AntX, * AntY, * AntZ, * minF; // 天线坐标、起始频率 double* AntX, * AntY, * AntZ, * minF; // 天线坐标、起始频率
double* x_mat, * y_mat, * z_mat;// 華醱釴梓 double* x_mat, * y_mat, * z_mat,*R_mat;// 華醱釴梓
double* r_vec; // 坐标范围 double* r_vec; // 坐标范围
double* Freq;// 频率 double* Freq;// 频率
cuComplex* phdata;// 回波 cuComplex* phdata;// 回波

View File

@ -1,3 +1,7 @@
#ifndef __GPUBPTOOL_CUH___
#define __GPUBPTOOL_CUH___
#include "BaseConstVariable.h" #include "BaseConstVariable.h"
#include "GPUTool.cuh" #include "GPUTool.cuh"
#include <cuda_runtime.h> #include <cuda_runtime.h>
@ -7,7 +11,6 @@
#include "GPUTool.cuh" #include "GPUTool.cuh"
extern __device__ double angleBetweenVectors(Vector3 a, Vector3 b, bool returnDegrees = false); extern __device__ double angleBetweenVectors(Vector3 a, Vector3 b, bool returnDegrees = false);
extern __device__ Vector3 vec_sub(Vector3 a, Vector3 b); extern __device__ Vector3 vec_sub(Vector3 a, Vector3 b);
extern __device__ double vec_dot(Vector3 a, Vector3 b); extern __device__ double vec_dot(Vector3 a, Vector3 b);
@ -21,3 +24,5 @@ extern __device__ double angleBetweenVectors_single(Vector3_single a, Vector3_s
extern __device__ Vector3_single vec_sub_single(Vector3_single a, Vector3_single b); extern __device__ Vector3_single vec_sub_single(Vector3_single a, Vector3_single b);
extern __device__ float vec_dot_single(Vector3_single a, Vector3_single b); extern __device__ float vec_dot_single(Vector3_single a, Vector3_single b);
extern __device__ Vector3_single vec_cross_single(Vector3_single a, Vector3_single b); extern __device__ Vector3_single vec_cross_single(Vector3_single a, Vector3_single b);
#endif

View File

@ -487,16 +487,17 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern(
double Pt, double Pt,
double refPhaseRange, double refPhaseRange,
double NearR, double FarR, double NearR, double FarR,
double maxGain,double GainWeight, double maxGain, double GainWeight,
double* d_temp_R, double* d_temp_amps// 计算输出 float* d_temp_R, float* d_temp_amps// 计算输出
) { ) {
long long idx = blockIdx.x * blockDim.x + threadIdx.x; // 获取当前的线程编码 int tid = threadIdx.x;
long long prfId = idx / SHAREMEMORY_FLOAT_HALF; int bid = blockIdx.x;
long long posId = idx % SHAREMEMORY_FLOAT_HALF + startPosId; // 当前线程对应的影像点 int dmx = blockDim.x;
int idx = bid*dmx+tid; // 获取当前的线程编码
//if (prfId > 20000) { int prfId = idx / SHAREMEMORY_FLOAT_HALF;
// printf("prfid %d,PRFCount : %d\n", prfId, PRFCount); int posId = idx % SHAREMEMORY_FLOAT_HALF + startPosId; // 当前线程对应的影像点
//} //d_temp_R[idx] = pixelcount;
//d_temp_amps[idx] = posId;
if (prfId < PRFCount && posId < pixelcount) { if (prfId < PRFCount && posId < pixelcount) {
SateState antp = antlist[prfId]; SateState antp = antlist[prfId];
@ -506,8 +507,6 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern(
double RstZ = antp.Pz - gp.Tz; double RstZ = antp.Pz - gp.Tz;
double RstR = sqrt(RstX * RstX + RstY * RstY + RstZ * RstZ); // 矢量距离 double RstR = sqrt(RstX * RstX + RstY * RstY + RstZ * RstZ); // 矢量距离
if (RstR<NearR || RstR>FarR) { if (RstR<NearR || RstR>FarR) {
d_temp_R[idx] = 0; d_temp_R[idx] = 0;
d_temp_amps[idx] = 0; d_temp_amps[idx] = 0;
@ -525,8 +524,8 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern(
float slopR = sqrtf(slopeX * slopeX + slopeY * slopeY + slopeZ * slopeZ); // float slopR = sqrtf(slopeX * slopeX + slopeY * slopeY + slopeZ * slopeZ); //
if (slopR > 1e-3) { if (slopR > 1e-3) {
float dotAB = RstX * slopeX + RstY * slopeY + RstZ * slopeZ;
float localangle = acosf((RstX * slopeX + RstY * slopeY + RstZ * slopeZ) / ( slopR)); float localangle = acosf(dotAB / (slopR));
if (localangle < 0 || localangle >= LAMP_CUDA_PI / 2 || isnan(localangle)) { if (localangle < 0 || localangle >= LAMP_CUDA_PI / 2 || isnan(localangle)) {
d_temp_R[idx] = 0; d_temp_R[idx] = 0;
@ -538,95 +537,111 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern(
// 计算斜距衰减 // 计算斜距衰减
float antDirectR = sqrtf(antp.antDirectX * antp.antDirectX //float antDirectR = sqrtf(antp.antDirectX * antp.antDirectX
+ antp.antDirectY * antp.antDirectY // + antp.antDirectY * antp.antDirectY
+ antp.antDirectZ * antp.antDirectZ); // + antp.antDirectZ * antp.antDirectZ);
float diectAngle = -1*(RstX*antp.antDirectX+ //float diectAngle = -1 * (RstX * antp.antDirectX +
RstY*antp.antDirectY+ // RstY * antp.antDirectY +
RstZ*antp.antDirectZ) / (antDirectR ); // RstZ * antp.antDirectZ) / (antDirectR);
diectAngle = acosf(diectAngle);// 弧度制 //diectAngle = acosf(diectAngle);// 弧度制
diectAngle = diectAngle * GainWeight; //diectAngle = diectAngle * GainWeight;
float ampGain = 1; float ampGain = 1;
ampGain=2 * maxGain * (1 - (powf(diectAngle,2) / 6) //ampGain = 2 * maxGain * (1 - (powf(diectAngle, 2) / 6)
+ (powf(diectAngle, 4) / 120) // + (powf(diectAngle, 4) / 120)
- (powf(diectAngle, 6) / 5040)); //dB // - (powf(diectAngle, 6) / 5040)); //dB
ampGain = powf(10.0, ampGain / 10.0); //ampGain = powf(10.0, ampGain / 10.0);
ampGain = ampGain / (PI4POW2 * powf(RstR, 4)); // 反射强度 ampGain = ampGain / (PI4POW2 * powf(RstR, 4)); // 反射强度
float sigma = GPU_getSigma0dB(sigma0Params, localangle); float sigma = GPU_getSigma0dB(sigma0Params, localangle);
sigma = powf(10.0, sigma / 10.0); sigma = powf(10.0, sigma / 10.0);
double temp_amp = double(ampGain * Pt * sigma); float temp_amp = float(ampGain * Pt * sigma);
double temp_R = double(RstR - refPhaseRange); double temp_R = RstR - refPhaseRange;
if (isnan(temp_amp) || isnan(temp_R) || isinf(temp_amp) || isinf(temp_R)) {
bool isNan = !(isnan(temp_amp) || isnan(temp_R) || isinf(temp_amp) || isinf(temp_R)); d_temp_R[idx] = 0;
d_temp_amps[idx] = 0;
d_temp_amps[idx] = temp_amp * isNan; return;
d_temp_R[idx] = temp_R * isNan; }
else {
d_temp_amps[idx] = temp_amp;
d_temp_R[idx] =static_cast<float>(temp_R);
return; return;
} }
} }
} }
}
else {
d_temp_R[idx] = 0;
d_temp_amps[idx] =0;
return;
}
} }
__global__ void CUDA_Kernel_Computer_echo_NoAntPattern_Optimized( __global__ void CUDA_Kernel_Computer_echo_NoAntPattern(
double* d_temp_R, double* d_temp_amps, long posNum, float* d_temp_R, float* d_temp_amps,
double f0, double dfreq, double f0, double dfreq,
long FreqPoints, // 当前频率的分块 long maxfreqnum, long nextfreqNum,// 最大脉冲值
long maxfreqnum, // 最大脉冲值
cuComplex* echodata, cuComplex* echodata,
long temp_PRF_Count long temp_PRF_Count
) { ) {
// 使用动态共享内存,根据线程块大小调整 __shared__ float s_R[SHAREMEMORY_FLOAT_HALF]; // 注意一个完整的block_size 共享相同内存
extern __shared__ double s_data[]; __shared__ float s_amp[SHAREMEMORY_FLOAT_HALF];
double* s_R = s_data;
double* s_amp = s_data + blockDim.x;
const int tid = threadIdx.x; long tid = threadIdx.x;
const int prfId = blockIdx.x; long bid = blockIdx.x;
const int fId = tid; // 每个线程处理一个频率点 long idx = bid * blockDim.x + tid;
long prfId = idx / nextfreqNum; // 脉冲ID
long fId = idx % nextfreqNum;//频率ID
long psid = 0;
long pixelId = 0;
for (long ii = 0; ii < SHAREMEMORY_FLOAT_HALF_STEP; ii++) { // SHAREMEMORY_FLOAT_HALF_STEP * BLOCK_SIZE=SHAREMEMORY_FLOAT_HALF
psid = ii * BLOCK_SIZE + tid;
pixelId = prfId * SHAREMEMORY_FLOAT_HALF + psid;
s_R[psid] = d_temp_R[pixelId];
s_amp[psid] = d_temp_amps[pixelId];
}
__syncthreads(); // 确定所有待处理数据都已经进入程序中
if (fId < maxfreqnum && prfId < temp_PRF_Count) {
long echo_ID = prfId * maxfreqnum + fId; // 计算对应的回波位置
double factorjTemp = RFPCPIDIVLIGHT * (f0 + fId * dfreq); double factorjTemp = RFPCPIDIVLIGHT * (f0 + fId * dfreq);
cuComplex echo = make_cuComplex(0.0f, 0.0f); cuComplex echo = make_cuComplex(0, 0);
// 分块加载数据并计算 for (long dataid = 0; dataid < SHAREMEMORY_FLOAT_HALF; dataid++) {
for (int block_offset = 0; block_offset < posNum; block_offset += blockDim.x) {
int psid = block_offset + tid;
int pixelId = prfId * posNum + psid;
// 加载当前块到共享内存 float temp_real = 0;
if (psid < posNum) { float temp_imag = 0;
s_R[tid] = static_cast<double>(d_temp_R[pixelId]); double R = s_R[dataid];
s_amp[tid] = static_cast<double>(d_temp_amps[pixelId]); float temp_phi = fmod(R * factorjTemp, 2 * PI);
}
else {
s_R[tid] = 0.0f;
s_amp[tid] = 0.0f;
}
__syncthreads();
// 计算当前块的贡献
for (int dataid = 0; dataid < blockDim.x; ++dataid) {
float temp_phi =fmod( s_R[dataid] * factorjTemp,2*PI);
float temp_amp = s_amp[dataid]; float temp_amp = s_amp[dataid];
float sin_phi, cos_phi; sincosf(temp_phi, &temp_imag, &temp_real);
sincosf(temp_phi, &sin_phi, &cos_phi); echo.x = echo.x + (temp_amp * temp_real);
echo.x += temp_amp * cos_phi; echo.y = echo.y + (temp_amp * temp_imag);
echo.y += temp_amp * sin_phi; //if (dataid > 5000) {
} // printf("echo_ID=%d; dataid=%d;ehodata=(%f,%f);R=%f;amp=%f;\n", echo_ID, dataid, temp_real, temp_imag, s_R[0], s_amp[0]);
__syncthreads(); //}
//if (isnan(temp_phi) || isnan(temp_amp) || isnan(echo.x) || isnan(echo.y)
// || isinf(temp_phi) || isinf(temp_amp) || isinf(echo.x) || isinf(echo.y)
// ) {
// printf("[amp,phi,real,imag]=[%f,%f,%f,%f];\n", temp_amp, temp_phi, echo.x, echo.y);
//}
} }
// 只处理有效的频率点和PRF echodata[echo_ID] = cuCaddf(echodata[echo_ID], echo);
if (prfId < temp_PRF_Count && fId < FreqPoints && fId < maxfreqnum) {
const int echo_ID = prfId * maxfreqnum + fId;
atomicAdd(&echodata[echo_ID].x, echo.x);
atomicAdd(&echodata[echo_ID].y, echo.y);
} }
} }
@ -634,27 +649,28 @@ __global__ void CUDA_Kernel_Computer_echo_NoAntPattern_Optimized(
/** 分块处理 ****************************************************************************************************************/ /** 分块处理 ****************************************************************************************************************/
extern "C" void ProcessRFPCTask(RFPCTask& task, long devid) extern "C" void ProcessRFPCTask(RFPCTask& task, long devid, float* h_R, float* h_amp)
{ {
size_t pixelcount = task.prfNum * task.freqNum; size_t pixelcount = task.prfNum * task.freqNum;
size_t grid_size = (pixelcount + BLOCK_SIZE - 1) / BLOCK_SIZE; size_t grid_size = (pixelcount + BLOCK_SIZE - 1) / BLOCK_SIZE;
printf("computer pixelcount goalnum gridsize blocksize prfnum %zu,%zu ,%zu,%d ,%d \n", pixelcount, task.targetnum, grid_size, BLOCK_SIZE,task.prfNum); printf("computer pixelcount goalnum gridsize blocksize prfnum %zu,%zu ,%zu,%d ,%d \n", pixelcount, task.targetnum, grid_size, BLOCK_SIZE, task.prfNum);
printf("Dev:%d ,freqnum%d , prfnum:%d ,Rref: %e ,Rnear : %e ,Rfar: %e , StartFreq: %e ,DeletFreq: %e \n", printf("Dev:%d ,freqnum%d , prfnum:%d ,Rref: %e ,Rnear : %e ,Rfar: %e , StartFreq: %e ,DeletFreq: %e \n",
devid, task.freqNum, task.prfNum, task.Rref, task.Rnear, task.Rfar, task.startFreq, task.stepFreq); devid, task.freqNum, task.prfNum, task.Rref, task.Rnear, task.Rfar, task.startFreq, task.stepFreq);
double* d_R = (double*)mallocCUDADevice(task.prfNum * SHAREMEMORY_FLOAT_HALF * sizeof(double), devid); float* d_R = (float*)mallocCUDADevice(task.prfNum * SHAREMEMORY_FLOAT_HALF * sizeof(float), devid);
double* d_amps = (double*)mallocCUDADevice(task.prfNum * SHAREMEMORY_FLOAT_HALF * sizeof(double), devid); float* d_amps = (float*)mallocCUDADevice(task.prfNum * SHAREMEMORY_FLOAT_HALF * sizeof(float), devid);
long BLOCK_FREQNUM = NextBlockPad(task.freqNum, BLOCK_SIZE); // 256*freqBlockID long BLOCK_FREQNUM = NextBlockPad(task.freqNum, BLOCK_SIZE); // 256*freqBlockID
long cudaBlocknum = 0; long cudaBlocknum = 0;
long freqpoints = BLOCK_FREQNUM; long freqpoints = BLOCK_SIZE;
printf("freqpoints:%d\n", freqpoints); printf("freqpoints:%d\n", task.freqNum);
long prfcount = task.prfNum; long prfcount = task.prfNum;
long process = 0; long process = 0;
for (long sTi = 0; sTi < task.targetnum; sTi = sTi + SHAREMEMORY_FLOAT_HALF) { for (long sTi = 0; sTi < task.targetnum; sTi = sTi + SHAREMEMORY_FLOAT_HALF) {
cudaBlocknum = (task.prfNum * SHAREMEMORY_FLOAT_HALF + BLOCK_SIZE - 1) / BLOCK_SIZE; cudaBlocknum = (task.prfNum * SHAREMEMORY_FLOAT_HALF + BLOCK_SIZE - 1) / BLOCK_SIZE;
Kernel_Computer_R_amp_NoAntPattern << <cudaBlocknum, BLOCK_SIZE >> >( Kernel_Computer_R_amp_NoAntPattern << <cudaBlocknum, BLOCK_SIZE >> > (
task.antlist, task.antlist,
prfcount, prfcount,
task.goallist, task.goallist,
@ -664,39 +680,29 @@ extern "C" void ProcessRFPCTask(RFPCTask& task, long devid)
task.Pt, task.Pt,
task.Rref, task.Rref,
task.Rnear, task.Rfar, task.Rnear, task.Rfar,
task.maxGain,task.GainWeight, task.maxGain, task.GainWeight,
d_R, d_amps// 计算输出 d_R, d_amps// 计算输出
); );
PrintLasterError("CUDA_Kernel_Computer_R_amp"); PrintLasterError("CUDA_Kernel_Computer_R_amp");
cudaDeviceSynchronize(); cudaDeviceSynchronize();
//DeviceToHost(h_R, d_R, task.prfNum * SHAREMEMORY_FLOAT_HALF * sizeof(float));
//DeviceToHost(h_amp, d_amps, task.prfNum * SHAREMEMORY_FLOAT_HALF * sizeof(float));
//break;
dim3 blocks(task.prfNum); cudaBlocknum = (task.prfNum * BLOCK_FREQNUM + BLOCK_SIZE- 1) / BLOCK_SIZE;
dim3 threads(BLOCK_SIZE); CUDA_Kernel_Computer_echo_NoAntPattern << <cudaBlocknum, BLOCK_SIZE >> > (
d_R, d_amps,
size_t shared_mem_size = 2 * BLOCK_SIZE * sizeof(double); task.startFreq / 1e9, task.stepFreq / 1e9,
task.freqNum, BLOCK_FREQNUM,
CUDA_Kernel_Computer_echo_NoAntPattern_Optimized << <blocks, threads, shared_mem_size >> > (
d_R, d_amps, SHAREMEMORY_FLOAT_HALF,
task.startFreq/1e9, task.stepFreq / 1e9,
freqpoints, task.freqNum,
task.d_echoData, task.d_echoData,
task.prfNum task.prfNum
); );
//cudaBlocknum = (task.prfNum * BLOCK_FREQNUM + BLOCK_SIZE - 1) / BLOCK_SIZE;
//CUDA_Kernel_Computer_echo_NoAntPattern << <cudaBlocknum, BLOCK_SIZE >> > (
// d_R, d_amps, SHAREMEMORY_FLOAT_HALF,
// task.startFreq/1e9, task.stepFreq / 1e9,
// freqpoints, task.freqNum,
// task.d_echoData,
// task.prfNum
// );
PrintLasterError("CUDA_Kernel_Computer_echo"); PrintLasterError("CUDA_Kernel_Computer_echo");
cudaDeviceSynchronize(); cudaDeviceSynchronize();
if ((sTi * 100.0 / task.targetnum) - process >= 10) { if ((sTi * 100.0 / task.targetnum) - process >= 1) {
process = sTi * 100.0 / task.targetnum; process = sTi * 100.0 / task.targetnum;
PRINT("device ID : %d , TargetID [%f]: %d / %d finished %d\n",devid, sTi * 100.0 / task.targetnum, sTi, task.targetnum,devid); PRINT("device ID : %d , TargetID [%f]: %d / %d finished %d\n", devid, sTi * 100.0 / task.targetnum, sTi, task.targetnum, devid);
} }
} }

View File

@ -16,11 +16,7 @@
extern "C" struct SateState { extern "C" struct SateState {
double Px, Py, Pz, Vx, Vy, Vz; double Px, Py, Pz, Vx, Vy, Vz,antDirectX, antDirectY, antDirectZ;
//double antXaxisX, antXaxisY, antXaxisZ;
//double antYaxisX, antYaxisY, antYaxisZ;
//double antZaxisX, antZaxisY, antZaxisZ;
double antDirectX, antDirectY, antDirectZ;
}; };
@ -152,7 +148,7 @@ extern "C" void CUDA_RFPC_MainProcess(
extern "C" double* hostSigmaData_toDevice(int devid); extern "C" double* hostSigmaData_toDevice(int devid);
extern "C" void ProcessRFPCTask(RFPCTask& task,long devid); extern "C" void ProcessRFPCTask(RFPCTask& task,long devid,float* h_R,float* h_amp);

View File

@ -24,152 +24,6 @@
__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, double RefRange) {
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] = NAN;
imgy[idx] = NAN;
imgz[idx] = NAN;
//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] = NAN;
imgy[idx] = NAN;
imgz[idx] = NAN;
//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{ NAN,NAN,NAN };
}
}
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;
//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] = NAN;
imgy[idx] = NAN;
imgz[idx] = NAN;
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);
}
}
}
__device__ double computerR(double& Px, double& Py, double& Pz, double& Tx, double& Ty, double& Tz) { __device__ double computerR(double& Px, double& Py, double& Pz, double& Tx, double& Ty, double& Tz) {
@ -402,25 +256,6 @@ __global__ void kernel_pixelTimeBP(
extern "C" { extern "C" {
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, double RefRange
)
{
long pixelcount = prfcount * freqpoints;
int grid_size = (pixelcount + BLOCK_SIZE - 1) / BLOCK_SIZE;
kernel_TimeBPImageGridNet << <grid_size, BLOCK_SIZE >> > (
antPx, antPy, antPz,
antDirx, antDiry, antDirz,
imgx, imgy, imgz,
prfcount, freqpoints, meanH,
Rnear, dx, RefRange);
PrintLasterError("TIMEBPCreateImageGrid");
cudaDeviceSynchronize();
}

View File

@ -11,15 +11,6 @@
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,double RefRange
);
extern "C" void TimeBPImage( extern "C" void TimeBPImage(
double* antPx, double* antPy, double* antPz, double* antPx, double* antPy, double* antPz,

View File

@ -0,0 +1,74 @@
#include "QEcoherentAndAdditive.h"
#include "ui_QEcoherentAndAdditive.h"
#include <QFileDialog>
#include <QMessageBox>
QEcoherentAndAdditiveDialog::QEcoherentAndAdditiveDialog(QWidget *parent)
: QDialog(parent)
,ui(new Ui::QEcoherentAndAdditiveClass)
{
ui->setupUi(this);
QObject::connect(ui->pushButtonEchoDataAddSelect, SIGNAL(clicked()), this, SLOT(onpushButtonEchoDataAddSelectClicked()));
QObject::connect(ui->pushButtonEchoDataSelect, SIGNAL(clicked()), this, SLOT(onpushButtonEchoDataSelectClicked()));
QObject::connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onaccepted()));
QObject::connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onrejected()));
}
QEcoherentAndAdditiveDialog::~QEcoherentAndAdditiveDialog()
{}
void QEcoherentAndAdditiveDialog::onpushButtonEchoDataAddSelectClicked()
{
QString fileNames = QFileDialog::getOpenFileName(
this, // 父窗口
tr(u8"选择影像文件"), // 标题
QString(), // 默认路径
tr(u8"xml Files (*.xml);;All Files (*)") // 文件过滤器
);
// 如果用户选择了文件
if (!fileNames.isEmpty()) {
QString message = "选择的文件有:\n";
this->ui->lineEditEchoDataAddPath->setText(fileNames);
}
else {
QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。"));
}
}
void QEcoherentAndAdditiveDialog::onpushButtonEchoDataSelectClicked()
{
QString fileNames = QFileDialog::getOpenFileName(
this, // 父窗口
tr(u8"选择影像文件"), // 标题
QString(), // 默认路径
tr(u8"xml Files (*.xml);;All Files (*)") // 文件过滤器
);
// 如果用户选择了文件
if (!fileNames.isEmpty()) {
QString message = "选择的文件有:\n";
this->ui->lineEditEchoDataAdd2Path->setText(fileNames);
}
else {
QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。"));
}
}
void QEcoherentAndAdditiveDialog::onaccepted()
{
QString echo1Path = this->ui->lineEditEchoDataAddPath->text();
QString echo2Path = this->ui->lineEditEchoDataAdd2Path->text();
QMessageBox::information(this, tr(u8"提示"), tr(u8"完成"));
}
void QEcoherentAndAdditiveDialog::onrejected()
{
}

View File

@ -0,0 +1,29 @@
#pragma once
#include <QMainWindow>
#include <QDialog>
namespace Ui {
class QEcoherentAndAdditiveClass;
}
class QEcoherentAndAdditiveDialog : public QDialog
{
Q_OBJECT
public:
QEcoherentAndAdditiveDialog(QWidget *parent = nullptr);
~QEcoherentAndAdditiveDialog();
public slots:
void onpushButtonEchoDataAddSelectClicked();
void onpushButtonEchoDataSelectClicked();
void onaccepted();
void onrejected();
private:
Ui::QEcoherentAndAdditiveClass* ui;
};

View File

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QEcoherentAndAdditiveClass</class>
<widget class="QDialog" name="QEcoherentAndAdditiveClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>747</width>
<height>239</height>
</rect>
</property>
<property name="windowTitle">
<string>仿真回波叠加</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QToolBar" name="mainToolBar"/>
</item>
<item row="1" column="2">
<widget class="QLineEdit" name="lineEditEchoDataAddPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>带叠加回波:</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="pushButtonEchoDataAddSelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="pushButtonEchoDataSelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="3" column="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="1" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_4">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>被叠加回波</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLineEdit" name="lineEditEchoDataAdd2Path">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -103,7 +103,7 @@
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>D:/FZSimulation/LTDQ/Input/LandCover.dat</string> <string>D:/FZSimulation/LTDQ/Input/DEM30/LandCover.dat</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -233,7 +233,7 @@
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>D:/FZSimulation/LTDQ/Input/DEM_XYZ.dat</string> <string>D:/FZSimulation/LTDQ/Input/DEM30/DEM_XYZ.dat</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -350,7 +350,7 @@
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>D:/FZSimulation/LTDQ/Input/DEM_Sloper.dat</string> <string>D:/FZSimulation/LTDQ/Input/DEM30/DEM_Sloper.dat</string>
</property> </property>
</widget> </widget>
</item> </item>

Some files were not shown because too many files have changed in this diff Show More