同步修改

pull/13/head
陈增辉 2025-03-13 13:03:10 +08:00
parent c7291b0475
commit 0dbe3a0d20
7 changed files with 375 additions and 0 deletions

View File

@ -11,6 +11,7 @@
#include "DEMLLA2XYZTool.h"
#include "QConvertCoordinateSystemDialog.h"
#include "QResampleRefrenceRaster.h"
#include "QtLookTableCorrectOffsetDialog.h"
GF3ImportDataToolButton::GF3ImportDataToolButton(QWidget* parent) :QToolAbstract(parent)
{
@ -111,6 +112,7 @@ void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWi
emit toolbox->addBoxToolItemSIGNAL(new QDEMLLA2XYZToolToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new QConvertCoordinateSystemToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new QResampleRefrenceRasterToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new QLookTableCorrectOffsetToolButton(toolbox));
}
QDEMResampleDialogToolButton::QDEMResampleDialogToolButton(QWidget* parent)
@ -180,3 +182,19 @@ void QResampleRefrenceRasterToolButton::excute()
QResampleRefrenceRaster* dialog = new QResampleRefrenceRaster;
dialog->show();
}
QLookTableCorrectOffsetToolButton::QLookTableCorrectOffsetToolButton(QWidget* parent)
{
this->toolPath = QVector<QString>(0);
this->toolPath.push_back(u8"基础处理");
this->toolname = QString(u8"查找表偏移校正");
}
QLookTableCorrectOffsetToolButton::~QLookTableCorrectOffsetToolButton()
{
}
void QLookTableCorrectOffsetToolButton::excute()
{
QtLookTableCorrectOffsetDialog* dialog = new QtLookTableCorrectOffsetDialog;
dialog->show();
}

View File

@ -109,4 +109,16 @@ public slots:
};
class BASETOOLBOX_EXPORT QLookTableCorrectOffsetToolButton : public QToolAbstract {
Q_OBJECT
public:
QLookTableCorrectOffsetToolButton(QWidget* parent = nullptr);
~QLookTableCorrectOffsetToolButton();
public slots:
virtual void excute() override;
};
extern "C" BASETOOLBOX_EXPORT void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox);

View File

@ -205,6 +205,7 @@
<ClCompile Include="BaseToolbox\QOrthSlrRaster.cpp" />
<ClCompile Include="BaseToolbox\QRDOrthProcessClass.cpp" />
<ClCompile Include="BaseToolbox\QResampleRefrenceRaster.cpp" />
<ClCompile Include="BaseToolbox\QtLookTableCorrectOffsetDialog.cpp" />
<ClCompile Include="BaseToolbox\SatelliteGF3xmlParser.cpp" />
<ClCompile Include="BaseToolbox\SateOrbit.cpp" />
<ClCompile Include="BaseToolbox\simptsn.cpp" />
@ -221,6 +222,7 @@
<QtMoc Include="BaseToolbox\QDEMResampleDialog.h" />
<QtMoc Include="BaseToolbox\QConvertCoordinateSystemDialog.h" />
<QtMoc Include="BaseToolbox\QResampleRefrenceRaster.h" />
<QtMoc Include="BaseToolbox\QtLookTableCorrectOffsetDialog.h" />
<ClInclude Include="BaseToolbox\SatelliteGF3xmlParser.h" />
<ClInclude Include="BaseToolbox\SateOrbit.h" />
<ClInclude Include="BaseToolbox\simptsn.h" />
@ -240,6 +242,7 @@
<QtUic Include="BaseToolbox\QOrthSlrRaster.ui" />
<QtUic Include="BaseToolbox\QRDOrthProcessClass.ui" />
<QtUic Include="BaseToolbox\QResampleRefrenceRaster.ui" />
<QtUic Include="BaseToolbox\QtLookTableCorrectOffsetDialog.ui" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\BaseCommonLibrary\BaseCommonLibrary.vcxproj">

View File

@ -100,6 +100,9 @@
<ClCompile Include="BaseToolbox\QResampleRefrenceRaster.cpp">
<Filter>BaseToolbox</Filter>
</ClCompile>
<ClCompile Include="BaseToolbox\QtLookTableCorrectOffsetDialog.cpp">
<Filter>BaseToolbox</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="BaseToolbox\DEMLLA2XYZTool.h">
@ -135,6 +138,9 @@
<QtMoc Include="BaseToolbox\QResampleRefrenceRaster.h">
<Filter>BaseToolbox</Filter>
</QtMoc>
<QtMoc Include="BaseToolbox\QtLookTableCorrectOffsetDialog.h">
<Filter>BaseToolbox</Filter>
</QtMoc>
</ItemGroup>
<ItemGroup>
<QtUic Include="BaseToolbox\DEMLLA2XYZTool.ui">
@ -167,5 +173,8 @@
<QtUic Include="BaseToolbox\QResampleRefrenceRaster.ui">
<Filter>BaseToolbox</Filter>
</QtUic>
<QtUic Include="BaseToolbox\QtLookTableCorrectOffsetDialog.ui">
<Filter>BaseToolbox</Filter>
</QtUic>
</ItemGroup>
</Project>

