diff --git a/LAMPDataProcessEXE/LAMPMainWidget.sqlite b/LAMPDataProcessEXE/LAMPMainWidget.sqlite
index 1ec0944..937ef44 100644
Binary files a/LAMPDataProcessEXE/LAMPMainWidget.sqlite and b/LAMPDataProcessEXE/LAMPMainWidget.sqlite differ
diff --git a/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgInterfaceToolbox.vcxproj b/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgInterfaceToolbox.vcxproj
index 7121617..f99433d 100644
--- a/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgInterfaceToolbox.vcxproj
+++ b/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgInterfaceToolbox.vcxproj
@@ -92,7 +92,7 @@
Windows
- false
+ DebugFull
true
true
diff --git a/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgWidgetComponet.cpp b/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgWidgetComponet.cpp
index 31e482f..96dd4b6 100644
--- a/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgWidgetComponet.cpp
+++ b/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgWidgetComponet.cpp
@@ -1,19 +1,21 @@
-#include "KJ135WBJYAlgWidgetComponet.h"
+#include "KJ135WBJYAlgWidgetComponet.h"
#include
#include
+#include
AbstractComponentWidget::AbstractComponentWidget(QWidget* parent) :QWidget(parent)
{
- this->componentType = ComponentType::UNKNOW; // Ĭδ֪
- this->ParaName = QString(); //
- this->ParaChsName = QString(); //
- this->Description = QString(); //
- this->Datatype = QString(); //
- this->ParaType = QString(); //
+ this->componentType = ComponentType::UNKNOW; // 默认未知类型
+ this->ParaName = QString(); // 参数名称
+ this->ParaChsName = QString(); // 参数中文名称
+ this->Description = QString(); // 参数描述
+ this->Datatype = QString(); // 数据类型
+ this->ParaType = QString(); // 参数类型
}
AbstractComponentWidget::~AbstractComponentWidget()
{
+
}
QString AbstractComponentWidget::getParaName() const
@@ -38,13 +40,13 @@ void AbstractComponentWidget::setParaChsName(const QString& name)
QString AbstractComponentWidget::getDescription() const
{
-
+
return this->Description;
}
void AbstractComponentWidget::setDescription(const QString& description)
{
- this->setToolTip(description);// ʾ
+ this->setToolTip(description);// 绑定提示
this->Description = description;
}
@@ -78,7 +80,16 @@ ComponentType AbstractComponentWidget::getComponentType() const
return this->componentType;
}
-// File ļѡ
+QString AbstractComponentWidget::getValue() const
+{
+ return QString();
+}
+
+void AbstractComponentWidget::initUI()
+{
+}
+
+// File 文件选择
FileSelectWidget::FileSelectWidget(QWidget* parent) :AbstractComponentWidget(parent)
{
@@ -90,29 +101,29 @@ FileSelectWidget::~FileSelectWidget()
void FileSelectWidget::initUI()
{
- // ʼؼ
+ // 初始化控件
// fileNameLabel
fileNameLabel = new QLabel(this);
fileNameLabel->setText(this->getParaName());
//filePathEdit
filePathEdit = new QLineEdit(this);
-
+
// fileSelectButton
fileSelectButton = new QToolButton(this);
- fileSelectButton->setText(u8"ѡļ");
+ fileSelectButton->setText(u8"选择文件");
- // ļСؼ߶
- fileNameLabel->setMinimumHeight(30);
- filePathEdit->setMinimumHeight(30);
- fileSelectButton->setMinimumHeight(30);
+ // 设置文件最小控件高度
+ fileNameLabel->setMinimumHeight(40);
+ filePathEdit->setMinimumHeight(40);
+ fileSelectButton->setMinimumHeight(40);
- // ź-
- QObject::connect(fileSelectButton, SIGNAL(clicked()) , this, SLOT(onFileSelectButtonClicked()));
+ // 绑定信号-槽
+ QObject::connect(fileSelectButton, SIGNAL(clicked()), this, SLOT(onFileSelectButtonClicked()));
- // ˮƽ
+ // 水平布局
QHBoxLayout* layout = new QHBoxLayout(this);
layout->addWidget(fileNameLabel);
layout->addWidget(filePathEdit);
@@ -129,7 +140,7 @@ QString FileSelectWidget::getValue() const
return filePathEdit->text();
}
else {
- QMessageBox::warning(nullptr, u8"", u8"ѡļ");
+ QMessageBox::warning(nullptr, u8"警告", u8"请先选择文件");
return QString();
}
}
@@ -138,46 +149,58 @@ void FileSelectWidget::onFileSelectButtonClicked()
{
if (this->componentType == ComponentType::FileSelect)
{
- QString fileName = QFileDialog::getOpenFileName(this, u8"ѡļ", "", u8"ļ(*.*);;ıļ(*.txt);;ͼļ(*.png *.jpg *.bmp)");
- if (!fileName.isEmpty())
- {
- filePathEdit->setText(fileName);
- }
- else {
- QMessageBox::warning(this, u8"", u8"ѡļ");
- }
- }
- else if (this->componentType == ComponentType::FolderSelect)
- {
- QString fileName = QFileDialog::getOpenFileName(this,
- QString(u8"ѡ%1").arg(this->getParaChsName()),
+ QString fileName = QFileDialog::getOpenFileName(this,
+ QString(u8"选择%1").arg(this->getParaChsName()),
"",
- QString(u8"ļ(*.*);;%1ļ(*.%2);;").arg(this->getDatatype()).arg(this->getDatatype()));
+ QString(u8"所有文件(*.*);;%1文件(*.%2);;").arg(this->getDatatype()).arg(this->getDatatype()));
if (!fileName.isEmpty())
{
filePathEdit->setText(fileName);
}
else {
- QMessageBox::warning(this, u8"", u8"ѡļ");
+ QMessageBox::warning(this, u8"警告", u8"请选择文件");
}
}
- else {
+ else if (this->componentType == ComponentType::MulitFileSelect)
+ {
+ QStringList fileName = QFileDialog::getOpenFileNames(this,
+ QString(u8"选择文件夹:%1").arg(this->getParaChsName()),
+ "");
+ if (fileName.count() != 0)
+ {
+ QString filePathlist = fileName.at(0);
+ for (long i = 1; i < fileName.count(); i++)
+ {
+ filePathlist = QString(u8"%1;%2").arg(filePathlist).arg(fileName.at(i));
+ }
+ filePathlist = QString(u8"%1;").arg(filePathlist);
+ filePathEdit->setText(filePathlist);
+ }
+ else {
+ QMessageBox::warning(this, u8"警告", u8"请选择文件夹");
+ }
+ }
+ else if (this->componentType == ComponentType::FolderSelect) {
QString fileName = QFileDialog::getExistingDirectory(this,
- QString(u8"ѡļУ%1").arg(this->getParaChsName()),
+ QString(u8"选择文件夹:%1").arg(this->getParaChsName()),
"");
if (!fileName.isEmpty())
{
+ fileName = QString(u8"%1%2").arg(fileName).arg(QDir::separator());
filePathEdit->setText(fileName);
}
else {
- QMessageBox::warning(this, u8"", u8"ѡļ");
+ QMessageBox::warning(this, u8"警告", u8"请选择文件夹");
}
- }
+ }
+ else {
+ QMessageBox::warning(this, u8"警告", u8"参数控件格式错误");
+ }
}
-//
+// 整数输入组件
IntInputWidget::IntInputWidget(QWidget* parent) :AbstractComponentWidget(parent)
{
@@ -193,13 +216,13 @@ void IntInputWidget::initUI()
intInput = new QSpinBox(this);
- intInput->setRange(-1000000, 1000000);
+ intInput->setRange(-920240809, 920240809);
intInput->setSingleStep(1);
- // ļСؼ߶
- fileNameLabel->setMinimumHeight(30);
- intInput->setMinimumHeight(30);
- // ˮƽ
+ // 设置文件最小控件高度
+ fileNameLabel->setMinimumHeight(40);
+ intInput->setMinimumHeight(40);
+ // 水平布局
QHBoxLayout* layout = new QHBoxLayout(this);
layout->addWidget(fileNameLabel);
layout->addWidget(intInput);
@@ -216,8 +239,8 @@ QString IntInputWidget::getValue() const
return QString::number(this->intInput->value());
}
}
-
-//
+
+// 浮点数输入组件
DoubleInputWidget::DoubleInputWidget(QWidget* parent) :AbstractComponentWidget(parent)
{
@@ -233,14 +256,13 @@ void DoubleInputWidget::initUI()
fileNameLabel->setText(this->getParaName());
- doubleInput = new QDoubleSpinBox(this);
- doubleInput->setRange(-1000000, 1000000);
- doubleInput->setSingleStep(1e-6);
+ doubleInput = new QLineEdit(this);
+
- // ļСؼ߶
- fileNameLabel->setMinimumHeight(30);
- doubleInput->setMinimumHeight(30);
- // ˮƽ
+ // 设置文件最小控件高度
+ fileNameLabel->setMinimumHeight(40);
+ doubleInput->setMinimumHeight(40);
+ // 水平布局
QHBoxLayout* layout = new QHBoxLayout(this);
layout->addWidget(fileNameLabel);
layout->addWidget(doubleInput);
@@ -251,7 +273,7 @@ QString DoubleInputWidget::getValue() const
{
if (nullptr != this->doubleInput)
{
- return QString::number(this->doubleInput->value(),'e',14);
+ return this->doubleInput->text();
}
else {
return QString();
@@ -260,10 +282,10 @@ QString DoubleInputWidget::getValue() const
-//
+// 整数输入组件
ScopeIntInputWidget::ScopeIntInputWidget(QWidget* parent) :AbstractComponentWidget(parent)
{
-
+
}
ScopeIntInputWidget::~ScopeIntInputWidget()
@@ -285,11 +307,11 @@ void ScopeIntInputWidget::initUI()
intInputMax->setRange(-1000000, 1000000);
intInputMax->setSingleStep(1);
- // ļСؼ߶
- fileNameLabel->setMinimumHeight(30);
- intInputMin->setMinimumHeight(30);
- intInputMax->setMinimumHeight(30);
- // ˮƽ
+ // 设置文件最小控件高度
+ fileNameLabel->setMinimumHeight(40);
+ intInputMin->setMinimumHeight(40);
+ intInputMax->setMinimumHeight(40);
+ // 水平布局
QHBoxLayout* layout = new QHBoxLayout(this);
layout->addWidget(fileNameLabel);
layout->addWidget(intInputMin);
@@ -298,6 +320,7 @@ void ScopeIntInputWidget::initUI()
this->setLayout(layout);
}
+
QString ScopeIntInputWidget::getValue() const
{
if (nullptr != intInputMin && nullptr != intInputMax)
@@ -307,14 +330,14 @@ QString ScopeIntInputWidget::getValue() const
.arg(QString::number(intInputMax->value()));
}
else {
- QMessageBox::warning(nullptr, u8"", u8"");
+ QMessageBox::warning(nullptr, u8"警告", u8"请先输入");
}
return QString();
}
-//
+// 浮点数输入组件
ScopeDoubleInputWidget::ScopeDoubleInputWidget(QWidget* parent) :AbstractComponentWidget(parent)
{
}
@@ -327,22 +350,19 @@ void ScopeDoubleInputWidget::initUI()
{
fileNameLabel = new QLabel(this);
fileNameLabel->setText(this->getParaName());
- doubleInputMin = new QDoubleSpinBox(this);
- doubleInputMax->setRange(-1000000, 1000000);
- doubleInputMin->setSingleStep(1);
+ doubleInputMin = new QLineEdit(this);
+
scopeConnectStr = new QLabel(this);
scopeConnectStr->setText(u8" - ");
- doubleInputMax = new QDoubleSpinBox(this);
- doubleInputMax->setRange(-1000000, 1000000);
- doubleInputMax->setSingleStep(1);
+ doubleInputMax = new QLineEdit(this);
- // ļСؼ߶
- fileNameLabel->setMinimumHeight(30);
- doubleInputMin->setMinimumHeight(30);
- doubleInputMax->setMinimumHeight(30);
- // ˮƽ
+ // 设置文件最小控件高度
+ fileNameLabel->setMinimumHeight(40);
+ doubleInputMin->setMinimumHeight(40);
+ doubleInputMax->setMinimumHeight(40);
+ // 水平布局
QHBoxLayout* layout = new QHBoxLayout(this);
layout->addWidget(fileNameLabel);
layout->addWidget(doubleInputMin);
@@ -356,11 +376,537 @@ QString ScopeDoubleInputWidget::getValue() const
if (nullptr != doubleInputMin && nullptr != doubleInputMax)
{
return QString("%1;%2")
- .arg(QString::number(doubleInputMin->value(),'e',14))
- .arg(QString::number(doubleInputMax->value(), 'e', 14));
+ .arg(doubleInputMin->text())
+ .arg(doubleInputMax->text());
}
else {
- QMessageBox::warning(nullptr, u8"", u8"");
+ QMessageBox::warning(nullptr, u8"警告", u8"请先输入");
}
return QString();
}
+
+AbstractComponentWidget* createComponentWidgetFactory(QString ParaName, QString ParaChsName, QString Datatype, QString ParaType, QString Description, QWidget* parent)
+{
+ qDebug() << "createComponentWidgetFactory: " << ParaName << ParaChsName << Datatype << ParaType << Description;
+ if (QString::compare(ParaName, u8"WorkSpace", Qt::CaseInsensitive) == 0) { // 判断是否相等
+ AbstractComponentWidget* workspacePathWidget = new FileSelectWidget(parent);
+ workspacePathWidget->setParaName(ParaName);
+ workspacePathWidget->setParaChsName(ParaChsName);
+ workspacePathWidget->setDescription(Description);
+ workspacePathWidget->setDatatype(Datatype);
+ workspacePathWidget->setComponentType(ComponentType::FolderSelect);
+ workspacePathWidget->initUI();
+ return workspacePathWidget;
+ }
+ else if(QString::compare(ParaName, u8"box", Qt::CaseInsensitive) == 0 ){ // 包围盒
+ AbstractComponentWidget* boxInpputWidget = new BoxDoubleInputWidget(parent);
+ boxInpputWidget->setParaName(ParaName);
+ boxInpputWidget->setParaChsName(ParaChsName);
+ boxInpputWidget->setDescription(Description);
+ boxInpputWidget->setDatatype(Datatype);
+ boxInpputWidget->setComponentType(ComponentType::BoxDoubleInput);
+ boxInpputWidget->initUI();
+ return boxInpputWidget;
+ }
+ else if (QString::compare(ParaName, u8"CoveringIDs", Qt::CaseInsensitive) == 0 ) { // 地表覆盖类型
+ AbstractComponentWidget* intInpputWidget = new MultiIntInputWidget(parent);
+ intInpputWidget->setParaName(ParaName);
+ intInpputWidget->setParaChsName(ParaChsName);
+ intInpputWidget->setDescription(Description);
+ intInpputWidget->setDatatype(Datatype);
+ intInpputWidget->setComponentType(ComponentType::MultiIntInput);
+ intInpputWidget->initUI();
+ return intInpputWidget;
+ }
+ else if (QString::compare(ParaName, u8"NDVIScope", Qt::CaseInsensitive) == 0) { //NDVI 范围
+ AbstractComponentWidget* scopeDoubleInputWidget = new ScopeDoubleInputWidget(parent);
+ scopeDoubleInputWidget->setParaName(ParaName);
+ scopeDoubleInputWidget->setParaChsName(ParaChsName);
+ scopeDoubleInputWidget->setDescription(Description);
+ scopeDoubleInputWidget->setDatatype(Datatype);
+ scopeDoubleInputWidget->setComponentType(ComponentType::ScopeDoubleInput);
+ scopeDoubleInputWidget->initUI();
+ return scopeDoubleInputWidget;
+ }
+ else if (QString::compare(ParaName, u8"MainImg", Qt::CaseInsensitive) == 0 ) { // 浮点数输入
+ AbstractComponentWidget* InputWidget = new IntInputWidget(parent);
+ InputWidget->setParaName(ParaName);
+ InputWidget->setParaChsName(ParaChsName);
+ InputWidget->setDescription(Description);
+ InputWidget->setDatatype(Datatype);
+ InputWidget->setComponentType(ComponentType::IntInput);
+ InputWidget->initUI();
+ return InputWidget;
+ }
+ else if (QString::compare(ParaName, u8"SARS", Qt::CaseInsensitive) == 0 ) { // 浮点数输入
+ AbstractComponentWidget* InputWidget = new FileSelectWidget(parent);
+ InputWidget->setParaName(ParaName);
+ InputWidget->setParaChsName(ParaChsName);
+ InputWidget->setDescription(Description);
+ InputWidget->setDatatype(Datatype);
+ InputWidget->setComponentType(ComponentType::MulitFileSelect);
+ InputWidget->initUI();
+ return InputWidget;
+ }
+ else if (QString::compare(ParaName, u8"CorrectMethod", Qt::CaseInsensitive) == 0 ) { // 浮点数输入
+ AbstractComponentWidget* scopeDoubleInputWidget = new CorrectMethodcomboxSelectWidget(parent);
+ scopeDoubleInputWidget->setParaName(ParaName);
+ scopeDoubleInputWidget->setParaChsName(ParaChsName);
+ scopeDoubleInputWidget->setDescription(Description);
+ scopeDoubleInputWidget->setDatatype(Datatype);
+ scopeDoubleInputWidget->setComponentType(ComponentType::IntInput);
+ scopeDoubleInputWidget->initUI();
+ return scopeDoubleInputWidget;
+ }
+ else if (QString::compare(ParaName, u8"FeatureCombination", Qt::CaseInsensitive) == 0) { // 浮点数输入
+ AbstractComponentWidget* InputWidget = new FeatureCombinationMultiIntInputWidget(parent);
+ InputWidget->setParaName(ParaName);
+ InputWidget->setParaChsName(ParaChsName);
+ InputWidget->setDescription(Description);
+ InputWidget->setDatatype(Datatype);
+ InputWidget->setComponentType(ComponentType::IntInput);
+ InputWidget->initUI();
+ return InputWidget;
+ }
+ else if (QString::compare(ParaType, u8"Value", Qt::CaseInsensitive) == 0 && QString::compare(Datatype, u8"string", Qt::CaseInsensitive) == 0) {
+ AbstractComponentWidget* InputWidget = new StringInputWidget(parent);
+ InputWidget->setParaName(ParaName);
+ InputWidget->setParaChsName(ParaChsName);
+ InputWidget->setDescription(Description);
+ InputWidget->setDatatype(Datatype);
+ InputWidget->setComponentType(ComponentType::IntInput);
+ InputWidget->initUI();
+ return InputWidget;
+ }
+ else if (QString::compare(ParaType, u8"Value", Qt::CaseInsensitive) == 0 && QString::compare(Datatype, u8"float", Qt::CaseInsensitive) == 0) { // 浮点数输入
+ AbstractComponentWidget* InputWidget = new DoubleInputWidget(parent);
+ InputWidget->setParaName(ParaName);
+ InputWidget->setParaChsName(ParaChsName);
+ InputWidget->setDescription(Description);
+ InputWidget->setDatatype(Datatype);
+ InputWidget->setComponentType(ComponentType::DoubleInput);
+ InputWidget->initUI();
+ return InputWidget;
+ }
+ else if (QString::compare(ParaType, u8"File", Qt::CaseInsensitive) == 0 && QString::compare(Datatype, u8"File", Qt::CaseInsensitive) == 0) { // 强制选择文件夹
+ AbstractComponentWidget* fileSelectWidget = new FileSelectWidget(parent);
+ fileSelectWidget->setParaName(ParaName);
+ fileSelectWidget->setParaChsName(ParaChsName);
+ fileSelectWidget->setDescription(Description);
+ fileSelectWidget->setDatatype(Datatype);
+ fileSelectWidget->setComponentType(ComponentType::FolderSelect);
+ fileSelectWidget->initUI();
+ return fileSelectWidget;
+ }
+ else if (QString::compare(ParaType, u8"File", Qt::CaseInsensitive) == 0 && QString::compare(Datatype, u8"tar.gz", Qt::CaseInsensitive) == 0) {// 选择文件
+ AbstractComponentWidget* fileSelectWidget = new FileSelectWidget(parent);
+ fileSelectWidget->setParaName(ParaName);
+ fileSelectWidget->setParaChsName(ParaChsName);
+ fileSelectWidget->setDescription(Description);
+ fileSelectWidget->setDatatype(Datatype);
+ fileSelectWidget->setComponentType(ComponentType::FileSelect);
+ fileSelectWidget->initUI();
+ return fileSelectWidget;
+ }
+ else if (QString::compare(ParaType, u8"File", Qt::CaseInsensitive) == 0) {// 选择文件
+ AbstractComponentWidget* fileSelectWidget = new FileSelectWidget(parent);
+ fileSelectWidget->setParaName(ParaName);
+ fileSelectWidget->setParaChsName(ParaChsName);
+ fileSelectWidget->setDescription(Description);
+ fileSelectWidget->setDatatype(Datatype);
+ fileSelectWidget->setComponentType(ComponentType::MulitFileSelect);
+ fileSelectWidget->initUI();
+ return fileSelectWidget;
+ }
+ return nullptr;
+}
+
+BoxDoubleInputWidget::BoxDoubleInputWidget(QWidget* parent) :AbstractComponentWidget(parent)
+{
+}
+
+BoxDoubleInputWidget::~BoxDoubleInputWidget()
+{
+}
+
+void BoxDoubleInputWidget::initUI()
+{
+ // 修改提示
+ this->Description = QString(u8"%1;不填参数请填写empty作为不填写指令").arg(this->Description);
+ this->setToolTip(this->Description);
+
+ fileNameLabel = new QLabel(this);
+ fileNameLabel->setText(this->getParaName());
+ doubleInputMin = new QLineEdit(this);
+ doubleInputMin->setPlaceholderText(u8"请输入包围盒参数");
+ // 设置文件最小控件高度
+ fileNameLabel->setMinimumHeight(40);
+ doubleInputMin->setMinimumHeight(40);
+ // 水平布局
+ QHBoxLayout* layout = new QHBoxLayout(this);
+ layout->addWidget(fileNameLabel);
+ layout->addWidget(doubleInputMin);
+ this->setLayout(layout);
+}
+
+QString BoxDoubleInputWidget::getValue() const
+{
+ QString valuestr = this->doubleInputMin->text();
+ // 非法性检查
+ if (valuestr.isEmpty())
+ {
+ QMessageBox::warning(nullptr, u8"警告", u8"请先输入");
+ return QString();
+ }
+ else if (valuestr.compare("empty", Qt::CaseSensitive) == 0)
+ {
+ return QString("empty");
+ }
+ else {
+ // 经纬度包围盒SNWE。例子:30.0;30.2;117.3;117.5 37;38.2;108.87;109.1 , 请根据例子给出规则检查代码
+
+ QStringList list = valuestr.split(";");
+ if (list.size() != 4)
+ {
+ QMessageBox::warning(nullptr, u8"警告", QString(u8"包围盒参数格式错误\n%1").arg(this->Description));
+ return QString("empty");
+ }
+ for (int i = 0; i < list.size(); i++)
+ {
+ bool ok;
+ double value = list.at(i).toDouble(&ok);
+ if (!ok)
+ {
+ QMessageBox::warning(nullptr, u8"警告", QString(u8"包围盒参数格式错误\n%1").arg(this->Description));
+ return QString("empty");
+ }
+ }
+ return valuestr;
+ }
+ return QString("empty");
+}
+
+
+MultiIntInputWidget::MultiIntInputWidget(QWidget* parent)
+{
+}
+
+MultiIntInputWidget::~MultiIntInputWidget()
+{
+}
+
+void MultiIntInputWidget::initUI()
+{
+ fileNameLabel = new QLabel(this);
+ fileNameLabel->setText(this->getParaName());
+ IntInputMin = new QLineEdit(this);
+ IntInputMin->setPlaceholderText(u8"请输入整数");
+ // 设置文件最小控件高度
+ fileNameLabel->setMinimumHeight(40);
+ IntInputMin->setMinimumHeight(40);
+ // 水平布局
+ QHBoxLayout* layout = new QHBoxLayout(this);
+ layout->addWidget(fileNameLabel);
+ layout->addWidget(IntInputMin);
+ this->setLayout(layout);
+}
+
+QString MultiIntInputWidget::getValue() const
+{
+ QString valuestr = this->IntInputMin->text();
+ // 非法性检查
+ if (valuestr.isEmpty())
+ {
+ QMessageBox::warning(nullptr, u8"警告", u8"请先输入");
+ return QString();
+ }
+ else if (valuestr.compare("empty", Qt::CaseSensitive) == 0)
+ {
+ return QString("empty");
+ }
+ else {
+ QStringList list = valuestr.split(";");
+ for (int i = 0; i < list.size(); i++)
+ {
+ bool ok;
+ int value = list.at(i).toInt(&ok);
+ if (!ok)
+ {
+ QMessageBox::warning(nullptr, u8"警告", QString(u8"整数参数格式错误\n%1").arg(this->Description));
+ return QString("empty");
+ }
+ }
+ return valuestr;
+ }
+ return QString("empty");
+}
+
+MultiDoubleInputWidget::MultiDoubleInputWidget(QWidget* parent)
+{
+}
+
+MultiDoubleInputWidget::~MultiDoubleInputWidget()
+{
+}
+
+void MultiDoubleInputWidget::initUI()
+{
+ fileNameLabel = new QLabel(this);
+ fileNameLabel->setText(this->getParaName());
+ doubleInputMin = new QLineEdit(this);
+ doubleInputMin->setPlaceholderText(u8"请输入浮点数");
+ // 设置文件最小控件高度
+ fileNameLabel->setMinimumHeight(40);
+ doubleInputMin->setMinimumHeight(40);
+ // 水平布局
+ QHBoxLayout* layout = new QHBoxLayout(this);
+ layout->addWidget(fileNameLabel);
+ layout->addWidget(doubleInputMin);
+ this->setLayout(layout);
+}
+
+QString MultiDoubleInputWidget::getValue() const
+{
+ QString valuestr = this->doubleInputMin->text();
+ // 非法性检查
+ if (valuestr.isEmpty())
+ {
+ QMessageBox::warning(nullptr, u8"警告", u8"请先输入");
+ return QString();
+ }
+ else if (valuestr.compare("empty", Qt::CaseSensitive) == 0)
+ {
+ return QString("empty");
+ }
+ else {
+ QStringList list = valuestr.split(";");
+ for (int i = 0; i < list.size(); i++)
+ {
+ bool ok;
+ double value = list.at(i).toDouble(&ok);
+ if (!ok)
+ {
+ QMessageBox::warning(nullptr, u8"警告", QString(u8"浮点数参数格式错误\n%1").arg(this->Description));
+ return QString("empty");
+ }
+ }
+ return valuestr;
+ }
+ return QString("empty");
+}
+
+
+CorrectMethodcomboxSelectWidget::CorrectMethodcomboxSelectWidget(QWidget* parent)
+{
+}
+
+CorrectMethodcomboxSelectWidget::~CorrectMethodcomboxSelectWidget()
+{
+}
+
+void CorrectMethodcomboxSelectWidget::initUI()
+{
+ fileNameLabel = new QLabel(this);
+ fileNameLabel->setText(this->getParaName());
+ comboxSelect = new QComboBox(this);
+ comboxSelect->addItem(u8"2:RD");
+ // 设置文件最小控件高度
+ fileNameLabel->setMinimumHeight(40);
+ comboxSelect->setMinimumHeight(40);
+ // 水平布局
+ QHBoxLayout* layout = new QHBoxLayout(this);
+ layout->addWidget(fileNameLabel);
+ layout->addWidget(comboxSelect);
+ this->setLayout(layout);
+ comboxSelect->setEnabled(false);
+}
+
+QString CorrectMethodcomboxSelectWidget::getValue() const
+{
+ return u8"2";
+}
+
+FeatureCombinationMultiIntInputWidget::FeatureCombinationMultiIntInputWidget(QWidget* parent)
+{
+}
+
+FeatureCombinationMultiIntInputWidget::~FeatureCombinationMultiIntInputWidget()
+{
+}
+
+void FeatureCombinationMultiIntInputWidget::initUI()
+{
+ /*
+ 根据下面的参数,设置一个 checkbox 阵列
+ Freeman:表面散射p_s(0)、偶次散射p_d(1)、体散射p_v(2);
+ Touzi:散射角α_s(3)、散射相位ϕ_α(4)、目标散射对称度τ(5)、相对能量λ_i(6);
+ Yamaguchi:表面散射f_s(7)、二次散射f_d(8)、体散射f_v(9)、螺旋体散射f_h(10);
+ Cloude-Pottier:分解散射熵H(11)、反熵A(12)、平均散射角α(13)*/
+ fileNameLabel = new QLabel(this);
+ fileNameLabel->setText(this->getParaName());
+
+
+ // 不同控件checkbox 初始化
+ checkbox0 = new QCheckBox(u8"表面散射p_s(0)", this);
+ checkbox1 = new QCheckBox(u8"偶次散射p_d(1)", this);
+ checkbox2 = new QCheckBox(u8"体散射p_v(2)", this);
+ checkbox3 = new QCheckBox(u8"散射角α_s(3)", this);
+ checkbox4 = new QCheckBox(u8"散射相位ϕ_α(4)", this);
+ checkbox5 = new QCheckBox(u8"目标散射对称度τ(5)", this);
+ checkbox6 = new QCheckBox(u8"相对能量λ_i(6)", this);
+ checkbox7 = new QCheckBox(u8"表面散射f_s(7)", this);
+ checkbox8 = new QCheckBox(u8"二次散射f_d(8)", this);
+ checkbox9 = new QCheckBox(u8"体散射f_v(9)", this);
+ checkbox10 = new QCheckBox(u8"螺旋体散射f_h(10)", this);
+ checkbox11 = new QCheckBox(u8"分解散射熵H(11)", this);
+ checkbox12 = new QCheckBox(u8"反熵A(12)", this);
+ checkbox13 = new QCheckBox(u8"平均散射角α(13)", this);
+ // 设置文件最小控件高度
+ fileNameLabel->setMinimumHeight(40);
+ checkbox0->setMinimumHeight(40);
+ checkbox1->setMinimumHeight(40);
+ checkbox2->setMinimumHeight(40);
+ checkbox3->setMinimumHeight(40);
+ checkbox4->setMinimumHeight(40);
+ checkbox5->setMinimumHeight(40);
+ checkbox6->setMinimumHeight(40);
+ checkbox7->setMinimumHeight(40);
+ checkbox8->setMinimumHeight(40);
+ checkbox9->setMinimumHeight(40);
+ checkbox10->setMinimumHeight(40);
+ checkbox11->setMinimumHeight(40);
+ checkbox12->setMinimumHeight(40);
+ checkbox13->setMinimumHeight(40);
+ // 垂直布局,并按照Freeman、Touzi、Yamaguchi、Cloude-Pottier的分组,每一个分组使用一个QGroupBox,水平
+ QVBoxLayout* layout = new QVBoxLayout(this);
+ layout->addWidget(fileNameLabel);
+ QGroupBox* FreemanGroup = new QGroupBox(u8"Freeman", this);
+ QHBoxLayout* FreemanLayout = new QHBoxLayout(FreemanGroup);
+ FreemanLayout->addWidget(checkbox0);
+ FreemanLayout->addWidget(checkbox1);
+ FreemanLayout->addWidget(checkbox2);
+ QGroupBox* TouziGroup = new QGroupBox(u8"Touzi", this);
+ QHBoxLayout* TouziLayout = new QHBoxLayout(TouziGroup);
+ TouziLayout->addWidget(checkbox3);
+ TouziLayout->addWidget(checkbox4);
+ TouziLayout->addWidget(checkbox5);
+ TouziLayout->addWidget(checkbox6);
+ QGroupBox* YamaguchiGroup = new QGroupBox(u8"Yamaguchi", this);
+ QHBoxLayout* YamaguchiLayout = new QHBoxLayout(YamaguchiGroup);
+ YamaguchiLayout->addWidget(checkbox7);
+ YamaguchiLayout->addWidget(checkbox8);
+ YamaguchiLayout->addWidget(checkbox9);
+ YamaguchiLayout->addWidget(checkbox10);
+ QGroupBox* CloudePottierGroup = new QGroupBox(u8"Cloude-Pottier", this);
+ QHBoxLayout* CloudePottierLayout = new QHBoxLayout(CloudePottierGroup);
+ CloudePottierLayout->addWidget(checkbox11);
+ CloudePottierLayout->addWidget(checkbox12);
+ CloudePottierLayout->addWidget(checkbox13);
+ layout->addWidget(FreemanGroup);
+ layout->addWidget(TouziGroup);
+ layout->addWidget(YamaguchiGroup);
+ layout->addWidget(CloudePottierGroup);
+ this->setLayout(layout);
+}
+
+QString FeatureCombinationMultiIntInputWidget::getValue() const
+{
+
+ // 检查所有的checkbox是否被选中,然后给出形如0,1,2,7,8,9,10的字符串
+ QString valuestr = QString();
+ if (checkbox0->isChecked())
+ {
+ valuestr += "0,";
+ }
+ if (checkbox1->isChecked())
+ {
+ valuestr += "1,";
+ }
+ if (checkbox2->isChecked())
+ {
+ valuestr += "2,";
+ }
+ if (checkbox3->isChecked())
+ {
+ valuestr += "3,";
+ }
+ if (checkbox4->isChecked())
+ {
+ valuestr += "4,";
+ }
+ if (checkbox5->isChecked())
+ {
+ valuestr += "5,";
+ }
+ if (checkbox6->isChecked())
+ {
+ valuestr += "6,";
+ }
+ if (checkbox7->isChecked())
+ {
+ valuestr += "7,";
+ }
+ if (checkbox8->isChecked())
+ {
+ valuestr += "8,";
+ }
+ if (checkbox9->isChecked())
+ {
+ valuestr += "9,";
+ }
+ if (checkbox10->isChecked())
+ {
+ valuestr += "10,";
+ }
+ if (checkbox11->isChecked())
+ {
+ valuestr += "11,";
+ }
+ if (checkbox12->isChecked())
+ {
+ valuestr += "12,";
+ }
+ if (checkbox13->isChecked())
+ {
+ valuestr += "13,";
+ }
+ // 去掉最后一个逗号
+ if (valuestr.length() > 0)
+ {
+ valuestr = valuestr.left(valuestr.length() - 1);
+ }
+ else {
+ QMessageBox::warning(nullptr, u8"警告", u8"请至少选择一个参数");
+ return QString();
+ }
+ return valuestr;
+}
+
+StringInputWidget::StringInputWidget(QWidget* parent)
+{
+}
+
+StringInputWidget::~StringInputWidget()
+{
+}
+
+void StringInputWidget::initUI()
+{
+ fileNameLabel = new QLabel(this);
+ fileNameLabel->setText(this->getParaName());
+ IntInputMin = new QLineEdit(this);
+ IntInputMin->setPlaceholderText(u8"请输入");
+ // 设置文件最小控件高度
+ fileNameLabel->setMinimumHeight(40);
+ IntInputMin->setMinimumHeight(40);
+ // 水平布局
+ QHBoxLayout* layout = new QHBoxLayout(this);
+ layout->addWidget(fileNameLabel);
+ layout->addWidget(IntInputMin);
+ this->setLayout(layout);
+}
+
+QString StringInputWidget::getValue() const
+{
+ return IntInputMin->text();
+}
diff --git a/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgWidgetComponet.h b/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgWidgetComponet.h
index 6f314d2..67305da 100644
--- a/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgWidgetComponet.h
+++ b/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgWidgetComponet.h
@@ -1,11 +1,11 @@
-#pragma once
+#pragma once
/**
-* ջʮ㷨༯
+* 空基十三五微波算法组件界面组件类集
* @file KJ135WBJYAlgWidgetComponet.h
* @brief KJ135WBJYAlgWidgetComponet.h
* @details
-* ջʮ㷨༯
+* 空基十三五微波算法组件界面组件类集
*/
#ifndef __KJ135WBJYAlgInterfaceToolbox_GLOBAL_H__
@@ -29,18 +29,25 @@
///
-/// ö
+/// 参数类型枚举
///
enum ComponentType{
- UNKNOW = 0, // δ֪
- FileSelect , // ļѡ
- FolderSelect, // ļѡ
- ComboxSelect,// öٶѡ
- IntInput,//
- DoubleInput,//
- MultipleSelect,// ѡ
- ScopeIntInput,// Χ
- ScopeDoubleInput,// Χ
+ UNKNOW = 0, // 未知类型
+ WorkSpace, // 工作空间路径
+ FileSelect , // 文件选择
+ MulitFileSelect , // 文件选择
+ FolderSelect, // 文件夹选择
+ ComboxSelect,// 枚举多选
+ IntInput,// 整数输入
+ stringInput,
+ BoxDoubleInput,// 复选框浮点数输入
+ DoubleInput,// 浮点数输入
+ MultipleSelect,// 多选
+ MultiIntInput,// 整数多选输入
+ MultiDoubleInput,// 浮点数多选输入
+ ScopeIntInput,// 整数范围输入
+ ScopeDoubleInput,// 浮点数范围输入
+
};
@@ -50,8 +57,8 @@ enum ComponentType{
/**
CoveringIDs
-رݵid
-رֲid,idʹá;ָʾGlobeLand30ݵcover_roi_ids = 10;20;30;40;50;70;71;72;83;74;90
+地表覆盖类型数据的类别id
+地表覆盖类型数据中植被区域、裸土区域的类别id,多个id使用“;”分割。示例:GlobeLand30数据的cover_roi_ids = 10;20;30;40;50;70;71;72;83;74;90
Value
string
Man
@@ -79,36 +86,39 @@ public:
~AbstractComponentWidget();
protected:
- QString ParaName; //
- QString ParaChsName;//
- QString Description;//
+ QString ParaName; // 参数名称
+ QString ParaChsName;// 参数中文名称
+ QString Description;// 参数描述
- QString Datatype;// Value //
- QString ParaType;// string
+ QString Datatype;// 数据类型 Value // 决定参数的输入类型
+ QString ParaType;// 参数类型 string
- ComponentType componentType = ComponentType::UNKNOW; //
-public://Բ
+ ComponentType componentType = ComponentType::UNKNOW; // 组件类型
+public://属性操作
QString getParaName() const;
void setParaName(const QString& name);
- // ò
+ // 设置参数中文名称
QString getParaChsName() const;
void setParaChsName(const QString& name);
- // ò
+ // 设置参数描述
QString getDescription() const;
void setDescription(const QString& description);
- //
+ // 设置数据类型
QString getDatatype() const;
void setDatatype(const QString& datatype);
- // ò
+ // 设置参数类型
QString getParaType() const;
void setParaType(const QString& type);
void setComponentType(ComponentType type);
ComponentType getComponentType() const;
+
+ virtual QString getValue() const;
+ virtual void initUI();
};
///
-/// File ļѡ
+/// File 文件选择组件
///
class FileSelectWidget : public AbstractComponentWidget
{
@@ -116,19 +126,19 @@ class FileSelectWidget : public AbstractComponentWidget
public:
FileSelectWidget(QWidget* parent = nullptr);
~FileSelectWidget();
- void initUI();
+ virtual void initUI() override;
private:
- QLabel* fileNameLabel=nullptr; // ļ
+ QLabel* fileNameLabel=nullptr; // 文件名称
QLineEdit* filePathEdit = nullptr;
QToolButton* fileSelectButton = nullptr;
public slots:
void onFileSelectButtonClicked();
public:
- QString getValue() const;
+ virtual QString getValue() const override;
};
///
-/// int
+/// int输入组件
///
class IntInputWidget : public AbstractComponentWidget
{
@@ -136,18 +146,18 @@ class IntInputWidget : public AbstractComponentWidget
public:
IntInputWidget(QWidget* parent = nullptr);
~IntInputWidget();
- void initUI();
+ virtual void initUI() override;
private:
- QLabel* fileNameLabel = nullptr; // ļ
+ QLabel* fileNameLabel = nullptr; // 文件名称
QSpinBox* intInput = nullptr;
public:
- QString getValue() const;
+ virtual QString getValue() const override;
};
///
-/// double
+/// double 输入组件
///
class DoubleInputWidget : public AbstractComponentWidget
{
@@ -155,16 +165,16 @@ class DoubleInputWidget : public AbstractComponentWidget
public:
DoubleInputWidget(QWidget* parent = nullptr);
~DoubleInputWidget();
- void initUI();
+ virtual void initUI() override;
private:
- QLabel* fileNameLabel = nullptr; // ļ
- QDoubleSpinBox* doubleInput = nullptr;
+ QLabel* fileNameLabel = nullptr; // 文件名称
+ QLineEdit* doubleInput = nullptr;
public:
- QString getValue() const;
+ virtual QString getValue() const override;
};
///
-/// ֵ ݷΧ
+/// 整数值 数据范围输入组件
///
class ScopeIntInputWidget : public AbstractComponentWidget
{
@@ -172,19 +182,19 @@ class ScopeIntInputWidget : public AbstractComponentWidget
public:
ScopeIntInputWidget(QWidget* parent = nullptr);
~ScopeIntInputWidget();
- void initUI();
+ virtual void initUI() override;
private:
- QLabel* fileNameLabel = nullptr; // ļ
- QLabel* scopeConnectStr = nullptr; // ļ
+ QLabel* fileNameLabel = nullptr; // 文件名称
+ QLabel* scopeConnectStr = nullptr; // 文件名称
QSpinBox* intInputMin = nullptr;
QSpinBox* intInputMax = nullptr;
public:
- QString getValue() const;
+ virtual QString getValue() const override;
};
///
-/// ֵ ݷΧ
+/// 浮点数值 数据范围输入组件
///
class ScopeDoubleInputWidget : public AbstractComponentWidget
{
@@ -192,24 +202,139 @@ class ScopeDoubleInputWidget : public AbstractComponentWidget
public:
ScopeDoubleInputWidget(QWidget* parent = nullptr);
~ScopeDoubleInputWidget();
- void initUI();
+ virtual void initUI() override;
private:
- QLabel* fileNameLabel = nullptr; // ļ
- QLabel* scopeConnectStr = nullptr; // ļ
- QDoubleSpinBox* doubleInputMin = nullptr;
- QDoubleSpinBox* doubleInputMax = nullptr;
+ QLabel* fileNameLabel = nullptr; // 文件名称
+ QLabel* scopeConnectStr = nullptr; // 文件名称
+ QLineEdit* doubleInputMin = nullptr;
+ QLineEdit* doubleInputMax = nullptr;
public:
- QString getValue() const;
+ virtual QString getValue() const override;
};
+class BoxDoubleInputWidget : public AbstractComponentWidget
+{
+ Q_OBJECT
+public:
+ BoxDoubleInputWidget(QWidget* parent = nullptr);
+ ~BoxDoubleInputWidget();
+ virtual void initUI() override;
+private:
+ QLabel* fileNameLabel = nullptr; // 文件名称
+ QLineEdit* doubleInputMin = nullptr;
+public:
+ virtual QString getValue() const override;
+};
+
+class MultiIntInputWidget : public AbstractComponentWidget
+{
+ Q_OBJECT
+public:
+ MultiIntInputWidget(QWidget* parent = nullptr);
+ ~MultiIntInputWidget();
+ virtual void initUI() override;
+private:
+ QLabel* fileNameLabel = nullptr; // 文件名称
+ QLineEdit* IntInputMin = nullptr;
+public:
+ virtual QString getValue() const override;
+};
+
+class MultiDoubleInputWidget : public AbstractComponentWidget
+{
+ Q_OBJECT
+public:
+ MultiDoubleInputWidget(QWidget* parent = nullptr);
+ ~MultiDoubleInputWidget();
+ virtual void initUI() override;
+private:
+ QLabel* fileNameLabel = nullptr; // 文件名称
+ QLineEdit* doubleInputMin = nullptr;
+public:
+ virtual QString getValue() const override;
+};
+
+
+class CorrectMethodcomboxSelectWidget : public AbstractComponentWidget
+{
+ Q_OBJECT
+public:
+ CorrectMethodcomboxSelectWidget(QWidget* parent = nullptr);
+ ~CorrectMethodcomboxSelectWidget();
+ virtual void initUI() override;
+private:
+ QLabel* fileNameLabel = nullptr; // 文件名称
+ QComboBox* comboxSelect = nullptr;
+public:
+ virtual QString getValue() const override;
+};
+class FeatureCombinationMultiIntInputWidget : public AbstractComponentWidget
+{
+ Q_OBJECT
+public:
+ FeatureCombinationMultiIntInputWidget(QWidget* parent = nullptr);
+ ~FeatureCombinationMultiIntInputWidget();
+ virtual void initUI() override;
+private:
+ QLabel* fileNameLabel = nullptr; // 文件名称
+ /*
+根据下面的参数,设置一个 checkbox 阵列
+ Freeman:表面散射p_s(0)、偶次散射p_d(1)、体散射p_v(2);
+ Touzi:散射角α_s(3)、散射相位ϕ_α(4)、目标散射对称度τ(5)、相对能量λ_i(6);
+ Yamaguchi:表面散射f_s(7)、二次散射f_d(8)、体散射f_v(9)、螺旋体散射f_h(10);
+ Cloude-Pottier:分解散射熵H(11)、反熵A(12)、平均散射角α(13)*/
+ QCheckBox* checkbox0 = nullptr; // 表面散射
+ QCheckBox* checkbox1 = nullptr; // 偶次散射p_d
+ QCheckBox* checkbox2 = nullptr; // 体散射p_v
+ QCheckBox* checkbox3 = nullptr; // 散射角α_s
+ QCheckBox* checkbox4 = nullptr; // 散射相位ϕ_α
+ QCheckBox* checkbox5 = nullptr; // 目标散射对称度τ
+ QCheckBox* checkbox6 = nullptr; // 相对能量λ_i
+ QCheckBox* checkbox7 = nullptr; // 表面散射f_s
+ QCheckBox* checkbox8 = nullptr; // 二次散射f_d
+ QCheckBox* checkbox9 = nullptr; // 体散射f_v
+ QCheckBox* checkbox10 = nullptr; // 螺旋体散射f_h
+ QCheckBox* checkbox11 = nullptr; // 分解散射熵H
+ QCheckBox* checkbox12 = nullptr; // 反熵A
+ QCheckBox* checkbox13 = nullptr; // 平均散射角α
+
+public:
+ virtual QString getValue() const override;
+};
+class StringInputWidget :public AbstractComponentWidget
+{
+ Q_OBJECT
+public:
+ StringInputWidget(QWidget* parent = nullptr);
+ ~StringInputWidget();
+ virtual void initUI() override;
+private:
+ QLabel* fileNameLabel = nullptr; // 文件名称
+ QLineEdit* IntInputMin = nullptr;
+public:
+ virtual QString getValue() const override;
+};
+///
+/// 参数文件工厂
+///
+/// 参数名称
+/// 参数中文别名
+/// 数据类型
+/// 参数类型
+/// 描述
+/// 父控件
+///
+AbstractComponentWidget* createComponentWidgetFactory(QString ParaName, QString ParaChsName, QString Datatype, QString ParaType, QString Description,QWidget* parent = nullptr);
+
+
#endif// __KJ135WBJYAlgInterfaceToolbox_GLOBAL_H__
diff --git a/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZAlgComponetXmlParamsDialog.cpp b/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZAlgComponetXmlParamsDialog.cpp
index 15ebdb7..ac0ad2b 100644
--- a/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZAlgComponetXmlParamsDialog.cpp
+++ b/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZAlgComponetXmlParamsDialog.cpp
@@ -2,7 +2,8 @@
#include "ui_QWBFZAlgComponetXmlParamsDialog.h"
#include
#include
-
+#include "WBFZAlgComponetXmlParaseOperator.h"
+#include "FileOperator.h"
QWBFZAlgComponetXmlParamsDialog::QWBFZAlgComponetXmlParamsDialog(QWidget *parent)
: QDialog(parent),
ui(new Ui::QWBFZAlgComponetXmlParamsDialogClass)
@@ -11,7 +12,57 @@ QWBFZAlgComponetXmlParamsDialog::QWBFZAlgComponetXmlParamsDialog(QWidget *parent
}
QWBFZAlgComponetXmlParamsDialog::~QWBFZAlgComponetXmlParamsDialog()
-{}
+{
+ delete ui;
+ delete xmlParseOperator;
+}
+
+void QWBFZAlgComponetXmlParamsDialog::loadXmlFile(const QString& fileName)
+{
+ if (nullptr != xmlParseOperator)
+ {
+ delete xmlParseOperator;
+ xmlParseOperator = nullptr;
+ }
+ else {}
+
+ // xml
+ xmlParseOperator = new WBFZAlgComponetXmlParaseOperator(this);
+ xmlParseOperator->loadXmlFile(fileName);
+
+ // ݽui
+ // 1. workspace·
+ workspacePathWidget = new FileSelectWidget(this);
+ workspacePathWidget->setParaName("WorkSpace");
+ workspacePathWidget->setParaChsName(u8"ռ·");
+ workspacePathWidget->setDescription(u8"ռ·");
+ workspacePathWidget->setDatatype(u8"string");
+ workspacePathWidget->initUI();
+
+ ui->verticalLayout_param->addWidget(workspacePathWidget);
+ // 2. б
+ QList < WBFZAlgComponetXmlParamenterItem*> parameterList = xmlParseOperator->getParameterList();
+ for (long i = 0; i < parameterList.size(); i++)
+ {
+ WBFZAlgComponetXmlParamenterItem* item = parameterList.at(i);
+ qDebug() << "item->getParaName():" << item->getParaName();
+ //
+ AbstractComponentWidget* parameterWidget = createComponentWidgetFactory(
+ item->getParaName(),
+ item->getParaChsName(),
+ item->getDatatype(),
+ item->getParaType(),
+ item->getDescription(),
+ this);
+ //parameterWidget->initUI();
+
+ ui->verticalLayout_param->addWidget(parameterWidget);
+
+ this->parameterWidgetList.append(parameterWidget);
+
+ }
+
+}
void WBFZAlgComponetLoadXmlParamsProcess()
{
@@ -23,8 +74,13 @@ void WBFZAlgComponetLoadXmlParamsProcess()
}
else {
// TODO: xmlļز
+ qDebug() << "xmlFileName:" << xmlFileName;
-
+ QWBFZAlgComponetXmlParamsDialog* dialog = new QWBFZAlgComponetXmlParamsDialog();
+ dialog->setWindowTitle(QString(u8"㷨xmlļ-%1").arg(getFileNameFromPath(xmlFileName)));
+ dialog->loadXmlFile(xmlFileName);
+ dialog->show();
+ return;
}
return;
}
diff --git a/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZAlgComponetXmlParamsDialog.h b/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZAlgComponetXmlParamsDialog.h
index 60624e7..6cf1f61 100644
--- a/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZAlgComponetXmlParamsDialog.h
+++ b/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZAlgComponetXmlParamsDialog.h
@@ -8,6 +8,9 @@ namespace Ui
class QWBFZAlgComponetXmlParamsDialogClass;
}
+class WBFZAlgComponetXmlParaseOperator;
+class AbstractComponentWidget; // 㷨
+
class QWBFZAlgComponetXmlParamsDialog : public QDialog
{
Q_OBJECT
@@ -18,6 +21,17 @@ public:
private:
Ui::QWBFZAlgComponetXmlParamsDialogClass* ui;
+
+private:
+ WBFZAlgComponetXmlParaseOperator* xmlParseOperator = nullptr; // 㷨xml
+public:
+ void loadXmlFile(const QString& fileName); // xmlļ
+
+private: // ؼ
+ AbstractComponentWidget* workspacePathWidget = nullptr; // ռ·
+ QList parameterWidgetList; // б
+
+
};
diff --git a/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZAlgComponetXmlParamsDialog.ui b/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZAlgComponetXmlParamsDialog.ui
index 5bf6b56..8ae3d0d 100644
--- a/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZAlgComponetXmlParamsDialog.ui
+++ b/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZAlgComponetXmlParamsDialog.ui
@@ -31,6 +31,11 @@
351
+
+ -
+
+
+
diff --git a/Toolbox/KJ135WBJYAlgInterfaceToolbox/WBFZAlgComponetXmlParaseOperator.cpp b/Toolbox/KJ135WBJYAlgInterfaceToolbox/WBFZAlgComponetXmlParaseOperator.cpp
index 4fc0725..7abf2ac 100644
--- a/Toolbox/KJ135WBJYAlgInterfaceToolbox/WBFZAlgComponetXmlParaseOperator.cpp
+++ b/Toolbox/KJ135WBJYAlgInterfaceToolbox/WBFZAlgComponetXmlParaseOperator.cpp
@@ -6,12 +6,13 @@ WBFZAlgComponetXmlParamenterItem::WBFZAlgComponetXmlParamenterItem(QDomElement*
qDebug() << "itemparameter is nullptr.";
return;
}
- this->ParaName = itemparameter->attribute("Name");
- this->ParaChsName = itemparameter->attribute("ChsName");
- this->Description = itemparameter->attribute("Description");
- this->Datatype = itemparameter->attribute("Datatype");
- this->ParaType = itemparameter->attribute("Type");
- this->ValueStr = itemparameter->text();
+
+ this->ParaName = itemparameter->firstChildElement("ParaName").isNull() ? QString() : itemparameter->firstChildElement("ParaName").text();
+ this->ParaChsName = itemparameter->firstChildElement("ParaChsName").isNull() ? QString() : itemparameter->firstChildElement("ParaChsName").text();
+ this->Description = itemparameter->firstChildElement("Description").isNull() ? QString() : itemparameter->firstChildElement("Description").text();
+ this->Datatype = itemparameter->firstChildElement("DataType").isNull() ? QString() : itemparameter->firstChildElement("DataType").text();
+ this->ParaType = itemparameter->firstChildElement("ParaType").isNull() ? QString() : itemparameter->firstChildElement("ParaType").text();
+ this->ValueStr = itemparameter->firstChildElement("ParaValue").isNull() ? QString() : itemparameter->firstChildElement("ParaValue").text();
}
WBFZAlgComponetXmlParamenterItem::~WBFZAlgComponetXmlParamenterItem()
@@ -20,7 +21,6 @@ WBFZAlgComponetXmlParamenterItem::~WBFZAlgComponetXmlParamenterItem()
WBFZAlgComponetXmlParaseOperator::WBFZAlgComponetXmlParaseOperator(QObject* parent) :QObject(parent)
{
-
}
WBFZAlgComponetXmlParaseOperator::~WBFZAlgComponetXmlParaseOperator()
@@ -55,7 +55,7 @@ void WBFZAlgComponetXmlParaseOperator::parseXmlFile()
// 5. Get the child elements of the root
QDomNodeList childNodes = root.childNodes();
// 6. get the workspace path node
- QDomNodeList workspacePathNodes = root.elementsByTagName("WorkspacePath");
+ QDomNodeList workspacePathNodes = root.elementsByTagName("WorkSpace");
if (workspacePathNodes.count() > 0) {
QDomElement workspacePathElement = workspacePathNodes.at(0).toElement();
this->workSpacePath = workspacePathElement.text();
@@ -65,26 +65,51 @@ void WBFZAlgComponetXmlParaseOperator::parseXmlFile()
return;
}
// 7. get Root/AlgCompt/Inputs µParameterӽڵ
- QDomNodeList parameterNodes = root.elementsByTagName("Parameter");
+ QDomNodeList InputsNodes = root.elementsByTagName("Inputs");
+ QDomNodeList parameterNodes = InputsNodes.at(0).toElement().elementsByTagName("Parameter");
if (parameterNodes.count() > 0) {
for (int i = 0; i < parameterNodes.count(); ++i) {
QDomElement parameterElement = parameterNodes.at(i).toElement();
WBFZAlgComponetXmlParamenterItem* item = new WBFZAlgComponetXmlParamenterItem(¶meterElement,this);
this->ParameterList.append(item);
+ qDebug() << "read Parameter Name:" << item->getParaName();
+ if (item->getParaName().isEmpty()) {
+ QMessageBox::warning(nullptr, u8"", u8"Ϊ,xmlļʽ");
+ qDebug() << "read Parameter Name Error:" << item->getParaName();
+ return;
+ }
}
}
else {
qDebug() << "Parameter not found.";
return;
}
-
- // 8. Display the parsed data
}
void WBFZAlgComponetXmlParaseOperator::displayParsedData()
{
}
+QString WBFZAlgComponetXmlParaseOperator::getWorkSpacePath() const
+{
+ return this->workSpacePath;
+}
+
+void WBFZAlgComponetXmlParaseOperator::setWorkSpacePath(const QString& path)
+{
+ this->workSpacePath = path;
+}
+
+QList WBFZAlgComponetXmlParaseOperator::getParameterList() const
+{
+ return ParameterList;
+}
+
+void WBFZAlgComponetXmlParaseOperator::setParameterList(const QList& list)
+{
+ this->ParameterList = list;
+}
+
QString WBFZAlgComponetXmlParamenterItem::getParaName() const
{
return this->ParaName;
@@ -107,7 +132,7 @@ void WBFZAlgComponetXmlParamenterItem::setParaChsName(const QString& name)
QString WBFZAlgComponetXmlParamenterItem::getDescription() const
{
- return QString();
+ return this->Description;
}
void WBFZAlgComponetXmlParamenterItem::setDescription(const QString& description)
diff --git a/Toolbox/KJ135WBJYAlgInterfaceToolbox/WBFZAlgComponetXmlParaseOperator.h b/Toolbox/KJ135WBJYAlgInterfaceToolbox/WBFZAlgComponetXmlParaseOperator.h
index 65aac2d..9270f65 100644
--- a/Toolbox/KJ135WBJYAlgInterfaceToolbox/WBFZAlgComponetXmlParaseOperator.h
+++ b/Toolbox/KJ135WBJYAlgInterfaceToolbox/WBFZAlgComponetXmlParaseOperator.h
@@ -76,6 +76,14 @@ private://
QDomElement rootElement; // ڵ
QDomElement workSpaceElement; // ռڵ
QList ParameterList; // б
+
+public:
+ QString getWorkSpacePath() const;// { return this->workSpacePath; } // ȡռ·
+ void setWorkSpacePath(const QString& path);// { this->workSpacePath = path; } // ùռ·
+ QList getParameterList() const; // { return this->ParameterList; } // ȡб
+ void setParameterList(const QList& list); //{ this->ParameterList = list; } // òб
+
+
};