150 lines
4.6 KiB
C++
150 lines
4.6 KiB
C++
#include "QGF3StripBatchProcessDialog.h"
|
|
#include "ui_QGF3StripBatchProcessDialog.h"
|
|
#include <QFileDialog>
|
|
#include <QApplication>
|
|
#include <QMessageBox>
|
|
#include "FileOperator.h"
|
|
#include "GeoOperator.h"
|
|
#include "BaseTool.h"
|
|
#include "GF3CalibrationAndGeocodingClass.h"
|
|
|
|
QGF3StripBatchProcessDialog::QGF3StripBatchProcessDialog(QWidget *parent)
|
|
: QDialog(parent), ui(new Ui::QGF3StripBatchProcessDialogClass)
|
|
{
|
|
ui->setupUi(this);
|
|
|
|
QObject::connect(ui->pushButtonAdd, SIGNAL(clicked(bool)), this, SLOT(onpushButtonAddClicked(bool)));
|
|
QObject::connect(ui->pushButtonRemove, SIGNAL(clicked(bool)), this, SLOT(onpushButtonRemoveClicked(bool)));
|
|
QObject::connect(ui->pushButtonWorkSpace, SIGNAL(clicked(bool)), this, SLOT(onpushButtonWorkSpaceClicked(bool)));
|
|
QObject::connect(ui->checkBoxDEM, SIGNAL(stateChanged(int)), this, SLOT(ontstateChanged(int)));
|
|
QObject::connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onreject()));
|
|
QObject::connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onaccept()));
|
|
QObject::connect(ui->pushButton_lineDEM, SIGNAL(clicked(bool)), this, SLOT(onpushButtonDEM(bool)));
|
|
|
|
|
|
|
|
}
|
|
|
|
QGF3StripBatchProcessDialog::~QGF3StripBatchProcessDialog()
|
|
{}
|
|
|
|
void QGF3StripBatchProcessDialog::onaccept()
|
|
{
|
|
QString demPath = "";
|
|
// 获取默认DEM数据
|
|
if (ui->checkBoxDEM->isChecked()) {
|
|
QString demdirPath = QApplication::applicationDirPath();// DEM所在文件夹
|
|
demPath = JoinPath(demdirPath,"SRTM_90m_DEM_V4.tif");
|
|
}
|
|
else {
|
|
demPath = ui->lineEdit_DEM->text();
|
|
}
|
|
// 获取分辨率
|
|
double resolutionMeter = ui->doubleSpinBox->value();// 分辨率转度
|
|
//double resoiutionDegree = getPixelSpacingInDegree(resolutionMeter);// 米 -> 度
|
|
QString workspacedirpath = ui->lineEditWorkDir->text();
|
|
this->ui->progressBar->setValue(0);
|
|
this->ui->progressBar->setMaximum(ui->listWidgetMetaxml->count());
|
|
bool polarHH2VV = ui->checkoutPolarHH2VV->isChecked();
|
|
for (long i = 0; i < ui->listWidgetMetaxml->count(); i++) {
|
|
QString inTargzFilePath = ui->listWidgetMetaxml->item(i)->text();
|
|
this->ui->label_info->setText(QString(u8"正射处理:%1").arg(inTargzFilePath));
|
|
GF3MainOrthProcess(demPath,
|
|
inTargzFilePath,
|
|
workspacedirpath,
|
|
resolutionMeter,
|
|
polarHH2VV);
|
|
|
|
this->ui->progressBar->setValue(i);
|
|
}
|
|
QMessageBox::information(this, u8"正射处理完成", u8"正射处理完成");
|
|
}
|
|
|
|
void QGF3StripBatchProcessDialog::onreject()
|
|
{
|
|
this->close();
|
|
}
|
|
|
|
void QGF3StripBatchProcessDialog::onpushButtonAddClicked(bool)
|
|
{
|
|
QStringList fileNames = QFileDialog::getOpenFileNames(
|
|
this, // 父窗口
|
|
tr(u8"选择GF3条带L1A压缩包"), // 标题
|
|
QString(), // 默认路径
|
|
tr(u8"tar.gz (*.tar.gz);;tar (*.tar);;All Files (*)") // 文件过滤器
|
|
);
|
|
|
|
// 如果用户选择了文件
|
|
if (!fileNames.isEmpty()) {
|
|
QString message = "选择的文件有:\n";
|
|
for (const QString& fileName : fileNames) {
|
|
this->ui->listWidgetMetaxml->addItem(fileName);
|
|
}
|
|
}
|
|
else {
|
|
QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。"));
|
|
}
|
|
}
|
|
|
|
void QGF3StripBatchProcessDialog::onpushButtonRemoveClicked(bool)
|
|
{
|
|
QList<QListWidgetItem*> selectedItems = this->ui->listWidgetMetaxml->selectedItems();
|
|
for (QListWidgetItem* item : selectedItems) {
|
|
delete this->ui->listWidgetMetaxml->takeItem(this->ui->listWidgetMetaxml->row(item));
|
|
}
|
|
}
|
|
|
|
void QGF3StripBatchProcessDialog::onpushButtonWorkSpaceClicked(bool)
|
|
{
|
|
// 调用文件选择对话框并选择一个 .tif 文件
|
|
QString fileName = QFileDialog::getExistingDirectory(this, u8"选择工作空间路径", "");
|
|
|
|
if (!fileName.isEmpty()) {
|
|
ui->lineEditWorkDir->setText(fileName);
|
|
}
|
|
else {
|
|
QMessageBox::information(this, u8"没有选择文件夹", u8"没有选择任何文件夹");
|
|
}
|
|
}
|
|
|
|
void QGF3StripBatchProcessDialog::ontstateChanged(int checked)
|
|
{
|
|
bool checkedflag = ui->checkBoxDEM->isChecked();
|
|
if (!checkedflag) {
|
|
ui->pushButton_lineDEM->setEnabled(true);
|
|
ui->lineEdit_DEM->setEnabled(true);
|
|
}
|
|
else {
|
|
ui->pushButton_lineDEM->setEnabled(false);
|
|
ui->lineEdit_DEM->setEnabled(false);
|
|
}
|
|
}
|
|
|
|
void QGF3StripBatchProcessDialog::onpushButtonDEM(bool flag)
|
|
{
|
|
QString fileName = QFileDialog::getOpenFileName(this, u8"选择DEM文件", "", u8"tif (*.tif);;All Files (*)");
|
|
if (!fileName.isEmpty()) {
|
|
ui->lineEdit_DEM->setText(fileName);
|
|
}
|
|
else {
|
|
QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件");
|
|
}
|
|
}
|
|
|
|
void showQGF3StripBatchProcessDialog(QWidget* parent)
|
|
{
|
|
QGF3StripBatchProcessDialog* dialog = new QGF3StripBatchProcessDialog(parent);
|
|
dialog->setWindowTitle(u8"GF3条带影像正射批量处理");
|
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
|
dialog->show();
|
|
}
|
|
|
|
QString getDefaultDEMFilePath()
|
|
{
|
|
QString fileName = QFileDialog::getOpenFileName(nullptr, u8"选择DEM文件", "", u8"tif (*.tif);;All Files (*)");
|
|
return QString();
|
|
}
|
|
|
|
|
|
|