2024-11-15 01:49:05 +00:00
|
|
|
|
#include "RasterProcessTool.h"
|
2024-11-15 09:23:00 +00:00
|
|
|
|
#include <QObject>
|
|
|
|
|
#include "QMergeRasterProcessDialog.h"
|
2024-11-25 08:24:38 +00:00
|
|
|
|
#include "QImportGF3StripL1ADataset.h"
|
|
|
|
|
#include "QComplex2AmpPhase.h"
|
|
|
|
|
#include "QRDOrthProcessClass.h"
|
|
|
|
|
#include "QOrthSlrRaster.h"
|
|
|
|
|
|
2024-11-15 01:49:05 +00:00
|
|
|
|
|
|
|
|
|
RasterProcessTool::RasterProcessTool(QWidget *parent)
|
|
|
|
|
: QMainWindow(parent)
|
|
|
|
|
{
|
|
|
|
|
ui.setupUi(this);
|
2024-11-15 09:23:00 +00:00
|
|
|
|
|
2024-11-25 17:51:20 +00:00
|
|
|
|
QObject::connect(this, SIGNAL(addBoxToolItemSIGNAL(QToolAbstract*)), this, SLOT(addBoxToolItemSLOT(QToolAbstract*)));
|
2024-11-15 01:49:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RasterProcessTool::~RasterProcessTool()
|
|
|
|
|
{}
|
2024-11-15 09:23:00 +00:00
|
|
|
|
|
2024-11-25 17:51:20 +00:00
|
|
|
|
void RasterProcessTool::addBoxToolItemSLOT(QToolAbstract* item)
|
2024-11-25 08:24:38 +00:00
|
|
|
|
{
|
2024-11-25 17:51:20 +00:00
|
|
|
|
QVector<QString> xnodepath = item->getToolXpath();
|
|
|
|
|
QString toolName = item->getToolName();
|
|
|
|
|
|
|
|
|
|
QTreeWidgetItem* parentItem = findOrCreateParentItem(xnodepath);
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ø<EFBFBD><C3B8><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> toolButton
|
|
|
|
|
if (parentItem && ui.treeWidgetToolBox->itemWidget(parentItem, 0) == nullptr) {
|
|
|
|
|
QTreeWidgetItem* actionItem = new QTreeWidgetItem(parentItem);
|
|
|
|
|
parentItem->addChild(actionItem);
|
|
|
|
|
QPushButton* button = new QPushButton(ui.treeWidgetToolBox);
|
|
|
|
|
button->setText(toolName);
|
|
|
|
|
ui.treeWidgetToolBox->setItemWidget(actionItem, 0, button);
|
|
|
|
|
connect(button, SIGNAL(clicked()), item, SLOT(excute()));
|
|
|
|
|
item->setParent(ui.treeWidgetToolBox);
|
|
|
|
|
qDebug() << "ToolButton bound to parent:" << actionItem->text(0);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
qDebug() << "ToolButton already bound to parent:" << parentItem->text(0);
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-25 08:24:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-11-25 17:51:20 +00:00
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD>һ<D2BB><F2B4B4BD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
QTreeWidgetItem* RasterProcessTool::findOrCreateParentItem( QVector<QString>& path) {
|
|
|
|
|
QTreeWidgetItem* currentItem = nullptr;
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6>㿪ʼ<E3BFAA><CABC><EFBFBD><EFBFBD>
|
|
|
|
|
for ( QString& nodeName : path) {
|
|
|
|
|
if (currentItem == nullptr) {
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD><EFBFBD>ڵ<EFBFBD>
|
|
|
|
|
currentItem = findOrCreateTopLevelItem(nodeName);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽڵ㣬<DAB5><E3A3AC><EFBFBD>ҵ<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ڸ<EFBFBD><DAB8>ӽڵ<D3BD>
|
|
|
|
|
currentItem = findChildItemByName(currentItem, nodeName);
|
|
|
|
|
if (currentItem == nullptr) {
|
|
|
|
|
currentItem = new QTreeWidgetItem(currentItem);
|
|
|
|
|
currentItem->setText(0, nodeName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return currentItem;
|
2024-11-25 08:24:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-11-25 17:51:20 +00:00
|
|
|
|
// <20><><EFBFBD>Ҷ<EFBFBD><D2B6><EFBFBD><EFBFBD>ڵ㣬<DAB5><E3A3AC><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>
|
|
|
|
|
QTreeWidgetItem* RasterProcessTool::findOrCreateTopLevelItem( QString& name) {
|
|
|
|
|
for (int i = 0; i < ui.treeWidgetToolBox->topLevelItemCount(); ++i) {
|
|
|
|
|
QTreeWidgetItem* item = ui.treeWidgetToolBox->topLevelItem(i);
|
|
|
|
|
if (item->text(0) == name) {
|
|
|
|
|
return item;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µĶ<C2B5><C4B6><EFBFBD><EFBFBD>ڵ<EFBFBD>
|
|
|
|
|
QTreeWidgetItem* newItem = new QTreeWidgetItem(ui.treeWidgetToolBox);
|
|
|
|
|
newItem->setText(0, name);
|
|
|
|
|
return newItem;
|
2024-11-25 08:24:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-11-25 17:51:20 +00:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ӽڵ㣬<DAB5><E3A3AC><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD> nullptr
|
|
|
|
|
QTreeWidgetItem* RasterProcessTool::findChildItemByName(QTreeWidgetItem* parentItem, QString& name) {
|
|
|
|
|
for (int i = 0; i < parentItem->childCount(); ++i) {
|
|
|
|
|
QTreeWidgetItem* childItem = parentItem->child(i);
|
|
|
|
|
if (childItem->text(0) == name) {
|
|
|
|
|
return childItem;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return nullptr;
|
2024-11-25 08:24:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-11-15 09:23:00 +00:00
|
|
|
|
|
|
|
|
|
|
2024-11-25 17:51:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|