增加界面
parent
9cd8da907b
commit
f34d0fde41
|
@ -1 +1 @@
|
|||
Subproject commit 45c32c0b4001544d089023998285dd4c768eb2a5
|
||||
Subproject commit 23277b911e28b107bc3d50e9d1a7f5a85c52fe01
|
|
@ -0,0 +1,89 @@
|
|||
#include "QMergeRasterProcessDialog.h"
|
||||
#include "QToolProcessBarDialog.h"
|
||||
#include "BaseLibraryCPP/ImageOperatorBase.h"
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
QMergeRasterProcessDialog::QMergeRasterProcessDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
QObject::connect(ui.pushButtonSelect, SIGNAL(clicked(bool)), this, SLOT(onpushButtonSelectClick(bool)));
|
||||
QObject::connect(ui.AddpushButton, SIGNAL(clicked(bool)), this, SLOT(onAddpushButtonClick(bool)));
|
||||
QObject::connect(ui.RemovepushButton, SIGNAL(clicked(bool())), this, SLOT(onRemovepushButtonClick(bool)));
|
||||
QObject::connect(ui.buttonBoxDialog, SIGNAL(accepted()), this, SLOT(acceptclick()));
|
||||
QObject::connect(ui.buttonBoxDialog, SIGNAL(rejected()), this, SLOT(rejectclick()));
|
||||
}
|
||||
|
||||
QMergeRasterProcessDialog::~QMergeRasterProcessDialog()
|
||||
{}
|
||||
|
||||
|
||||
void QMergeRasterProcessDialog::onpushButtonSelectClick(bool checked ) {
|
||||
|
||||
// 调用文件选择对话框并选择一个 .tif 文件
|
||||
QString fileName = QFileDialog::getSaveFileName(this,
|
||||
u8"选择 TIF 文件", // 对话框标题
|
||||
"", // 初始目录,可以设置为路径
|
||||
u8"Image Files (*.tif);;All Files (*)"); // 文件类型过滤器
|
||||
|
||||
if (!fileName.isEmpty()) {
|
||||
this->ui.lineEditOutPath->setText(fileName);
|
||||
}
|
||||
else {
|
||||
QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void QMergeRasterProcessDialog::onAddpushButtonClick(bool checked )
|
||||
{
|
||||
QStringList fileNames = QFileDialog::getOpenFileNames(
|
||||
this, // 父窗口
|
||||
tr(u8"选择TIF文件"), // 标题
|
||||
QString(), // 默认路径
|
||||
tr(u8"TIF Files (*.tif);;All Files (*)") // 文件过滤器
|
||||
);
|
||||
|
||||
// 如果用户选择了文件
|
||||
if (!fileNames.isEmpty()) {
|
||||
QString message = "选择的文件有:\n";
|
||||
for (const QString& fileName : fileNames) {
|
||||
this->ui.listWidgetRaster->addItem(fileName);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。"));
|
||||
}
|
||||
}
|
||||
|
||||
void QMergeRasterProcessDialog::onRemovepushButtonClick(bool checked )
|
||||
{
|
||||
QList<QListWidgetItem*> selectedItems =this->ui.listWidgetRaster->selectedItems();
|
||||
for (QListWidgetItem* item : selectedItems) {
|
||||
delete this->ui.listWidgetRaster->takeItem(this->ui.listWidgetRaster->row(item));
|
||||
}
|
||||
}
|
||||
|
||||
void QMergeRasterProcessDialog::acceptclick()
|
||||
{
|
||||
QToolProcessBarDialog* processdialog = new QToolProcessBarDialog(this);
|
||||
|
||||
QVector<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();
|
||||
}
|
||||
processdialog->show();
|
||||
processdialog->showProcess(0.0,u8"合并影像");
|
||||
|
||||
MergeRasterProcess(infile, outstring, infile[0], MERGEMODE::MERGE_GEOCODING, false, processdialog);
|
||||
|
||||
}
|
||||
|
||||
void QMergeRasterProcessDialog::rejectclick()
|
||||
{
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include "ui_QMergeRasterProcessDialog.h"
|
||||
|
||||
class QMergeRasterProcessDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QMergeRasterProcessDialog(QWidget *parent = nullptr);
|
||||
~QMergeRasterProcessDialog();
|
||||
public slots:
|
||||
|
||||
void onpushButtonSelectClick(bool checked = false);
|
||||
void onAddpushButtonClick(bool checked = false);
|
||||
void onRemovepushButtonClick(bool checked = false);
|
||||
void acceptclick();
|
||||
void rejectclick();
|
||||
|
||||
private:
|
||||
Ui::QMergeRasterProcessDialogClass ui;
|
||||
};
|
|
@ -0,0 +1,119 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QMergeRasterProcessDialogClass</class>
|
||||
<widget class="QDialog" name="QMergeRasterProcessDialogClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>538</width>
|
||||
<height>450</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>QMergeRasterProcessDialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QDialogButtonBox" name="buttonBoxDialog">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>输出影像名:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditOutPath">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonSelect">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>打开</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="AddpushButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>添加</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="RemovepushButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>移除</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QListWidget" name="listWidgetRaster"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -0,0 +1,24 @@
|
|||
#include "QToolProcessBarDialog.h"
|
||||
|
||||
QToolProcessBarDialog::QToolProcessBarDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
ui.progressBar->setRange(0, 100);
|
||||
|
||||
}
|
||||
|
||||
QToolProcessBarDialog::~QToolProcessBarDialog()
|
||||
{}
|
||||
|
||||
void QToolProcessBarDialog::showProcess(double precent, QString tip)
|
||||
{
|
||||
ui.progressBar->setValue(std::ceil(precent * 100));
|
||||
ui.labelTip->setText(tip);
|
||||
this->update();
|
||||
}
|
||||
|
||||
void QToolProcessBarDialog::showToolInfo(QString tip)
|
||||
{
|
||||
ui.textEditTip->append("\n"+tip);
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include "ui_QToolProcessBarDialog.h"
|
||||
#include "BaseLibraryCPP/ImageOperatorBase.h"
|
||||
class QToolProcessBarDialog : public QDialog, public ShowProessAbstract
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QToolProcessBarDialog(QWidget *parent = nullptr);
|
||||
~QToolProcessBarDialog();
|
||||
|
||||
private:
|
||||
Ui::QToolProcessBarDialogClass ui;
|
||||
|
||||
public:
|
||||
virtual void showProcess(double precent, QString tip) override;
|
||||
virtual void showToolInfo(QString tip) override;
|
||||
};
|
|
@ -0,0 +1,73 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QToolProcessBarDialogClass</class>
|
||||
<widget class="QDialog" name="QToolProcessBarDialogClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>QToolProcessBarDialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="OKpushButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>退出</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelTip">
|
||||
<property name="text">
|
||||
<string>提示</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="value">
|
||||
<number>24</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textEditTip"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,10 +1,24 @@
|
|||
#include "RasterProcessTool.h"
|
||||
#include <QObject>
|
||||
#include "QMergeRasterProcessDialog.h"
|
||||
|
||||
RasterProcessTool::RasterProcessTool(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
QObject::connect(this->ui.actionmergeRaster, SIGNAL(triggered()), this, SLOT(onactionmergeRasterTriggered()));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
RasterProcessTool::~RasterProcessTool()
|
||||
{}
|
||||
|
||||
|
||||
|
||||
void RasterProcessTool::onactionmergeRasterTriggered()
|
||||
{
|
||||
QMergeRasterProcessDialog* dialog = new QMergeRasterProcessDialog(this);
|
||||
dialog->show();
|
||||
}
|
||||
|
|
|
@ -11,6 +11,11 @@ public:
|
|||
RasterProcessTool(QWidget *parent = nullptr);
|
||||
~RasterProcessTool();
|
||||
|
||||
public slots:
|
||||
|
||||
|
||||
void onactionmergeRasterTriggered();
|
||||
|
||||
private:
|
||||
Ui::RasterProcessToolClass ui;
|
||||
};
|
||||
|
|
|
@ -1,28 +1,54 @@
|
|||
<UI version="4.0" >
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>RasterProcessToolClass</class>
|
||||
<widget class="QMainWindow" name="RasterProcessToolClass" >
|
||||
<property name="objectName" >
|
||||
<string notr="true">RasterProcessToolClass</string>
|
||||
</property>
|
||||
<property name="geometry" >
|
||||
<widget class="QMainWindow" name="RasterProcessToolClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>400</height>
|
||||
<width>761</width>
|
||||
<height>404</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<property name="windowTitle">
|
||||
<string>RasterProcessTool</string>
|
||||
</property> <widget class="QMenuBar" name="menuBar" />
|
||||
<widget class="QToolBar" name="mainToolBar" />
|
||||
<widget class="QWidget" name="centralWidget" />
|
||||
<widget class="QStatusBar" name="statusBar" />
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget"/>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>761</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menurasterProcessTool">
|
||||
<property name="title">
|
||||
<string>rasterProcessTool</string>
|
||||
</property>
|
||||
<addaction name="actionmergeRaster"/>
|
||||
</widget>
|
||||
<addaction name="menurasterProcessTool"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="mainToolBar">
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
<action name="actionmergeRaster">
|
||||
<property name="text">
|
||||
<string>mergeRaster</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutDefault spacing="6" margin="11" />
|
||||
<pixmapfunction></pixmapfunction>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources>
|
||||
<include location="RasterProcessTool.qrc"/>
|
||||
<include location="RasterProcessTool.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</UI>
|
||||
</ui>
|
||||
|
|
|
@ -67,6 +67,11 @@
|
|||
<ClCompile>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<OpenMPSupport>true</OpenMPSupport>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="Configuration">
|
||||
|
@ -92,13 +97,15 @@
|
|||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<QtRcc Include="RasterProcessTool.qrc" />
|
||||
<QtUic Include="QMergeRasterProcessDialog.ui" />
|
||||
<QtUic Include="QToolProcessBarDialog.ui" />
|
||||
<QtUic Include="RasterProcessTool.ui" />
|
||||
<QtMoc Include="RasterProcessTool.h" />
|
||||
<ClCompile Include="BaseLibraryCPP\BaseTool.cpp" />
|
||||
|
@ -112,6 +119,8 @@
|
|||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QMergeRasterProcessDialog.cpp" />
|
||||
<ClCompile Include="QToolProcessBarDialog.cpp" />
|
||||
<ClCompile Include="RasterProcessTool.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
|
@ -125,6 +134,8 @@
|
|||
<ClInclude Include="BaseLibraryCPP\LogInfoCls.h" />
|
||||
<ClInclude Include="BaseLibraryCPP\SARSimulationImageL1.h" />
|
||||
<ClInclude Include="BaseLibraryCPP\stdafx.h" />
|
||||
<QtMoc Include="QToolProcessBarDialog.h" />
|
||||
<QtMoc Include="QMergeRasterProcessDialog.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
|
||||
|
|
|
@ -67,6 +67,12 @@
|
|||
<ClCompile Include="BaseLibraryCPP\stdafx.cpp">
|
||||
<Filter>BaseLibraryCPP</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QMergeRasterProcessDialog.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QToolProcessBarDialog.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="BaseLibraryCPP\BaseConstVariable.h">
|
||||
|
@ -97,4 +103,20 @@
|
|||
<Filter>BaseLibraryCPP</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="QMergeRasterProcessDialog.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="QToolProcessBarDialog.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtUic Include="QMergeRasterProcessDialog.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
<QtUic Include="QToolProcessBarDialog.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
</ItemGroup>
|
||||
</Project>
|
12
main.cpp
12
main.cpp
|
@ -3,11 +3,9 @@
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
//QApplication a(argc, argv);
|
||||
//RasterProcessTool w;
|
||||
//w.show();
|
||||
//return a.exec();
|
||||
|
||||
|
||||
return 0;
|
||||
QApplication a(argc, argv);
|
||||
RasterProcessTool w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue