DemTrain 20230313
This commit is contained in:
51
DEM_GeneVec/CProgressBar.cpp
Normal file
51
DEM_GeneVec/CProgressBar.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
#include "CProgressBar.h"
|
||||
|
||||
CProgressBar::CProgressBar(QWidget* parent) : QProgressBar(parent)
|
||||
{
|
||||
//this->setStyleSheet(
|
||||
// "QProgressBar {color:black;font-size:12px;font-weight:normal;font-family:'Microsoft YaHei'; text-align:center; }"
|
||||
// "QProgressBar::chunk {background-color: rgb(0, 160, 244);}");
|
||||
}
|
||||
|
||||
void CProgressBar::ShowTips(const QString& strTips)
|
||||
{
|
||||
if (this->isHidden())
|
||||
{
|
||||
this->show();
|
||||
}
|
||||
|
||||
this->resetFormat();
|
||||
this->setRange(0, 100);
|
||||
this->setFormat(strTips);
|
||||
this->setValue(100);
|
||||
}
|
||||
|
||||
double CProgressBar::GetDoubleFormatValue()
|
||||
{
|
||||
double dValue = 0.0;
|
||||
|
||||
QString strFormat = this->format();
|
||||
if (!strFormat.isEmpty())
|
||||
{
|
||||
int nIndex = strFormat.indexOf(":");
|
||||
if (nIndex != -1)
|
||||
{
|
||||
QString strFormatData = strFormat.mid(nIndex + 1, strFormat.length() - nIndex - 2);
|
||||
dValue = strFormatData.toDouble();
|
||||
}
|
||||
}
|
||||
|
||||
return dValue;
|
||||
}
|
||||
|
||||
void CProgressBar::SetDoubleFormatValue(const QString& strFormat, double dValue)
|
||||
{
|
||||
if (this->isHidden())
|
||||
{
|
||||
this->show();
|
||||
}
|
||||
|
||||
this->setFormat(strFormat + ":" + QString::number(dValue, 'f', 2) + "%");
|
||||
this->setValue(dValue);
|
||||
}
|
||||
|
18
DEM_GeneVec/CProgressBar.h
Normal file
18
DEM_GeneVec/CProgressBar.h
Normal file
@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include<QProgressBar>
|
||||
|
||||
class CProgressBar : public QProgressBar
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CProgressBar(QWidget* parent = 0);
|
||||
~CProgressBar() {}
|
||||
|
||||
public:
|
||||
void ShowTips(const QString& strTips);
|
||||
|
||||
void SetDoubleFormatValue(const QString& strFormat, double dValue);
|
||||
|
||||
double GetDoubleFormatValue();
|
||||
};
|
425
DEM_GeneVec/DEM_GeneVec.cpp
Normal file
425
DEM_GeneVec/DEM_GeneVec.cpp
Normal file
@ -0,0 +1,425 @@
|
||||
#include "DEM_GeneVec.h"
|
||||
#include<windows.h>
|
||||
#include<stdio.h>
|
||||
#include<stdlib.h>
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
TrainMoudle::TrainMoudle()
|
||||
{
|
||||
//ui.setupUi(this);
|
||||
}
|
||||
|
||||
TrainMoudle::~TrainMoudle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString TrainMoudle::PannelName()
|
||||
{
|
||||
return QString::fromLocal8Bit("");
|
||||
}
|
||||
|
||||
QString TrainMoudle::CategoryName()
|
||||
{
|
||||
return QString::fromLocal8Bit("DEMģ<EFBFBD><EFBFBD>");
|
||||
}
|
||||
|
||||
QString TrainMoudle::EnglishName()
|
||||
{
|
||||
return QString::fromLocal8Bit("DEM_Module");
|
||||
}
|
||||
|
||||
QString TrainMoudle::ChineseName()
|
||||
{
|
||||
return QString::fromLocal8Bit("ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
}
|
||||
|
||||
QString TrainMoudle::Information()
|
||||
{
|
||||
return QString::fromLocal8Bit("ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
}
|
||||
|
||||
QString TrainMoudle::IconPath()
|
||||
{
|
||||
return ":/DEM_GeneVec/resources/dem_vec.svg";
|
||||
}
|
||||
|
||||
QWidget* TrainMoudle::CenterWidget()
|
||||
{
|
||||
QString gdal_path = qApp->applicationDirPath().toLocal8Bit() + "/share/gdal";
|
||||
QString pro_lib_path = qApp->applicationDirPath().toLocal8Bit() + "/share/proj";
|
||||
qputenv("GDAL_DATA", gdal_path.toLocal8Bit());
|
||||
qputenv("PROJ_LIB", pro_lib_path.toLocal8Bit());
|
||||
|
||||
bool showWin = false;
|
||||
if (myWidget == nullptr)
|
||||
{
|
||||
myWidget = new QDialog();
|
||||
showWin = true;
|
||||
qDebug() << "new QDialog()";
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "already have myWidget";
|
||||
myWidget->activateWindow();
|
||||
myWidget->raise();
|
||||
return myWidget;
|
||||
}
|
||||
ui.setupUi(myWidget);
|
||||
|
||||
myWidget->setWindowTitle(QString::fromLocal8Bit("ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
myWidget->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint);
|
||||
myWidget->setWindowIcon(QIcon(":/DEM_GeneVec/resources/dem_vec.svg"));
|
||||
myWidget->setAttribute(Qt::WA_QuitOnClose, false);
|
||||
|
||||
myWidget->setAttribute(Qt::WA_DeleteOnClose);
|
||||
connect(myWidget, &QDialog::destroyed, this, [=] {
|
||||
qDebug() << "----DEM train window close----";
|
||||
|
||||
QDir pluginsDir = QDir(qApp->applicationDirPath());
|
||||
if (pluginsDir.cd("srsplugins\\DemModel"))
|
||||
{
|
||||
QString strConfigPath = pluginsDir.absoluteFilePath("dem_config.ini");
|
||||
QFile f(strConfigPath);
|
||||
if (f.exists())
|
||||
{
|
||||
WriteConfigPaths(strConfigPath);
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
|
||||
if (mThread != nullptr)
|
||||
{
|
||||
mThread->requestInterruption();//<2F><><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><DFB3>ж<EFBFBD>
|
||||
mThread->quit();
|
||||
mThread->wait();//<2F><><EFBFBD><EFBFBD>wait<69><74><EFBFBD>ȵ<EFBFBD><C8B5><EFBFBD>finished<65>źŶ<C5BA>Ӧ<EFBFBD>IJۺ<C4B2><DBBA><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mWorkObject->on_cancel();
|
||||
mThread = nullptr;//m_objThread, &QThread::finished, m_objThread, &QObject::deleteLater<65><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫdelete
|
||||
mWorkObject = nullptr;//m_objThread, &QThread::finished, m_obj, &QObject::deleteLater
|
||||
}
|
||||
myWidget->close();
|
||||
myWidget = nullptr;
|
||||
});
|
||||
connect(ui.pbtInModel, &QPushButton::pressed, this, &TrainMoudle::choseInModel);
|
||||
connect(ui.pbtInDom, &QPushButton::pressed, this, &TrainMoudle::choseInDom);
|
||||
connect(ui.pbtInDsm, &QPushButton::pressed, this, &TrainMoudle::choseInDsm);
|
||||
connect(ui.pbtInLabel, &QPushButton::pressed, this, &TrainMoudle::choseInLabel);
|
||||
connect(ui.pbtOutModel, &QPushButton::pressed, this, &TrainMoudle::choseOutModel);
|
||||
|
||||
connect(ui.pushButton_ok, &QPushButton::pressed, this, &TrainMoudle::readAndStart);
|
||||
connect(ui.pushButton_cancel, &QPushButton::pressed, this, &TrainMoudle::pbCancel);
|
||||
|
||||
connect(ui.checkBoxMid, &QCheckBox::clicked, this, [=](bool checked) {
|
||||
executeMid = checked;
|
||||
if (!executeMid && !executeTrain)
|
||||
ui.pushButton_ok->setEnabled(false);
|
||||
else
|
||||
ui.pushButton_ok->setEnabled(true);
|
||||
});
|
||||
connect(ui.checkBoxTrain, &QCheckBox::clicked, this, [=](bool checked) {
|
||||
executeTrain = checked;
|
||||
if (!executeMid && !executeTrain)
|
||||
ui.pushButton_ok->setEnabled(false);
|
||||
else
|
||||
ui.pushButton_ok->setEnabled(true);
|
||||
});
|
||||
|
||||
ui.progressBar->setTextVisible(true);
|
||||
ui.progressBar->setRange(0, 100);
|
||||
|
||||
ui.lineEpoch1->setValidator(new QIntValidator(0, 999, this));
|
||||
ui.lineEpoch2->setValidator(new QIntValidator(0, 999, this));
|
||||
ui.lineEpoch1->setText("100");
|
||||
ui.lineEpoch2->setText("100");
|
||||
|
||||
ui.pbtInModel->setFocus();
|
||||
|
||||
QFile qssFile(":/DEM_GeneVec/DEM_GeneVec.qss");
|
||||
qssFile.open(QFile::ReadOnly); //<2F><>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>
|
||||
if (qssFile.isOpen())
|
||||
{
|
||||
QString qss = QLatin1String(qssFile.readAll());
|
||||
myWidget->setStyleSheet(qss);
|
||||
qssFile.close();
|
||||
}
|
||||
else
|
||||
qDebug() << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>";
|
||||
|
||||
QDir pluginsDir = QDir(qApp->applicationDirPath());
|
||||
if (pluginsDir.cd("srsplugins\\DemModel"))
|
||||
{
|
||||
QString strConfigPath = pluginsDir.absoluteFilePath("dem_config.ini");
|
||||
QFile f(strConfigPath);
|
||||
if (f.exists())
|
||||
{
|
||||
ReadConfigHistoryPaths(strConfigPath);
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
|
||||
if (showWin)
|
||||
myWidget->show();
|
||||
|
||||
return myWidget;
|
||||
}
|
||||
|
||||
void TrainMoudle::startWorkThread()
|
||||
{
|
||||
if (mWorkObject != nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
mThread = new QThread();
|
||||
mWorkObject = new WorkThreadObject();
|
||||
mWorkObject->moveToThread(mThread);
|
||||
connect(mThread, &QThread::finished, mThread, &QObject::deleteLater);
|
||||
connect(mThread, &QThread::finished, mWorkObject, &QObject::deleteLater);
|
||||
connect(mWorkObject, &WorkThreadObject::process, myWidget, [=](double val) {ui.progressBar->SetDoubleFormatValue(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), val); });
|
||||
connect(mWorkObject, &WorkThreadObject::addDataToMap, this, &TrainMoudle::addMap);
|
||||
//connect(this, &TrainMoudle::killChildThread, mWorkObject, &WorkThreadObject::on_cancel);
|
||||
|
||||
connect(this, &TrainMoudle::start, mWorkObject, &WorkThreadObject::runTrainWork);
|
||||
mThread->start();
|
||||
}
|
||||
//pbtDataset
|
||||
//pbtValName
|
||||
//pbtOutModel
|
||||
void TrainMoudle::choseInModel()
|
||||
{
|
||||
QString inModel = QFileDialog::getOpenFileName(ui.pbtInModel, QString::fromLocal8Bit("ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><EFBFBD>"), "", "*.pth");
|
||||
if (inModel != "")
|
||||
ui.lineInModel->setText(inModel);
|
||||
}
|
||||
void TrainMoudle::choseInDom()
|
||||
{
|
||||
QString dataset = QFileDialog::getExistingDirectory(ui.pbtInDom, QString::fromLocal8Bit("ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DOM<EFBFBD>ļ<EFBFBD>·<EFBFBD><EFBFBD>"), "");
|
||||
if (dataset != "")
|
||||
ui.lineInDom->setText(dataset);
|
||||
}
|
||||
void TrainMoudle::choseInDsm()
|
||||
{
|
||||
QString valName = QFileDialog::getExistingDirectory(ui.pbtInDsm, QString::fromLocal8Bit("ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Slope<EFBFBD>ļ<EFBFBD>·<EFBFBD><EFBFBD>"), "");
|
||||
if (valName != "")
|
||||
ui.lineInDsm->setText(valName);
|
||||
}
|
||||
void TrainMoudle::choseInLabel()
|
||||
{
|
||||
QString valName = QFileDialog::getExistingDirectory(ui.pbtInLabel, QString::fromLocal8Bit("ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Label<EFBFBD>ļ<EFBFBD>·<EFBFBD><EFBFBD>"), "");
|
||||
if (valName != "")
|
||||
ui.lineInLabel->setText(valName);
|
||||
}
|
||||
void TrainMoudle::choseOutModel()
|
||||
{
|
||||
QString outModel = QFileDialog::getExistingDirectory(ui.pbtOutModel, QString::fromLocal8Bit("ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><EFBFBD>"), "");
|
||||
if (outModel != "")
|
||||
ui.lineOutModel->setText(outModel);
|
||||
}
|
||||
|
||||
void TrainMoudle::ReadConfigHistoryPaths(QString strPath)
|
||||
{
|
||||
QSettings configIni(strPath, QSettings::IniFormat);
|
||||
|
||||
//<2F><EFBFBD><F2BFAAB1><EFBFBD>Ϊ<EFBFBD><CEAA>[DemTrain] <20><><EFBFBD>飬<EFBFBD><E9A3AC><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>port<72>ֶε<D6B6>ֵ
|
||||
configIni.beginGroup("DemTrain");
|
||||
|
||||
ui.lineInModel->setText(configIni.value("RetrainModel").toString());
|
||||
ui.lineInDom->setText(configIni.value("SrcDom").toString());
|
||||
ui.lineInDsm->setText(configIni.value("SrcDsm").toString());
|
||||
ui.lineInLabel->setText(configIni.value("SrcLabel").toString());
|
||||
ui.lineOutModel->setText(configIni.value("TrainResult").toString());
|
||||
|
||||
configIni.endGroup();//<2F>ر<EFBFBD><D8B1><EFBFBD>
|
||||
}
|
||||
|
||||
void TrainMoudle::WriteConfigPaths(QString strPath)
|
||||
{
|
||||
QSettings configIni(strPath, QSettings::IniFormat);
|
||||
configIni.setIniCodec("utf-8");
|
||||
//<2F><EFBFBD><F2BFAAB1><EFBFBD>Ϊ<EFBFBD><CEAA>[DemTrain] <20><><EFBFBD><EFBFBD>
|
||||
configIni.beginGroup("DemTrain");
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>·<EFBFBD><C2B7>
|
||||
QString temp = ui.lineInModel->text();
|
||||
if (temp != "")
|
||||
configIni.setValue("RetrainModel", temp);
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DOM·<4D><C2B7>
|
||||
temp = ui.lineInDom->text();
|
||||
if (temp != "")
|
||||
configIni.setValue("SrcDom", temp);
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DSM·<4D><C2B7>
|
||||
temp = ui.lineInDsm->text();
|
||||
if (temp != "")
|
||||
configIni.setValue("SrcDsm", temp);
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Label·<6C><C2B7>
|
||||
temp = ui.lineInLabel->text();
|
||||
if (temp != "")
|
||||
configIni.setValue("SrcLabel", temp);
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
|
||||
temp = ui.lineOutModel->text();
|
||||
if (temp != "")
|
||||
configIni.setValue("TrainResult", temp);
|
||||
|
||||
configIni.endGroup();//<2F>ر<EFBFBD><D8B1><EFBFBD>
|
||||
}
|
||||
|
||||
void TrainMoudle::addMap()
|
||||
{
|
||||
QMessageBox mess(QMessageBox::NoIcon,
|
||||
QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><EFBFBD><EFBFBD>"),
|
||||
QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD>\n") + ui.lineOutModel->text(),
|
||||
QMessageBox::Ok, NULL);
|
||||
mess.setWindowFlags(Qt::Drawer);
|
||||
mess.setButtonText(QMessageBox::Ok, QString::fromLocal8Bit("ȷ<EFBFBD><EFBFBD>"));
|
||||
int result = mess.exec();
|
||||
//switch (result)
|
||||
//{
|
||||
//case QMessageBox::Ok:
|
||||
// //string_list.append(ui.lineEdit_outras->text());
|
||||
// //string_list.append(ui.lineEdit_outshp->text());
|
||||
// //qDebug() << "----Yes:" << string_list;
|
||||
// //openResultData(string_list);
|
||||
// //emit addDataToCanvas(string_list);
|
||||
// break;
|
||||
//default:
|
||||
// break;
|
||||
//}
|
||||
pbCancel();
|
||||
}
|
||||
|
||||
void TrainMoudle::readAndStart()
|
||||
{
|
||||
QString inModel = ui.lineInModel->text();
|
||||
QString inDOM = ui.lineInDom->text();
|
||||
QString inDSM = ui.lineInDsm->text();
|
||||
QString inLabel = ui.lineInLabel->text();
|
||||
QString outModel = ui.lineOutModel->text();
|
||||
|
||||
ui.progressBar->SetDoubleFormatValue(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), 0);
|
||||
|
||||
if (inModel == "" || inDOM == "" || inDSM == "" || inLabel == "" || outModel == "")
|
||||
{
|
||||
QMessageBox mess(QMessageBox::NoIcon, QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
mess.setWindowFlags(Qt::Drawer);
|
||||
int result = mess.exec();
|
||||
return;
|
||||
}
|
||||
QDir inDOMdir(inDOM);
|
||||
if (!inDOMdir.exists())
|
||||
{
|
||||
QMessageBox mess(QMessageBox::NoIcon, QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), QString::fromLocal8Bit("DOM<EFBFBD>ļ<EFBFBD><EFBFBD>в<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
mess.setWindowFlags(Qt::Drawer);
|
||||
int result = mess.exec();
|
||||
return;
|
||||
}
|
||||
QDir inDSMdir(inDSM);
|
||||
if (!inDSMdir.exists())
|
||||
{
|
||||
QMessageBox mess(QMessageBox::NoIcon, QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), QString::fromLocal8Bit("Slope<EFBFBD>ļ<EFBFBD><EFBFBD>в<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
mess.setWindowFlags(Qt::Drawer);
|
||||
int result = mess.exec();
|
||||
return;
|
||||
}
|
||||
QDir inLabeldir(inLabel);
|
||||
if (!inLabeldir.exists())
|
||||
{
|
||||
QMessageBox mess(QMessageBox::NoIcon, QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), QString::fromLocal8Bit("Label<EFBFBD>ļ<EFBFBD><EFBFBD>в<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
mess.setWindowFlags(Qt::Drawer);
|
||||
int result = mess.exec();
|
||||
return;
|
||||
}
|
||||
QDir outModeldir(outModel);
|
||||
if (!outModeldir.exists())
|
||||
{
|
||||
QMessageBox mess(QMessageBox::NoIcon, QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), QString::fromLocal8Bit("ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD>в<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
mess.setWindowFlags(Qt::Drawer);
|
||||
int result = mess.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
if (executeMid && executeTrain)
|
||||
qDebug() << "executeMid & executeTrain";
|
||||
if (executeMid && (!executeTrain))
|
||||
qDebug() << "executeMid, not executeTrain";
|
||||
if ((!executeMid) && executeTrain)
|
||||
{
|
||||
//<2F>ж<EFBFBD>train<69>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѵ<EFBFBD><D1B5><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
QDir dirImage(outModel + "/Images");
|
||||
QDir dirLabel(outModel + "/Labels");
|
||||
if (!dirImage.exists() || !dirLabel.exists())
|
||||
{
|
||||
QMessageBox mess(QMessageBox::NoIcon, QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"),
|
||||
QString::fromLocal8Bit("δ<EFBFBD>ҵ<EFBFBD>ѵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>\nȷ<EFBFBD><EFBFBD>Images<EFBFBD><EFBFBD>Labels<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: \n") + outModel);
|
||||
mess.setWindowFlags(Qt::Drawer);
|
||||
int result = mess.exec();
|
||||
return;
|
||||
}
|
||||
//<2F>ж<EFBFBD><D0B6>ļ<EFBFBD><C4BC>Ƿ<EFBFBD>ƥ<EFBFBD><C6A5>
|
||||
QStringList imgList = getAllFiles(outModel + "/Images", "tif");
|
||||
QStringList labelList = getAllFiles(outModel + "/Labels", "tif");
|
||||
if (imgList.size() == 0 || labelList.size() == 0)
|
||||
{
|
||||
QMessageBox mess(QMessageBox::NoIcon, QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"),
|
||||
QString::fromLocal8Bit("ѵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>"));
|
||||
mess.setWindowFlags(Qt::Drawer);
|
||||
int result = mess.exec();
|
||||
return;
|
||||
}
|
||||
if (imgList.size() != labelList.size())
|
||||
{
|
||||
QMessageBox mess(QMessageBox::NoIcon, QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"),
|
||||
QString::fromLocal8Bit("ѵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Images<EFBFBD><EFBFBD>Labels<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD>"));
|
||||
mess.setWindowFlags(Qt::Drawer);
|
||||
int result = mess.exec();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (ui.lineEpoch1->text() == "" || ui.lineEpoch2->text() == "")
|
||||
{
|
||||
QMessageBox mess(QMessageBox::NoIcon, QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD>ѵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
mess.setWindowFlags(Qt::Drawer);
|
||||
int result = mess.exec();
|
||||
return;
|
||||
}
|
||||
QString epoch1 = ui.lineEpoch1->text();
|
||||
QString epoch2 = ui.lineEpoch2->text();
|
||||
|
||||
if (mThread == nullptr)
|
||||
{
|
||||
qDebug() << "--startThread";
|
||||
startWorkThread();
|
||||
}
|
||||
|
||||
emit start(inModel, inDOM, inDSM, inLabel, outModel, executeMid, executeTrain, epoch1, epoch2);
|
||||
}
|
||||
|
||||
QStringList TrainMoudle::getAllFiles(QString path, QString fileType)
|
||||
{
|
||||
QDir dir(path);
|
||||
if (!dir.exists())
|
||||
return QStringList();
|
||||
dir.setFilter(QDir::Files | QDir::NoSymLinks);
|
||||
QFileInfoList list = dir.entryInfoList();
|
||||
|
||||
int file_count = list.count();
|
||||
if (file_count <= 0)
|
||||
return QStringList();
|
||||
QStringList files;
|
||||
for (int i = 0; i < file_count; i++)
|
||||
{
|
||||
QFileInfo file_info = list.at(i);
|
||||
QString suffix = file_info.suffix();
|
||||
if (QString::compare(suffix, QString(fileType), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
QString absolute_file_path = file_info.absoluteFilePath();
|
||||
files.append(absolute_file_path);
|
||||
}
|
||||
}
|
||||
return files;
|
||||
}
|
||||
|
||||
void TrainMoudle::pbCancel()
|
||||
{
|
||||
delete myWidget;//<2F><><EFBFBD><EFBFBD>&QDialog::destroyed
|
||||
}
|
79
DEM_GeneVec/DEM_GeneVec.h
Normal file
79
DEM_GeneVec/DEM_GeneVec.h
Normal file
@ -0,0 +1,79 @@
|
||||
#pragma once
|
||||
|
||||
#include <QtWidgets/QDialog>
|
||||
#include <QFileDialog>
|
||||
#include <QMetaType>
|
||||
#include <QDialog>
|
||||
#include <QDebug>
|
||||
#include <QObject>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#include <QString>
|
||||
#include <QThread>
|
||||
#include <QVector>
|
||||
#include <QIntValidator>
|
||||
|
||||
#include "ui_DEM_GeneVec.h"
|
||||
#include "ThreadObject.h"
|
||||
#include "SrsMainPluginInterFace.h"
|
||||
|
||||
#include "gdal_priv.h"
|
||||
//#include "gdal_alg_priv.h"
|
||||
|
||||
class TrainMoudle : public SrsMainInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(SrsMainInterface)
|
||||
Q_PLUGIN_METADATA(IID MainInterface_iid)
|
||||
|
||||
public:
|
||||
TrainMoudle();
|
||||
~TrainMoudle();
|
||||
|
||||
virtual QString PannelName() override;
|
||||
virtual QString CategoryName() override;
|
||||
|
||||
virtual QString EnglishName() override;
|
||||
virtual QString ChineseName() override;
|
||||
virtual QString Information() override;
|
||||
virtual QString IconPath() override;
|
||||
virtual QWidget* CenterWidget() override;
|
||||
|
||||
void startWorkThread();
|
||||
|
||||
//<2F><>json<6F>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>ʷ<EFBFBD>洢<EFBFBD><E6B4A2>·<EFBFBD><C2B7>
|
||||
void ReadConfigHistoryPaths(QString strPath);
|
||||
//<2F><><EFBFBD>汾<EFBFBD>δ<CEB4>·<EFBFBD><C2B7><EFBFBD><EFBFBD>json<6F>ļ<EFBFBD>
|
||||
void WriteConfigPaths(QString strPath);
|
||||
|
||||
QStringList getAllFiles(QString path, QString fileType);
|
||||
|
||||
public slots:
|
||||
void choseInModel();
|
||||
void choseInDom();
|
||||
void choseInDsm();
|
||||
void choseInLabel();
|
||||
void choseOutModel();
|
||||
|
||||
void addMap();
|
||||
//pushbutton_OK
|
||||
void readAndStart();
|
||||
void pbCancel();
|
||||
|
||||
signals:
|
||||
void start(QString inModel, QString dom, QString dsm, QString label, QString outModel, bool mid, bool train, QString epoch1, QString epoch2);
|
||||
void killChildThread();
|
||||
|
||||
private:
|
||||
Ui::DEM_GeneVecClass ui;
|
||||
|
||||
QDialog* myWidget = nullptr;
|
||||
|
||||
WorkThreadObject* mWorkObject = nullptr;
|
||||
|
||||
QThread* mThread = nullptr;
|
||||
|
||||
bool executeMid = true;
|
||||
bool executeTrain = true;
|
||||
|
||||
};
|
6
DEM_GeneVec/DEM_GeneVec.qrc
Normal file
6
DEM_GeneVec/DEM_GeneVec.qrc
Normal file
@ -0,0 +1,6 @@
|
||||
<RCC>
|
||||
<qresource prefix="/DEM_GeneVec">
|
||||
<file>resources/dem_vec.svg</file>
|
||||
<file>DEM_GeneVec.qss</file>
|
||||
</qresource>
|
||||
</RCC>
|
98
DEM_GeneVec/DEM_GeneVec.qss
Normal file
98
DEM_GeneVec/DEM_GeneVec.qss
Normal file
@ -0,0 +1,98 @@
|
||||
QProgressBar#progressBar {
|
||||
border:0px solid white;
|
||||
text-align:center;
|
||||
color:black;
|
||||
}
|
||||
QProgressBar#progressBar:chunk {
|
||||
background-color:#3FABBA;
|
||||
width:20px;
|
||||
}
|
||||
QProgressBar#progressBar QLineEdit {
|
||||
border:none;
|
||||
color:black;
|
||||
padding-left:5px;
|
||||
font-size:16px;
|
||||
background-color:transparent;
|
||||
}
|
||||
|
||||
QLabel{
|
||||
color:black;
|
||||
font-family:'Microsoft YaHei';
|
||||
font-size:12px;
|
||||
}
|
||||
|
||||
/*----QPushButton<6F><6E>ʽ<EFBFBD><CABD>*/
|
||||
#pushButton_ok, #pushButton_cancel, #pbtInModel, #pbtInDom, #pbtInDsm, #pbtInLabel, #pbtOutModel{
|
||||
font-family:'Microsoft YaHei';
|
||||
font-size:12px;
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #dcdfe6;
|
||||
padding: 2px;
|
||||
border-radius: 5px;
|
||||
max-height:20px;
|
||||
}
|
||||
#pushButton_ok, #pushButton_cancel{
|
||||
min-width:36px;
|
||||
}
|
||||
#pushButton_ok:hover, #pushButton_cancel:hover, #pbtInModel:hover, #pbtInDom:hover, #pbtInDsm:hover,#pbtInLabel:hover,#pbtOutModel:hover{
|
||||
background-color: #ecf5ff;
|
||||
color: #409eff;
|
||||
}
|
||||
#pushButton_ok:pressed, #pushButton_cancel:pressed, #pbtInModel:pressed, #pbtInDom:pressed, #pbtInDsm:pressed,#pbtInLabel:pressed,#pbtOutModel:pressed{
|
||||
border: 1px solid #3a8ee6;
|
||||
color: #409eff;
|
||||
}
|
||||
#pushButton_ok:checked, #pushButton_cancel:checked, #pbtInModel:checked, #pbtInDom:checked, #pbtInDsm:checked,#pbtInLabel:checked,#pbtOutModel:checked{
|
||||
border: 1px solid #3a8ee6;
|
||||
color: #409eff;
|
||||
}
|
||||
#pushButton_ok:focus, #pushButton_cancel:focus, #pbtInModel:focus, #pbtInDom:focus, #pbtInDsm:focus,#pbtInLabel:focus,#pbtOutModel:focus{
|
||||
border: 1px solid #3a8ee6;
|
||||
color: #409eff;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/*----QLineEdit<69><74>ʽ*/
|
||||
#lineInModel, #lineInDsm, #lineInDom, #lineOutModel, #lineInLabel, #lineEpoch1, #lineEpoch2{
|
||||
border:0px;
|
||||
border-bottom: 1px solid #B3B3B3;
|
||||
font-family:'Microsoft YaHei';
|
||||
font-size:12px;
|
||||
background-color:transparent;
|
||||
}
|
||||
#lineInModel:hover, #lineInDsm:hover, #lineInDom:hover, #lineOutModel:hover, #lineInLabel:hover, #lineEpoch1:hover, #lineEpoch2:hover{
|
||||
border-bottom: 2px solid #66A3FF;
|
||||
}
|
||||
#lineInModel:focus, #lineInDsm:focus, #lineInDom:focus, #lineOutModel:focus, #lineInLabel:focus, #lineEpoch1:focus, #lineEpoch2:focus{
|
||||
border-bottom: 2px solid #7666FF;
|
||||
}
|
||||
|
||||
/*QCheckBox{
|
||||
background:transparent;
|
||||
border:0px;
|
||||
color:black;
|
||||
min-height: 20px;
|
||||
min-width: 60px;
|
||||
}
|
||||
QCheckBox::disabled{
|
||||
background:transparent;
|
||||
border:0px;
|
||||
color:#202020;
|
||||
min-height: 20px;
|
||||
min-width: 60px;
|
||||
}
|
||||
QCheckBox::indicator{
|
||||
margin-right:-10px;
|
||||
}
|
||||
QCheckBox::indicator:checked{
|
||||
image: url(:/RemoteSensingProcess/Resources/checkbox_checked.svg);
|
||||
width:25px;
|
||||
}
|
||||
QCheckBox::indicator:unchecked{
|
||||
image: url(:/RemoteSensingProcess/Resources/checkbox_unchecked.svg);
|
||||
width:25px;
|
||||
}
|
||||
QCheckBox::indicator:disabled{
|
||||
image: url(:/RemoteSensingProcess/Resources/checkbox_disabled.svg);
|
||||
width:25px;
|
||||
}*/
|
485
DEM_GeneVec/DEM_GeneVec.ui
Normal file
485
DEM_GeneVec/DEM_GeneVec.ui
Normal file
@ -0,0 +1,485 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DEM_GeneVecClass</class>
|
||||
<widget class="QDialog" name="DEM_GeneVecClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>550</width>
|
||||
<height>320</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>550</width>
|
||||
<height>320</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>550</width>
|
||||
<height>320</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineInDom">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEpoch1">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>110</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>解冻训练次数</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEpoch2">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="lineOutModel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pbtInModel">
|
||||
<property name="text">
|
||||
<string>选择文件</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineInLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QPushButton" name="pbtOutModel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>75</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>75</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>选择文件夹</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineInModel"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineInDsm">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QPushButton" name="pbtInLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>75</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>75</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>选择文件夹</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>110</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>110</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>输入DOM文件路径</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>110</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>110</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>输入DSM文件路径</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="pbtInDom">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>75</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>75</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>选择文件夹</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_mask">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>110</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>110</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>输入Label文件路径</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="pbtInDsm">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>75</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>75</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>选择文件夹</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_mask_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>110</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>110</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>输出模型文件路径</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>输入初始模型文件路径</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>110</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>冻结训练次数</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxMid">
|
||||
<property name="text">
|
||||
<string>生成训练集、验证集</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxTrain">
|
||||
<property name="text">
|
||||
<string>模型训练</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_ok">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>确定</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_cancel">
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="CProgressBar" name="progressBar">
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>CProgressBar</class>
|
||||
<extends>QProgressBar</extends>
|
||||
<header>CProgressBar.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>lineInModel</tabstop>
|
||||
<tabstop>pbtInModel</tabstop>
|
||||
<tabstop>lineInDom</tabstop>
|
||||
<tabstop>pbtInDom</tabstop>
|
||||
<tabstop>lineInDsm</tabstop>
|
||||
<tabstop>pbtInDsm</tabstop>
|
||||
<tabstop>lineInLabel</tabstop>
|
||||
<tabstop>pbtInLabel</tabstop>
|
||||
<tabstop>lineOutModel</tabstop>
|
||||
<tabstop>pbtOutModel</tabstop>
|
||||
<tabstop>pushButton_ok</tabstop>
|
||||
<tabstop>pushButton_cancel</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="DEM_GeneVec.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
89
DEM_GeneVec/DEM_GeneVec.vcxproj
Normal file
89
DEM_GeneVec/DEM_GeneVec.vcxproj
Normal file
@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="16.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{858826AD-BC7C-4B9D-8E48-626392904948}</ProjectGuid>
|
||||
<Keyword>QtVS_v304</Keyword>
|
||||
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">10.0.19041.0</WindowsTargetPlatformVersion>
|
||||
<QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
|
||||
<ProjectName>DEM_Train</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')">
|
||||
<Import Project="$(QtMsBuild)\qt_defaults.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="QtSettings">
|
||||
<QtInstall>QtQgis</QtInstall>
|
||||
<QtModules>core;gui;widgets</QtModules>
|
||||
<QtBuildConfig>release</QtBuildConfig>
|
||||
</PropertyGroup>
|
||||
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
|
||||
<Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />
|
||||
</Target>
|
||||
<ImportGroup Label="ExtensionSettings" />
|
||||
<ImportGroup Label="Shared" />
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(QtMsBuild)\Qt.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<IncludePath>D:\qgis\osgeo4w\include;D:\qgis\osgeo4w\apps\Qt5\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>D:\qgis\osgeo4w\lib;D:\qgis\osgeo4w\apps\Qt5\lib;$(LibraryPath)</LibraryPath>
|
||||
<TargetName>dem1-$(ProjectName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Link>
|
||||
<AdditionalDependencies>gdal_i.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="Configuration">
|
||||
<ClCompile>
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="CProgressBar.cpp" />
|
||||
<ClCompile Include="ThreadObject.cpp" />
|
||||
<QtRcc Include="DEM_GeneVec.qrc" />
|
||||
<QtMoc Include="DEM_GeneVec.h" />
|
||||
<ClCompile Include="DEM_GeneVec.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtUic Include="DEM_GeneVec.ui" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="ThreadObject.h" />
|
||||
<QtMoc Include="SrsMainPluginInterFace.h" />
|
||||
<QtMoc Include="CProgressBar.h" />
|
||||
<ClInclude Include="x64\Release\uic\ui_DEM_GeneVec.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="DEM_GeneVec.qss" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
|
||||
<Import Project="$(QtMsBuild)\qt.targets" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
76
DEM_GeneVec/DEM_GeneVec.vcxproj.filters
Normal file
76
DEM_GeneVec/DEM_GeneVec.vcxproj.filters
Normal file
@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Form Files">
|
||||
<UniqueIdentifier>{99349809-55BA-4b9d-BF79-8FDBB0286EB3}</UniqueIdentifier>
|
||||
<Extensions>ui</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Translation Files">
|
||||
<UniqueIdentifier>{639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}</UniqueIdentifier>
|
||||
<Extensions>ts</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="process">
|
||||
<UniqueIdentifier>{96222dac-cebd-43e4-bfdd-ebee13ab43e3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtRcc Include="DEM_GeneVec.qrc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</QtRcc>
|
||||
<QtMoc Include="DEM_GeneVec.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<ClCompile Include="DEM_GeneVec.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ThreadObject.cpp">
|
||||
<Filter>process</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CProgressBar.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtUic Include="DEM_GeneVec.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="x64\Release\uic\ui_DEM_GeneVec.h">
|
||||
<Filter>Form Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="ThreadObject.h">
|
||||
<Filter>process</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="SrsMainPluginInterFace.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="CProgressBar.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="DEM_GeneVec.qss">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
58
DEM_GeneVec/SrsMainPluginInterFace.h
Normal file
58
DEM_GeneVec/SrsMainPluginInterFace.h
Normal file
@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
//#if _MSC_VER >=1600 // MSVC2015>1899, msvc_ver=14.0
|
||||
//#pragma execution_character_set("utf-8")
|
||||
//#endif
|
||||
//#include "qtclasslibrary1_global.h"
|
||||
#include <qstring.h>
|
||||
#include <QtPlugin>
|
||||
#include <QVector>
|
||||
#include <QObject>
|
||||
|
||||
struct SPluginMetaData
|
||||
{
|
||||
QVector<QString> qvsReturnFilePaths;
|
||||
QVector<QString> qvsSendFilePaths;
|
||||
bool isAdd2Map;
|
||||
|
||||
};
|
||||
class SrsMainInterface : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
virtual ~SrsMainInterface() {}
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD>pannel<65><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
virtual QString PannelName() = 0;
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD>Category<72><79><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
virtual QString CategoryName() = 0;
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD><EFBFBD><EFBFBD>Ӣ<EFBFBD><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
virtual QString EnglishName() = 0;
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
virtual QString ChineseName() = 0;
|
||||
virtual QString Information() = 0;
|
||||
virtual QString IconPath() = 0;
|
||||
virtual QWidget* CenterWidget() = 0;
|
||||
//
|
||||
//public slots:
|
||||
// virtual void test(QWidget* parent) = 0;
|
||||
|
||||
signals:
|
||||
void AddDataToMap(QStringList string_list);
|
||||
//void addDataToCanvas(QStringList string_list);
|
||||
};
|
||||
|
||||
#define MainInterface_iid "com.Srs.MainInterface"
|
||||
Q_DECLARE_INTERFACE(SrsMainInterface, MainInterface_iid)
|
97
DEM_GeneVec/ThreadObject.cpp
Normal file
97
DEM_GeneVec/ThreadObject.cpp
Normal file
@ -0,0 +1,97 @@
|
||||
#include <QProcess>
|
||||
#include <QDir>
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QTimer>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "DEM_GeneVec.h"
|
||||
#include "ThreadObject.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
WorkThreadObject::WorkThreadObject(QObject* parent) :QObject(parent)
|
||||
{
|
||||
qRegisterMetaType<std::function<void(double)> >("std::function<void(double)>");
|
||||
}
|
||||
|
||||
WorkThreadObject::~WorkThreadObject()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void WorkThreadObject::runTrainWork(QString inModel, QString dom, QString dsm, QString label, QString outModel, bool mid, bool train, QString epoch1, QString epoch2)
|
||||
{
|
||||
QString str = QString("%1->%2,thread id:%3").arg(__FILE__).arg(__FUNCTION__).arg((int)QThread::currentThreadId());
|
||||
qDebug() << str;
|
||||
|
||||
QDir pluginsDir = QDir(qApp->applicationDirPath());
|
||||
if (!pluginsDir.cd("models\\envs"))
|
||||
{
|
||||
qDebug() << "no folder models\\envs";
|
||||
return;
|
||||
}
|
||||
QString exeDirName = pluginsDir.absoluteFilePath("train_4c_vegetaion.exe");
|
||||
|
||||
QString inDom = " --dom_path "+ dom + "/";
|
||||
QString inDsm = " --dsm_path " + dsm + "/";
|
||||
QString inLabel = " --label_path " + label + "/";
|
||||
QString trainedModel = " --retrained_model " + inModel;
|
||||
QString save_model = " --save_model " + outModel + "/";
|
||||
QString strMid, strTrain;
|
||||
if (mid)
|
||||
strMid = " --exe_mid True ";
|
||||
else
|
||||
strMid = " --exe_mid False ";
|
||||
if (train)
|
||||
strTrain = " --exe_train True";
|
||||
else
|
||||
strTrain = " --exe_train False";
|
||||
QString strEpoch1, strEpoch2;
|
||||
strEpoch1 = " --epoch1 " + epoch1;
|
||||
strEpoch2 = " --epoch2 " + epoch2;
|
||||
|
||||
//QString CUDA = " --CUDA False";
|
||||
QString ss = exeDirName + inDom + inDsm + inLabel + trainedModel + save_model+ strMid + strTrain + strEpoch1 + strEpoch2;// + CUDA
|
||||
qDebug() << ss;
|
||||
QProcess* pProces = new QProcess(this);
|
||||
connect(pProces, SIGNAL(readyReadStandardOutput()), this, SLOT(on_read()));
|
||||
|
||||
pProces->start(ss);
|
||||
}
|
||||
|
||||
void WorkThreadObject::on_read()
|
||||
{
|
||||
mProces = (QProcess*)sender();
|
||||
QString output = QString::fromLocal8Bit(mProces->readAllStandardOutput());
|
||||
//qDebug() << "out:" << output;
|
||||
if (output.toDouble() > 0)
|
||||
{
|
||||
qDebug() << "exe out:" << output.toDouble();
|
||||
emit process(output.toDouble());
|
||||
if (output.toDouble() == 100.0)
|
||||
{
|
||||
emit addDataToMap();
|
||||
}
|
||||
}
|
||||
else
|
||||
qDebug() << "Unresolved exe out:" << output;
|
||||
}
|
||||
|
||||
void WorkThreadObject::on_cancel()
|
||||
{
|
||||
QString str = QString("--1.%1->%2,thread id:%3").arg(__FILE__).arg(__FUNCTION__).arg((int)QThread::currentThreadId());
|
||||
qDebug() << str;
|
||||
|
||||
if (mProces == nullptr)
|
||||
{
|
||||
qDebug() << "--mProces null";
|
||||
}
|
||||
else
|
||||
{
|
||||
QString KillStr = "taskkill /f /im train_4c_vegetaion.exe";
|
||||
mProces->startDetached(KillStr);
|
||||
qDebug() << "--kill Proces";
|
||||
}
|
||||
}
|
48
DEM_GeneVec/ThreadObject.h
Normal file
48
DEM_GeneVec/ThreadObject.h
Normal file
@ -0,0 +1,48 @@
|
||||
#ifndef THREADOBJECT_H
|
||||
#define THREADOBJECT_H
|
||||
#include <functional>
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QObject>
|
||||
#include <QProcess>
|
||||
#include <QThread>
|
||||
#include <QVector>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
//#include "MultiQProcess.h"
|
||||
|
||||
//#include "qtclasslibrary1_global.h"
|
||||
#include "SrsMainPluginInterFace.h"
|
||||
#include "ui_DEM_GeneVec.h"
|
||||
//#include "Extract.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
class TrainMoudle;
|
||||
|
||||
class WorkThreadObject :public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
WorkThreadObject(QObject* parent = NULL);
|
||||
~WorkThreadObject();
|
||||
|
||||
void on_cancel();
|
||||
|
||||
signals:
|
||||
void process(double value);
|
||||
void addDataToMap();
|
||||
|
||||
public slots:
|
||||
//void RunWork(QString landsat_file, QString gf_file, QString tvdi_file);
|
||||
//void RunWork(QString file1, QString file2, QString file_out, std::function<void(int)>progressCallback);
|
||||
//void RunWork(QString file1, QString file2, QString file_out);
|
||||
void runTrainWork(QString inModel, QString dom, QString dsm, QString label, QString outModel, bool mid, bool train, QString epoch1, QString epoch2);
|
||||
void on_read();
|
||||
|
||||
private:
|
||||
QProcess* mProces = nullptr;
|
||||
};
|
||||
|
||||
#endif
|
16
DEM_GeneVec/main.cpp
Normal file
16
DEM_GeneVec/main.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include "DEM_GeneVec.h"
|
||||
#include <QtWidgets/QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
|
||||
QString gdal_path = qApp->applicationDirPath().toLocal8Bit() + "/share/gdal";
|
||||
QString pro_lib_path = qApp->applicationDirPath().toLocal8Bit() + "/share/proj";
|
||||
qputenv("GDAL_DATA", gdal_path.toLocal8Bit());
|
||||
qputenv("PROJ_LIB", pro_lib_path.toLocal8Bit());
|
||||
|
||||
TrainMoudle w;
|
||||
w.CenterWidget()->show();
|
||||
return a.exec();
|
||||
}
|
2
DEM_GeneVec/resources/dem_vec.svg
Normal file
2
DEM_GeneVec/resources/dem_vec.svg
Normal file
@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1650520802998" class="icon" viewBox="0 0 1132 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5053" width="28.7421875" height="26" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css">@font-face { font-family: feedback-iconfont; src: url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff2?t=1630033759944") format("woff2"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff?t=1630033759944") format("woff"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.ttf?t=1630033759944") format("truetype"); }
|
||||
</style></defs><path d="M1131.403629 583.018705c1.939725-47.361608-39.010016-64.495842-39.010017-64.495842l-226.408963-105.391702s0.538812-182.926804 0-232.120374a73.440128 73.440128 0 0 0-40.949741-66.651092S645.82591 35.80085 592.645128 6.974387c-27.694956-15.086747-56.5753 0-56.5753 0S367.529315 89.035513 315.480039 112.312208c-47.577133 21.229208-46.876677 66.651092-46.876677 66.651092V411.891892S120.160551 482.476314 57.873839 509.524696C-1.71881 535.333809 0.005389 589.592216 0.005389 589.592216s0.538812 185.890272 0 234.275623c-0.538812 52.264801 42.350653 68.806341 42.350654 68.806342s143.862906 80.06752 212.669247 114.713156c50.91777 25.539707 83.946969 0.646575 83.946969 0.646575l226.085675-122.525936s178.777948 92.67573 220.859195 121.879361c48.816402 33.729655 82.007245 5.65753 82.007245 5.65753s199.198938-111.156994 230.288412-126.836435c33.298605-16.703184 33.298605-58.030094 33.298605-58.030094s-2.047487-197.905788-0.107762-245.159633zM299.85448 675.371147l-206.903955-99.895816 206.903955-99.949696 210.783404 98.925953-210.783404 100.919559z m232.282018 148.335049l-199.091175 109.594438v-195.696657l199.091175-94.561573v180.663792z m32.705911-537.357589L340.911983 181.010787l223.930426-108.840101 232.766949 108.840101-232.766949 105.391702z m35.66938 64.38808l197.043688-94.561573v159.057415L600.511789 512.110995V350.790568z m235.137723 324.63446l-205.82633-99.895816 197.151451-99.949696 214.662853 99.949696-205.987974 99.895816z m227.378825 154.800797l-195.211725 103.12869v-195.696657l195.211725-94.561573v187.12954z" p-id="5054" fill="#2c2c2c"></path></svg>
|
After Width: | Height: | Size: 2.2 KiB |
Reference in New Issue
Block a user