View File

@ -0,0 +1,109 @@
#include "QtLookTableCorrectOffsetDialog.h"
#include "ui_QtLookTableCorrectOffsetDialog.h"
#include <QFileDialog>
#include <QMessageBox>
#include "ImageOperatorBase.h"
#include "GeoOperator.h"
#include <QFile>
#include "BaseConstVariable.h"
#include <QProgressDialog>
#include "BaseTool.h"
QtLookTableCorrectOffsetDialog::QtLookTableCorrectOffsetDialog(QWidget *parent)
: QDialog(parent), ui(new Ui::QtLookTableCorrectOffsetDialogClass)
{
ui->setupUi(this);
QPushButton* OutRasterBtn = ui->OutRasterBtn;
QPushButton* InRasterBtn = ui->InRasterBtn;
QDialogButtonBox* dialogBtn = ui->dialogBtn;
connect(OutRasterBtn, SIGNAL(clicked()), this, SLOT(onOutRasterBtnClicked()));
connect(InRasterBtn, SIGNAL(clicked()), this, SLOT(onInRasterBtnClicked()));
connect(dialogBtn, SIGNAL(accepted()), this, SLOT(onAcceptBtnClicked()));
connect(dialogBtn, SIGNAL(rejected()), this, SLOT(onRejectBtnClicked()));
}
QtLookTableCorrectOffsetDialog::~QtLookTableCorrectOffsetDialog()
{}
void QtLookTableCorrectOffsetDialog::onOutRasterBtnClicked()
{
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->OutRasterlineEdit->setText(fileName);
}
else {
QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。"));
}
}
void QtLookTableCorrectOffsetDialog::onInRasterBtnClicked()
{
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->InRasterlineEdit->setText(fileName);
}
else {
QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。"));
}
}
void QtLookTableCorrectOffsetDialog::onAcceptBtnClicked()
{
this->ui->progressBar->setValue(0);
QString OutRasterPath = this->ui->OutRasterlineEdit->text();
QString InRasterPath = this->ui->InRasterlineEdit->text();
double offsetRow = this->ui->OffsetRowdoubleSpinBox->value();
double offsetCol = this->ui->OffsetColdoubleSpinBox->value();
QFile::copy(InRasterPath, OutRasterPath);
gdalImage outds(OutRasterPath);
gdalImage inds(InRasterPath);
if (outds.height != inds.height || outds.width != inds.width) {
QMessageBox::information(this, tr(u8"tip"), tr(u8"size not match!!"));
return;
}
this->ui->progressBar->setMaximum(inds.height);
this->ui->progressBar->setValue(0);
long blocksize = Memory1MB / 8.0 / outds.width * 2000;
for (long i = 0; i < outds.height; i = i + blocksize) {
Eigen::MatrixXd Rowdata = inds.getData(i, 0, blocksize, outds.width, 1);
Eigen::MatrixXd Coldata = inds.getData(i, 0, blocksize, outds.width, 2);
Rowdata = Rowdata.array() + offsetRow;
Coldata = Coldata.array() + offsetCol;
outds.saveImage(Rowdata, i, 0, 1);
outds.saveImage(Coldata, i, 0, 1);
this->ui->progressBar->setValue(i);
}
this->ui->progressBar->setValue(inds.height);
QMessageBox::information(this, tr(u8"tip"), tr(u8"completed!!"));
}
void QtLookTableCorrectOffsetDialog::onRejectBtnClicked()
{
this->close();
}

View File

@ -0,0 +1,28 @@
#pragma once
#include <QDialog>
namespace Ui {
class QtLookTableCorrectOffsetDialogClass;
}
class QtLookTableCorrectOffsetDialog : public QDialog
{
Q_OBJECT
public:
QtLookTableCorrectOffsetDialog(QWidget *parent = nullptr);
~QtLookTableCorrectOffsetDialog();
public slots:
void onOutRasterBtnClicked();
void onInRasterBtnClicked();
void onAcceptBtnClicked();
void onRejectBtnClicked();
private:
Ui::QtLookTableCorrectOffsetDialogClass* ui;
};

View File

@ -0,0 +1,196 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QtLookTableCorrectOffsetDialogClass</class>
<widget class="QDialog" name="QtLookTableCorrectOffsetDialogClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle">
<string>查找表数值校正</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<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="1">
<widget class="QLineEdit" name="OutRasterlineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="OutRasterBtn">
<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="InRasterlineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</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>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>查找表校正:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="InRasterBtn">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>列号偏移:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="OffsetRowdoubleSpinBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="minimum">
<double>-1000000000000.000000000000000</double>
</property>
<property name="maximum">
<double>1000000000000.000000000000000</double>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="OffsetColdoubleSpinBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="minimum">
<double>-1000000000000.000000000000000</double>
</property>
<property name="maximum">
<double>1000000000000.000000000000000</double>
</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>158</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>24</number>
</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>