Merge pull request 'RTPC-dev , 合并强度仿真结果' (#4) from RTPC-dev into Release

Reviewed-on: http://123.153.4.249:22779/LAMPSARToolSoftware/RasterProcessTool/pulls/4
Release
chenzenghui 2025-02-21 11:03:23 +08:00
commit 8f346b93da
113 changed files with 5189 additions and 357 deletions

View File

@ -138,10 +138,13 @@
<ProjectReference Include="..\GPUBaseLib\GPUBaseLib.vcxproj">
<Project>{b8b40c54-f7fe-4809-b6fb-8bc014570d7b}</Project>
</ProjectReference>
<ProjectReference Include="..\ImageshowTool\ImageshowTool.vcxproj">
<Project>{8c8ca066-a93a-4098-9a46-b855efeaadf2}</Project>
</ProjectReference>
<ProjectReference Include="..\LAMPDataProcessEXE\LAMPDataProcessEXE.vcxproj">
<Project>{4e6e79a3-048c-4fb4-bbb0-43c518a3e6d4}</Project>
</ProjectReference>
<ProjectReference Include="..\LAMPSARProcessProgram\RasterProcessTool.vcxproj">
<ProjectReference Include="..\RasterProcessToolWidget\RasterProcessTool.vcxproj">
<Project>{7ef67daa-dbc0-4b7f-80e8-11b4d2cb7ec2}</Project>
</ProjectReference>
<ProjectReference Include="..\RasterMainWidgetGUI\RasterMainWidgetGUI.vcxproj">
@ -150,9 +153,6 @@
<ProjectReference Include="..\Toolbox\BaseToolbox\BaseToolbox.vcxproj">
<Project>{070c157e-3c30-4e2b-a80c-cbc7b74df03f}</Project>
</ProjectReference>
<ProjectReference Include="..\Toolbox\ImageshowTool\ImageshowTool.vcxproj">
<Project>{8c8ca066-a93a-4098-9a46-b855efeaadf2}</Project>
</ProjectReference>
<ProjectReference Include="..\Toolbox\LAMPScatterTool\LAMPScatterTool.vcxproj">
<Project>{d603a623-132d-4304-ab03-638fc438f084}</Project>
</ProjectReference>

View File

@ -95,6 +95,8 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>./BaseTool;$(IncludePath)</IncludePath>
<CopyLocalProjectReference>true</CopyLocalProjectReference>
<CopyCppRuntimeToOutputDir>true</CopyCppRuntimeToOutputDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
@ -138,7 +140,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;BASECOMMONLIBRARY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
@ -187,6 +189,7 @@
<ClInclude Include="BaseTool\LogInfoCls.h" />
<QtMoc Include="ToolAbstract\QToolAbstract.h" />
<QtMoc Include="BaseTool\QToolProcessBarDialog.h" />
<ClInclude Include="BaseTool\PrintMsgToQDebug.h" />
<ClInclude Include="BaseTool\RasterToolBase.h" />
<ClInclude Include="BaseTool\SARSimulationImageL1.h" />
<ClInclude Include="BaseTool\stdafx.h" />
@ -200,6 +203,7 @@
<ClCompile Include="BaseTool\GeoOperator.cpp" />
<ClCompile Include="BaseTool\ImageOperatorBase.cpp" />
<ClCompile Include="BaseTool\LogInfoCls.cpp" />
<ClCompile Include="BaseTool\PrintMsgToQDebug.cpp" />
<ClCompile Include="BaseTool\QToolProcessBarDialog.cpp" />
<ClCompile Include="BaseTool\RasterToolBase.cpp" />
<ClCompile Include="BaseTool\SARSimulationImageL1.cpp" />

View File

@ -57,6 +57,9 @@
<ClInclude Include="BaseTool\stdafx.h">
<Filter>BaseTool</Filter>
</ClInclude>
<ClInclude Include="BaseTool\PrintMsgToQDebug.h">
<Filter>BaseTool</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
@ -98,6 +101,9 @@
<ClCompile Include="ToolAbstract\QToolAbstract.cpp">
<Filter>ToolAbstract</Filter>
</ClCompile>
<ClCompile Include="BaseTool\PrintMsgToQDebug.cpp">
<Filter>BaseTool</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="BaseTool\QToolProcessBarDialog.h">

View File

@ -128,6 +128,9 @@ struct Point3 {
double x = 0;
double y = 0;
double z = 0;
void setX(double ix) { x = ix; }
void setY(double iy) { y = iy; }
void setZ(double iz) { z = iz; }
};
struct DemBox {
@ -141,12 +144,12 @@ struct DemBox {
/*********************************************** FEKO仿真参数 ********************************************************************/
struct SatellitePos {
double time;
double Px;
double Py;
double Pz;
double Vx;
double Vy;
double Vz;
double Px ;
double Py ;
double Pz ;
double Vx ;
double Vy ;
double Vz ;
};

View File

@ -35,9 +35,20 @@
#include <gsl/gsl_multifit.h>
#include <qcoreapplication.h>
#include <xmmintrin.h> // 包含SSE指令集头文件
#include <emmintrin.h> // 包含SSE2指令集头文件
#include <omp.h> // 包含OpenMP头文件
QString longDoubleToQStringScientific(long double value) {
std::ostringstream stream;
// 设置流的精度为35位有效数字并使用科学计数法
stream << std::scientific << std::setprecision(35) << value;
// 将标准字符串转换为 QString
return QString::fromStdString(stream.str());
}
QString getCurrentTimeString() {
struct tm ConversionTime;
@ -626,4 +637,46 @@ Eigen::VectorXd linspace(double start, double stop, int num) {
}
return result;
}
}
void initializeMatrixWithSSE2(Eigen::MatrixXd& mat, const double* data, long rowcount, long colcount) {
__m128d zero = _mm_setzero_pd();
#pragma omp parallel for
for (long i = 0; i < rowcount; ++i) {
for (long j = 0; j < colcount; j += 2) { // 每次处理2个double
if (j + 2 <= colcount) {
__m128d src = _mm_loadu_pd(&data[i * colcount + j]);
_mm_storeu_pd(&mat(i, j), src);
}
else {
// 处理剩余部分
for (long k = j; k < colcount; ++k) {
mat(i, k) = data[i * colcount + k];
}
}
}
}
}
void initializeMatrixWithSSE2(Eigen::MatrixXf& mat, const float* data, long rowcount, long colcount) {
__m128 zero = _mm_setzero_ps();
#pragma omp parallel for
for (long i = 0; i < rowcount; ++i) {
for (long j = 0; j < colcount; j += 4) { // 每次处理4个float
if (j + 4 <= colcount) {
__m128 src = _mm_loadu_ps(&data[i * colcount + j]);
_mm_storeu_ps(&mat(i, j), src);
}
else {
// 处理剩余部分
for (long k = j; k < colcount; ++k) {
mat(i, k) = data[i * colcount + k];
}
}
}
}
}

View File

@ -27,9 +27,18 @@
#include <QString>
#include <QStringList>
#include "LogInfoCls.h"
#include <QString>
#include <QDebug>
#include <iomanip>
#include <sstream>
///////////////////////////////////// 运行时间打印
/////////////////////////////////////////////////////////////
///////////////////////////////////// 基础数学函数 /////////////////////////////////////////////////////////////
QString longDoubleToQStringScientific(long double value);
///////////////////////////////////// 运行时间打印 /////////////////////////////////////////////////////////////
QString BASECONSTVARIABLEAPI getCurrentTimeString();
@ -114,4 +123,31 @@ QVector<SatellitePos> BASECONSTVARIABLEAPI SatelliteAntPos2SatellitePos(QVector
QString BASECONSTVARIABLEAPI getDebugDataPath(QString filename);
std::vector<std::string> BASECONSTVARIABLEAPI split(const std::string& str, char delimiter);
Eigen::VectorXd BASECONSTVARIABLEAPI linspace(double start, double stop, int num);
/** 内存赋值 ***********************************************************************************************************/
void initializeMatrixWithSSE2(Eigen::MatrixXd& mat, const double* data, long rowcount, long colcount);
void initializeMatrixWithSSE2(Eigen::MatrixXf& mat, const float* data, long rowcount, long colcount);
/** 模板函数类 ***********************************************************************************************************/
template<typename T>
inline void BASECONSTVARIABLEAPI memsetInitArray(std::shared_ptr<T> ptr, long arrcount,T ti) {
for (long i = 0; i < arrcount; i++) {
ptr.get()[i] = ti;
}
}
template<typename T>
inline void BASECONSTVARIABLEAPI memcpyArray(std::shared_ptr<T> srct, std::shared_ptr<T> dest, long arrcount) {
for (long i = 0; i < arrcount; i++) {
dest.get()[i] = srct.get()[i];
}
}
#endif

View File

@ -97,6 +97,13 @@ QString getFileNameWidthoutExtend(QString path)
return fileNameWithoutExtension;
}
QString BASECONSTVARIABLEAPI getFileExtension(QString path)
{
QFileInfo fileInfo(path);
QString fileExtension = fileInfo.suffix(); // 获取无后缀文件名
return fileExtension;
}
bool isDirectory(const QString& path)
{
QFileInfo fileinfo(path);

View File

@ -37,6 +37,8 @@ QString BASECONSTVARIABLEAPI getFileNameFromPath(const QString& path);
QString BASECONSTVARIABLEAPI getFileNameWidthoutExtend(QString path);
QString BASECONSTVARIABLEAPI getFileExtension(QString path);
int BASECONSTVARIABLEAPI write_binfile(char* filepath, char* data, size_t data_len);
char* read_textfile(char* text_path, int* length);

View File

@ -629,6 +629,137 @@ Eigen::MatrixXd gdalImage::getData(int start_row, int start_col, int rows_count,
return datamatrix;
}
Eigen::MatrixXf gdalImage::getDataf(int start_row, int start_col, int rows_count, int cols_count,
int band_ids = 1)
{
omp_lock_t lock;
omp_init_lock(&lock);
omp_set_lock(&lock);
GDALAllRegister();
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen(
this->img_path.toUtf8().constData(), GA_ReadOnly)); // 锟斤拷只斤拷式锟斤拷取斤拷影锟斤拷
GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType();
GDALRasterBand* demBand = rasterDataset->GetRasterBand(band_ids);
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;
Eigen::MatrixXf datamatrix(rows_count, cols_count);
if (gdal_datatype == GDT_Byte) {
char* temp = new char[rows_count * cols_count];
demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count,
rows_count, gdal_datatype, 0, 0);
for (int i = 0; i < rows_count; i++) {
for (int j = 0; j < cols_count; j++) {
datamatrix(i, j) = temp[i * cols_count + j];
}
}
delete[] temp;
}
else if (gdal_datatype == GDT_UInt16) {
unsigned short* temp = new unsigned short[rows_count * cols_count];
demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count,
rows_count, gdal_datatype, 0, 0);
for (int i = 0; i < rows_count; i++) {
for (int j = 0; j < cols_count; j++) {
datamatrix(i, j) = temp[i * cols_count + j];
}
}
delete[] temp;
}
else if (gdal_datatype == GDT_Int16) {
short* temp = new short[rows_count * cols_count];
demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count,
rows_count, gdal_datatype, 0, 0);
for (int i = 0; i < rows_count; i++) {
for (int j = 0; j < cols_count; j++) {
datamatrix(i, j) = temp[i * cols_count + j];
}
}
delete[] temp;
}
else if (gdal_datatype == GDT_UInt32) {
unsigned int* temp = new unsigned int[rows_count * cols_count];
demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count,
rows_count, gdal_datatype, 0, 0);
for (int i = 0; i < rows_count; i++) {
for (int j = 0; j < cols_count; j++) {
datamatrix(i, j) = temp[i * cols_count + j];
}
}
delete[] temp;
}
else if (gdal_datatype == GDT_Int32) {
int* temp = new int[rows_count * cols_count];
demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count,
rows_count, gdal_datatype, 0, 0);
for (int i = 0; i < rows_count; i++) {
for (int j = 0; j < cols_count; j++) {
datamatrix(i, j) = temp[i * cols_count + j];
}
}
delete[] temp;
}
//else if (gdal_datatype == GDT_UInt64) {
// unsigned long* temp = new unsigned long[rows_count * cols_count];
// demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count,
// rows_count, gdal_datatype, 0, 0); for (int i = 0; i < rows_count; i++) {
// for (int j = 0; j <
// cols_count; j++) {
// datamatrix(i, j) = temp[i * cols_count + j];
// }
// }
// delete[] temp;
//}
//else if (gdal_datatype == GDT_Int64) {
// long* temp = new long[rows_count * cols_count];
// demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count,
// rows_count, gdal_datatype, 0, 0); for (int i = 0; i < rows_count; i++) {
// for (int j = 0; j <
// cols_count; j++) {
// datamatrix(i, j) = temp[i * cols_count + j];
// }
// }
// delete[] temp;
//}
else if (gdal_datatype == GDT_Float32) {
float* temp = new float[rows_count * cols_count];
demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count,
rows_count, gdal_datatype, 0, 0);
for (int i = 0; i < rows_count; i++) {
for (int j = 0; j < cols_count; j++) {
datamatrix(i, j) = temp[i * cols_count + j];
}
}
delete[] temp;
}
else if (gdal_datatype == GDT_Float64) {
double* temp = new double[rows_count * cols_count];
demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count,
rows_count, gdal_datatype, 0, 0);
for (int i = 0; i < rows_count; i++) {
for (int j = 0; j < cols_count; j++) {
datamatrix(i, j) = temp[i * cols_count + j];
}
}
delete[] temp;
}
else {
}
GDALClose((GDALDatasetH)rasterDataset);
omp_unset_lock(&lock); // 锟酵放伙拷斤拷
omp_destroy_lock(&lock); // 劫伙拷斤拷
// GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
return datamatrix;
}
Eigen::MatrixXi gdalImage::getDatai(int start_row, int start_col, int rows_count, int cols_count, int band_ids)
{
omp_lock_t lock;
@ -848,7 +979,10 @@ void gdalImage::saveImage(Eigen::MatrixXd data, int start_row = 0, int start_col
}
GDALAllRegister();
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff");
QString filesuffer = getFileExtension(this->img_path).toLower();
bool isTiff = filesuffer.contains("tif");
GDALDriver* poDriver = isTiff? GetGDALDriverManager()->GetDriverByName("GTiff"): GetGDALDriverManager()->GetDriverByName("ENVI");
GDALDataset* poDstDS = nullptr;
if(exists_test(this->img_path)) {
poDstDS = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_Update));
@ -912,9 +1046,90 @@ void gdalImage::saveImage(Eigen::MatrixXd data, int start_row = 0, int start_col
omp_destroy_lock(&lock); // 劫伙拷斤拷
}
void gdalImage::saveImage(Eigen::MatrixXf data, int start_row = 0, int start_col = 0,
int band_ids = 1)
{
GDALDataType datetype = this->getDataType();
omp_lock_t lock;
omp_init_lock(&lock);
omp_set_lock(&lock);
if (start_row + data.rows() > this->height || start_col + data.cols() > this->width) {
QString tip = u8"file path: " + this->img_path + " image size :( " + QString::number(this->height) + " , " + QString::number(this->width) + " ) " + " input size (" + QString::number(start_row + data.rows()) + ", " + QString::number(start_col + data.cols()) + ") ";
qDebug() << tip;
throw std::exception(tip.toUtf8().constData());
}
GDALAllRegister();
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
QString filesuffer = getFileExtension(this->img_path).toLower();
bool isTiff = filesuffer.contains("tif");
GDALDriver* poDriver = isTiff ? GetGDALDriverManager()->GetDriverByName("GTiff") : GetGDALDriverManager()->GetDriverByName("ENVI");
GDALDataset* poDstDS = nullptr;
if (exists_test(this->img_path)) {
poDstDS = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_Update));
}
else {
poDstDS = poDriver->Create(this->img_path.toUtf8().constData(), this->width, this->height,
this->band_num, datetype, NULL); // 斤拷锟斤拷
if (nullptr == poDstDS) {
QString tip = u8"file path: " + this->img_path + " image size :( " + QString::number(this->height) + " , " + QString::number(this->width) + " ) " + " input size (" + QString::number(start_row + data.rows()) + ", " + QString::number(start_col + data.cols()) + ") ";
qDebug() << tip;
throw std::exception(tip.toUtf8().constData());
return;
}
poDstDS->SetProjection(this->projection.toUtf8().constData());
double gt_ptr[6];
for (int i = 0; i < this->gt.rows(); i++) {
for (int j = 0; j < this->gt.cols(); j++) {
gt_ptr[i * 3 + j] = this->gt(i, j);
}
}
poDstDS->SetGeoTransform(gt_ptr);
//delete gt_ptr;
}
int datarows = data.rows();
int datacols = data.cols();
void* databuffer = nullptr;
if (datetype == GDT_Float32) {
databuffer = new float[datarows * datacols];
for (int i = 0; i < datarows; i++) {
for (int j = 0; j < datacols; j++) {
((float*)databuffer)[i * datacols + j] = float(data(i, j));
}
}
poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, datacols, datarows,
databuffer, datacols, datarows, datetype, 0, 0);
}
else if (datetype == GDT_Float64) {
databuffer = new double[datarows * datacols];
for (int i = 0; i < datarows; i++) {
for (int j = 0; j < datacols; j++) {
((double*)databuffer)[i * datacols + j] = double(data(i, j));
}
}
poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, datacols, datarows,
databuffer, datacols, datarows, datetype, 0, 0);
}
else {
}
GDALFlushCache(poDstDS);
GDALClose((GDALDatasetH)poDstDS);
// GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
delete[] databuffer;
omp_unset_lock(&lock); // 锟酵放伙拷斤拷
omp_destroy_lock(&lock); // 劫伙拷斤拷
}
void gdalImage::saveImage(Eigen::MatrixXi data, int start_row, int start_col, int band_ids)
{
GDALDataType datetype=this->getDataType();
omp_lock_t lock;
omp_init_lock(&lock);
@ -926,7 +1141,9 @@ void gdalImage::saveImage(Eigen::MatrixXi data, int start_row, int start_col, in
}
GDALAllRegister();
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff");
QString filesuffer = getFileExtension(this->img_path).toLower();
bool isTiff = filesuffer.contains("tif");
GDALDriver* poDriver = isTiff ? GetGDALDriverManager()->GetDriverByName("GTiff") : GetGDALDriverManager()->GetDriverByName("ENVI");
GDALDataset* poDstDS = nullptr;
if (exists_test(this->img_path)) {
poDstDS = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_Update));
@ -969,6 +1186,193 @@ void gdalImage::saveImage(Eigen::MatrixXi data, int start_row, int start_col, in
omp_destroy_lock(&lock); // 劫伙拷斤拷
}
void gdalImage::saveImage(std::shared_ptr<double> data, int start_row, int start_col, int rowcount, int colcount, int band_ids)
{
GDALDataType datetype = this->getDataType();
omp_lock_t lock;
omp_init_lock(&lock);
omp_set_lock(&lock);
if (start_row + rowcount > this->height || start_col + colcount > this->width) {
QString tip = u8"file path: " + this->img_path + " image size :( " + QString::number(this->height) + " , " + QString::number(this->width) + " ) " + " input size (" + QString::number(start_row + rowcount) + ", " + QString::number(start_col + colcount) + ") ";
qDebug() << tip;
throw std::exception(tip.toUtf8().constData());
}
GDALAllRegister();
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
QString filesuffer = getFileExtension(this->img_path).toLower();
bool isTiff = filesuffer.contains("tif");
GDALDriver* poDriver = isTiff ? GetGDALDriverManager()->GetDriverByName("GTiff") : GetGDALDriverManager()->GetDriverByName("ENVI");
GDALDataset* poDstDS = nullptr;
if (exists_test(this->img_path)) {
poDstDS = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_Update));
}
else {
poDstDS = poDriver->Create(this->img_path.toUtf8().constData(), this->width, this->height,
this->band_num, GDT_Float32, NULL); // 斤拷锟斤拷
poDstDS->SetProjection(this->projection.toUtf8().constData());
double gt_ptr[6];
for (int i = 0; i < this->gt.rows(); i++) {
for (int j = 0; j < this->gt.cols(); j++) {
gt_ptr[i * 3 + j] = this->gt(i, j);
}
}
poDstDS->SetGeoTransform(gt_ptr);
}
long datarows = rowcount;
long datacols = colcount;
double* databuffer = new double[datarows * datacols];
if (datetype == GDT_Float64) {
memcpy(databuffer, data.get(), sizeof(double) * datarows * datacols);
}
else {
for (long i = 0; i < datarows; i++) {
for (long j = 0; j < datacols; j++) {
databuffer[i * datacols + j] = data.get()[i * datacols + j];
}
}
}
// 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, datetype, 0, 0);
GDALFlushCache(poDstDS);
GDALClose((GDALDatasetH)poDstDS);
// GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
delete[] databuffer;
omp_unset_lock(&lock); // 锟酵放伙拷斤拷
omp_destroy_lock(&lock); // 劫伙拷斤拷
}
void gdalImage::saveImage(std::shared_ptr<float> data, int start_row, int start_col, int rowcount, int colcount, int band_ids)
{
GDALDataType datetype = this->getDataType();
omp_lock_t lock;
omp_init_lock(&lock);
omp_set_lock(&lock);
if (start_row + rowcount > this->height || start_col + colcount > this->width) {
QString tip = u8"file path: " + this->img_path + " image size :( " + QString::number(this->height) + " , " + QString::number(this->width) + " ) " + " input size (" + QString::number(start_row + rowcount) + ", " + QString::number(start_col + colcount) + ") ";
qDebug() << tip;
throw std::exception(tip.toUtf8().constData());
}
GDALAllRegister();
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
QString filesuffer = getFileExtension(this->img_path).toLower();
bool isTiff = filesuffer.contains("tif");
GDALDriver* poDriver = isTiff ? GetGDALDriverManager()->GetDriverByName("GTiff") : GetGDALDriverManager()->GetDriverByName("ENVI");
GDALDataset* poDstDS = nullptr;
if (exists_test(this->img_path)) {
poDstDS = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_Update));
}
else {
poDstDS = poDriver->Create(this->img_path.toUtf8().constData(), this->width, this->height,
this->band_num, GDT_Float32, NULL); // 斤拷锟斤拷
poDstDS->SetProjection(this->projection.toUtf8().constData());
double gt_ptr[6];
for (int i = 0; i < this->gt.rows(); i++) {
for (int j = 0; j < this->gt.cols(); j++) {
gt_ptr[i * 3 + j] = this->gt(i, j);
}
}
poDstDS->SetGeoTransform(gt_ptr);
}
long datarows = rowcount;
long datacols = colcount;
float* databuffer = new float[datarows * datacols];
if (datetype == GDT_Float32) {
memcpy(databuffer, data.get(), sizeof(float) * datarows * datacols);
}
else {
for (long i = 0; i < datarows; i++) {
for (long j = 0; j < datacols; j++) {
databuffer[i * datacols + j] = data.get()[i * datacols + j];
}
}
}
// 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, datetype, 0, 0);
GDALFlushCache(poDstDS);
GDALClose((GDALDatasetH)poDstDS);
//delete poDstDS;
//poDstDS = nullptr;
// GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
delete[] databuffer;
omp_unset_lock(&lock); // 锟酵放伙拷斤拷
omp_destroy_lock(&lock); // 劫伙拷斤拷
}
void gdalImage::saveImage(std::shared_ptr<int> data, int start_row, int start_col, int rowcount, int colcount, int band_ids)
{
GDALDataType datetype = this->getDataType();
omp_lock_t lock;
omp_init_lock(&lock);
omp_set_lock(&lock);
if (start_row + rowcount > this->height || start_col + colcount > this->width) {
QString tip = u8"file path: " + this->img_path + " image size :( " + QString::number(this->height) + " , " + QString::number(this->width) + " ) " + " input size (" + QString::number(start_row + rowcount) + ", " + QString::number(start_col + colcount) + ") ";
qDebug() << tip;
throw std::exception(tip.toUtf8().constData());
}
GDALAllRegister();
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
QString filesuffer = getFileExtension(this->img_path).toLower();
bool isTiff = filesuffer.contains("tif");
GDALDriver* poDriver = isTiff ? GetGDALDriverManager()->GetDriverByName("GTiff") : GetGDALDriverManager()->GetDriverByName("ENVI");
GDALDataset* poDstDS = nullptr;
if (exists_test(this->img_path)) {
poDstDS = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_Update));
}
else {
poDstDS = poDriver->Create(this->img_path.toUtf8().constData(), this->width, this->height,
this->band_num, GDT_Float32, NULL); // 斤拷锟斤拷
poDstDS->SetProjection(this->projection.toUtf8().constData());
double gt_ptr[6];
for (int i = 0; i < this->gt.rows(); i++) {
for (int j = 0; j < this->gt.cols(); j++) {
gt_ptr[i * 3 + j] = this->gt(i, j);
}
}
poDstDS->SetGeoTransform(gt_ptr);
}
long datarows = rowcount;
long datacols = colcount;
int* databuffer = new int[datarows * datacols];
if (datetype == GDT_Int32) {
memcpy(databuffer, data.get(), sizeof(int) * datarows * datacols);
}
else {
for (long i = 0; i < datarows; i++) {
for (long j = 0; j < datacols; j++) {
databuffer[i * datacols + j] = data.get()[i * datacols + j];
}
}
}
// 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, datetype, 0, 0);
GDALFlushCache(poDstDS);
GDALClose((GDALDatasetH)poDstDS);
// GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
delete[] databuffer;
omp_unset_lock(&lock); // 锟酵放伙拷斤拷
omp_destroy_lock(&lock); // 劫伙拷斤拷
}
void gdalImage::saveImage()
{
this->saveImage(this->data, this->start_row, this->start_col, this->data_band_ids);
@ -1488,7 +1892,7 @@ int ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int
}
// GDALDestroyGenImgProjTransformer(hTransformArg);
qDebug() << "create init GDALDataset " ;
GDALDataset* pDDst =
pDriver->Create(pszOutFile, new_width, new_height, nBandCount, dataType, NULL);
if(pDDst == NULL) {
@ -1500,7 +1904,8 @@ int ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int
pDDst->SetGeoTransform(gt);
GDALWarpOptions* psWo = GDALCreateWarpOptions();
CPLSetConfigOption("GDAL_NUM_THREADS", "ALL_CPUS"); // 使用所有可用的CPU核心
CPLSetConfigOption("GDAL_CACHEMAX", "16000"); // 设置缓存大小为500MB
// psWo->papszWarpOptions = CSLDuplicate(NULL);
psWo->eWorkingDataType = dataType;
psWo->eResampleAlg = eResample;
@ -1751,8 +2156,6 @@ void clipRaster(QString inRasterPath, QString outRasterPath, long minRow, long m
ErrorCode MergeRasterProcess(QVector<QString> filepaths, QString outfileptah, QString mainString, MERGEMODE mergecode, bool isENVI, ShowProessAbstract* dia )
{
// 参数检查
if (!isExists(mainString)) {
qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::FILENOFOUND) )<< "\t" << mainString;
@ -2121,7 +2524,7 @@ gdalImageComplex::gdalImageComplex(const QString& raster_path)
this->projection = rasterDataset->GetProjectionRef();
// 斤拷投影
// 释放投影
GDALFlushCache((GDALDatasetH)rasterDataset);
GDALClose((GDALDatasetH)rasterDataset);
rasterDataset = NULL; // 指矫匡拷
@ -2468,7 +2871,14 @@ long GetEPSGFromRasterFile(QString filepath)
std::cout << pszProjection << std::endl;
long epsgCode = atoi(oSRS.GetAuthorityCode(nullptr)); // 获取EPSG代码
const char* epscodestr = oSRS.GetAuthorityCode(nullptr);
if (NULL == epscodestr || nullptr == epscodestr) {
qDebug() << "EPSG code string could not be determined from the spatial reference.";
GDALClose(poDataset);
return -1;
}
long epsgCode = atoi(epscodestr); // 获取EPSG代码
if (epsgCode != 0) {
GDALClose(poDataset);
@ -3034,3 +3444,291 @@ void testOutAntPatternTrans(QString antpatternfilename, double* antPatternArr,
}
void MergeTiffs(QList<QString> inputFiles, QString outputFile) {
GDALAllRegister();
if (inputFiles.isEmpty()) {
fprintf(stderr, "No input files provided.\n");
return;
}
// Open the first file to determine the data type and coordinate system
GDALDataset* poFirstDS = (GDALDataset*)GDALOpen(inputFiles.first().toUtf8().constData(), GA_ReadOnly);
if (poFirstDS == nullptr) {
fprintf(stderr, "Failed to open the first file %s\n", inputFiles.first().toUtf8().constData());
return;
}
double adfGeoTransform[6];
CPLErr eErr = poFirstDS->GetGeoTransform(adfGeoTransform);
if (eErr != CE_None) {
fprintf(stderr, "Failed to get GeoTransform for the first file %s\n", inputFiles.first().toUtf8().constData());
GDALClose(poFirstDS);
return;
}
int nXSize = 0;
int nYSize = 0;
double minX = std::numeric_limits<double>::max();
double minY = std::numeric_limits<double>::max();
double maxX = std::numeric_limits<double>::lowest();
double maxY = std::numeric_limits<double>::lowest();
double pixelWidth = adfGeoTransform[1];
double pixelHeight = adfGeoTransform[5];
// Determine the bounding box and size of the output raster
for (const QString& inputFile : inputFiles) {
GDALDataset* poSrcDS = (GDALDataset*)GDALOpen(inputFile.toUtf8().constData(), GA_ReadOnly);
if (poSrcDS == nullptr) {
fprintf(stderr, "Failed to open %s\n", inputFile.toUtf8().constData());
continue;
}
double adfThisTransform[6];
eErr = poSrcDS->GetGeoTransform(adfThisTransform);
if (eErr != CE_None) {
fprintf(stderr, "Failed to get GeoTransform for %s\n", inputFile.toUtf8().constData());
GDALClose(poSrcDS);
continue;
}
minX = std::min(minX, adfThisTransform[0]);
minY = std::min(minY, adfThisTransform[3] + adfThisTransform[5] * poSrcDS->GetRasterYSize());
maxX = std::max(maxX, adfThisTransform[0] + adfThisTransform[1] * poSrcDS->GetRasterXSize());
maxY = std::max(maxY, adfThisTransform[3]);
GDALClose(poSrcDS);
}
nXSize = static_cast<int>(std::ceil((maxX - minX) / pixelWidth));
nYSize = static_cast<int>(std::ceil((maxY - minY) / (-pixelHeight)));
GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff");
if (poDriver == nullptr) {
fprintf(stderr, "GTiff driver not available.\n");
GDALClose(poFirstDS);
return;
}
char** papszOptions = nullptr;
GDALDataset* poDstDS = poDriver->Create(outputFile.toUtf8().constData(), nXSize, nYSize, 1, poFirstDS->GetRasterBand(1)->GetRasterDataType(), papszOptions);
if (poDstDS == nullptr) {
fprintf(stderr, "Creation of output file failed.\n");
GDALClose(poFirstDS);
return;
}
poDstDS->SetGeoTransform(adfGeoTransform);
const OGRSpatialReference* oSRS = poFirstDS->GetSpatialRef( );
poDstDS->SetSpatialRef(oSRS);
float fillValue = std::numeric_limits<float>::quiet_NaN();
void* pafScanline = CPLMalloc(GDALGetDataTypeSizeBytes(poFirstDS->GetRasterBand(1)->GetRasterDataType()) * nXSize);
memset(pafScanline, 0, GDALGetDataTypeSizeBytes(poFirstDS->GetRasterBand(1)->GetRasterDataType()) * nXSize);
// Initialize all pixels to NaN
for (int iY = 0; iY < nYSize; ++iY) {
GDALRasterBand* poBand = poDstDS->GetRasterBand(1);
poBand->RasterIO(GF_Write, 0, iY, nXSize, 1, pafScanline, nXSize, 1, poFirstDS->GetRasterBand(1)->GetRasterDataType(), 0, 0);
}
CPLFree(pafScanline);
// Read each source image and write into the destination image
for (const QString& inputFile : inputFiles) {
GDALDataset* poSrcDS = (GDALDataset*)GDALOpen(inputFile.toUtf8().constData(), GA_ReadOnly);
if (poSrcDS == nullptr) {
fprintf(stderr, "Failed to open %s\n", inputFile.toUtf8().constData());
continue;
}
double adfThisTransform[6];
poSrcDS->GetGeoTransform(adfThisTransform);
int srcXSize = poSrcDS->GetRasterXSize();
int srcYSize = poSrcDS->GetRasterYSize();
int dstXOffset = static_cast<int>(std::round((adfThisTransform[0] - minX) / pixelWidth));
int dstYOffset = static_cast<int>(std::round((maxY - adfThisTransform[3]) / (-pixelHeight)));
GDALRasterBand* poSrcBand = poSrcDS->GetRasterBand(1);
GDALRasterBand* poDstBand = poDstDS->GetRasterBand(1);
void* pafBuffer = CPLMalloc(GDALGetDataTypeSizeBytes(poFirstDS->GetRasterBand(1)->GetRasterDataType()) * srcXSize * srcYSize);
poSrcBand->RasterIO(GF_Read, 0, 0, srcXSize, srcYSize, pafBuffer, srcXSize, srcYSize, poFirstDS->GetRasterBand(1)->GetRasterDataType(), 0, 0);
poDstBand->RasterIO(GF_Write, dstXOffset, dstYOffset, srcXSize, srcYSize, pafBuffer, srcXSize, srcYSize, poFirstDS->GetRasterBand(1)->GetRasterDataType(), 0, 0);
CPLFree(pafBuffer);
GDALClose(poSrcDS);
}
GDALClose(poDstDS);
GDALClose(poFirstDS);
}
bool ConvertCoordinateSystem(QString inRasterPath, QString outRasterPath, long outepsgcode)
{
GDALAllRegister(); // 注册所有GDAL驱动
// 打开输入栅格
GDALDataset* poSrcDS = (GDALDataset*)GDALOpen(inRasterPath.toUtf8().constData(), GA_ReadOnly);
if (!poSrcDS) return false;
// 创建目标坐标系
OGRSpatialReference oTargetSRS;
oTargetSRS.importFromEPSG(outepsgcode);
char* pszTargetSRS = nullptr;
oTargetSRS.exportToWkt(&pszTargetSRS);
// 设置Warp选项
GDALWarpOptions* psWarpOptions = GDALCreateWarpOptions();
psWarpOptions->hSrcDS = poSrcDS;
psWarpOptions->hDstDS = nullptr;
psWarpOptions->nBandCount = poSrcDS->GetRasterCount();
psWarpOptions->panSrcBands = (int*)CPLMalloc(sizeof(int) * psWarpOptions->nBandCount);
psWarpOptions->panDstBands = (int*)CPLMalloc(sizeof(int) * psWarpOptions->nBandCount);
for (int i = 0; i < psWarpOptions->nBandCount; ++i) {
psWarpOptions->panSrcBands[i] = i + 1;
psWarpOptions->panDstBands[i] = i + 1;
}
// 设置坐标转换参数
psWarpOptions->papszWarpOptions = CSLSetNameValue(nullptr, "INIT_DEST", "NO_DATA");
psWarpOptions->dfWarpMemoryLimit = 8000; // 内存限制8000MB
// 创建坐标转换器
psWarpOptions->pTransformerArg =
GDALCreateGenImgProjTransformer(poSrcDS, nullptr, nullptr, pszTargetSRS,
FALSE, 0, 1);
psWarpOptions->pfnTransformer = GDALGenImgProjTransform;
// 创建输出文件
GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff");
GDALDataset* poDstDS = poDriver->Create(
outRasterPath.toUtf8().constData(),
0, 0, 0, GDT_Unknown, nullptr);
// 执行坐标转换
GDALWarpOperation oOperation;
oOperation.Initialize(psWarpOptions);
oOperation.ChunkAndWarpImage(0, 0,
poSrcDS->GetRasterXSize(),
poSrcDS->GetRasterYSize());
// 清理资源
GDALDestroyGenImgProjTransformer(psWarpOptions->pTransformerArg);
GDALDestroyWarpOptions(psWarpOptions);
CPLFree(pszTargetSRS);
GDALClose(poSrcDS);
GDALClose(poDstDS);
return true;
}
void ResampleByReferenceRasterB(QString rasterAPath, QString rasterBPath, QString rasterCPath) {
GDALAllRegister(); // 初始化GDAL驱动
// 阶段1读取参考栅格B的元数据
GDALDatasetH hRefDS = GDALOpen(rasterBPath.toUtf8().constData(), GA_ReadOnly);
if (!hRefDS) {
qDebug() << u8"参考栅格打开失败:" << rasterBPath;
return;
}
// 获取地理变换参数和尺寸
double geotransform[6];
int refWidth = GDALGetRasterXSize(hRefDS);
int refHeight = GDALGetRasterYSize(hRefDS);
if (GDALGetGeoTransform(hRefDS, geotransform) != CE_None) {
GDALClose(hRefDS);
qDebug() << u8"参考栅格缺少地理变换参数:" << rasterBPath;
return;
}
// 计算目标地理范围
const double xmin = geotransform[0];
const double ymax = geotransform[3];
const double xmax = xmin + geotransform[1] * refWidth;
const double ymin = ymax + geotransform[5] * refHeight;
// 获取目标坐标系
const char* projRef = GDALGetProjectionRef(hRefDS);
OGRSpatialReference targetSRS;
if (projRef[0] == '\0' || targetSRS.importFromWkt(projRef) != OGRERR_NONE) {
GDALClose(hRefDS);
qDebug() << u8"参考栅格坐标系无效:" << rasterBPath;
return;
}
GDALClose(hRefDS); // 尽早释放参考数据集
// 阶段2配置Warp参数
char** warpOptions = nullptr;
warpOptions = CSLAddString(warpOptions, "-t_srs"); // 目标坐标系
char* targetSRSWkt = nullptr;
targetSRS.exportToWkt(&targetSRSWkt);
warpOptions = CSLAddString(warpOptions, targetSRSWkt);
warpOptions = CSLAddString(warpOptions, "-te"); // 目标范围
warpOptions = CSLAddString(warpOptions, QString::number(xmin, 'f', 10).toUtf8().constData());
warpOptions = CSLAddString(warpOptions, QString::number(ymin, 'f', 10).toUtf8().constData());
warpOptions = CSLAddString(warpOptions, QString::number(xmax, 'f', 10).toUtf8().constData());
warpOptions = CSLAddString(warpOptions, QString::number(ymax, 'f', 10).toUtf8().constData());
warpOptions = CSLAddString(warpOptions, "-ts"); // 目标尺寸
warpOptions = CSLAddString(warpOptions, QString::number(refWidth).toUtf8().constData());
warpOptions = CSLAddString(warpOptions, QString::number(refHeight).toUtf8().constData());
warpOptions = CSLAddString(warpOptions, "-r"); // 双线性重采样
warpOptions = CSLAddString(warpOptions, "bilinear");
warpOptions = CSLAddString(warpOptions, "-of"); // 输出为GTiff
warpOptions = CSLAddString(warpOptions, "GTiff");
warpOptions = CSLAddString(warpOptions, "-wo"); // 启用多线程
warpOptions = CSLAddString(warpOptions, "NUM_THREADS=ALL_CPUS");
warpOptions = CSLAddString(warpOptions, "-co"); // 压缩优化
warpOptions = CSLAddString(warpOptions, "COMPRESS=LZW");
// 阶段3执行重采样操作
GDALWarpAppOptions* warpAppOptions = GDALWarpAppOptionsNew(warpOptions, nullptr);
GDALDatasetH hSrcDS = GDALOpen(rasterAPath.toUtf8().constData(), GA_ReadOnly);
if (!hSrcDS) {
GDALWarpAppOptionsFree(warpAppOptions);
CSLDestroy(warpOptions);
CPLFree(targetSRSWkt);
qDebug() << u8"源栅格打开失败:" << rasterAPath;
return;
}
int bUsageError = FALSE;
GDALDatasetH hDstDS = GDALWarp(
rasterCPath.toUtf8().constData(), // 输出路径
nullptr, // 自动选择驱动
1, &hSrcDS, // 输入数据集
warpAppOptions, // 转换参数
&bUsageError // 错误状态
);
// 阶段4资源清理与状态检查
GDALClose(hSrcDS);
if (hDstDS) GDALClose(hDstDS);
GDALWarpAppOptionsFree(warpAppOptions);
CSLDestroy(warpOptions);
CPLFree(targetSRSWkt);
if (bUsageError || !hDstDS) {
qDebug() << u8"重采样过程发生错误";
return;
}
qDebug() << u8"重采样成功完成:" << rasterCPath;
}

View File

@ -26,6 +26,7 @@
#include <cpl_conv.h> // for CPLMalloc()
#include "LogInfoCls.h"
#include <QObject>
#include <QList>
enum ProjectStripDelta {
Strip_6, // 6度带
@ -71,14 +72,14 @@ enum GDALREADARRCOPYMETHOD {
VARIABLEMETHOD // 变量赋值
};
class BASECONSTVARIABLEAPI ShowProessAbstract{
class BASECONSTVARIABLEAPI ShowProessAbstract {
public:
virtual void showProcess(double precent,QString tip);
virtual void showToolInfo( QString tip) ;
virtual void showProcess(double precent, QString tip);
virtual void showToolInfo(QString tip);
};
@ -91,7 +92,7 @@ public:
/// \param long 经度
/// \param lat 纬度
/// \return 对应投影坐标系统的 EPSG编码,-1 表示计算错误
long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat(double long, double lat,ProjectStripDelta stripState );
long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat(double long, double lat, ProjectStripDelta stripState);
long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat_inStrip3(double lon, double lat);
@ -106,15 +107,15 @@ long BASECONSTVARIABLEAPI GetEPSGFromRasterFile(QString filepath);
std::shared_ptr<PointRaster> BASECONSTVARIABLEAPI GetCenterPointInRaster(QString filepath);
CoordinateSystemType BASECONSTVARIABLEAPI getCoordinateSystemTypeByEPSGCode(long EPSGCODE);
// 文件打开 // 当指令销毁时调用GDALClose 销毁类型
std::shared_ptr<GDALDataset> BASECONSTVARIABLEAPI OpenDataset(const QString& in_path, GDALAccess rwmode= GA_ReadOnly);
std::shared_ptr<GDALDataset> BASECONSTVARIABLEAPI OpenDataset(const QString& in_path, GDALAccess rwmode = GA_ReadOnly);
void BASECONSTVARIABLEAPI CloseDataset(GDALDataset* ptr);
// 数据格式转换
int BASECONSTVARIABLEAPI TIFF2ENVI(QString in_tiff_path,QString out_envi_path);
int BASECONSTVARIABLEAPI ENVI2TIFF(QString in_envi_path,QString out_tiff_path);
int BASECONSTVARIABLEAPI TIFF2ENVI(QString in_tiff_path, QString out_envi_path);
int BASECONSTVARIABLEAPI ENVI2TIFF(QString in_envi_path, QString out_tiff_path);
// 保存影像数据 --直接保存 ENVI 文件
@ -123,12 +124,12 @@ int BASECONSTVARIABLEAPI CreateDataset(QString new_file_path, int height, in
int BASECONSTVARIABLEAPI saveDataset(QString new_file_path, int start_line, int start_cols, int band_ids, int datacols, int datarows, void* databuffer);
// 根据限制条件估算分块大小
int BASECONSTVARIABLEAPI block_num_pre_memory(int width, int height, GDALDataType gdal_dtype,double memey_size);
int BASECONSTVARIABLEAPI block_num_pre_memory(int width, int height, GDALDataType gdal_dtype, double memey_size);
// 将结果转换为复数 或者 实数
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> BASECONSTVARIABLEAPI ReadComplexMatrixData(int start_line,int width, int line_num, std::shared_ptr<GDALDataset> rasterDataset, GDALDataType gdal_datatype);
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> BASECONSTVARIABLEAPI ReadComplexMatrixData(int start_line, int width, int line_num, std::shared_ptr<GDALDataset> rasterDataset, GDALDataType gdal_datatype);
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> BASECONSTVARIABLEAPI ReadMatrixDoubleData(int start_line, int width, int line_num, std::shared_ptr<GDALDataset> rasterDataset, GDALDataType gdal_datatype,int band_idx);
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> BASECONSTVARIABLEAPI ReadMatrixDoubleData(int start_line, int width, int line_num, std::shared_ptr<GDALDataset> rasterDataset, GDALDataType gdal_datatype, int band_idx);
Eigen::MatrixXd BASECONSTVARIABLEAPI getGeoTranslationArray(QString in_path);
ImageGEOINFO BASECONSTVARIABLEAPI getImageINFO(QString in_path);
@ -143,7 +144,7 @@ struct RasterExtend {
double max_y;//经度
};
@ -161,15 +162,23 @@ public: // 方法
virtual void setHeight(int);
virtual void setWidth(int);
virtual void setTranslationMatrix(Eigen::MatrixXd gt);
virtual void setData(Eigen::MatrixXd,int data_band_ids=1);
virtual void setData(Eigen::MatrixXd, int data_band_ids = 1);
virtual Eigen::MatrixXd getData(int start_row, int start_col, int rows_count, int cols_count, int band_ids);
virtual Eigen::MatrixXf getDataf(int start_row, int start_col, int rows_count, int cols_count, int band_ids);
virtual Eigen::MatrixXi getDatai(int start_row, int start_col, int rows_count, int cols_count, int band_ids);
virtual ErrorCode getData(double* data, int start_row, int start_col, int rows_count, int cols_count, int band_ids);
virtual ErrorCode getData(long* data, int start_row, int start_col, int rows_count, int cols_count, int band_ids);
virtual Eigen::MatrixXd getGeoTranslation();
virtual GDALDataType getDataType();
virtual void saveImage(Eigen::MatrixXd, int start_row, int start_col, int band_ids);
virtual void saveImage(Eigen::MatrixXf, int start_row, int start_col, int band_ids);
virtual void saveImage(Eigen::MatrixXi, int start_row, int start_col, int band_ids);
virtual void saveImage(std::shared_ptr<double>, 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();
virtual void setNoDataValue(double nodatavalue, int band_ids);
virtual void setNoDataValuei(int nodatavalue, int band_ids);
@ -186,7 +195,7 @@ public: // 方法
double BandminValue(int bandids = 1);
virtual GDALRPCInfo getRPC();
virtual Eigen::MatrixXd getLandPoint(Eigen::MatrixXd points);
virtual Eigen::MatrixXd getHist(int bandids);
virtual RasterExtend getExtend();
@ -210,7 +219,7 @@ public:
/// <summary>
/// gdalImage图像操作类
/// </summary>
class BASECONSTVARIABLEAPI gdalImageComplex:public gdalImage
class BASECONSTVARIABLEAPI gdalImageComplex :public gdalImage
{
public: // 方法
@ -219,7 +228,7 @@ public: // 方法
void setData(Eigen::MatrixXcd);
void saveImage(Eigen::MatrixXcd data, int start_row, int start_col, int band_ids);
Eigen::MatrixXcd getDataComplex(int start_row, int start_col, int rows_count, int cols_count, int band_ids);
void saveImage() override;
void savePreViewImage();
public:
@ -230,7 +239,7 @@ public:
gdalImage BASECONSTVARIABLEAPI CreategdalImageDouble(const QString& img_path, int height, int width, int band_num, Eigen::MatrixXd gt, QString projection, bool need_gt = true, bool overwrite = false, bool isEnvi = false);
gdalImage BASECONSTVARIABLEAPI CreategdalImage(const QString& img_path, int height, int width, int band_num, Eigen::MatrixXd gt, QString projection, bool need_gt = true, bool overwrite = false, bool isEnvi = false);
gdalImage BASECONSTVARIABLEAPI CreategdalImage(const QString& img_path, int height, int width, int band_num, Eigen::MatrixXd gt, long espgcode, GDALDataType eType=GDT_Float32, bool need_gt = true, bool overwrite = false,bool isENVI=false);
gdalImage BASECONSTVARIABLEAPI CreategdalImage(const QString& img_path, int height, int width, int band_num, Eigen::MatrixXd gt, long espgcode, GDALDataType eType = GDT_Float32, bool need_gt = true, bool overwrite = false, bool isENVI = false);
gdalImageComplex BASECONSTVARIABLEAPI CreategdalImageComplex(const QString& img_path, int height, int width, int band_num, Eigen::MatrixXd gt, QString projection, bool need_gt = true, bool overwrite = false);
@ -255,13 +264,13 @@ int BASECONSTVARIABLEAPI alignRaster(QString inputPath, QString referencePath
//--------------------- 保存文博 -------------------------------
int BASECONSTVARIABLEAPI saveMatrixXcd2TiFF(Eigen::MatrixXcd data, QString out_tiff_path);
//----------------------------------------------------
void BASECONSTVARIABLEAPI clipRaster(QString inRasterPath, QString outRasterPath, long minRow, long maxRow, long minCol, long maxCol);
// 坐标系转换
bool BASECONSTVARIABLEAPI ConvertCoordinateSystem(QString inRasterPath, QString outRasterPath, long outepsgcode);
//--------------------- 图像合并流程 ------------------------------
enum MERGEMODE
@ -269,12 +278,13 @@ enum MERGEMODE
MERGE_GEOCODING,
};
ErrorCode BASECONSTVARIABLEAPI MergeRasterProcess(QVector<QString> filepath, QString outfileptah, QString mainString, MERGEMODE mergecode = MERGEMODE::MERGE_GEOCODING, bool isENVI = false, ShowProessAbstract* dia=nullptr);
ErrorCode BASECONSTVARIABLEAPI MergeRasterInGeoCoding(QVector<gdalImage> inimgs, gdalImage resultimg,gdalImage maskimg, ShowProessAbstract* dia = nullptr);
void BASECONSTVARIABLEAPI MergeTiffs(QList<QString> inputFiles, QString outputFile);
ErrorCode BASECONSTVARIABLEAPI MergeRasterProcess(QVector<QString> filepath, QString outfileptah, QString mainString, MERGEMODE mergecode = MERGEMODE::MERGE_GEOCODING, bool isENVI = false, ShowProessAbstract* dia = nullptr);
ErrorCode BASECONSTVARIABLEAPI MergeRasterInGeoCoding(QVector<gdalImage> inimgs, gdalImage resultimg, gdalImage maskimg, ShowProessAbstract* dia = nullptr);
// 保存矩阵转换为envi文件默认数据格式为double
bool BASECONSTVARIABLEAPI saveEigenMatrixXd2Bin(Eigen::MatrixXd data, QString dataStrPath);
@ -293,7 +303,7 @@ void BASECONSTVARIABLEAPI testOutClsArr(QString filename, long* amp, long rowc
//--------------------- 图像文件读写 ------------------------------
template<typename T>
inline std::shared_ptr<T> readDataArr(gdalImage& imgds, int start_row, int start_col, int rows_count, int cols_count, int band_ids, GDALREADARRCOPYMETHOD method)
inline std::shared_ptr<T> readDataArr(gdalImage& imgds, long start_row, long start_col, long& rows_count, long& cols_count, int band_ids, GDALREADARRCOPYMETHOD method)
{
std::shared_ptr<T> result = nullptr;
@ -490,9 +500,9 @@ inline std::shared_ptr<T> readDataArr(gdalImage& imgds, int start_row, int start
// GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
return result;
}
template<typename T>
inline std::shared_ptr<T> readDataArrComplex(gdalImageComplex& imgds, int start_row, int start_col, int rows_count, int cols_count, int band_ids, GDALREADARRCOPYMETHOD method)
inline std::shared_ptr<T> readDataArrComplex(gdalImageComplex& imgds, long start_row, long start_col, long& rows_count, long& cols_count, int band_ids, GDALREADARRCOPYMETHOD method)
{
std::shared_ptr<T> result = nullptr;
@ -565,6 +575,8 @@ inline std::shared_ptr<T> readDataArrComplex(gdalImageComplex& imgds, int start_
}
//--------------------- 图像分块 ------------------------------

View File

@ -0,0 +1,13 @@
#include "PrintMsgToQDebug.h"
#include <QDebug>
BASECONSTVARIABLEAPI void PrintMsgToQDebug(char* msg)
{
qDebug() << QString(msg);
return ;
}
BASECONSTVARIABLEAPI void PrintTipMsgToQDebug(const char* tip, const char* msg)
{
qDebug() <<QString(tip)<<"\t:\t" << QString(msg);
return;
}

View File

@ -0,0 +1,11 @@
#pragma once
#ifndef PRINTMSGTOQDEBUG_H_
#define PRINTMSGTOQDEBUG_H_
#include "BaseConstVariable.h"
extern "C" BASECONSTVARIABLEAPI void PrintMsgToQDebug(char* msg);
extern "C" BASECONSTVARIABLEAPI void PrintTipMsgToQDebug(const char* tip, const char* msg);
#endif // !PRINTMSGTOQDEBUG_H_

View File

@ -25,6 +25,11 @@
<ClInclude Include="GPUTool\GPUBaseLibAPI.h" />
<CudaCompile Include="GPUTool\GPUTool.cuh" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BaseCommonLibrary\BaseCommonLibrary.vcxproj">
<Project>{872ecd6f-30e3-4a1b-b17c-15e87d373ff6}</Project>
</ProjectReference>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
@ -80,6 +85,8 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>..\BaseCommonLibrary;..\BaseCommonLibrary\BaseTool;..\BaseCommonLibrary\ToolAbstract;.;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
<CopyLocalProjectReference>true</CopyLocalProjectReference>
<CopyCppRuntimeToOutputDir>true</CopyCppRuntimeToOutputDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>

View File

@ -11,6 +11,7 @@
#include <chrono>
#include "BaseConstVariable.h"
#include "GPUTool.cuh"
#include "PrintMsgToQDebug.h"
#ifdef __CUDANVCC___
#define BLOCK_DIM 1024
@ -486,7 +487,8 @@ void PrintLasterError(const char* s)
{
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("%s: %s\n", s, cudaGetErrorString(err));
//printf("%s: %s\n", s, cudaGetErrorString(err));
PrintTipMsgToQDebug(s, cudaGetErrorString(err));
exit(2);
}
}

View File

@ -218,6 +218,17 @@ void ImageShowDialogClass::load_double_data(float* data, long rows, long cols, Q
this->load_double_MatrixX_data(dataArr, name);
}
void ImageShowDialogClass::load_double_data(double* data, long rows, long cols, QString name)
{
Eigen::MatrixXd dataArr = Eigen::MatrixXd::Zero(rows, cols);
for (long i = 0; i < rows; i++) {
for (long j = 0; j < cols; j++) {
dataArr(i, j) = data[i * cols + j];
}
}
this->load_double_MatrixX_data(dataArr, name);
}
void ImageShowDialogClass::load_double_data(float* Xs, float* Ys, float* data, long rows, long cols, QString name)
{

View File

@ -134,6 +134,7 @@ public:
void load_double_MatrixX_data(Eigen::MatrixXd data, QString name);
void load_double_MatrixX_data(Eigen::MatrixXd X,Eigen::MatrixXd Y,Eigen::MatrixXd data, QString name);
void load_double_data(float* data, long rows, long cols, QString name);
void load_double_data(double* data, long rows, long cols, QString name);
void load_double_data(float* Xs,float* Ys,float* data, long rows, long cols, QString name);
void remove_Data( QString name);

View File

@ -62,9 +62,11 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<IncludePath>..\..\BaseCommonLibrary;..\..\BaseCommonLibrary\BaseTool;..\..\BaseCommonLibrary\ToolAbstract;..\..\GPUBaseLib\GPUTool;.\Imageshow;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\Toolbox\</OutDir>
<TargetName>PluginTool_$(ProjectName)</TargetName>
<IncludePath>..\BaseCommonLibrary;..\BaseCommonLibrary\BaseTool;..\BaseCommonLibrary\ToolAbstract;..\GPUBaseLib\GPUTool;.\Imageshow;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<TargetName>$(ProjectName)</TargetName>
<CopyLocalProjectReference>true</CopyLocalProjectReference>
<CopyCppRuntimeToOutputDir>true</CopyCppRuntimeToOutputDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
@ -121,11 +123,11 @@
<QtRcc Include="Imageshow\qcustomplot.qrc" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\BaseCommonLibrary\BaseCommonLibrary.vcxproj">
<ProjectReference Include="..\BaseCommonLibrary\BaseCommonLibrary.vcxproj">
<Project>{872ecd6f-30e3-4a1b-b17c-15e87d373ff6}</Project>
</ProjectReference>
<ProjectReference Include="..\..\LAMPSARProcessProgram\RasterProcessTool.vcxproj">
<Project>{7ef67daa-dbc0-4b7f-80e8-11b4d2cb7ec2}</Project>
<ProjectReference Include="..\GPUBaseLib\GPUBaseLib.vcxproj">
<Project>{b8b40c54-f7fe-4809-b6fb-8bc014570d7b}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@ -3,21 +3,21 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.10.35122.118
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RasterProcessToolWidget", "RasterProcessTool.vcxproj", "{7EF67DAA-DBC0-4B7F-80E8-11B4D2CB7EC2}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RasterProcessToolWidget", "RasterProcessToolWidget\RasterProcessTool.vcxproj", "{7EF67DAA-DBC0-4B7F-80E8-11B4D2CB7EC2}"
ProjectSection(ProjectDependencies) = postProject
{B8B40C54-F7FE-4809-B6FB-8BC014570D7B} = {B8B40C54-F7FE-4809-B6FB-8BC014570D7B}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseCommonLibrary", "..\BaseCommonLibrary\BaseCommonLibrary.vcxproj", "{872ECD6F-30E3-4A1B-B17C-15E87D373FF6}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseCommonLibrary", "BaseCommonLibrary\BaseCommonLibrary.vcxproj", "{872ECD6F-30E3-4A1B-B17C-15E87D373FF6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseToolbox", "..\Toolbox\BaseToolbox\BaseToolbox.vcxproj", "{070C157E-3C30-4E2B-A80C-CBC7B74DF03F}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseToolbox", "Toolbox\BaseToolbox\BaseToolbox.vcxproj", "{070C157E-3C30-4E2B-A80C-CBC7B74DF03F}"
ProjectSection(ProjectDependencies) = postProject
{B8B40C54-F7FE-4809-B6FB-8BC014570D7B} = {B8B40C54-F7FE-4809-B6FB-8BC014570D7B}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LAMPScatterTool", "..\Toolbox\LAMPScatterTool\LAMPScatterTool.vcxproj", "{D603A623-132D-4304-AB03-638FC438F084}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LAMPScatterTool", "Toolbox\LAMPScatterTool\LAMPScatterTool.vcxproj", "{D603A623-132D-4304-AB03-638FC438F084}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimulationSARTool", "..\Toolbox\SimulationSARTool\SimulationSARTool.vcxproj", "{ED06DFCD-4B9F-41F7-8F25-1823C2398142}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimulationSARTool", "Toolbox\SimulationSARTool\SimulationSARTool.vcxproj", "{ED06DFCD-4B9F-41F7-8F25-1823C2398142}"
ProjectSection(ProjectDependencies) = postProject
{B8B40C54-F7FE-4809-B6FB-8BC014570D7B} = {B8B40C54-F7FE-4809-B6FB-8BC014570D7B}
EndProjectSection
@ -26,17 +26,17 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ToolBox", "ToolBox", "{41B1
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BaseLib", "BaseLib", "{2768F9D6-D410-4E88-A479-8336DAF97072}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageshowTool", "..\Toolbox\ImageshowTool\ImageshowTool.vcxproj", "{8C8CA066-A93A-4098-9A46-B855EFEAADF2}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ALLRelease", "..\ALLRelease\ALLRelease.vcxproj", "{8A71D19D-9AC6-42E9-81EC-9E82AF8075B8}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ALLRelease", "ALLRelease\ALLRelease.vcxproj", "{8A71D19D-9AC6-42E9-81EC-9E82AF8075B8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MainWidget", "MainWidget", "{6505E2BA-06A2-447B-BC85-8CF1A81359BC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LAMPDataProcessEXE", "..\LAMPDataProcessEXE\LAMPDataProcessEXE.vcxproj", "{4E6E79A3-048C-4FB4-BBB0-43C518A3E6D4}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LAMPDataProcessEXE", "LAMPDataProcessEXE\LAMPDataProcessEXE.vcxproj", "{4E6E79A3-048C-4FB4-BBB0-43C518A3E6D4}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GPUBaseLib", "..\GPUBaseLib\GPUBaseLib.vcxproj", "{B8B40C54-F7FE-4809-B6FB-8BC014570D7B}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GPUBaseLib", "GPUBaseLib\GPUBaseLib.vcxproj", "{B8B40C54-F7FE-4809-B6FB-8BC014570D7B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RasterMainWidgetGUI", "..\RasterMainWidgetGUI\RasterMainWidgetGUI.vcxproj", "{E56B3878-A3DC-41A4-ABF3-B628816D0D64}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RasterMainWidgetGUI", "RasterMainWidgetGUI\RasterMainWidgetGUI.vcxproj", "{E56B3878-A3DC-41A4-ABF3-B628816D0D64}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageshowTool", "ImageshowTool\ImageshowTool.vcxproj", "{8C8CA066-A93A-4098-9A46-B855EFEAADF2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -86,14 +86,6 @@ Global
{ED06DFCD-4B9F-41F7-8F25-1823C2398142}.Release|x64.Build.0 = Release|x64
{ED06DFCD-4B9F-41F7-8F25-1823C2398142}.Release|x86.ActiveCfg = Release|x64
{ED06DFCD-4B9F-41F7-8F25-1823C2398142}.Release|x86.Build.0 = Release|x64
{8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Debug|x64.ActiveCfg = Debug|x64
{8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Debug|x64.Build.0 = Debug|x64
{8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Debug|x86.ActiveCfg = Debug|x64
{8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Debug|x86.Build.0 = Debug|x64
{8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Release|x64.ActiveCfg = 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.Build.0 = Release|x64
{8A71D19D-9AC6-42E9-81EC-9E82AF8075B8}.Debug|x64.ActiveCfg = Debug|x64
{8A71D19D-9AC6-42E9-81EC-9E82AF8075B8}.Debug|x64.Build.0 = Debug|x64
{8A71D19D-9AC6-42E9-81EC-9E82AF8075B8}.Debug|x86.ActiveCfg = Debug|Win32
@ -126,6 +118,14 @@ Global
{E56B3878-A3DC-41A4-ABF3-B628816D0D64}.Release|x64.Build.0 = Release|x64
{E56B3878-A3DC-41A4-ABF3-B628816D0D64}.Release|x86.ActiveCfg = Release|x64
{E56B3878-A3DC-41A4-ABF3-B628816D0D64}.Release|x86.Build.0 = Release|x64
{8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Debug|x64.ActiveCfg = Debug|x64
{8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Debug|x64.Build.0 = Debug|x64
{8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Debug|x86.ActiveCfg = Debug|x64
{8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Debug|x86.Build.0 = Debug|x64
{8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Release|x64.ActiveCfg = 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.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -136,9 +136,9 @@ Global
{070C157E-3C30-4E2B-A80C-CBC7B74DF03F} = {41B1F23D-9119-47A7-B102-34022AF83CDA}
{D603A623-132D-4304-AB03-638FC438F084} = {41B1F23D-9119-47A7-B102-34022AF83CDA}
{ED06DFCD-4B9F-41F7-8F25-1823C2398142} = {41B1F23D-9119-47A7-B102-34022AF83CDA}
{8C8CA066-A93A-4098-9A46-B855EFEAADF2} = {41B1F23D-9119-47A7-B102-34022AF83CDA}
{B8B40C54-F7FE-4809-B6FB-8BC014570D7B} = {2768F9D6-D410-4E88-A479-8336DAF97072}
{E56B3878-A3DC-41A4-ABF3-B628816D0D64} = {6505E2BA-06A2-447B-BC85-8CF1A81359BC}
{8C8CA066-A93A-4098-9A46-B855EFEAADF2} = {2768F9D6-D410-4E88-A479-8336DAF97072}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {179F0A62-C631-4667-AD03-3780ADE09F41}

View File

@ -62,8 +62,9 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<IncludePath>..\BaseCommonLibrary;..\BaseCommonLibrary\BaseTool;..\BaseCommonLibrary\ToolAbstract;..\GPUBaseLib\GPUTool;..\LAMPSARProcessProgram;..\LAMPMainWidget;..\RasterMainWidgetGUI;..\RasterMainWidgetGUI\RasterMainWidget;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
<IncludePath>..\BaseCommonLibrary;..\BaseCommonLibrary\BaseTool;..\BaseCommonLibrary\ToolAbstract;..\GPUBaseLib\GPUTool;..\RasterProcessToolWidget;..\LAMPMainWidget;..\RasterMainWidgetGUI;..\RasterMainWidgetGUI\RasterMainWidget;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
<CopyLocalProjectReference>true</CopyLocalProjectReference>
<CopyCppRuntimeToOutputDir>true</CopyCppRuntimeToOutputDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
@ -114,12 +115,15 @@
<ProjectReference Include="..\GPUBaseLib\GPUBaseLib.vcxproj">
<Project>{b8b40c54-f7fe-4809-b6fb-8bc014570d7b}</Project>
</ProjectReference>
<ProjectReference Include="..\LAMPSARProcessProgram\RasterProcessTool.vcxproj">
<Project>{7ef67daa-dbc0-4b7f-80e8-11b4d2cb7ec2}</Project>
<ProjectReference Include="..\ImageshowTool\ImageshowTool.vcxproj">
<Project>{8c8ca066-a93a-4098-9a46-b855efeaadf2}</Project>
</ProjectReference>
<ProjectReference Include="..\RasterMainWidgetGUI\RasterMainWidgetGUI.vcxproj">
<Project>{e56b3878-a3dc-41a4-abf3-b628816d0d64}</Project>
</ProjectReference>
<ProjectReference Include="..\RasterProcessToolWidget\RasterProcessTool.vcxproj">
<Project>{7ef67daa-dbc0-4b7f-80e8-11b4d2cb7ec2}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">

View File

@ -6,7 +6,7 @@
#include <QTextStream>
#include <QDateTime>
#include "LAMPMainWidgetRunProgram.h"
#include "RasterWidgetMessageShow.h"
#pragma execution_character_set("utf-8")
@ -22,28 +22,77 @@ void customMessageHandler(QtMsgType type, const QMessageLogContext& context, con
QFile outFile("application.log");
outFile.open(QIODevice::WriteOnly | QIODevice::Append);
QTextStream ts(&outFile);
RasterMessageShow::RasterWidgetMessageShow* _showIntance = RasterMessageShow::RasterWidgetMessageShow::getInstance();
switch (type) {
case QtDebugMsg:
{
QString logMessage = QString("%1 Debug: %2 (%3:%4, %5)")
.arg(dateTime) // Assuming dateTime is a QDateTime object and needs to be converted to string
.arg(QString::fromLocal8Bit(localMsg.constData()))
.arg(file)
.arg(context.line)
.arg(function);
ts << logMessage << "\n";
_showIntance->ShowMessageInfo(logMessage);
break;
}
case QtInfoMsg:
{
QString logMessage = QString("%1 Info: %2 (%3:%4, %5)")
.arg(dateTime)
.arg(QString::fromLocal8Bit(localMsg.constData()))
.arg(file)
.arg(context.line)
.arg(function);
ts << logMessage << "\n";
_showIntance->ShowMessageInfo(logMessage);
break;
}
case QtWarningMsg:
{
QString logMessage = QString("%1 Warning: %2 (%3:%4, %5)")
.arg(dateTime)
.arg(QString::fromLocal8Bit(localMsg.constData()))
.arg(file)
.arg(context.line)
.arg(function);
ts << logMessage << "\n";
break;
}
case QtCriticalMsg:
{
QString logMessage = QString("%1 Critical: %2 (%3:%4, %5)")
.arg(dateTime)
.arg(QString::fromLocal8Bit(localMsg.constData()))
.arg(file)
.arg(context.line)
.arg(function);
ts << logMessage << "\n";
_showIntance->ShowMessageInfo(logMessage);
break;
}
case QtFatalMsg:
{
QString logMessage = QString("%1 Fatal: %2 (%3:%4, %5)")
.arg(dateTime)
.arg(QString::fromLocal8Bit(localMsg.constData()))
.arg(file)
.arg(context.line)
.arg(function);
ts << logMessage<<"\n";
_showIntance->ShowMessageInfo(logMessage);
abort();
}
}
switch (type) {
case QtDebugMsg:
ts << dateTime << " Debug: " << localMsg.constData() << " (" << file << ":" << context.line << ", " << function << ")\n";
break;
case QtInfoMsg:
ts << dateTime << " Info: " << localMsg.constData() << " (" << file << ":" << context.line << ", " << function << ")\n";
break;
case QtWarningMsg:
ts << dateTime << " Warning: " << localMsg.constData() << " (" << file << ":" << context.line << ", " << function << ")\n";
break;
case QtCriticalMsg:
ts << dateTime << " Critical: " << localMsg.constData() << " (" << file << ":" << context.line << ", " << function << ")\n";
break;
case QtFatalMsg:
ts << dateTime << " Fatal: " << localMsg.constData() << " (" << file << ":" << context.line << ", " << function << ")\n";
abort();
}
}
int main(int argc, char *argv[])
{
qInstallMessageHandler(customMessageHandler);
QApplication a(argc, argv);
RasterMainWidgetRun();
return a.exec();

View File

@ -0,0 +1,10 @@
#include "PrintMessage_C.h"
#include <QDebug>
RASTERMAINWIDGETGUICFUNAPI_EXPORT void PrintMessageWindowsShow_C_Fun(char* msg)
{
qDebug() << QString(msg);
return ;
}

View File

@ -0,0 +1,13 @@
#pragma once
#ifndef PRINTMESSAGE_C_H_
#define PRINTMESSAGE_C_H_
#include "RasterMainWidgetGUICFunAPI.h"
extern "C" RASTERMAINWIDGETGUICFUNAPI_EXPORT void PrintMessageWindowsShow_C_Fun(char* msg);
#endif

View File

@ -13,6 +13,8 @@
#include "BaseTool.h"
#include "FileOperator.h"
#include "RasterWidgetMessageShow.h"
#pragma execution_character_set("utf-8")
@ -53,8 +55,12 @@ RasterMainWidget::RasterMainWidget(QWidget *parent)
setupActions();
setRightToolbox();
mUi->panAction->trigger();
mUi->layerList->setCurrentItem(mLayerList.first());
//mUi->panAction->trigger();
//mUi->layerList->setCurrentItem(mLayerList.first());
}
RasterMainWidget::~RasterMainWidget() {
@ -98,8 +104,8 @@ RasterMainWidget::setupActions() {
void RasterMainWidget::setupWindow() {
mUi->mapCanvasLayout->addWidget(mMapConvas);
setFixedSize(size());
setWindowFlags(windowFlags() & ~Qt::WindowMaximizeButtonHint);
//setFixedSize(size());
//setWindowFlags(windowFlags() | Qt::WindowMinMaxButtonsHint | Qt::WindowSystemMenuHint);
QObject::connect(mMapConvas, &MapCanvas::zoomChanged, this, &RasterMainWidget::zoomChangedHandle);
QObject::connect(mMapConvas, &MapCanvas::clicked, this, &RasterMainWidget::clickedHandle);
@ -107,6 +113,12 @@ void RasterMainWidget::setupWindow() {
QObject::connect(mUi->layerList, &QListWidget::currentItemChanged, this, &RasterMainWidget::layerChanged);
QObject::connect(mUi->leftTopBtn, &QPushButton::clicked, this, &RasterMainWidget::leftTopClickedHandle);
QObject::connect(mUi->rightBottomBtn, &QPushButton::clicked, this, &RasterMainWidget::rightBottomClickedHandle);
RasterMessageShow::RasterWidgetMessageShow* messageshow = RasterMessageShow::RasterWidgetMessageShow::getInstance(this);
messageshow->bandingTextBrowserMessage(this->mUi->textBrowserMessage);
}
void RasterMainWidget::setupStatusBar() {

View File

@ -15,6 +15,7 @@
#include "QApplicationSettingManager.h"
#include "ToolBoxWidget.h"
namespace Ui {
class RasterMainWidget;
}
@ -75,7 +76,6 @@ namespace LAMPMainWidget {
private slots:
void on_drawArea_triggered();
void on_addPlaneaction_triggered();
private:

View File

@ -2,6 +2,9 @@
<ui version="4.0">
<class>RasterMainWidget</class>
<widget class="QMainWindow" name="RasterMainWidget">
<property name="windowModality">
<enum>Qt::WindowModal</enum>
</property>
<property name="enabled">
<bool>true</bool>
</property>
@ -9,8 +12,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>810</width>
<height>637</height>
<width>906</width>
<height>609</height>
</rect>
</property>
<property name="sizePolicy">
@ -19,191 +22,70 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="windowTitle">
<string>地图下载器</string>
<string>LAMP栅格处理主界面</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QWidget" name="gridLayoutWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1441</width>
<height>911</height>
</rect>
</property>
<layout class="QGridLayout" name="mainLayout">
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="mapTab">
<attribute name="title">
<string>地图</string>
</attribute>
<widget class="QWidget" name="gridLayoutWidget_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1241</width>
<height>881</height>
</rect>
</property>
<layout class="QGridLayout" name="mapCanvasLayout"/>
</widget>
<widget class="QWidget" name="gridLayoutWidget_3">
<property name="geometry">
<rect>
<x>1250</x>
<y>-1</y>
<width>191</width>
<height>881</height>
</rect>
</property>
<layout class="QGridLayout" name="infoLayout">
<item row="0" column="1">
<widget class="QGroupBox" name="layersListGbx">
<property name="title">
<string/>
</property>
<widget class="QGroupBox" name="layersGbx">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>171</width>
<height>611</height>
</rect>
</property>
<property name="title">
<string>图层列表</string>
</property>
<widget class="QWidget" name="gridLayoutWidget_4">
<property name="geometry">
<rect>
<x>9</x>
<y>30</y>
<width>151</width>
<height>571</height>
</rect>
</property>
<layout class="QGridLayout" name="layersLayout">
<item row="0" column="0">
<widget class="QListWidget" name="layerList"/>
</item>
</layout>
</widget>
</widget>
<widget class="QGroupBox" name="downloadGbx">
<property name="geometry">
<rect>
<x>10</x>
<y>650</y>
<width>171</width>
<height>221</height>
</rect>
</property>
<property name="title">
<string>下载区域</string>
</property>
<widget class="QLineEdit" name="leftTopText">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>151</width>
<height>31</height>
</rect>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="leftTopBtn">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>151</width>
<height>25</height>
</rect>
</property>
<property name="toolTip">
<string>点击开始选择左上角点</string>
</property>
<property name="text">
<string>选择左上角</string>
</property>
</widget>
<widget class="QLineEdit" name="rightBottomText">
<property name="geometry">
<rect>
<x>12</x>
<y>140</y>
<width>151</width>
<height>31</height>
</rect>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="rightBottomBtn">
<property name="geometry">
<rect>
<x>10</x>
<y>180</y>
<width>151</width>
<height>25</height>
</rect>
</property>
<property name="toolTip">
<string>点击开始选择右下角点</string>
</property>
<property name="text">
<string>选择右下角</string>
</property>
</widget>
</widget>
</widget>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QGridLayout" name="mainLayout">
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<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="infoLayout"/>
</item>
</layout>
</widget>
</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 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>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>810</width>
<height>22</height>
<width>906</width>
<height>23</height>
</rect>
</property>
<widget class="QMenu" name="projectMenu">
@ -275,6 +157,217 @@
<addaction name="downloadAction"/>
<addaction name="separator"/>
</widget>
<widget class="QDockWidget" name="dockWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<attribute name="dockWidgetArea">
<number>1</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="layersGbx">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>图层列表</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QGridLayout" name="layersLayout">
<item row="0" column="0">
<widget class="QListWidget" name="layerList">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="dockWidgetMessage">
<property name="windowTitle">
<string>消息窗口</string>
</property>
<attribute name="dockWidgetArea">
<number>8</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents_2">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QTextBrowser" name="textBrowserMessage">
<property name="styleSheet">
<string notr="true">line-height:1</string>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'SimSun'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="dockWidget_2">
<attribute name="dockWidgetArea">
<number>2</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents_3">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QGroupBox" name="layersListGbx">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string/>
</property>
<widget class="QGroupBox" name="downloadGbx">
<property name="geometry">
<rect>
<x>10</x>
<y>650</y>
<width>171</width>
<height>221</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>下载区域</string>
</property>
<widget class="QLineEdit" name="leftTopText">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>151</width>
<height>31</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="leftTopBtn">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>151</width>
<height>25</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>点击开始选择左上角点</string>
</property>
<property name="text">
<string>选择左上角</string>
</property>
</widget>
<widget class="QLineEdit" name="rightBottomText">
<property name="geometry">
<rect>
<x>12</x>
<y>140</y>
<width>151</width>
<height>31</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="rightBottomBtn">
<property name="geometry">
<rect>
<x>10</x>
<y>180</y>
<width>151</width>
<height>25</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>点击开始选择右下角点</string>
</property>
<property name="text">
<string>选择右下角</string>
</property>
</widget>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="dockWidget_3">
<attribute name="dockWidgetArea">
<number>1</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents_4">
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<layout class="QGridLayout" name="mapCanvasLayout"/>
</item>
</layout>
</widget>
</widget>
<action name="tutorialAction">
<property name="text">
<string>使用教程</string>

View File

@ -62,8 +62,9 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<IncludePath>.;.\RasterMainWidget;..\LAMPSARProcessProgram;..\LAMPSARProcessProgram\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>
<CopyCppRuntimeToOutputDir>true</CopyCppRuntimeToOutputDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
@ -99,6 +100,7 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="PrintMessage_C.cpp" />
<ClCompile Include="RasterMainWidget\crs.cpp" />
<ClCompile Include="RasterMainWidget\gaodenormalprovider.cpp" />
<ClCompile Include="RasterMainWidget\imgwriter.cpp" />
@ -127,6 +129,7 @@
<ClCompile Include="RasterMainWidget\tmsprovider.cpp" />
<ClCompile Include="RasterMainWidget\tmsproviderfactory.cpp" />
<ClCompile Include="RasterMainWidget\webmercator.cpp" />
<ClCompile Include="RasterWidgetMessageShow.cpp" />
<QtRcc Include="RasterMainWidgetGUI.qrc" />
<ClCompile Include="main.cpp" />
<QtUic Include="RasterMainWidget\RasterMainWidget.ui" />
@ -134,7 +137,9 @@
<QtUic Include="RasterMainWidget\taskwindow.ui" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="PrintMessage_C.h" />
<ClInclude Include="RasterMainWidgetGUIAPI.h" />
<ClInclude Include="RasterMainWidgetGUICFunAPI.h" />
<ClInclude Include="RasterMainWidget\crs.h" />
<ClInclude Include="RasterMainWidget\gaodesatelliteprovider.h" />
<ClInclude Include="RasterMainWidget\googlechinanormalprovider.h" />
@ -161,6 +166,7 @@
<ClInclude Include="RasterMainWidget\tmslayer.h" />
<ClInclude Include="RasterMainWidget\tmsproviderfactory.h" />
<ClInclude Include="RasterMainWidget\webmercator.h" />
<QtMoc Include="RasterWidgetMessageShow.h" />
<QtMoc Include="RasterMainWidget\tmsprovider.h" />
<QtMoc Include="RasterMainWidget\taskwindow.h" />
<QtMoc Include="RasterMainWidget\sponsorwindow.h" />
@ -180,7 +186,10 @@
<ProjectReference Include="..\GPUBaseLib\GPUBaseLib.vcxproj">
<Project>{b8b40c54-f7fe-4809-b6fb-8bc014570d7b}</Project>
</ProjectReference>
<ProjectReference Include="..\LAMPSARProcessProgram\RasterProcessTool.vcxproj">
<ProjectReference Include="..\ImageshowTool\ImageshowTool.vcxproj">
<Project>{8c8ca066-a93a-4098-9a46-b855efeaadf2}</Project>
</ProjectReference>
<ProjectReference Include="..\RasterProcessToolWidget\RasterProcessTool.vcxproj">
<Project>{7ef67daa-dbc0-4b7f-80e8-11b4d2cb7ec2}</Project>
</ProjectReference>
</ItemGroup>

View File

@ -115,6 +115,12 @@
<ClCompile Include="RasterMainWidget\webmercator.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="RasterWidgetMessageShow.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="PrintMessage_C.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="RasterMainWidget\crs.h">
@ -198,6 +204,12 @@
<ClInclude Include="RasterMainWidgetGUIAPI.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PrintMessage_C.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="RasterMainWidgetGUICFunAPI.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<QtMoc Include="RasterMainWidget\gaodenormalprovider.h">
@ -224,6 +236,9 @@
<QtMoc Include="RasterMainWidget\tmsprovider.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="RasterWidgetMessageShow.h">
<Filter>Header Files</Filter>
</QtMoc>
</ItemGroup>
<ItemGroup>
<None Include="RasterMainWidget\proj.db" />

View File

@ -0,0 +1,11 @@
#pragma once
#ifndef RASTERMAINWIDGETGUICFUNAPI_H_
#define RASTERMAINWIDGETGUICFUNAPI_H_
#ifdef RASTERMAINWIDGETGUI_LIB
#define RASTERMAINWIDGETGUICFUNAPI_EXPORT __declspec(dllexport)
#else
#define RASTERMAINWIDGETGUICFUNAPI_EXPORT __declspec(dllimport)
#endif
#endif

View File

@ -0,0 +1,45 @@
#include "RasterWidgetMessageShow.h"
namespace RasterMessageShow {
RasterWidgetMessageShow* RasterWidgetMessageShow::_instance = nullptr;
RasterWidgetMessageShow::RasterWidgetMessageShow(QObject* parant):QObject(parant)
{
QObject::connect(this, SIGNAL(ShowMessage(QString)), this, SLOT(ShowMessageInfo(QString)));
}
RasterWidgetMessageShow::~RasterWidgetMessageShow()
{
}
void RasterWidgetMessageShow::bandingTextBrowserMessage(QTextBrowser* intextBrowserMessage)
{
this->textBrowserMessage = intextBrowserMessage;
}
QTextBrowser* RasterWidgetMessageShow::getTextBrowserMessage()
{
return textBrowserMessage;
}
void RasterWidgetMessageShow::ShowMessageInfo(QString Message)
{
if (nullptr != this->textBrowserMessage) {
this->textBrowserMessage->append(Message);
}
else {}
}
RasterWidgetMessageShow* RasterWidgetMessageShow::getInstance(QObject* parant)
{
if (nullptr == RasterWidgetMessageShow::_instance) {
RasterWidgetMessageShow::_instance = new RasterWidgetMessageShow(parant);
}
return RasterWidgetMessageShow::_instance;
}
};

View File

@ -0,0 +1,35 @@
#pragma once
#include "RasterMainWidgetGUIAPI.h"
#include <QTextBrowser>
#include <QString>
namespace RasterMessageShow {
class RASTERMAINWIDGETGUI_EXPORT RasterWidgetMessageShow:public QObject
{
Q_OBJECT
public:
RasterWidgetMessageShow(QObject* parant=nullptr);
~RasterWidgetMessageShow();
private:
QTextBrowser* textBrowserMessage=nullptr;
public:
void bandingTextBrowserMessage(QTextBrowser* textBrowserMessage);
QTextBrowser* getTextBrowserMessage();
signals:
void ShowMessage(QString Message);
public slots:
void ShowMessageInfo(QString Message);
private:
static RasterWidgetMessageShow* _instance; // µ¥Àý
public:
static RasterWidgetMessageShow* getInstance(QObject* parant = nullptr);
};
}

View File

@ -0,0 +1,14 @@
<RCC>
<qresource prefix="/themes">
<file alias="mActionPan">theme/mActionPan.svg</file>
<file alias="mActionRefresh">theme/mActionRefresh.svg</file>
<file alias="mActionZoomIn">theme/mActionZoomIn.svg</file>
<file alias="mActionZoomOut">theme/mActionZoomOut.svg</file>
<file alias="mActionSelect">theme/mActionSelect.svg</file>
<file alias="mActionDownload">theme/mActionDownload.svg</file>
</qresource>
<qresource prefix="/">
<file>plane-red.png</file>
<file>plane-black.png</file>
</qresource>
</RCC>

View File

@ -72,6 +72,7 @@
<IncludePath>..\BaseCommonLibrary;..\BaseCommonLibrary\BaseTool;..\GPUBaseLib\GPUTool;..\BaseCommonLibrary\ToolAbstract;$(oneMKLIncludeDir);$(IncludePath)</IncludePath>
<ReferencePath>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\lib\x64;$(ReferencePath)</ReferencePath>
<CopyLocalProjectReference>true</CopyLocalProjectReference>
<CopyCppRuntimeToOutputDir>true</CopyCppRuntimeToOutputDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
@ -125,6 +126,7 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="QApplicationSettingManager.cpp" />
<QtRcc Include="..\RasterMainWidgetGUI\resource\res.qrc" />
<QtRcc Include="RasterProcessTool.qrc" />
<QtUic Include="QApplicationSettingManager.ui" />
<QtUic Include="ToolBoxWidget.ui" />
@ -147,6 +149,7 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="RasterProcessToolWidgetAPI.h" />
<ClInclude Include="RasterProcessToolWidgetCFunAPI.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">

View File

@ -38,6 +38,9 @@
<ClCompile Include="ToolBoxWidget.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<QtRcc Include="..\RasterMainWidgetGUI\resource\res.qrc">
<Filter>Resource Files</Filter>
</QtRcc>
</ItemGroup>
<ItemGroup>
<ClCompile Include="QApplicationSettingManager.cpp">
@ -61,5 +64,8 @@
<ClInclude Include="RasterProcessToolWidgetAPI.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="RasterProcessToolWidgetCFunAPI.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -0,0 +1,12 @@
#pragma once
#ifndef RASTERPROCESSTOOLWIDGETCFUNAPI_H_
#define RASTERPROCESSTOOLWIDGETCFUNAPI_H_
#ifdef RASTERPROCESSTOOLWIDGET_LIB
#define RASTERPROCESSTOOLWIDGETCFUNAPI_EXPORT __declspec(dllexport)
#else
#define RASTERPROCESSTOOLWIDGETCFUNAPI_EXPORT __declspec(dllimport)
#endif
#endif

View File

@ -47,11 +47,11 @@ void ToolBoxWidget::initToolbox(QString dlltoolPath)
// 设置文件过滤规则,只查找包含 "plugin_" 的 dll 文件
QStringList filters;
filters << "PluginTool_*.dll";
// 获取当前目录下所有符合过滤规则的文件
QFileInfoList files = dir.entryInfoList(filters, QDir::Files);
for (const QFileInfo& fileInfo : files) {
QString plugpath = fileInfo.absoluteFilePath();
QString plugpath =fileInfo.absoluteFilePath();
qDebug() << "Found DLL:" << plugpath;
//continue;
QString pluginname = fileInfo.fileName();
@ -66,7 +66,9 @@ void ToolBoxWidget::initToolbox(QString dlltoolPath)
HMODULE hmodel = LoadLibrary(LPCWSTR(plugpath.utf16()));
qDebug() << "Error Code :" + QString::number(GetLastError());
if (hmodel) {
qDebug() << "find fun RegisterPreToolBox started!!!";
fun = (Reg)GetProcAddress(hmodel, "RegisterPreToolBox");
qDebug() << "find fun RegisterPreToolBox started!!!";
if (fun) {
qDebug() << "loading Plugin started!!!";
fun(this->_mainWindows, this);
@ -75,7 +77,7 @@ void ToolBoxWidget::initToolbox(QString dlltoolPath)
else {
FreeLibrary(hmodel);
qDebug() << "do not find Register function Plugin: " << plugpath;
return ;
continue ;
}
}
else {
@ -191,7 +193,7 @@ QToolboxTreeWidgetItem::QToolboxTreeWidgetItem(QTreeWidget* IntreeWidgetToolBox,
button->setIcon(icon);
button->setText(toolName);
button->setLayoutDirection(Qt::LeftToRight);
button->setStyleSheet("QPushButton { text-align: left;font-size: 12px; font-weight: normal; }");
button->setStyleSheet("QPushButton { text-align: left; font-weight: blob; }");
IntreeWidgetToolBox->setItemWidget(actionItem, 0, button);
QObject::connect(button, SIGNAL(clicked()), item, SLOT(excute()));
item->setParent(IntreeWidgetToolBox);

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -7,9 +7,10 @@
#include "QMergeRasterProcessDialog.h"
#include "RasterMainWidget.h"
#include "ToolBoxWidget.h"
#include "QDEMResampleDialog.h"
#include "DEMLLA2XYZTool.h"
#include "QConvertCoordinateSystemDialog.h"
#include "QResampleRefrenceRaster.h"
GF3ImportDataToolButton::GF3ImportDataToolButton(QWidget* parent) :QToolAbstract(parent)
{
@ -101,18 +102,79 @@ void MergeRasterProcessToolButton::excute()
void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox)
{
GF3ImportDataToolButton* items1 = new GF3ImportDataToolButton(toolbox);
Complex2AmpPhaseToolButton* items2 = new Complex2AmpPhaseToolButton(toolbox);
QRDOrthProcessClassToolButton* items3 = new QRDOrthProcessClassToolButton(toolbox);
QOrthSlrRasterToolButton* items4 = new QOrthSlrRasterToolButton(toolbox);
MergeRasterProcessToolButton* items5 = new MergeRasterProcessToolButton(toolbox);
emit toolbox->addBoxToolItemSIGNAL(items1);
emit toolbox->addBoxToolItemSIGNAL(items2);
emit toolbox->addBoxToolItemSIGNAL(items3);
emit toolbox->addBoxToolItemSIGNAL(items4);
emit toolbox->addBoxToolItemSIGNAL(items5);
emit toolbox->addBoxToolItemSIGNAL(new GF3ImportDataToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new Complex2AmpPhaseToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new QRDOrthProcessClassToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new QOrthSlrRasterToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new MergeRasterProcessToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new QDEMResampleDialogToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new QDEMLLA2XYZToolToolButton(toolbox));
}
QDEMResampleDialogToolButton::QDEMResampleDialogToolButton(QWidget* parent)
{
this->toolPath = QVector<QString>(0);
this->toolPath.push_back(u8"基础处理");
this->toolname = QString(u8"DEM重采样");
}
QDEMResampleDialogToolButton::~QDEMResampleDialogToolButton()
{
}
void QDEMResampleDialogToolButton::excute()
{
QDEMResampleDialog* dialog = new QDEMResampleDialog();
dialog->show();
}
QDEMLLA2XYZToolToolButton::QDEMLLA2XYZToolToolButton(QWidget* parent)
{
this->toolPath = QVector<QString>(0);
this->toolPath.push_back(u8"基础处理");
this->toolname = QString(u8"DEM(WGS84)LLA转为XYZ");
}
QDEMLLA2XYZToolToolButton::~QDEMLLA2XYZToolToolButton()
{
}
void QDEMLLA2XYZToolToolButton::excute()
{
DEMLLA2XYZTool* dialog = new DEMLLA2XYZTool();
dialog->show();
}
QConvertCoordinateSystemToolButton::QConvertCoordinateSystemToolButton(QWidget* parent)
{
this->toolPath = QVector<QString>(0);
this->toolPath.push_back(u8"基础处理");
this->toolname = QString(u8"栅格坐标系转换");
}
QConvertCoordinateSystemToolButton::~QConvertCoordinateSystemToolButton()
{
}
void QConvertCoordinateSystemToolButton::excute()
{
QConvertCoordinateSystemDialog* dialog = new QConvertCoordinateSystemDialog();
dialog->show();
}
QResampleRefrenceRasterToolButton::QResampleRefrenceRasterToolButton(QWidget* parent)
{
this->toolPath = QVector<QString>(0);
this->toolPath.push_back(u8"基础处理");
this->toolname = QString(u8"栅格重采样(参考影像)");
}
QResampleRefrenceRasterToolButton::~QResampleRefrenceRasterToolButton()
{
}
void QResampleRefrenceRasterToolButton::excute()
{
QResampleRefrenceRaster* dialog = new QResampleRefrenceRaster;
dialog->show();
}

View File

@ -63,7 +63,50 @@ public slots:
};
class BASETOOLBOX_EXPORT QDEMResampleDialogToolButton : public QToolAbstract {
Q_OBJECT
public:
QDEMResampleDialogToolButton(QWidget* parent = nullptr);
~QDEMResampleDialogToolButton();
public slots:
virtual void excute() override;
};
class BASETOOLBOX_EXPORT QDEMLLA2XYZToolToolButton : public QToolAbstract {
Q_OBJECT
public:
QDEMLLA2XYZToolToolButton(QWidget* parent = nullptr);
~QDEMLLA2XYZToolToolButton();
public slots:
virtual void excute() override;
};
class BASETOOLBOX_EXPORT QConvertCoordinateSystemToolButton : public QToolAbstract {
Q_OBJECT
public:
QConvertCoordinateSystemToolButton(QWidget* parent = nullptr);
~QConvertCoordinateSystemToolButton();
public slots:
virtual void excute() override;
};
class BASETOOLBOX_EXPORT QResampleRefrenceRasterToolButton : public QToolAbstract {
Q_OBJECT
public:
QResampleRefrenceRasterToolButton(QWidget* parent = nullptr);
~QResampleRefrenceRasterToolButton();
public slots:
virtual void excute() override;
};
extern "C" BASETOOLBOX_EXPORT void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox);

View File

@ -62,9 +62,11 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<IncludePath>..\..\BaseCommonLibrary;..\..\BaseCommonLibrary\BaseTool;..\..\BaseCommonLibrary\ToolAbstract;..\..\GPUBaseLib\GPUTool;.\BaseToolbox;..\..\RasterMainWidgetGUI\RasterMainWidget;..\..\RasterMainWidgetGUI;..\..\LAMPSARProcessProgram;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
<IncludePath>..\..\BaseCommonLibrary;..\..\BaseCommonLibrary\BaseTool;..\..\BaseCommonLibrary\ToolAbstract;..\..\GPUBaseLib\GPUTool;.\BaseToolbox;..\..\RasterMainWidgetGUI\RasterMainWidget;..\..\RasterMainWidgetGUI;..\..\RasterProcessToolWidget;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\Toolbox\</OutDir>
<TargetName>PluginTool_$(ProjectName)</TargetName>
<CopyLocalProjectReference>true</CopyLocalProjectReference>
<CopyCppRuntimeToOutputDir>true</CopyCppRuntimeToOutputDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
@ -110,10 +112,13 @@
<ClCompile Include="BaseToolbox\GF3PSTNClass.cpp" />
<ClCompile Include="BaseToolbox\QClipRasterByRowCols.cpp" />
<ClCompile Include="BaseToolbox\QComplex2AmpPhase.cpp" />
<ClCompile Include="BaseToolbox\QConvertCoordinateSystemDialog.cpp" />
<ClCompile Include="BaseToolbox\QDEMResampleDialog.cpp" />
<ClCompile Include="BaseToolbox\QImportGF3StripL1ADataset.cpp" />
<ClCompile Include="BaseToolbox\QMergeRasterProcessDialog.cpp" />
<ClCompile Include="BaseToolbox\QOrthSlrRaster.cpp" />
<ClCompile Include="BaseToolbox\QRDOrthProcessClass.cpp" />
<ClCompile Include="BaseToolbox\QResampleRefrenceRaster.cpp" />
<ClCompile Include="BaseToolbox\SatelliteGF3xmlParser.cpp" />
<ClCompile Include="BaseToolbox\SateOrbit.cpp" />
<ClCompile Include="BaseToolbox\simptsn.cpp" />
@ -127,6 +132,9 @@
<QtMoc Include="BaseToolbox\QOrthSlrRaster.h" />
<QtMoc Include="BaseToolbox\QRDOrthProcessClass.h" />
<QtMoc Include="BaseToolbox\QMergeRasterProcessDialog.h" />
<QtMoc Include="BaseToolbox\QDEMResampleDialog.h" />
<QtMoc Include="BaseToolbox\QConvertCoordinateSystemDialog.h" />
<QtMoc Include="BaseToolbox\QResampleRefrenceRaster.h" />
<ClInclude Include="BaseToolbox\SatelliteGF3xmlParser.h" />
<ClInclude Include="BaseToolbox\SateOrbit.h" />
<ClInclude Include="BaseToolbox\simptsn.h" />
@ -139,10 +147,13 @@
<QtUic Include="BaseToolbox\DEMLLA2XYZTool.ui" />
<QtUic Include="BaseToolbox\QClipRasterByRowCols.ui" />
<QtUic Include="BaseToolbox\QComplex2AmpPhase.ui" />
<QtUic Include="BaseToolbox\QConvertCoordinateSystemDialog.ui" />
<QtUic Include="BaseToolbox\QDEMResampleDialog.ui" />
<QtUic Include="BaseToolbox\QImportGF3StripL1ADataset.ui" />
<QtUic Include="BaseToolbox\QMergeRasterProcessDialog.ui" />
<QtUic Include="BaseToolbox\QOrthSlrRaster.ui" />
<QtUic Include="BaseToolbox\QRDOrthProcessClass.ui" />
<QtUic Include="BaseToolbox\QResampleRefrenceRaster.ui" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\BaseCommonLibrary\BaseCommonLibrary.vcxproj">
@ -151,12 +162,12 @@
<ProjectReference Include="..\..\GPUBaseLib\GPUBaseLib.vcxproj">
<Project>{b8b40c54-f7fe-4809-b6fb-8bc014570d7b}</Project>
</ProjectReference>
<ProjectReference Include="..\..\LAMPSARProcessProgram\RasterProcessTool.vcxproj">
<Project>{7ef67daa-dbc0-4b7f-80e8-11b4d2cb7ec2}</Project>
</ProjectReference>
<ProjectReference Include="..\..\RasterMainWidgetGUI\RasterMainWidgetGUI.vcxproj">
<Project>{e56b3878-a3dc-41a4-abf3-b628816d0d64}</Project>
</ProjectReference>
<ProjectReference Include="..\..\RasterProcessToolWidget\RasterProcessTool.vcxproj">
<Project>{7ef67daa-dbc0-4b7f-80e8-11b4d2cb7ec2}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">

View File

@ -91,6 +91,15 @@
<ClCompile Include="BaseToolbox\QMergeRasterProcessDialog.cpp">
<Filter>BaseToolbox</Filter>
</ClCompile>
<ClCompile Include="BaseToolbox\QDEMResampleDialog.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="BaseToolbox\QConvertCoordinateSystemDialog.cpp">
<Filter>BaseToolbox</Filter>
</ClCompile>
<ClCompile Include="BaseToolbox\QResampleRefrenceRaster.cpp">
<Filter>BaseToolbox</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="BaseToolbox\DEMLLA2XYZTool.h">
@ -117,6 +126,15 @@
<QtMoc Include="BaseToolbox\QMergeRasterProcessDialog.h">
<Filter>BaseToolbox</Filter>
</QtMoc>
<QtMoc Include="BaseToolbox\QDEMResampleDialog.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="BaseToolbox\QConvertCoordinateSystemDialog.h">
<Filter>BaseToolbox</Filter>
</QtMoc>
<QtMoc Include="BaseToolbox\QResampleRefrenceRaster.h">
<Filter>BaseToolbox</Filter>
</QtMoc>
</ItemGroup>
<ItemGroup>
<QtUic Include="BaseToolbox\DEMLLA2XYZTool.ui">
@ -140,5 +158,14 @@
<QtUic Include="BaseToolbox\QMergeRasterProcessDialog.ui">
<Filter>BaseToolbox</Filter>
</QtUic>
<QtUic Include="BaseToolbox\QDEMResampleDialog.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="BaseToolbox\QConvertCoordinateSystemDialog.ui">
<Filter>BaseToolbox</Filter>
</QtUic>
<QtUic Include="BaseToolbox\QResampleRefrenceRaster.ui">
<Filter>BaseToolbox</Filter>
</QtUic>
</ItemGroup>
</Project>

View File

@ -10,8 +10,8 @@ DEMLLA2XYZTool::DEMLLA2XYZTool(QWidget *parent)
{
ui.setupUi(this);
connect(this->ui.dialogBtn, SIGNAL(accept()), this, SLOT(accept()));
connect(this->ui.dialogBtn, SIGNAL(reject()), this, SLOT(reject()));
connect(this->ui.dialogBtn, SIGNAL(accepted()), this, SLOT(onaccept()));
connect(this->ui.dialogBtn, SIGNAL(rejected()), this, SLOT(onreject()));
connect(this->ui.DEMWSG84SelectBtn, SIGNAL(clicked()), this, SLOT(onDEMWSG84SelectBtn_Clicked()));
connect(this->ui.DEMXYZSelectBtn, SIGNAL(clicked()), this, SLOT(onDEMXYZSelectBtn_Clicked()));
connect(this->ui.BtnSloper, SIGNAL(clicked()), this, SLOT(onBtnSloper_Clicked()));
@ -22,7 +22,7 @@ DEMLLA2XYZTool::DEMLLA2XYZTool(QWidget *parent)
DEMLLA2XYZTool::~DEMLLA2XYZTool()
{}
void DEMLLA2XYZTool::accept()
void DEMLLA2XYZTool::onaccept()
{
QString DEMPath = this->ui.lineEditLLA->text();
QString XYZPath = this->ui.lineEditXYZ->text();
@ -36,14 +36,14 @@ void DEMLLA2XYZTool::accept()
// 分块计算并转换为XYZ
Eigen::MatrixXd demArr = demds.getData(0, 0, demds.height, demds.width, 1);
Eigen::MatrixXd demR = demArr;
//Eigen::MatrixXd demArr = demds.getData(0, 0, demds.height, demds.width, 1);
//Eigen::MatrixXd demR = demArr;
Landpoint LandP{ 0,0,0 };
Point3 GERpoint{ 0,0,0 };
double R = 0;
double dem_row = 0, dem_col = 0, dem_alt = 0;
long line_invert = 1000;
long line_invert = Memory1MB/8.0/ demds.width*2000;
double rowidx = 0;
double colidx = 0;
@ -60,6 +60,7 @@ void DEMLLA2XYZTool::accept()
int datarows = demdata.rows();
int datacols = demdata.cols();
#pragma omp parallel for
for (int i = 0; i < datarows; i++) {
for (int j = 0; j < datacols; j++) {
rowidx = i + max_rows_ids;
@ -75,7 +76,7 @@ void DEMLLA2XYZTool::accept()
demxyz.saveImage(xyzdata_y, max_rows_ids, 0, 2);
demxyz.saveImage(xyzdata_z, max_rows_ids, 0, 3);
this->ui.progressBar->setValue(max_rows_ids/ demds.height/2);
this->ui.progressBar->setValue(100.0*(max_rows_ids/ demds.height/2));
}
@ -107,7 +108,7 @@ void DEMLLA2XYZTool::accept()
Vector3D Zaxis = { 0,0,1 };
double rowidx = 0, colidx = 0;
#pragma omp parallel for
for (long i = 1; i < dem_rows - 1; i++) {
for (long j = 1; j < dem_cols - 1; j++) {
rowidx = i + startlineid;
@ -139,7 +140,7 @@ void DEMLLA2XYZTool::accept()
demsloperxyz.saveImage(demsloper_z, start_ids - 1, 0, 3);
demsloperxyz.saveImage(demsloper_angle, start_ids - 1, 0, 4);
this->ui.progressBar->setValue(50+start_ids / demds.height / 2);
this->ui.progressBar->setValue(50+ 100.0 * start_ids / demds.height / 2);
}
QMessageBox::information(this, tr(u8"程序执行完成"), tr(u8"程序执行完成。"));
@ -148,7 +149,7 @@ void DEMLLA2XYZTool::accept()
this->ui.label_3->setText("");
}
void DEMLLA2XYZTool::reject()
void DEMLLA2XYZTool::onreject()
{
this->close();
}

View File

@ -14,8 +14,8 @@ public:
public slots:
void accept();
void reject();
void onaccept();
void onreject();
void onDEMWSG84SelectBtn_Clicked();
void onDEMXYZSelectBtn_Clicked();
void onBtnSloper_Clicked();

View File

@ -13,6 +13,7 @@ QComplex2AmpPhase::QComplex2AmpPhase(QWidget *parent)
QObject::connect(ui.radioButtonAmp,SIGNAL(toggled(bool)),this,SLOT(radioButtonAmptoggled(bool)));
QObject::connect(ui.radioButtonPhase, SIGNAL(toggled(bool)), this, SLOT(radioButtonPhasetoggled(bool)));
QObject::connect(ui.radioButtonSigma0, SIGNAL(toggled(bool)), this, SLOT(radioButtonSigma0toggled(bool)));
QObject::connect(ui.buttonBox, SIGNAL(accept()), this, SLOT(accept()));
QObject::connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
//toggled(bool )
}

View File

@ -0,0 +1,83 @@
#include "QConvertCoordinateSystemDialog.h"
#include "ui_QConvertCoordinateSystemDialog.h"
#include <QFileDialog>
#include <QMessageBox>
#include "ImageOperatorBase.h"
QConvertCoordinateSystemDialog::QConvertCoordinateSystemDialog(QWidget *parent)
: QDialog(parent),ui(new Ui::QConvertCoordinateSystemDialogClass)
{
ui->setupUi(this);
connect(ui->dialogBtn, SIGNAL(accepted()), this, SLOT(onaccepted()));
connect(ui->dialogBtn, SIGNAL(rejected()), this, SLOT(onrejected()));
connect(ui->btnSelectInRaster, SIGNAL(clicked(bool)), this, SLOT(onbtnSelectInRasterClicked(bool)));
connect(ui->btnSelectOutRaster, SIGNAL(clicked(bool)), this, SLOT(onbtnSelectOutRasterClicked(bool)));
}
QConvertCoordinateSystemDialog::~QConvertCoordinateSystemDialog()
{}
void QConvertCoordinateSystemDialog::onaccepted()
{
QString espgcodestr = this->ui->lineEditEPSGCoder->text().trimmed();
bool espgcodeflag = false;
long espgcodeInt = -1;
espgcodeInt=espgcodestr.toInt(&espgcodeflag);
if (!espgcodeflag) {
QMessageBox::warning(this, u8"warning", u8"错误的ESPG代码");
return;
}
else {}
QString inrasterpath = this->ui->lineEditInRaster->text();
QString outrasterpath = this->ui->lineEditOutRaster->text();
ConvertCoordinateSystem(inrasterpath, outrasterpath, espgcodeInt);
QMessageBox::information(this, tr(u8"info"), tr(u8"completed!!!!"));
}
void QConvertCoordinateSystemDialog::onrejected()
{
this->close();
}
void QConvertCoordinateSystemDialog::onbtnSelectInRasterClicked(bool flag)
{
QString fileName = QFileDialog::getOpenFileName(
this, // 父窗口
tr(u8"选择影像文件"), // 标题
QString(), // 默认路径
tr(u8"tif Files (*.tif);;data Files (*.data);;bin Files (*.bin);;All Files (*)") // 文件过滤器
);
// 如果用户选择了文件
if (!fileName.isEmpty()) {
this->ui->lineEditInRaster->setText(fileName);
}
else {
QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。"));
}
}
void QConvertCoordinateSystemDialog::onbtnSelectOutRasterClicked(bool flag)
{
QString fileName = QFileDialog::getSaveFileName(
this, // 父窗口
tr(u8"选择影像文件"), // 标题
QString(), // 默认路径
tr(u8"tif Files (*.tif);;data Files (*.data);;bin Files (*.bin);;All Files (*)") // 文件过滤器
);
// 如果用户选择了文件
if (!fileName.isEmpty()) {
this->ui->lineEditOutRaster->setText(fileName);
}
else {
QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。"));
}
}

View File

@ -0,0 +1,28 @@
#pragma once
#include <QDialog>
namespace Ui {
class QConvertCoordinateSystemDialogClass;
}
class QConvertCoordinateSystemDialog : public QDialog
{
Q_OBJECT
public:
QConvertCoordinateSystemDialog(QWidget *parent = nullptr);
~QConvertCoordinateSystemDialog();
private:
Ui::QConvertCoordinateSystemDialogClass* ui;
public slots:
void onaccepted();
void onrejected();
void onbtnSelectInRasterClicked(bool flag);
void onbtnSelectOutRasterClicked(bool flag);
};

View File

@ -0,0 +1,144 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QConvertCoordinateSystemDialogClass</class>
<widget class="QDialog" name="QConvertCoordinateSystemDialogClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>187</height>
</rect>
</property>
<property name="windowTitle">
<string>栅格坐标系转换</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="2">
<widget class="QPushButton" name="btnSelectInRaster">
<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="lineEditEPSGCoder">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>4326</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditOutRaster">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="btnSelectOutRaster">
<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="lineEditInRaster">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="0" 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="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="2" column="0">
<widget class="QLabel" name="SloperLabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>EPSG Code:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>27</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="dialogBtn">
<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,117 @@
#include "QDEMResampleDialog.h"
#include "ui_QDEMResampleDialog.h"
#include <QFileDialog>
#include <QMessageBox>
#include <QDebug>
#include "ImageOperatorBase.h"
QDEMResampleDialog::QDEMResampleDialog(QWidget *parent)
: QDialog(parent),ui(new Ui::QDEMResampleDialogClass)
{
ui->setupUi(this);
connect(ui->dialogBtn, SIGNAL(accepted()), this, SLOT(onAccepted()));
connect(ui->dialogBtn, SIGNAL(rejected()), this, SLOT(onRejected()));
connect(ui->DEMWSG84SelectBtn, SIGNAL(clicked(bool)), this, SLOT(onDEMWSG84SelectBtnClicked(bool)));
connect(ui->outDEMSelectBtn, SIGNAL(clicked(bool)), this, SLOT(onoutDEMSelectBtnClicked(bool)));
}
QDEMResampleDialog::~QDEMResampleDialog()
{}
void QDEMResampleDialog::onDEMWSG84SelectBtnClicked(bool flag)
{
// 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getOpenFileName(this,
u8"DEM Raster Select", // 对话框标题
"", // 初始目录,可以设置为路径
u8"tiff Files (*.tiff);;tif Files (*.tif);;dat Files (*.dat);;All Files (*.*)"); // 文件类型过滤器
if (!fileName.isEmpty()) {
this->ui->lineEditDEMLLA->setText(fileName);
}
else {
QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件");
}
}
void QDEMResampleDialog::onoutDEMSelectBtnClicked(bool flag)
{
// 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getSaveFileName(this,
u8"DEM Raster Select", // 对话框标题
"", // 初始目录,可以设置为路径
u8"tiff Files (*.tiff);;tif Files (*.tif);;dat Files (*.dat);;All Files (*.*)"); // 文件类型过滤器
if (!fileName.isEmpty()) {
this->ui->lineEditoutDEM->setText(fileName);
}
else {
QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件");
}
}
void QDEMResampleDialog::onAccepted()
{
double gridx = ui->doubleSpinBoxGridX->value();
double gridy = ui->doubleSpinBoxGridY->value();
QString inDEMPath = ui->lineEditDEMLLA->text();
QString outDEMPath = ui->lineEditoutDEM->text();
gdalImage demimg(inDEMPath);
Eigen::MatrixXd srcgt = demimg.gt;
//
qDebug() << "----- src gt ------------------------------------";
qDebug() << QString("%1\t%2\t%3").arg(srcgt(0, 0)).arg(srcgt(0, 1)).arg(srcgt(0, 2));
qDebug() << QString("%1\t%2\t%3").arg(srcgt(1, 0)).arg(srcgt(1, 1)).arg(srcgt(1, 2));
qDebug() << "-----------------------------------------";
double Xscale = srcgt(0, 1)/gridx;
double Yscale = srcgt(1, 2)/gridy;
int new_width = ceil(Xscale * demimg.width) + 1;
int new_height = ceil(Yscale * demimg.height) + 1;
srcgt(0, 1) = gridx;
srcgt(1, 2) = gridy;
qDebug() << "target gt";
qDebug() << "----- target gt ------------------------------------";
qDebug() << QString("%1\t%2\t%3").arg(srcgt(0, 0)).arg(srcgt(0, 1)).arg(srcgt(0, 2));
qDebug() << QString("%1\t%2\t%3").arg(srcgt(1, 0)).arg(srcgt(1, 1)).arg(srcgt(1, 2));
qDebug() << "-----------------------------------------";
std::shared_ptr<double> gt(new double[6]);
gt.get()[0] = srcgt(0, 0);
gt.get()[1] = srcgt(0, 1);
gt.get()[2] = srcgt(0, 2);
gt.get()[3] = srcgt(1, 0);
gt.get()[4] = srcgt(1, 1);
gt.get()[5] = srcgt(1, 2);
qDebug() << "DEM ReSample start ...";
qDebug() << "height:\t" << new_height;
qDebug() << "width:\t" << new_width;
qDebug() << ResampleGDAL(inDEMPath.toLocal8Bit().constData(),
outDEMPath.toLocal8Bit().constData(), gt.get(), new_width, new_height, GDALResampleAlg::GRA_Bilinear);
qDebug() << "DEM ReSample finished!!!";
}
void QDEMResampleDialog::onRejected()
{
this->close();
}

View File

@ -0,0 +1,28 @@
#pragma once
#include <QDialog>
namespace Ui {
class QDEMResampleDialogClass;
}
class QDEMResampleDialog : public QDialog
{
Q_OBJECT
public:
QDEMResampleDialog(QWidget *parent = nullptr);
~QDEMResampleDialog();
private:
Ui::QDEMResampleDialogClass* ui;
public slots:
void onDEMWSG84SelectBtnClicked(bool flag);
void onoutDEMSelectBtnClicked(bool flag);
void onAccepted();
void onRejected();
};

View File

@ -0,0 +1,197 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QDEMResampleDialogClass</class>
<widget class="QDialog" name="QDEMResampleDialogClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>252</height>
</rect>
</property>
<property name="windowTitle">
<string>QDEMResampleDialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditoutDEM">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditDEMLLA">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>输入DEMWGS84</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="DEMWSG84SelectBtn">
<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="outDEMSelectBtn">
<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>输出重采样DEM</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>参数</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxGridX">
<property name="minimumSize">
<size>
<width>120</width>
<height>30</height>
</size>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="minimum">
<double>-720.000000000000000</double>
</property>
<property name="maximum">
<double>720.000000000000000</double>
</property>
<property name="value">
<double>0.000010000000000</double>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxGridY">
<property name="minimumSize">
<size>
<width>120</width>
<height>30</height>
</size>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="minimum">
<double>-720.000000000000000</double>
</property>
<property name="maximum">
<double>720.000000000000000</double>
</property>
<property name="value">
<double>-0.000010000000000</double>
</property>
</widget>
</item>
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>GridX</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>GridY</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="dialogBtn">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -9,7 +9,7 @@
QMergeRasterProcessDialog::QMergeRasterProcessDialog(QWidget *parent)
: QDialog(parent)
: QDialog(parent),ui(new Ui::QMergeRasterProcessDialogClass)
{
ui->setupUi(this);
@ -75,16 +75,18 @@ void QMergeRasterProcessDialog::acceptclick()
{
QToolProcessBarDialog* processdialog = new QToolProcessBarDialog(this);
QVector<QString> infile(ui->listWidgetRaster->count());
QList<QString> infile;// (ui->listWidgetRaster->count());
QString outstring = ui->lineEditOutPath->text();
for (long i = 0; i < ui->listWidgetRaster->count(); i++) {
infile[i] = ui->listWidgetRaster->item(i)->text();
infile.append(ui->listWidgetRaster->item(i)->text());
}
processdialog->show();
processdialog->showProcess(0.0,u8"ºÏ²¢Ó°Ïñ");
MergeRasterProcess(infile, outstring, infile[0], MERGEMODE::MERGE_GEOCODING, false, processdialog);
MergeTiffs(infile, outstring);
//MergeRasterProcess(infile, outstring, infile[0], MERGEMODE::MERGE_GEOCODING, false, processdialog);
processdialog->close();
QMessageBox::information(this, u8"info", u8"completed!!!");
}
void QMergeRasterProcessDialog::rejectclick()

View File

@ -156,6 +156,9 @@
</item>
<item>
<widget class="QLineEdit" name="lineEditOutPath_2">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
@ -169,6 +172,9 @@
</item>
<item>
<widget class="QPushButton" name="pushButtonSelect_2">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
@ -201,6 +207,9 @@
</item>
<item>
<widget class="QLineEdit" name="lineEditOutPath_3">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
@ -214,6 +223,9 @@
</item>
<item>
<widget class="QPushButton" name="pushButtonSelect_3">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>

View File

@ -0,0 +1,97 @@
#include "QResampleRefrenceRaster.h"
#include "ui_QResampleRefrenceRaster.h"
#include <QMessageBox>
#include <QFileDialog>
QResampleRefrenceRaster::QResampleRefrenceRaster(QWidget *parent)
: QDialog(parent),ui(new Ui::QResampleRefrenceRasterClass)
{
ui->setupUi(this);
connect(ui->dialogBtn, SIGNAL(accepted()), this, SLOT(ondialogBtnaccepted()));
connect(ui->dialogBtn, SIGNAL(rejected()), this, SLOT(ondialogBtnrejected()));
connect(ui->BtnInRaster, SIGNAL(clicked(bool)), this, SLOT(onBtnInRasterClicked(bool)));
connect(ui->BtnOutRaster, SIGNAL(clicked(bool)), this, SLOT(onBtnOutRasterClicked(bool)));
connect(ui->BtnRefRaster, SIGNAL(clicked(bool)), this, SLOT(onBtnRefRasterClicked(bool)));
}
QResampleRefrenceRaster::~QResampleRefrenceRaster()
{}
void QResampleRefrenceRaster::onBtnInRasterClicked(bool)
{
QString fileName = QFileDialog::getOpenFileName(
this, // 父窗口
tr(u8"选择影像"), // 标题
QString(), // 默认路径
tr(u8"tif Files (*.tif);;data Files (*.data);;bin Files (*.bin);;All Files (*)") // 文件过滤器
);
// 如果用户选择了文件
if (!fileName.isEmpty()) {
this->ui->lineEditInRaster->setText(fileName);
}
else {
QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。"));
}
}
void QResampleRefrenceRaster::onBtnOutRasterClicked(bool)
{
QString fileName = QFileDialog::getSaveFileName(
this, // 父窗口
tr(u8"保存影像"), // 标题
QString(), // 默认路径
tr(u8"tif Files (*.tif);;data Files (*.data);;bin Files (*.bin);;All Files (*)") // 文件过滤器
);
// 如果用户选择了文件
if (!fileName.isEmpty()) {
this->ui->lineEditOutRaster->setText(fileName);
}
else {
QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。"));
}
}
void QResampleRefrenceRaster::onBtnRefRasterClicked(bool)
{
QString fileName = QFileDialog::getOpenFileName(
this, // 父窗口
tr(u8"选择参考影像"), // 标题
QString(), // 默认路径
tr(u8"tif Files (*.tif);;data Files (*.data);;bin Files (*.bin);;All Files (*)") // 文件过滤器
);
// 如果用户选择了文件
if (!fileName.isEmpty()) {
this->ui->lineEditRefRaster->setText(fileName);
}
else {
QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。"));
}
}
void QResampleRefrenceRaster::ondialogBtnaccepted()
{
QString inRasterPath = this->ui->lineEditInRaster->text();
QString RefRasterPath = this->ui->lineEditRefRaster->text();
QString OutRasterPath = this->ui->lineEditOutRaster->text();
}
void QResampleRefrenceRaster::ondialogBtnrejected()
{
this->close();
}

View File

@ -0,0 +1,30 @@
#pragma once
#include <QDialog>
namespace Ui {
class QResampleRefrenceRasterClass;
}
class QResampleRefrenceRaster : public QDialog
{
Q_OBJECT
public:
QResampleRefrenceRaster(QWidget *parent = nullptr);
~QResampleRefrenceRaster();
private:
Ui::QResampleRefrenceRasterClass* ui;
public slots :
void onBtnInRasterClicked(bool);
void onBtnOutRasterClicked(bool);
void onBtnRefRasterClicked(bool);
void ondialogBtnaccepted();
void ondialogBtnrejected();
};

View File

@ -0,0 +1,161 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QResampleRefrenceRasterClass</class>
<widget class="QDialog" name="QResampleRefrenceRasterClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle">
<string>QResampleRefrenceRaster</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="2">
<widget class="QPushButton" name="BtnInRaster">
<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="BtnOutRaster">
<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="lineEditOutRaster">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditRefRaster">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="BtnRefRaster">
<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="lineEditInRaster">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="0" 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="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="2" column="0">
<widget class="QLabel" name="SloperLabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>输入影像:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>220</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="dialogBtn">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -10,4 +10,7 @@ class ToolBoxWidget;
extern "C" LAMPSCATTERTOOL_EXPORT void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox);

View File

@ -62,9 +62,11 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<IncludePath>..\..\BaseCommonLibrary;..\..\BaseCommonLibrary\BaseTool;..\..\BaseCommonLibrary\ToolAbstract;..\..\GPUBaseLib\GPUTool;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<IncludePath>..\..\BaseCommonLibrary;..\..\BaseCommonLibrary\BaseTool;..\..\BaseCommonLibrary\ToolAbstract;..\..\GPUBaseLib\GPUTool;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\Toolbox\</OutDir>
<TargetName>PluginTool_$(ProjectName)</TargetName>
<CopyLocalProjectReference>true</CopyLocalProjectReference>
<CopyCppRuntimeToOutputDir>true</CopyCppRuntimeToOutputDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
@ -115,7 +117,10 @@
<ProjectReference Include="..\..\BaseCommonLibrary\BaseCommonLibrary.vcxproj">
<Project>{872ecd6f-30e3-4a1b-b17c-15e87d373ff6}</Project>
</ProjectReference>
<ProjectReference Include="..\..\LAMPSARProcessProgram\RasterProcessTool.vcxproj">
<ProjectReference Include="..\..\RasterMainWidgetGUI\RasterMainWidgetGUI.vcxproj">
<Project>{e56b3878-a3dc-41a4-abf3-b628816d0d64}</Project>
</ProjectReference>
<ProjectReference Include="..\..\RasterProcessToolWidget\RasterProcessTool.vcxproj">
<Project>{7ef67daa-dbc0-4b7f-80e8-11b4d2cb7ec2}</Project>
</ProjectReference>
</ItemGroup>

View File

@ -0,0 +1,192 @@
#include <time.h>
#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 "LookTableSimulationComputer.cuh"
extern __device__ __host__ double getNumberDopplerCenterRate(double R, double r0, double r1, double r2, double r3, double r4, double reftime)
{
double t=R / LIGHTSPEED - reftime;
double dopplerCenterRate = r0 + r1*t + r2*t*t + r3*t*t*t + r4*t*t*t*t;
return dopplerCenterRate;
}
__device__ __host__ double getDopplerCenterRate(double Rx, double Ry, double Rz, double Vx, double Vy, double Vz, double fact_lamda)
{
return -2*(Rx*Vx+Ry*Vy+Rz*Vz)* fact_lamda;
}
__device__ __host__ double getPolyfitNumber(double x, double a0, double a1, double a2, double a3, double a4, double a5)
{
return a0 + a1 * x + a2 * x * x + a3 * x * x * x + a4 * x * x * x * x + a5 * x * x * x * x * x;
}
__global__ void Kernel_RDProcess_doppler(
double* demX, double* demY, double* demZ,
float* outRidx, float* outCidx,
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];
float Rd_r = -1;
float Rd_c = -1;
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);
//printf("ti: %10.6f\n", ti);
//printf("inct: %10.6f\n", inct);
//printf("demx: %10.6f\n", demx);
//printf("demy: %10.6f\n", demy);
//printf("demz: %10.6f\n", demz);
//printf("Rd_r: %10.6f\n", Rd_r);
//printf("Rd_c: %10.6f\n", Rd_c);
//printf("dt: %10.6f\n", dt);
//printf("Spx: %10.6f\n", Spx);
//printf("Spy: %10.6f\n", Spy);
//printf("Spz: %10.6f\n", Spz);
//printf("Svx: %10.6f\n", Svx);
//printf("Svy: %10.6f\n", Svy);
//printf("Svz: %10.6f\n", Svz);
//printf("Rx: %10.6f\n", Rx);
//printf("Ry: %10.6f\n", Ry);
//printf("Rz: %10.6f\n", Rz);
//printf("R: %10.6f\n", R);
//printf("dp1: %10.6f\n", dp1);
//printf("dpn1: %10.6f\n", dpn1);
//printf("dp2: %10.6f\n", dp2);
//printf("dpn2: %10.6f\n", dpn2);
if (abs(inct) <= dt||isnan(inct) ) {
Rd_r = (ti - starttime) * PRF;
Rd_c = Fs/LIGHTSPEED * (R - nearRange)*2;
//printf("ti: %10.6f,starttime:%10.6f,PRF:%10.6f,Rd_c:%10.6f,R:%10.6f\n", ti, starttime, PRF, Rd_c, R);
outRidx[idx] = Rd_r;
outCidx[idx] = Rd_c;//Rd_c;
return;
}
ti = ti + inct;
}
outRidx[idx] = -1;
outCidx[idx] = -1;
}
}
void RDProcess_dopplerGPU(
double* demX, double* demY, double* demZ,
float* outRidx, float* outCidx,
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 << <numBlocks, BLOCK_SIZE >> > (
demX, demY, demZ,
outRidx, outCidx,
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();
}

View File

@ -0,0 +1,41 @@
#include "GPUTool.cuh"
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
#include <cublas_v2.h>
#include "BaseConstVariable.h"
extern __device__ __host__ double getNumberDopplerCenterRate(double R, double r0, double r1, double r2, double r3, double r4,double reftime);
extern __device__ __host__ double getDopplerCenterRate(double Rx,double Ry,double Rz,double Vx,double Vy,double Vz,double fact_lamda); //fact_lamda lamda 的倒数
extern __device__ __host__ double getPolyfitNumber(double x, double a0, double a1, double a2, double a3, double a4,double a5);
//
extern "C" void RDProcess_dopplerGPU(
double* demX, double* demY, double* demZ, // 处理入射坐标
float* outRidx,float* outCidx, // 输出 行列数
long rowcount,long colcount,
double starttime, double nearRange, double farRange,
double PRF, double Fs,
double fact_lamda, // lamda 倒数
double Xp0 = 0, double Yp0 = 0,double Zp0 = 0,double Xv0 = 0,double Yv0 = 0,double Zv0 = 0, // 轨道参数
double Xp1 = 0, double Yp1 = 0,double Zp1 = 0,double Xv1 = 0,double Yv1 = 0,double Zv1 = 0,
double Xp2 = 0, double Yp2 = 0,double Zp2 = 0,double Xv2 = 0,double Yv2 = 0,double Zv2 = 0,
double Xp3 = 0, double Yp3 = 0,double Zp3 = 0,double Xv3 = 0,double Yv3 = 0,double Zv3 = 0,
double Xp4 = 0, double Yp4 = 0,double Zp4 = 0,double Xv4 = 0,double Yv4 = 0,double Zv4 = 0,
double Xp5 = 0, double Yp5 = 0,double Zp5 = 0,double Xv5 = 0,double Yv5 = 0,double Zv5 = 0,
double reftime=0,double r0 = 0, double r1 = 0, double r2 = 0, double r3 = 0, double r4 = 0
);

View File

@ -0,0 +1,695 @@
#include "OribtModelOperator.h"
#include <Eigen/Core>
#include <Eigen/Dense>
#include <QMatrix>
#include <QtMath>
#include <QDate>
#include <QTime>
#include <QDateTime>
#include <BaseTool.h>
OrbitElements::OrbitElements() : semiMajorAxis(0), eccentricity(0), inclination(0),
longitudeOfAscendingNode(0), argumentOfPeriapsis(0), trueAnomaly(0) {}
/** 六根数轨道拟合模型************************************************************************************/
OrbitEstimator::OrbitEstimator() {}
void OrbitEstimator::estimateOrbit(const SatellitePos& node) {
// 根据轨道节点估算轨道六根数的具体算法
elements = estimateKeplerianElements(node);
}
void OrbitEstimator::saveToXml(const QString& filename) const {
QDomDocument doc("OrbitElements");
QDomElement root = doc.createElement("OrbitElements");
doc.appendChild(root);
QDomElement elem;
elem = doc.createElement("SemiMajorAxis");
elem.appendChild(doc.createTextNode(QString::number(elements.semiMajorAxis)));
root.appendChild(elem);
elem = doc.createElement("Eccentricity");
elem.appendChild(doc.createTextNode(QString::number(elements.eccentricity)));
root.appendChild(elem);
elem = doc.createElement("Inclination");
elem.appendChild(doc.createTextNode(QString::number(elements.inclination)));
root.appendChild(elem);
elem = doc.createElement("LongitudeOfAscendingNode");
elem.appendChild(doc.createTextNode(QString::number(elements.longitudeOfAscendingNode)));
root.appendChild(elem);
elem = doc.createElement("ArgumentOfPeriapsis");
elem.appendChild(doc.createTextNode(QString::number(elements.argumentOfPeriapsis)));
root.appendChild(elem);
elem = doc.createElement("TrueAnomaly");
elem.appendChild(doc.createTextNode(QString::number(elements.trueAnomaly)));
root.appendChild(elem);
QFile file(filename);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
qDebug() << "Cannot open file for writing:" << filename;
return;
}
QTextStream out(&file);
doc.save(out, 4); // Indent by 4 spaces
file.close();
}
bool OrbitEstimator::loadFromXml(const QString& filename) {
QFile file(filename);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
qDebug() << "Cannot open file for reading:" << filename;
return false;
}
QDomDocument doc;
if (!doc.setContent(&file)) {
file.close();
return false;
}
file.close();
QDomElement root = doc.documentElement();
QDomNodeList nodeList = root.elementsByTagName("*");
for (int i = 0; i < nodeList.count(); ++i) {
QDomElement element = nodeList.at(i).toElement();
if (element.tagName() == "SemiMajorAxis") {
elements.semiMajorAxis = element.text().toDouble();
}
else if (element.tagName() == "Eccentricity") {
elements.eccentricity = element.text().toDouble();
}
else if (element.tagName() == "Inclination") {
elements.inclination = element.text().toDouble();
}
else if (element.tagName() == "LongitudeOfAscendingNode") {
elements.longitudeOfAscendingNode = element.text().toDouble();
}
else if (element.tagName() == "ArgumentOfPeriapsis") {
elements.argumentOfPeriapsis = element.text().toDouble();
}
else if (element.tagName() == "TrueAnomaly") {
elements.trueAnomaly = element.text().toDouble();
}
}
return true;
}
SatellitePos OrbitEstimator::calculateNode(double time) const {
// 根据轨道六根数计算轨道节点的具体算法
return calculateKeplerianNode(elements, time);
}
SatellitePos OrbitEstimator::predictNode(double time)
{
return calculateNode(time);
}
OrbitElements OrbitEstimator::estimateKeplerianElements(const SatellitePos& node) {
// 示例简单地将所有值设为0
OrbitElements elements;
elements.semiMajorAxis = 0;
elements.eccentricity = 0;
elements.inclination = 0;
elements.longitudeOfAscendingNode = 0;
elements.argumentOfPeriapsis = 0;
elements.trueAnomaly = 0;
return elements;
}
SatellitePos OrbitEstimator::calculateKeplerianNode(const OrbitElements& elements, double time) const {
const double G = 6.67430e-11; // 引力常数 m^3 kg^-1 s^-2
const double M_Earth = 5.972e24; // 地球质量 kg
const double mu = G * M_Earth; // 地球引力参数 m^3 s^-2
double a = elements.semiMajorAxis;
double e = elements.eccentricity;
double i = elements.inclination;
double Omega = elements.longitudeOfAscendingNode;
double omega = elements.argumentOfPeriapsis;
// 计算平均运动
double n = std::sqrt(mu / (a * a * a));
// 计算从参考时刻到给定时间的平均异常
double t_ref = 0.0; // 参考时刻假设为0
double M = n * (time - t_ref);
// 求解开普勒方程 E - e*sin(E) = M 使用牛顿迭代法
double E = M; // 初始猜测
double tolerance = 1e-8;
int maxIterations = 100;
for (int iter = 0; iter < maxIterations; ++iter) {
double f = E - e * std::sin(E) - M;
double df = 1 - e * std::cos(E);
double delta = f / df;
E -= delta;
if (std::abs(delta) < tolerance) {
break;
}
}
// 计算偏近点角 ν
double sin_nu = std::sqrt(1 - e * e) * std::sin(E) / (1 - e * std::cos(E));
double cos_nu = (std::cos(E) - e) / (1 - e * std::cos(E));
double nu = std::atan2(sin_nu, cos_nu);
// 计算半径 r
double r = a * (1 - e * std::cos(E));
// 计算位置向量在轨道平面上的分量
double Px_prime = r * std::cos(nu);
double Py_prime = r * std::sin(nu);
// 计算速度向量在轨道平面上的分量
double h = std::sqrt(mu * a * (1 - e * e)); // 角动量
double Vx_prime = -(h / r) * std::sin(nu);
double Vy_prime = (h / r) * (std::cos(nu) + e);
// 将轨道平面坐标系转换到惯性坐标系
double cos_Omega = std::cos(Omega);
double sin_Omega = std::sin(Omega);
double cos_omega = std::cos(omega);
double sin_omega = std::sin(omega);
double cos_i = std::cos(i);
double sin_i = std::sin(i);
double Px = Px_prime * (cos_Omega * cos_omega - sin_Omega * sin_omega * cos_i) +
Py_prime * (-cos_Omega * sin_omega - sin_Omega * cos_omega * cos_i);
double Py = Px_prime * (sin_Omega * cos_omega + cos_Omega * sin_omega * cos_i) +
Py_prime * (-sin_Omega * sin_omega + cos_Omega * cos_omega * cos_i);
double Pz = Px_prime * sin_omega * sin_i + Py_prime * cos_omega * sin_i;
double Vx = Vx_prime * (cos_Omega * cos_omega - sin_Omega * sin_omega * cos_i) +
Vy_prime * (-cos_Omega * sin_omega - sin_Omega * cos_omega * cos_i);
double Vy = Vx_prime * (sin_Omega * cos_omega + cos_Omega * sin_omega * cos_i) +
Vy_prime * (-sin_Omega * sin_omega + cos_Omega * cos_omega * cos_i);
double Vz = Vx_prime * sin_omega * sin_i + Vy_prime * cos_omega * sin_i;
SatellitePos node;
node.time = time;
node.Px = Px;
node.Py = Py;
node.Pz = Pz;
node.Vx = Vx;
node.Vy = Vy;
node.Vz = Vz;
return node;
}
double OrbitEstimator::solveKeplerEquation(double M, double e) const {
double E = M; // 初始猜测
double tolerance = 1e-8;
int maxIterations = 100;
for (int iter = 0; iter < maxIterations; ++iter) {
double f = E - e * std::sin(E) - M;
double df = 1 - e * std::cos(E);
double delta = f / df;
E -= delta;
if (std::abs(delta) < tolerance) {
break;
}
}
return E;
}
/** 多项式轨道拟合模型************************************************************************************/
void PolynomialOrbitModel::fitPolynomial(const QList<SatellitePos>& nodes, int degree) {
QList<double> times;
QList<double> positionsX;
QList<double> positionsY;
QList<double> positionsZ;
QList<double> velocitiesX;
QList<double> velocitiesY;
QList<double> velocitiesZ;
for (const auto& node : nodes) {
times.append(node.time);
positionsX.append(node.Px);
positionsY.append(node.Py);
positionsZ.append(node.Pz);
velocitiesX.append(node.Vx);
velocitiesY.append(node.Vy);
velocitiesZ.append(node.Vz);
}
qDebug() << "fit degree " << degree;
coefficientsX = leastSquaresFit(times, positionsX, degree);
coefficientsY = leastSquaresFit(times, positionsY, degree);
coefficientsZ = leastSquaresFit(times, positionsZ, degree);
coefficientsVx = leastSquaresFit(times, velocitiesX, degree);
coefficientsVy = leastSquaresFit(times, velocitiesY, degree);
coefficientsVz = leastSquaresFit(times, velocitiesZ, degree);
}
SatellitePos PolynomialOrbitModel::predictPosition(double time) {
double Px = 0.0;
double Py = 0.0;
double Pz = 0.0;
double Vx = 0.0;
double Vy = 0.0;
double Vz = 0.0;
for (int i = 0; i < coefficientsX.size(); ++i) {
Px += coefficientsX(i) * std::pow(time, i);
Py += coefficientsY(i) * std::pow(time, i);
Pz += coefficientsZ(i) * std::pow(time, i);
Vx += coefficientsVx(i) * std::pow(time, i);
Vy += coefficientsVy(i) * std::pow(time, i);
Vz += coefficientsVz(i) * std::pow(time, i);
}
SatellitePos predictedNode;
predictedNode.time = time;
predictedNode.Px = Px;
predictedNode.Py = Py;
predictedNode.Pz = Pz;
predictedNode.Vx = Vx;
predictedNode.Vy = Vy;
predictedNode.Vz = Vz;
return predictedNode;
}
Eigen::VectorXd PolynomialOrbitModel::leastSquaresFit(const QList<double>& x, const QList<double>& y, int degree) {
int n = x.size();
Eigen::MatrixXd A=Eigen::MatrixXd::Zero(n, degree + 1);
for (int i = 0; i < n; ++i) {
for (int j = 0; j <= degree; ++j) {
A(i, j) = std::pow(x[i], j);
}
}
Eigen::VectorXd b(y.count());
for (long i = 0; i < y.count(); i++) {
b(i) = y[i];
}
Eigen::VectorXd coefficients = A.colPivHouseholderQr().solve(b);
//Eigen::Vector2d coefficientsVector = Eigen::Vector2d::Zero(degree);
//coefficientsVector = coefficients.array();
return coefficients;
}
void PolynomialOrbitModel::saveCoefficientsToXml(QDomElement& parent, const Eigen::VectorXd& coefficients, const QString& tagName) const {
QDomDocument doc = parent.ownerDocument();
QDomElement coeffElement = doc.createElement(tagName);
for (int i = 0; i < coefficients.size(); ++i) {
QDomElement valueElement = doc.createElement("Value");
valueElement.appendChild(doc.createTextNode(QString::number(coefficients(i))));
coeffElement.appendChild(valueElement);
}
parent.appendChild(coeffElement);
}
bool PolynomialOrbitModel::loadCoefficientsFromXml(const QDomElement& parent, Eigen::VectorXd& coefficients, const QString& tagName) {
QDomNodeList coeffNodes = parent.elementsByTagName(tagName);
if (coeffNodes.isEmpty()) {
qWarning() << "Tag" << tagName << "not found in XML.";
return false;
}
QDomElement coeffElement = coeffNodes.at(0).toElement();
QDomNodeList valueNodes = coeffElement.elementsByTagName("Value");
int size = valueNodes.count();
coefficients.resize(size);
for (int i = 0; i < size; ++i) {
QDomElement valueElement = valueNodes.at(i).toElement();
coefficients(i) = valueElement.text().toDouble();
}
return true;
}
void PolynomialOrbitModel::saveToXml(const QString& filename) const {
QDomDocument doc("PolynomialOrbitModel");
QDomElement root = doc.createElement("PolynomialOrbitModel");
doc.appendChild(root);
saveCoefficientsToXml(root, coefficientsX, "CoefficientsX");
saveCoefficientsToXml(root, coefficientsY, "CoefficientsY");
saveCoefficientsToXml(root, coefficientsZ, "CoefficientsZ");
saveCoefficientsToXml(root, coefficientsVx, "CoefficientsVx");
saveCoefficientsToXml(root, coefficientsVy, "CoefficientsVy");
saveCoefficientsToXml(root, coefficientsVz, "CoefficientsVz");
QFile file(filename);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
qDebug() << "Cannot open file for writing:" << filename;
return;
}
QTextStream out(&file);
doc.save(out, 4); // Indent by 4 spaces
file.close();
}
bool PolynomialOrbitModel::loadFromXml(const QString& filename) {
QFile file(filename);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
qDebug() << "Cannot open file for reading:" << filename;
return false;
}
QDomDocument doc;
if (!doc.setContent(&file)) {
file.close();
return false;
}
file.close();
QDomElement root = doc.documentElement();
if (!loadCoefficientsFromXml(root, coefficientsX, "CoefficientsX")) return false;
if (!loadCoefficientsFromXml(root, coefficientsY, "CoefficientsY")) return false;
if (!loadCoefficientsFromXml(root, coefficientsZ, "CoefficientsZ")) return false;
if (!loadCoefficientsFromXml(root, coefficientsVx, "CoefficientsVx")) return false;
if (!loadCoefficientsFromXml(root, coefficientsVy, "CoefficientsVy")) return false;
if (!loadCoefficientsFromXml(root, coefficientsVz, "CoefficientsVz")) return false;
return true;
}
SatellitePos PolynomialOrbitModel::predictNode(double time)
{
return predictPosition(time);
}
/** 两行根数************************************************************************************/
TwoLineElements::TwoLineElements() {}
bool TwoLineElements::loadFromTleFile(const QString& filename) {
QFile file(filename);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
qDebug() << "Cannot open file for reading:" << filename;
return false;
}
QTextStream in(&file);
line1 = in.readLine().toStdString();
line2 = in.readLine().toStdString();
if (line1.empty() || line2.empty()) {
qDebug() << "Invalid TLE data in file:" << filename;
return false;
}
file.close();
parseTleLines();
return true;
}
void TwoLineElements::parseTleLines() {
// 解析第一行
// 示例1 25544U 98067A 23044.15434167 .00001971 00000-0 39389-4 0 9994
// 第二行
// 示例2 25544 51.6416 243.5887 0001672 130.5360 325.0288 15.49472743275958
// 这里仅做基本解析,实际应用中需要更严格的验证和错误处理
}
double TwoLineElements::meanMotion() const {
// 第二行第53-63位是平均运动每分钟转数
return std::stod(line2.substr(52, 11));
}
double TwoLineElements::semiMajorAxis() const {
const double G = 6.67430e-11; // 引力常数 m^3 kg^-1 s^-2
const double M_Earth = 5.972e24; // 地球质量 kg
const double mu = G * M_Earth; // 地球引力参数 m^3 s^-2
double n = meanMotion() * 2 * M_PI / 60; // 转换为弧度/秒
return std::cbrt(mu / (n * n));
}
double TwoLineElements::eccentricity() const {
// 第二行第9-16位是离心率小数点省略
return std::stod("0." + line2.substr(8, 7));
}
double TwoLineElements::inclination() const {
// 第二行第20-25位是倾斜角
return std::stod(line2.substr(19, 5));
}
double TwoLineElements::longitudeOfAscendingNode() const {
// 第二行第34-42位是升交点赤经
return std::stod(line2.substr(33, 9));
}
double TwoLineElements::argumentOfPeriapsis() const {
// 第二行第45-52位是近地点幅角
return std::stod(line2.substr(44, 8));
}
double TwoLineElements::meanAnomaly() const {
// 第二行第64-72位是平均近点角
return std::stod(line2.substr(63, 9));
}
double TwoLineElements::revolutionNumberAtEpoch() const {
// 第二行第64-72位是绕地次数
return std::stod(line2.substr(63, 5));
}
double TwoLineElements::epochTime() const {
// 第一行第20-32位是历元时间
int year = std::stoi(line1.substr(18, 2)) + 2000;
double dayOfYear = std::stod(line1.substr(20, 12));
int month = 1, day = 1;
while (dayOfYear > 0) {
int daysInMonth[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
daysInMonth[1] = 29;
}
if (dayOfYear <= daysInMonth[month - 1]) {
day = static_cast<int>(dayOfYear);
break;
}
dayOfYear -= daysInMonth[month - 1];
month++;
}
QDate date(year, month, day);
QTime time(0, 0, 0);
QDateTime dateTime(date, time);
return dateTime.toSecsSinceEpoch() + (dayOfYear - day) * 86400;
}
SatellitePos TwoLineElements::calculateNode(double time) const {
return calculateKeplerianNode(time);
}
SatellitePos TwoLineElements::predictNode(double time)
{
return calculateNode(time);
}
SatellitePos TwoLineElements::calculateKeplerianNode(double time) const {
const double G = 6.67430e-11; // 引力常数 m^3 kg^-1 s^-2
const double M_Earth = 5.972e24; // 地球质量 kg
const double mu = G * M_Earth; // 地球引力参数 m^3 s^-2
double a = semiMajorAxis();
double e = eccentricity();
double i = inclination() * M_PI / 180.0;
double Omega = longitudeOfAscendingNode() * M_PI / 180.0;
double omega = argumentOfPeriapsis() * M_PI / 180.0;
double M0 = meanAnomaly() * M_PI / 180.0;
// 计算平均运动
double n = std::sqrt(mu / (a * a * a));
// 计算从参考时刻到给定时间的平均异常
double t_ref = epochTime(); // 参考时刻
double M = M0 + n * (time - t_ref);
// 求解开普勒方程 E - e*sin(E) = M 使用牛顿迭代法
double E = solveKeplerEquation(M, e);
// 计算偏近点角 ν
double sin_nu = std::sqrt(1 - e * e) * std::sin(E) / (1 - e * std::cos(E));
double cos_nu = (std::cos(E) - e) / (1 - e * std::cos(E));
double nu = std::atan2(sin_nu, cos_nu);
// 计算半径 r
double r = a * (1 - e * std::cos(E));
// 计算位置向量在轨道平面上的分量
double Px_prime = r * std::cos(nu);
double Py_prime = r * std::sin(nu);
// 计算速度向量在轨道平面上的分量
double h = std::sqrt(mu * a * (1 - e * e)); // 角动量
double Vx_prime = -(h / r) * std::sin(nu);
double Vy_prime = (h / r) * (std::cos(nu) + e);
// 将轨道平面坐标系转换到惯性坐标系
double cos_Omega = std::cos(Omega);
double sin_Omega = std::sin(Omega);
double cos_omega = std::cos(omega);
double sin_omega = std::sin(omega);
double cos_i = std::cos(i);
double sin_i = std::sin(i);
double Px = Px_prime * (cos_Omega * cos_omega - sin_Omega * sin_omega * cos_i) +
Py_prime * (-cos_Omega * sin_omega - sin_Omega * cos_omega * cos_i);
double Py = Px_prime * (sin_Omega * cos_omega + cos_Omega * sin_omega * cos_i) +
Py_prime * (-sin_Omega * sin_omega + cos_Omega * cos_omega * cos_i);
double Pz = Px_prime * sin_omega * sin_i + Py_prime * cos_omega * sin_i;
double Vx = Vx_prime * (cos_Omega * cos_omega - sin_Omega * sin_omega * cos_i) +
Vy_prime * (-cos_Omega * sin_omega - sin_Omega * cos_omega * cos_i);
double Vy = Vx_prime * (sin_Omega * cos_omega + cos_Omega * sin_omega * cos_i) +
Vy_prime * (-sin_Omega * sin_omega + cos_Omega * cos_omega * cos_i);
double Vz = Vx_prime * sin_omega * sin_i + Vy_prime * cos_omega * sin_i;
SatellitePos node;
node.time = time;
node.Px = Px;
node.Py = Py;
node.Pz = Pz;
node.Vx = Vx;
node.Vy = Vy;
node.Vz = Vz;
return node;
}
double TwoLineElements::solveKeplerEquation(double M, double e) const {
double E = M; // 初始猜测
double tolerance = 1e-8;
int maxIterations = 100;
for (int iter = 0; iter < maxIterations; ++iter) {
double f = E - e * std::sin(E) - M;
double df = 1 - e * std::cos(E);
double delta = f / df;
E -= delta;
if (std::abs(delta) < tolerance) {
break;
}
}
return E;
}
/** 轨道节点文件读写************************************************************************************/
QList<SatellitePos> loadNodesFromXml(const QString& filename) {
QFile file(filename);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
qDebug() << "Cannot open file for reading:" << filename;
return {};
}
QDomDocument doc;
if (!doc.setContent(&file)) {
file.close();
return {};
}
file.close();
QDomElement root = doc.documentElement();
QDomNodeList gpsParamNodes = root.elementsByTagName("GPSParam");
QList<SatellitePos> loadedNodes;
for (int i = 0; i < gpsParamNodes.count(); ++i) {
QDomElement paramElement = gpsParamNodes.at(i).toElement();
SatellitePos node;
node.time = convertToMilliseconds(paramElement.firstChildElement("TimeStamp").text().toStdString());
node.Px = paramElement.firstChildElement("xPosition").text().toDouble();
node.Py = paramElement.firstChildElement("yPosition").text().toDouble();
node.Pz = paramElement.firstChildElement("zPosition").text().toDouble();
node.Vx = paramElement.firstChildElement("xVelocity").text().toDouble();
node.Vy = paramElement.firstChildElement("yVelocity").text().toDouble();
node.Vz = paramElement.firstChildElement("zVelocity").text().toDouble();
loadedNodes.append(node);
}
return loadedNodes;
}
void saveNodesToXml(const QString& filename, const QList<SatellitePos>& inposes) {
QDomDocument doc("GPSData");
QDomElement root = doc.createElement("GPS");
doc.appendChild(root);
for (const auto& node : inposes) {
QDomElement paramElement = doc.createElement("GPSParam");
QDomElement timeStampElement = doc.createElement("TimeStamp");
timeStampElement.appendChild(doc.createTextNode(QString::number(node.time)));
paramElement.appendChild(timeStampElement);
QDomElement xPositionElement = doc.createElement("xPosition");
xPositionElement.appendChild(doc.createTextNode(QString::number(node.Px)));
paramElement.appendChild(xPositionElement);
QDomElement yPositionElement = doc.createElement("yPosition");
yPositionElement.appendChild(doc.createTextNode(QString::number(node.Py)));
paramElement.appendChild(yPositionElement);
QDomElement zPositionElement = doc.createElement("zPosition");
zPositionElement.appendChild(doc.createTextNode(QString::number(node.Pz)));
paramElement.appendChild(zPositionElement);
QDomElement xVelocityElement = doc.createElement("xVelocity");
xVelocityElement.appendChild(doc.createTextNode(QString::number(node.Vx)));
paramElement.appendChild(xVelocityElement);
QDomElement yVelocityElement = doc.createElement("yVelocity");
yVelocityElement.appendChild(doc.createTextNode(QString::number(node.Vy)));
paramElement.appendChild(yVelocityElement);
QDomElement zVelocityElement = doc.createElement("zVelocity");
zVelocityElement.appendChild(doc.createTextNode(QString::number(node.Vz)));
paramElement.appendChild(zVelocityElement);
root.appendChild(paramElement);
}
QFile file(filename);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
qDebug() << "Cannot open file for writing:" << filename;
return;
}
QTextStream out(&file);
doc.save(out, 4); // Indent by 4 spaces
file.close();
}
OrbitModelAbstract::OrbitModelAbstract()
{
}
OrbitModelAbstract::~OrbitModelAbstract()
{
}
SatellitePos OrbitModelAbstract::predictNode(double time)
{
return SatellitePos();
}

View File

@ -0,0 +1,101 @@
#ifndef ORIBTMODELOPERATOR_H_
#define ORIBTMODELOPERATOR_H_
#include <QFile>
#include <QDomDocument>
#include <QVector3D>
#include <QDebug>
#include <QList>
#include <Eigen/Core>
#include <Eigen/Dense>
#include "BaseConstVariable.h"
QList<SatellitePos> loadNodesFromXml(const QString& filename);
void saveNodesToXml(const QString& filename, const QList<SatellitePos>& inposes);
class OrbitModelAbstract {
public:
OrbitModelAbstract();
~OrbitModelAbstract();
public:
virtual SatellitePos predictNode(double time) ;
};
class OrbitElements {
public:
double semiMajorAxis; // 半长轴 (a)
double eccentricity; // 离心率 (e)
double inclination; // 倾斜角 (i)
double longitudeOfAscendingNode; // 升交点赤经 (Ω)
double argumentOfPeriapsis; // 近地点幅角 (ω)
double trueAnomaly; // 真近点角 (ν)
OrbitElements();
};
class OrbitEstimator :public OrbitModelAbstract {
public:
OrbitEstimator();
void estimateOrbit(const SatellitePos& node);
void saveToXml(const QString& filename) const;
bool loadFromXml(const QString& filename);
SatellitePos calculateNode(double time) const;
virtual SatellitePos predictNode(double time) override;
private:
OrbitElements elements;
OrbitElements estimateKeplerianElements(const SatellitePos& node);
SatellitePos calculateKeplerianNode(const OrbitElements& elements, double time) const;
double solveKeplerEquation(double M, double e) const;
};
class PolynomialOrbitModel :public OrbitModelAbstract {
public:
void fitPolynomial(const QList<SatellitePos>& nodes, int degree=3);
SatellitePos predictPosition(double time);
void saveToXml(const QString& filename) const;
bool loadFromXml(const QString& filename);
virtual SatellitePos predictNode(double time) override;
private:
Eigen::VectorXd coefficientsX;
Eigen::VectorXd coefficientsY;
Eigen::VectorXd coefficientsZ;
Eigen::VectorXd coefficientsVx;
Eigen::VectorXd coefficientsVy;
Eigen::VectorXd coefficientsVz;
Eigen::VectorXd leastSquaresFit(const QList<double>& x, const QList<double>& y, int degree);
void saveCoefficientsToXml(QDomElement& parent, const Eigen::VectorXd& coefficients, const QString& tagName) const;
bool loadCoefficientsFromXml(const QDomElement& parent, Eigen::VectorXd& coefficients, const QString& tagName);
};
class TwoLineElements :public OrbitModelAbstract {
public:
TwoLineElements();
bool loadFromTleFile(const QString& filename);
SatellitePos calculateNode(double time) const;
virtual SatellitePos predictNode(double time) override;
private:
std::string line1;
std::string line2;
void parseTleLines();
double meanMotion() const;
double semiMajorAxis() const;
double eccentricity() const;
double inclination() const;
double longitudeOfAscendingNode() const;
double argumentOfPeriapsis() const;
double meanAnomaly() const;
double revolutionNumberAtEpoch() const;
double epochTime() const;
double solveKeplerEquation(double M, double e) const;
SatellitePos calculateKeplerianNode(double time) const;
};
#endif

View File

@ -0,0 +1,443 @@
#include "QSimulationLookTableDialog.h"
#include "ui_QSimulationLookTableDialog.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"
QSimulationLookTableDialog::QSimulationLookTableDialog(QWidget *parent)
: QDialog(parent),ui(new Ui::QSimulationLookTableDialogClass)
{
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->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)));
}
QSimulationLookTableDialog::~QSimulationLookTableDialog()
{
}
void QSimulationLookTableDialog::onrejected()
{
this->close();
}
void QSimulationLookTableDialog::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 QSimulationLookTableDialog::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 QSimulationLookTableDialog::onpushButtonDEMClicked(bool)
{
// 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getOpenFileName(this,
u8"DEM 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 QSimulationLookTableDialog::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 QSimulationLookTableDialog::LookTableSimualtionMainProcess(QString sateName, QString orbitpath, QString SatePath, QString DEMPath, QString outDirPath, bool gpuflag, bool looktableflag, bool checkBoxIncAngle, bool DopplerFlag)
{
this->ui->progressBar->setMinimum(0);
this->ui->progressBar->setMaximum(100);
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);
if (looktableflag || checkBoxIncAngle) {
outLookTablePath = JoinPath(outDirPath, sateName + "_looktable.bin");
this->ui->label_tip->setText(u8"look table create...");
this->ui->progressBar->setValue(0);
this->LookTableSimulationDopplerProcess(
DEMPath, outLookTablePath,
OribtStartTime,
PolyfitPx, PolyfitPy, PolyfitPz,
PolyfitVx, PolyfitVy, PolyfitVz,
dopplerRefrenceTime,
DopplerCentroidCoefficients,
startTime,
endTime,
nearRange,
farRange,
PRF,
Fs,
lamda,
gpuflag,
looktableflag,
checkBoxIncAngle
);
}
if (checkBoxIncAngle) {
this->ui->label_tip->setText(u8"sloper process...");
this->ui->progressBar->setValue(0);
outIncPath = JoinPath(outDirPath, sateName + "_incAngle.bin");
}
}
void QSimulationLookTableDialog::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, bool gpuflag, bool looktableflag, bool incflag)
{
qDebug() << "generate look table ";
qDebug() << "DEMPath\t" << DEMPath;
qDebug() << "outLookTablePath\t" << outLookTablePath;
gdalImage demimg(DEMPath);
gdalImage outLookTable = CreategdalImage( // 创建查找表
outLookTablePath,
demimg.height, demimg.width, 2,
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;
// 内存预分配
//
std::shared_ptr<float> host_Rid((float*)mallocCUDAHost(sizeof(float) * GPUMemoryline * demimg.width), FreeCUDAHost);
std::shared_ptr<float> host_Cid((float*)mallocCUDAHost(sizeof(float) * GPUMemoryline * demimg.width), FreeCUDAHost);
std::shared_ptr<float> device_Rid((float*)mallocCUDADevice(sizeof(float) * GPUMemoryline * demimg.width), FreeCUDADevice);
std::shared_ptr<float> device_Cid((float*)mallocCUDADevice(sizeof(float) * GPUMemoryline * demimg.width), FreeCUDADevice);
//
std::shared_ptr<double> host_demX((double*)mallocCUDAHost(sizeof(double) * GPUMemoryline * demimg.width), FreeCUDAHost);
std::shared_ptr<double> host_demY((double*)mallocCUDAHost(sizeof(double) * GPUMemoryline * demimg.width), FreeCUDAHost);
std::shared_ptr<double> host_demZ((double*)mallocCUDAHost(sizeof(double) * GPUMemoryline * demimg.width), FreeCUDAHost);
std::shared_ptr<double> device_demX((double*)mallocCUDADevice(sizeof(double) * GPUMemoryline * demimg.width), FreeCUDADevice);
std::shared_ptr<double> device_demY((double*)mallocCUDADevice(sizeof(double) * GPUMemoryline * demimg.width), FreeCUDADevice);
std::shared_ptr<double> device_demZ((double*)mallocCUDADevice(sizeof(double) * GPUMemoryline * demimg.width), FreeCUDADevice);
//
//std::shared_ptr<ImageShowDialogClass> datashowptr(new ImageShowDialogClass);
// 处理复制结果
long rowcount = GPUMemoryline;
long colcount = demimg.width;
//rowcount = 1;
//colcount = 1;
//long testRid = demimg.height / 2;
//long testCid = demimg.width / 2;
double fact_lamda = 1 / lamda;
for (long rid = 0; rid < demimg.height; rid = rid + GPUMemoryline) {
qDebug() << "computer read file : " << rid << "~" << rowcount + rid << "\t:" << demimg.height;
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> demX = readDataArr<double>(demimg, rid, testCid, rowcount, colcount, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);// 行列数修改
//std::shared_ptr<double> demY = readDataArr<double>(demimg, rid, testCid, rowcount, colcount, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
//std::shared_ptr<double> demZ = readDataArr<double>(demimg, rid, testCid, rowcount, colcount, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
//demX.get()[0]=-1407793.922129;
//demY.get()[0]=5465044.940211;
//demZ.get()[0]=2963219.736386;
// 数据复制
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) * GPUMemoryline * demimg.width);
HostToDevice(host_demY.get(), device_demY.get(), sizeof(double) * GPUMemoryline * demimg.width);
HostToDevice(host_demZ.get(), device_demZ.get(), sizeof(double) * GPUMemoryline * demimg.width);
qDebug() << "GPU computer start: " << rid << "~" << rowcount + rid << "\t:" << demimg.height;
RDProcess_dopplerGPU(
device_demX.get(), device_demY.get(), device_demZ.get(),
device_Rid.get(), device_Cid.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_Rid.get(), device_Rid.get(), sizeof(float) * GPUMemoryline * demimg.width);
DeviceToHost(host_Cid.get(), device_Cid.get(), sizeof(float) * GPUMemoryline * demimg.width);
qDebug() << "GPU computer finished!!: " << rid << "~" << rowcount + rid << "\t:" << demimg.height;
//exit(-1);
// 数据存储
outLookTable.saveImage(host_Rid, rid, 0, rowcount, colcount, 1);
outLookTable.saveImage(host_Cid, rid, 0, rowcount, colcount, 2);
//datashowptr->load_double_data(host_Rid.get(), rowcount, colcount, QString("host_Rid"));
//datashowptr->exec();
qDebug() << "GPU computer result write finished: " << rid << "~" << rowcount + rid << "\t:" << demimg.height;
this->ui->progressBar->setValue(floor(100.0*(rowcount + rid)/ demimg.height));
}
qDebug() << "look table computed finished!!!";
this->ui->progressBar->setValue(100);
}
void QSimulationLookTableDialog::LocalIncidenceAngleSimulationCompter(QString DEMPath, QString LookTablePath, QString outIncPath, 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 starttime, double endtime, double nearRange, double farRange, double PRF, double Fs)
{
//gdalImage outInc = CreategdalImageDouble(
// outIncPath,
// demimg.height, demimg.width, 1,
// demimg.gt,
// demimg.projection,
// true,
// true,
// true
//);
}
void QSimulationLookTableDialog::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();
//double gridX = this->ui->doubleSpinBoxGridX->value();
//double gridY = this->ui->doubleSpinBoxGridY->value();
bool gpuflag = this->ui->radioButtonGPU->isChecked();
bool looktableflag = this->ui->LookTableCheck->isChecked();
bool checkBoxIncAngle = this->ui->checkBoxIncAngle->isChecked();
bool BoxDopplerFlag = this->ui->checkBoxDoppler->isChecked();
QString simulationName = this->ui->lineEditLookName->text();
this->LookTableSimualtionMainProcess(
simulationName,
orbitpath, SatePath, DEMPath, outDirPath,
gpuflag, looktableflag, checkBoxIncAngle, BoxDopplerFlag
);
QMessageBox::information(this, u8"info", u8"completed!!!");
}

View File

@ -0,0 +1,93 @@
#pragma once
#include <QDialog>
namespace Ui {
class QSimulationLookTableDialogClass;
}
class QSimulationLookTableDialog : public QDialog
{
Q_OBJECT
public:
QSimulationLookTableDialog(QWidget *parent = nullptr);
~QSimulationLookTableDialog();
private:
Ui::QSimulationLookTableDialogClass* ui;
public slots:
void onaccepted();
void onrejected();
void onpushButtonOrbitModelClicked(bool);
void onpushButtonSataSettingClicked(bool);
void onpushButtonDEMClicked(bool);
void onpushButtonOutDirClicked(bool);
private: // doppler 处理软件
void LookTableSimualtionMainProcess(
QString sateName,
QString orbitpath, QString SatePath, QString DEMPath, QString outDirPath
, bool gpuflag, bool looktableflag, bool checkBoxIncAngle, bool DopplerFlag
);
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,
bool gpuflag,
bool looktableflag,
bool incflag
);
void LocalIncidenceAngleSimulationCompter(
QString DEMPath,
QString LookTablePath,
QString outIncPath,
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 starttime, // 成像开始时间
double endtime, // 成像结束时间
double nearRange, // 近斜距
double farRange, // 远斜距
double PRF, // 脉冲重复采样频率
double Fs // 距离采样频率
);
};

View File

@ -0,0 +1,340 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QSimulationLookTableDialogClass</class>
<widget class="QDialog" name="QSimulationLookTableDialogClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>763</width>
<height>387</height>
</rect>
</property>
<property name="windowTitle">
<string>QSimulationLookTableDialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="6" column="0" rowspan="2">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>计算资源</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="radioButtonGPU">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>GPU</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonCPU">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>CPU</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="11" column="0" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="4" 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="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="8" 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="5" 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="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="5" 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="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="4" 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="pushButtonOrbitModel">
<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="QCheckBox" name="checkBoxDoppler">
<property name="text">
<string>采用多普勒参数</string>
</property>
<property name="checked">
<bool>true</bool>
</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="8" 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="7" column="1">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>产品输出类型</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="LookTableCheck">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>查找表</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxIncAngle">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>局地入射角</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</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="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>
<item row="5" 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="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="9" column="1">
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_tip">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,100 @@
#include "QSimulationSARPolynomialOrbitModel.h"
#include "ui_QSimulationSARPolynomialOrbitModel.h"
#include <QFileDialog>
#include "OribtModelOperator.h"
#include "LogInfoCls.h"
#include "SARSatelliteSimulationAbstractCls.h"
#include "SatelliteOribtModel.h"
QSimulationPolynomialSAROrbitModel::QSimulationPolynomialSAROrbitModel(QWidget *parent)
: QDialog(parent),ui(new Ui::QSimulationSARPolynomialOrbitModelClass)
{
ui->setupUi(this);
connect(ui->pushButtongpxml, SIGNAL(clicked(bool)), this, SLOT(onpushButtongpxmlClicked(bool)));
connect(ui->pushButtonOrbitModel, SIGNAL(clicked(bool)), this, SLOT(onpushButtonOrbitModelClicked(bool)));
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbtnaccepted()));
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbtnrejected()));
}
QSimulationPolynomialSAROrbitModel::~QSimulationPolynomialSAROrbitModel()
{}
void QSimulationPolynomialSAROrbitModel::onpushButtongpxmlClicked(bool)
{
// 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getOpenFileName(this,
u8"GPS xml", // 对话框标题
"", // 初始目录,可以设置为路径
u8"xml Files (*.xml)"); // 文件类型过滤器
if (!fileName.isEmpty()) {
this->ui->gpsXmlPathEdit->setText(fileName);
}
else {
QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件");
}
}
void QSimulationPolynomialSAROrbitModel::onpushButtonOrbitModelClicked(bool)
{
// 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getSaveFileName(this,
u8"Polynomial GPS Model xml", // 对话框标题
"", // 初始目录,可以设置为路径
u8"xml Files (*.xml)"); // 文件类型过滤器
if (!fileName.isEmpty()) {
this->ui->modelxmlPathEdit->setText(fileName);
}
else {
QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件");
}
}
void QSimulationPolynomialSAROrbitModel::onbtnaccepted()
{
QString gpsxmlpath = this->ui->gpsXmlPathEdit->text();
QString outmodelpath = this->ui->modelxmlPathEdit->text();
qDebug() << "Input GPS Xml:\t" << gpsxmlpath;
qDebug() << "out Model Xml:\t" << outmodelpath;
//2. 读取GPS节点
std::vector<SatelliteOribtNode> nodes;
ErrorCode stateCode = ReadSateGPSPointsXML(gpsxmlpath, nodes);
if (stateCode != ErrorCode::SUCCESS)
{
qWarning() << QString::fromStdString(errorCode2errInfo(stateCode));
return;
}
else {}
std::shared_ptr<PolyfitSatelliteOribtModel> ployfitOribtModel = std::make_shared< PolyfitSatelliteOribtModel>();
double startTime = 0;
for (long i = 0; i < nodes.size(); i++) {
ployfitOribtModel->addOribtNode(nodes[i]);
startTime += nodes[i].time / nodes.size();
}
long polynum = 3;
qDebug() << "refrence time " << startTime;
qDebug() << "poly degree " << polynum;
ployfitOribtModel->setSatelliteOribtStartTime(startTime);
stateCode = ployfitOribtModel->polyFit(polynum, false);
if (stateCode != ErrorCode::SUCCESS) {
qDebug() << QString::fromStdString(errorCode2errInfo(stateCode));
return ;
}
ployfitOribtModel->saveToXml(outmodelpath);
qDebug() << "PolynomialSAROrbitModel fit finished!!";
QMessageBox::information(this, u8"信息", u8"模型拟合成功");
}
void QSimulationPolynomialSAROrbitModel::onbtnrejected()
{
this->close();
}

View File

@ -0,0 +1,27 @@
#pragma once
#include "SimulationSARToolAPI.h"
#include "QToolAbstract.h"
#include <QDialog>
namespace Ui {
class QSimulationSARPolynomialOrbitModelClass;
}
class SIMULATIONSARTOOLAPI_EXPORT QSimulationPolynomialSAROrbitModel : public QDialog
{
Q_OBJECT
public:
QSimulationPolynomialSAROrbitModel(QWidget *parent = nullptr);
~QSimulationPolynomialSAROrbitModel();
public slots:
void onpushButtongpxmlClicked(bool);
void onpushButtonOrbitModelClicked(bool);
void onbtnaccepted();
void onbtnrejected();
private:
Ui::QSimulationSARPolynomialOrbitModelClass* ui;
};

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