增加算法执行界面组件
parent
fb6b753200
commit
2fd81a6b62
Binary file not shown.
|
@ -90,6 +90,9 @@ namespace LAMPMainWidget {
|
|||
}
|
||||
|
||||
void RasterMainWidget::setupWindow() {
|
||||
//mMapglWidget = new QOpenGLWidget(mMapConvas); // 使用OpenGL渲染
|
||||
//mMapConvas->setViewport(mMapglWidget);
|
||||
//mMapConvas->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
||||
mUi->mapCanvasLayout->addWidget(mMapConvas);
|
||||
//setFixedSize(size());
|
||||
//setWindowFlags(windowFlags() | Qt::WindowMinMaxButtonsHint | Qt::WindowSystemMenuHint);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <QActionGroup>
|
||||
#include <QListWidgetItem>
|
||||
#include <QHash>
|
||||
#include <QOpenGLWidget>
|
||||
#include <QTableWidget>
|
||||
#include <mapcanvas.h>
|
||||
#include <maplayer.h>
|
||||
|
@ -76,6 +77,9 @@ namespace LAMPMainWidget {
|
|||
private:
|
||||
Ui::RasterMainWidget* mUi;
|
||||
MapCanvas* mMapConvas;//地图容器
|
||||
QOpenGLWidget* mMapglWidget;// OpenGL窗口
|
||||
|
||||
|
||||
QLineEdit* mScaleText;
|
||||
QLabel* mScaleLabel;
|
||||
QLineEdit* mCenterText;
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace RasterMessageShow {
|
|||
this->textBrowserMessage->append(Message);
|
||||
this->textBrowserMessage->moveCursor(QTextCursor::MoveOperation::End);
|
||||
this->textBrowserMessage->repaint();
|
||||
std::cout << Message.toLocal8Bit().constData() << std::endl;
|
||||
//std::cout << Message.toLocal8Bit().constData() << std::endl;
|
||||
}
|
||||
else {}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,23 @@
|
|||
#include "KJ135WBJYAlgInterfaceToolbox.h"
|
||||
#include "ToolBoxWidget.h"
|
||||
#include "QWBFZAlgComponetXmlParamsDialog.h"
|
||||
#include "QWBFZExcuteAlgProgramDialog.h"
|
||||
|
||||
void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox)
|
||||
{
|
||||
emit toolbox->addBoxToolItemSIGNAL(new WBFZAlgComponetLoadXmlParamsDialogToolButton(toolbox));
|
||||
emit toolbox->addBoxToolItemSIGNAL(new QWBFZExcuteAlgProgramDialogToolButton(toolbox));
|
||||
}
|
||||
|
||||
|
||||
WBFZAlgComponetLoadXmlParamsDialogToolButton::WBFZAlgComponetLoadXmlParamsDialogToolButton(QWidget* parent)
|
||||
WBFZAlgComponetLoadXmlParamsDialogToolButton::WBFZAlgComponetLoadXmlParamsDialogToolButton(QWidget* parent) : QToolAbstract(parent)
|
||||
{
|
||||
this->toolPath = QVector<QString>(0);
|
||||
this->toolPath.push_back(u8"空基十三五微波算法组件");
|
||||
this->toolPath.push_back(u8"微波算法组件");
|
||||
this->toolname = QString(u8"¼ÓÔØËã·¨×é¼þxml²ÎÊý½çÃæ");
|
||||
}
|
||||
|
||||
|
||||
WBFZAlgComponetLoadXmlParamsDialogToolButton::~WBFZAlgComponetLoadXmlParamsDialogToolButton()
|
||||
{
|
||||
|
||||
|
@ -25,3 +28,26 @@ void WBFZAlgComponetLoadXmlParamsDialogToolButton::run()
|
|||
{
|
||||
WBFZAlgComponetLoadXmlParamsProcess();
|
||||
}
|
||||
|
||||
|
||||
|
||||
QWBFZExcuteAlgProgramDialogToolButton::QWBFZExcuteAlgProgramDialogToolButton(QWidget* parent) : QToolAbstract(parent)
|
||||
{
|
||||
this->toolPath = QVector<QString>(0);
|
||||
this->toolPath.push_back(u8"微波算法组件");
|
||||
this->toolname = QString(u8"执行微波算法组件");
|
||||
}
|
||||
|
||||
QWBFZExcuteAlgProgramDialogToolButton::~QWBFZExcuteAlgProgramDialogToolButton()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void QWBFZExcuteAlgProgramDialogToolButton::run()
|
||||
{
|
||||
QWBFZExcuteAlgProgramDialog* dialog = new QWBFZExcuteAlgProgramDialog();
|
||||
dialog->setWindowTitle(u8"执行微波算法组件");
|
||||
dialog->show();
|
||||
//dialog->exec();
|
||||
//dialog->deleteLater();
|
||||
}
|
||||
|
|
|
@ -38,6 +38,18 @@ public:
|
|||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 加载空基十三五微波算法组件执行界面
|
||||
/// </summary>
|
||||
class KJ2ALGINTERFACETOOLBOX_EXPORT QWBFZExcuteAlgProgramDialogToolButton : public QToolAbstract {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QWBFZExcuteAlgProgramDialogToolButton(QWidget* parent = nullptr);
|
||||
~QWBFZExcuteAlgProgramDialogToolButton();
|
||||
public:
|
||||
virtual void run() override;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -112,9 +112,11 @@
|
|||
<ClCompile Include="KJ135WBJYAlgInterfaceToolbox.cpp" />
|
||||
<ClCompile Include="KJ135WBJYAlgWidgetComponet.cpp" />
|
||||
<ClCompile Include="QWBFZAlgComponetXmlParamsDialog.cpp" />
|
||||
<ClCompile Include="QWBFZExcuteAlgProgramDialog.cpp" />
|
||||
<ClCompile Include="WBFZAlgComponetXmlParaseOperator.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="QWBFZExcuteAlgProgramDialog.h" />
|
||||
<QtMoc Include="WBFZAlgComponetXmlParaseOperator.h" />
|
||||
<QtMoc Include="QWBFZAlgComponetXmlParamsDialog.h" />
|
||||
<QtMoc Include="KJ135WBJYAlgInterfaceToolbox.h" />
|
||||
|
@ -123,6 +125,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtUic Include="QWBFZAlgComponetXmlParamsDialog.ui" />
|
||||
<QtUic Include="QWBFZExcuteAlgProgramDialog.ui" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
|
||||
|
|
|
@ -35,6 +35,9 @@
|
|||
<ClCompile Include="WBFZAlgComponetXmlParaseOperator.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QWBFZExcuteAlgProgramDialog.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="KJ135WBJYAlgInterfacetoolbox_global.h">
|
||||
|
@ -54,10 +57,16 @@
|
|||
<QtMoc Include="WBFZAlgComponetXmlParaseOperator.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="QWBFZExcuteAlgProgramDialog.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtUic Include="QWBFZAlgComponetXmlParamsDialog.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
<QtUic Include="QWBFZExcuteAlgProgramDialog.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,94 @@
|
|||
#include "QWBFZExcuteAlgProgramDialog.h"
|
||||
#include "ui_QWBFZExcuteAlgProgramDialog.h"
|
||||
#include "KJ135WBJYAlgWidgetComponet.h"
|
||||
#include <QProcess>
|
||||
#include <qt_windows.h>
|
||||
|
||||
QWBFZExcuteAlgProgramDialog::QWBFZExcuteAlgProgramDialog(QWidget *parent)
|
||||
: QDialog(parent),
|
||||
ui(new Ui::QWBFZExcuteAlgProgramDialogClass),
|
||||
xmlfileSelectWidget(new FileSelectWidget(this)),
|
||||
exefileSelectWidget(new FileSelectWidget(this))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// 添加参数选择组件
|
||||
exefileSelectWidget->setParaName(u8"算法执行exe");
|
||||
exefileSelectWidget->setParaChsName(u8"算法执行exe");
|
||||
exefileSelectWidget->setDescription(u8"算法执行exe");
|
||||
exefileSelectWidget->setDatatype(u8"string");
|
||||
exefileSelectWidget->setParaType(u8"Value");
|
||||
exefileSelectWidget->setComponentType(ComponentType::FileSelect);
|
||||
exefileSelectWidget->initUI();
|
||||
|
||||
xmlfileSelectWidget->setParaName(u8"算法xml参数文件");
|
||||
xmlfileSelectWidget->setParaChsName(u8"算法xml参数文件");
|
||||
xmlfileSelectWidget->setDescription(u8"算法xml参数文件");
|
||||
xmlfileSelectWidget->setDatatype(u8"string");
|
||||
xmlfileSelectWidget->setParaType(u8"Value");
|
||||
xmlfileSelectWidget->setComponentType(ComponentType::FileSelect);
|
||||
xmlfileSelectWidget->initUI();
|
||||
|
||||
|
||||
ui->verticalLayout_InParamsRegion->addWidget(exefileSelectWidget);
|
||||
ui->verticalLayout_InParamsRegion->addWidget(xmlfileSelectWidget);
|
||||
|
||||
// 连接信号槽
|
||||
QObject::connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onacceptButton_Clicked()));
|
||||
QObject::connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(oncancelButton_Clicked()));
|
||||
this->show();
|
||||
}
|
||||
|
||||
QWBFZExcuteAlgProgramDialog::~QWBFZExcuteAlgProgramDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void QWBFZExcuteAlgProgramDialog::onacceptButton_Clicked()
|
||||
{
|
||||
QString xmlfilepath = xmlfileSelectWidget->getValue();
|
||||
QString exefilepath = exefileSelectWidget->getValue();
|
||||
|
||||
qDebug() <<"xmlpath :\t" << xmlfilepath;
|
||||
qDebug() << "exepath :\t" << exefilepath;
|
||||
|
||||
// 获取exe文件文件夹路径
|
||||
QString exeDirPath = QFileInfo(exefilepath).absolutePath();
|
||||
qDebug() << "exedirpath :\t" << exeDirPath;
|
||||
|
||||
// 构建cmd命令:先进入exe文件所在目录,然后执行exe文件,参数为xml文件路径
|
||||
QString cmdstr = QString("cd /d %1 && %2 %3").arg(exeDirPath).arg(exefilepath).arg(xmlfilepath);
|
||||
qDebug() << "cmdstr :\t" << cmdstr;
|
||||
// 执行cmd命令
|
||||
QProcess* process = new QProcess(this);
|
||||
process->setProcessChannelMode(QProcess::MergedChannels);
|
||||
|
||||
|
||||
// 设置Windows API参数强制弹出窗口
|
||||
process->setCreateProcessArgumentsModifier([](QProcess::CreateProcessArguments* args) {
|
||||
args->flags |= CREATE_NEW_CONSOLE; // 创建新控制台窗口
|
||||
args->startupInfo->wShowWindow = SW_SHOWNORMAL; // 正常显示窗口
|
||||
args->startupInfo->dwFlags &= ~STARTF_USESTDHANDLES; // 禁用标准句柄重定向[3,7](@ref)
|
||||
});
|
||||
|
||||
|
||||
// 实时读取命令输出
|
||||
connect(process, &QProcess::readyRead, [=]() {
|
||||
QString output = QString::fromLocal8Bit(process->readAll());
|
||||
qDebug() << "CMD Output:" << output;
|
||||
});
|
||||
|
||||
// 设置程序路径和参数
|
||||
process->start("cmd.exe", QStringList() << "/k" << cmdstr);
|
||||
|
||||
// 错误处理
|
||||
connect(process, &QProcess::errorOccurred, [](QProcess::ProcessError error) {
|
||||
qDebug() << "Error:" << error;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
void QWBFZExcuteAlgProgramDialog::oncancelButton_Clicked()
|
||||
{
|
||||
this->close();
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
#pragma once
|
||||
#ifndef __QWBFZEXCUTEALGPROGRAMDIALOG_H__
|
||||
#define __QWBFZEXCUTEALGPROGRAMDIALOG_H__
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class QWBFZExcuteAlgProgramDialogClass;
|
||||
};
|
||||
|
||||
|
||||
class FileSelectWidget;
|
||||
|
||||
|
||||
class QWBFZExcuteAlgProgramDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QWBFZExcuteAlgProgramDialog(QWidget *parent = nullptr);
|
||||
~QWBFZExcuteAlgProgramDialog();
|
||||
|
||||
|
||||
public slots:
|
||||
void onacceptButton_Clicked(); // 确定按钮点击事件
|
||||
void oncancelButton_Clicked(); // 取消按钮点击事件
|
||||
|
||||
private:
|
||||
Ui::QWBFZExcuteAlgProgramDialogClass* ui;
|
||||
FileSelectWidget* xmlfileSelectWidget = nullptr; // xml文件选择组件
|
||||
FileSelectWidget* exefileSelectWidget = nullptr; // 输入文件选择组件
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QWBFZExcuteAlgProgramDialogClass</class>
|
||||
<widget class="QDialog" name="QWBFZExcuteAlgProgramDialogClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>QWBFZExcuteAlgProgramDialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_InParamsRegion"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in New Issue