106 lines
3.0 KiB
C++
106 lines
3.0 KiB
C++
#include "QGF3StripBatchProcessDialog.h"
|
|
#include "ui_QGF3StripBatchProcessDialog.h"
|
|
#include <QFileDialog>
|
|
#include <QMessageBox>
|
|
|
|
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()));
|
|
|
|
|
|
|
|
}
|
|
|
|
QGF3StripBatchProcessDialog::~QGF3StripBatchProcessDialog()
|
|
{}
|
|
|
|
void QGF3StripBatchProcessDialog::onaccept()
|
|
{
|
|
|
|
}
|
|
|
|
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 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();
|
|
}
|
|
|
|
|
|
|