添加项目文件。
This commit is contained in:
parent
3ba0a0d0ab
commit
b163a03dc9
22
DEM_Fill.sln
Normal file
22
DEM_Fill.sln
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.32126.315
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DEM_Fill", "DEM_Fill\DEM_Fill.vcxproj", "{32F04C81-EC93-432F-9B60-0B92B5FCC5C5}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{32F04C81-EC93-432F-9B60-0B92B5FCC5C5}.Release|x64.ActiveCfg = Release|x64
|
||||
{32F04C81-EC93-432F-9B60-0B92B5FCC5C5}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {D6C86E29-E4F8-449B-838C-C7B217220096}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
364
DEM_Fill/DEM_Fill.cpp
Normal file
364
DEM_Fill/DEM_Fill.cpp
Normal file
@ -0,0 +1,364 @@
|
||||
#include "DEM_Fill.h"
|
||||
|
||||
#include <qgsrasterlayer.h>
|
||||
#include <qgsvectorlayer.h>
|
||||
#include <qgsmapcanvas.h>
|
||||
|
||||
void WorkThreadObject::runFillingWork(QString in_masked, QString out_filled, QString scale, QString size)
|
||||
{
|
||||
QDir pyDir = QDir(qApp->applicationDirPath());
|
||||
if (!pyDir.cd("models\\mask_fill"))
|
||||
{
|
||||
qDebug() << "no folder models\\mask_fill";
|
||||
return;
|
||||
}
|
||||
QString pyFilePath = pyDir.absoluteFilePath("demFillHoles.py");
|
||||
if (pyFilePath == "")
|
||||
{
|
||||
qDebug() << "not find demFillHoles.py";
|
||||
return;
|
||||
}
|
||||
QDir datDir = QDir(qApp->applicationDirPath());
|
||||
if (!datDir.cd("QGIS_3.22.8\\bin"))
|
||||
{
|
||||
qDebug() << "no folder QGIS_3.22.8\\bin";
|
||||
return;
|
||||
}
|
||||
QString datPath = datDir.absoluteFilePath("python-qgis-ltr.bat");
|
||||
if (datPath == "")
|
||||
{
|
||||
qDebug() << "not find qgis env";
|
||||
return;
|
||||
}
|
||||
const char* cmd = (datPath + " " + pyFilePath + " --in_holedem " + in_masked + "/" + " --work_space " + out_filled + "/" +
|
||||
" --scale " + scale + " --win_size " + size).toStdString().c_str();
|
||||
cout << cmd << "\n";
|
||||
run_cmd(cmd);
|
||||
//QString cmd = datPath + " " + pyFilePath
|
||||
// + " --in_holedem " + in_masked + "/" + " --work_space " + out_filled + "/"
|
||||
// + " --scale " + scale + " --win_size " + size;
|
||||
//QProcess* pProces = new QProcess(this);
|
||||
//connect(pProces, SIGNAL(readyReadStandardOutput()), this, SLOT(readProcessStandardOutput()));
|
||||
//pProces->start(cmd);
|
||||
//emit process(2);
|
||||
}
|
||||
|
||||
void WorkThreadObject::readProcessStandardOutput()
|
||||
{
|
||||
mProcess = (QProcess*)sender();
|
||||
QString output = QString::fromLocal8Bit(mProcess->readAllStandardOutput());
|
||||
output.chop(2);
|
||||
if (output.toFloat() != 0)
|
||||
{
|
||||
qDebug() << "process:" << output.toFloat();
|
||||
emit process(output.toFloat());
|
||||
}
|
||||
else
|
||||
qDebug() << "unsolved exe out:" << output;
|
||||
}
|
||||
|
||||
int WorkThreadObject::run_cmd(const char* cmd)
|
||||
{
|
||||
char MsgBuff[1024];
|
||||
int MsgLen = 1020;
|
||||
FILE* fp;
|
||||
if (cmd == NULL)
|
||||
return -1;
|
||||
if ((fp = _popen(cmd, "r")) == NULL)
|
||||
return -2;
|
||||
else
|
||||
{
|
||||
memset(MsgBuff, 0, MsgLen);
|
||||
//读取命令执行过程中的输出
|
||||
while (fgets(MsgBuff, MsgLen, fp) != NULL)
|
||||
{
|
||||
printf("MsgBuff: %s\n", MsgBuff);
|
||||
QString qStr = QString(MsgBuff);
|
||||
if (qStr.toDouble() != 0.0)
|
||||
emit process(qStr.toDouble());
|
||||
}
|
||||
//关闭执行的进程
|
||||
if (_pclose(fp) == -1)
|
||||
return -3;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
DataFilling::DataFilling()
|
||||
{
|
||||
//ui.setupUi(this);
|
||||
}
|
||||
|
||||
QString DataFilling::PannelName()
|
||||
{
|
||||
return QString::fromLocal8Bit("");
|
||||
}
|
||||
|
||||
QString DataFilling::CategoryName()
|
||||
{
|
||||
return QString::fromLocal8Bit("DEM模块");
|
||||
}
|
||||
|
||||
QString DataFilling::EnglishName()
|
||||
{
|
||||
return QString::fromLocal8Bit("DEM_Module");
|
||||
}
|
||||
|
||||
QString DataFilling::ChineseName()
|
||||
{
|
||||
return QString::fromLocal8Bit("数据填补");
|
||||
}
|
||||
|
||||
QString DataFilling::Information()
|
||||
{
|
||||
return "数据填补";
|
||||
}
|
||||
|
||||
QString DataFilling::IconPath()
|
||||
{
|
||||
return ":/DEM_Fill/resources/fill.svg";
|
||||
}
|
||||
|
||||
QWidget* DataFilling::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("数据填补"));
|
||||
myWidget->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint);
|
||||
myWidget->setWindowIcon(QIcon(":/DEM_Fill/resources/fill.svg"));
|
||||
myWidget->setAttribute(Qt::WA_QuitOnClose, false);
|
||||
|
||||
myWidget->setAttribute(Qt::WA_DeleteOnClose);
|
||||
connect(myWidget, &QDialog::destroyed, this, [=] {
|
||||
qDebug() << "----DEM Fill 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();
|
||||
}
|
||||
}
|
||||
|
||||
myWidget->close();
|
||||
myWidget = nullptr;
|
||||
if (mWorkThread != nullptr)
|
||||
{
|
||||
mWorkThread->quit();
|
||||
mWorkThread->wait();//调用wait后先调用finished信号对应的槽函数,执行完成后再往下走
|
||||
mWorkThread = nullptr;//mWorkThread, &QThread::finished, mWorkThread, &QObject::deleteLater,不需要delete
|
||||
mWorker = nullptr;//mWorkThread, &QThread::finished, mWorker, &QObject::deleteLater
|
||||
}
|
||||
});
|
||||
connect(ui.pbtMasked, &QPushButton::pressed, this, &DataFilling::chooseMaskedSlope);
|
||||
connect(ui.pbtOutFill, &QPushButton::pressed, this, &DataFilling::chooseOutFill);
|
||||
|
||||
connect(ui.pushButton_ok, &QPushButton::pressed, this, &DataFilling::readAndStart);
|
||||
connect(ui.pushButton_cancel, &QPushButton::pressed, this, &DataFilling::pbCancel);
|
||||
|
||||
ui.progressBar->setTextVisible(true);
|
||||
ui.progressBar->setRange(0, 100);
|
||||
|
||||
ui.pbtMasked->setFocus();
|
||||
|
||||
ui.lineRectangleScale->setValidator(new QRegExpValidator(QRegExp("^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$")));
|
||||
ui.lineExpandSize->setValidator(new QIntValidator(0, 999, this));
|
||||
ui.lineRectangleScale->setText("0.1");
|
||||
ui.lineExpandSize->setText("3");
|
||||
|
||||
QFile qssFile(":/DEM_Fill/DEM_Fill.qss");
|
||||
qssFile.open(QFile::ReadOnly); //以只读方式打开
|
||||
if (qssFile.isOpen())
|
||||
{
|
||||
QString qss = QLatin1String(qssFile.readAll());
|
||||
myWidget->setStyleSheet(qss);
|
||||
qssFile.close();
|
||||
}
|
||||
else
|
||||
qDebug() << "无法打开文件";
|
||||
|
||||
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 DataFilling::startWorkThread()
|
||||
{
|
||||
if (mWorker != nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
mWorkThread = new QThread();
|
||||
mWorker = new WorkThreadObject();
|
||||
mWorker->moveToThread(mWorkThread);
|
||||
connect(mWorkThread, &QThread::finished, mWorkThread, &QObject::deleteLater);
|
||||
connect(mWorkThread, &QThread::finished, mWorker, &QObject::deleteLater);
|
||||
connect(mWorker, &WorkThreadObject::sendMaskedTiff, this, &DataFilling::openResultData);
|
||||
|
||||
connect(mWorker, &WorkThreadObject::process, myWidget, [=](int value) {
|
||||
ui.progressBar->setValue(value);
|
||||
if (value == 100)
|
||||
{
|
||||
QMessageBox mess(QMessageBox::Information,
|
||||
QString::fromLocal8Bit("填补结束"),
|
||||
QString::fromLocal8Bit("填补结果文件夹:\n") + outPath);
|
||||
mess.setWindowFlags(Qt::Drawer);
|
||||
mess.setStandardButtons(QMessageBox::Yes);
|
||||
mess.button(QMessageBox::StandardButton::Yes)->setText(QString::fromLocal8Bit("确认"));
|
||||
//mess.setTextInteractionFlags(Qt::TextSelectableByMouse);
|
||||
int result = mess.exec();
|
||||
pbCancel();
|
||||
}
|
||||
});
|
||||
connect(this, &DataFilling::startDataFill, mWorker, &WorkThreadObject::runFillingWork);
|
||||
|
||||
mWorkThread->start();
|
||||
}
|
||||
|
||||
void DataFilling::chooseMaskedSlope()
|
||||
{
|
||||
QString dirDom = QFileDialog::getExistingDirectory(ui.pbtMasked, QString::fromLocal8Bit("选择输入裁剪后的DEM文件夹"), "");
|
||||
if (dirDom != "")
|
||||
ui.lineMasked->setText(dirDom);
|
||||
}
|
||||
void DataFilling::chooseOutFill()
|
||||
{
|
||||
QString dirDom = QFileDialog::getExistingDirectory(ui.pbtOutFill, QString::fromLocal8Bit("选择输出数据填补结果文件夹"), "");
|
||||
if (dirDom != "")
|
||||
ui.lineOutFill->setText(dirDom);
|
||||
}
|
||||
void DataFilling::readAndStart()
|
||||
{
|
||||
QString in_masked = ui.lineMasked->text();
|
||||
QString out_filled = ui.lineOutFill->text();
|
||||
QString scale = ui.lineRectangleScale->text();
|
||||
QString size = ui.lineExpandSize->text();
|
||||
if (in_masked == "" || out_filled == "" || scale == "" || size == "")
|
||||
{
|
||||
QMessageBox mess(QMessageBox::NoIcon, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("请检查输入输出路径"));
|
||||
mess.setWindowFlags(Qt::Drawer);
|
||||
int result = mess.exec();
|
||||
return;
|
||||
}
|
||||
outPath = out_filled;
|
||||
|
||||
ui.progressBar->setValue(0);
|
||||
|
||||
if (mWorkThread == nullptr)
|
||||
{
|
||||
qDebug() << "--startThread";
|
||||
startWorkThread();
|
||||
}
|
||||
emit startDataFill(in_masked, out_filled, scale, size);
|
||||
}
|
||||
|
||||
void DataFilling::ReadConfigHistoryPaths(QString strPath)
|
||||
{
|
||||
QSettings configIni(strPath, QSettings::IniFormat);
|
||||
|
||||
//打开标题为:[DemFill] 的组
|
||||
configIni.beginGroup("DemFill");
|
||||
|
||||
ui.lineMasked->setText(configIni.value("MaskedFiles").toString());
|
||||
ui.lineOutFill->setText(configIni.value("FilledFiles").toString());
|
||||
|
||||
configIni.endGroup();//关闭组
|
||||
}
|
||||
void DataFilling::WriteConfigPaths(QString strPath)
|
||||
{
|
||||
QSettings configIni(strPath, QSettings::IniFormat);
|
||||
configIni.setIniCodec("utf-8");
|
||||
//打开标题为:[DemFill] 的组
|
||||
configIni.beginGroup("DemFill");
|
||||
|
||||
//更新输入模型路径
|
||||
QString temp = ui.lineMasked->text();
|
||||
if (temp != "")
|
||||
configIni.setValue("MaskedFiles", temp);
|
||||
//更新输入DOM路径
|
||||
temp = ui.lineOutFill->text();
|
||||
if (temp != "")
|
||||
configIni.setValue("FilledFiles", temp);
|
||||
|
||||
configIni.endGroup();//关闭组
|
||||
}
|
||||
|
||||
void DataFilling::pbCancel()
|
||||
{
|
||||
delete myWidget;//调起&QDialog::destroyed
|
||||
}
|
||||
|
||||
void DataFilling::openResultData(QStringList string_list)
|
||||
{
|
||||
if (string_list.isEmpty())
|
||||
return;
|
||||
QgsRasterLayer* rastLayer;
|
||||
QgsVectorLayer* vecLayer;
|
||||
for each (QString layerPath in string_list)
|
||||
{
|
||||
QFileInfo fileInfo(layerPath);
|
||||
QString layerBaseName = fileInfo.baseName(); // 图层名称
|
||||
if ("tif" == fileInfo.suffix() || "tiff" == fileInfo.suffix())
|
||||
{
|
||||
rastLayer = new QgsRasterLayer(fileInfo.filePath(), layerPath, "gdal");
|
||||
if (!rastLayer)
|
||||
return;
|
||||
QgsMapLayer* mapLayer = rastLayer;
|
||||
QgsRectangle myRectangle;
|
||||
//rastLayer->setContrastEnhancement(QgsContrastEnhancement::StretchToMinimumMaximum
|
||||
// , QgsRasterMinMaxOrigin::StdDev, myRectangle);
|
||||
QList<QgsMapLayer*> mapLayers;
|
||||
mapLayers << mapLayer;
|
||||
QgsProject::instance()->addMapLayers(mapLayers);
|
||||
//zoomToSelectedLayer(mapLayer);
|
||||
}
|
||||
else if ("shp" == fileInfo.suffix())
|
||||
{
|
||||
vecLayer = new QgsVectorLayer(fileInfo.filePath(), layerPath);
|
||||
if (!vecLayer)
|
||||
return;
|
||||
QgsMapLayer* mapLayer = vecLayer;
|
||||
QList<QgsMapLayer*> mapLayers;
|
||||
mapLayers << mapLayer;
|
||||
QgsProject::instance()->addMapLayers(mapLayers);
|
||||
}
|
||||
}
|
||||
}
|
92
DEM_Fill/DEM_Fill.h
Normal file
92
DEM_Fill/DEM_Fill.h
Normal file
@ -0,0 +1,92 @@
|
||||
#pragma once
|
||||
|
||||
#include <QtWidgets/QDialog>
|
||||
#include <QProcess>
|
||||
#include <QThread>
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
#include <QFileDialog>
|
||||
#include <QStringList>
|
||||
#include <QIntValidator>
|
||||
#include <QRegExpValidator>
|
||||
|
||||
#include "SrsMainPluginInterFace.h"
|
||||
|
||||
#include "ui_DEM_Fill.h"
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class WorkThreadObject :public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
int run_cmd(const char* cmd);
|
||||
|
||||
signals:
|
||||
void process(int value);
|
||||
void sendMaskedTiff(QStringList maskedData);
|
||||
|
||||
public slots:
|
||||
void runFillingWork(QString in_masked, QString out_filled, QString scale, QString size);
|
||||
void readProcessStandardOutput();
|
||||
|
||||
private:
|
||||
QProcess* mProcess = nullptr;
|
||||
|
||||
QString outTiffPath, tifflinear, tiffcubic;
|
||||
};
|
||||
|
||||
class DataFilling : public SrsMainInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(SrsMainInterface)
|
||||
Q_PLUGIN_METADATA(IID MainInterface_iid)
|
||||
|
||||
public:
|
||||
DataFilling();
|
||||
|
||||
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();
|
||||
|
||||
//读json文件,获取历史存储的路径
|
||||
void ReadConfigHistoryPaths(QString strPath);
|
||||
//保存本次打开的路径到json文件
|
||||
void WriteConfigPaths(QString strPath);
|
||||
|
||||
|
||||
public slots:
|
||||
//pushbutton_OK
|
||||
void readAndStart();
|
||||
void pbCancel();
|
||||
|
||||
void chooseMaskedSlope();
|
||||
void chooseOutFill();
|
||||
|
||||
void openResultData(QStringList string_list);
|
||||
|
||||
signals:
|
||||
void startDataFill(QString in_masked, QString out_filled, QString scale, QString size);
|
||||
|
||||
private:
|
||||
Ui::DEM_FillClass ui;
|
||||
|
||||
QDialog* myWidget = nullptr;
|
||||
|
||||
QThread* mWorkThread = nullptr;
|
||||
WorkThreadObject* mWorker = nullptr;
|
||||
|
||||
QString outPath;
|
||||
};
|
6
DEM_Fill/DEM_Fill.qrc
Normal file
6
DEM_Fill/DEM_Fill.qrc
Normal file
@ -0,0 +1,6 @@
|
||||
<RCC>
|
||||
<qresource prefix="/DEM_Fill">
|
||||
<file>resources/fill.svg</file>
|
||||
<file>DEM_Fill.qss</file>
|
||||
</qresource>
|
||||
</RCC>
|
68
DEM_Fill/DEM_Fill.qss
Normal file
68
DEM_Fill/DEM_Fill.qss
Normal file
@ -0,0 +1,68 @@
|
||||
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Ñùʽ±í*/
|
||||
#pushButton_ok, #pushButton_cancel, #pbtMasked, #pbtOutFill{
|
||||
font-family:'Microsoft YaHei';
|
||||
font-size:12px;
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #dcdfe6;
|
||||
padding: 2px;
|
||||
border-radius: 5px;
|
||||
max-height:20px;
|
||||
}
|
||||
#pushButton_ok:hover, #pushButton_cancel:hover, #pbtMasked:hover, #pbtOutFill:hover{
|
||||
background-color: #ecf5ff;
|
||||
color: #409eff;
|
||||
}
|
||||
#pushButton_ok:pressed, #pushButton_cancel:pressed, #pbtMasked:pressed, #pbtOutFill:pressed{
|
||||
border: 1px solid #3a8ee6;
|
||||
color: #409eff;
|
||||
}
|
||||
#pushButton_ok:checked, #pushButton_cancel:checked, #pbtMasked:checked, #pbtOutFill:checked{
|
||||
border: 1px solid #3a8ee6;
|
||||
color: #409eff;
|
||||
}
|
||||
#pushButton_ok:focus, #pushButton_cancel:focus, #pbtMasked:focus, #pbtOutFill:focus{
|
||||
border: 1px solid #3a8ee6;
|
||||
color: #409eff;
|
||||
outline: none;
|
||||
}
|
||||
#pushButton_ok, #pushButton_cancel{
|
||||
min-width:36px;
|
||||
}
|
||||
|
||||
/*----QLineEditÑùʽ*/
|
||||
#lineMasked, #lineOutFill,#lineRectangleScale,#lineExpandSize{
|
||||
border:0px;
|
||||
border-bottom: 1px solid #B3B3B3;
|
||||
font-family:'Microsoft YaHei';
|
||||
background-color:transparent;
|
||||
}
|
||||
#lineMasked:hover, #lineOutFill:hover,#lineRectangleScale:hover,#lineExpandSize:hover{
|
||||
border-bottom: 2px solid #66A3FF;
|
||||
}
|
||||
#lineMasked:focus, #lineOutFill:focus,#lineRectangleScale:focus,#lineExpandSize:focus{
|
||||
border-bottom: 2px solid #7666FF;
|
||||
}
|
236
DEM_Fill/DEM_Fill.ui
Normal file
236
DEM_Fill/DEM_Fill.ui
Normal file
@ -0,0 +1,236 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DEM_FillClass</class>
|
||||
<widget class="QDialog" name="DEM_FillClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>250</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>250</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>250</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>DEM_Fill</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="DEM_Fill.qrc">
|
||||
<normaloff>:/DEM_Fill/resources/fill.svg</normaloff>:/DEM_Fill/resources/fill.svg</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>输入裁剪后的DEM文件</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="lineMasked"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="pbtMasked">
|
||||
<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="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<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="3" column="0">
|
||||
<widget class="QLineEdit" name="lineOutFill"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="pbtOutFill">
|
||||
<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" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="topMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>外接矩形外扩比例</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineRectangleScale"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>空洞外扩像素</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineExpandSize"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>81</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<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>13</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">
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<tabstops>
|
||||
<tabstop>lineMasked</tabstop>
|
||||
<tabstop>pbtMasked</tabstop>
|
||||
<tabstop>lineOutFill</tabstop>
|
||||
<tabstop>pbtOutFill</tabstop>
|
||||
<tabstop>lineRectangleScale</tabstop>
|
||||
<tabstop>lineExpandSize</tabstop>
|
||||
<tabstop>pushButton_ok</tabstop>
|
||||
<tabstop>pushButton_cancel</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="DEM_Fill.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
84
DEM_Fill/DEM_Fill.vcxproj
Normal file
84
DEM_Fill/DEM_Fill.vcxproj
Normal file
@ -0,0 +1,84 @@
|
||||
<?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>{32F04C81-EC93-432F-9B60-0B92B5FCC5C5}</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>
|
||||
</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>qt5.11.2</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'">
|
||||
<TargetName>dem4-$(ProjectName)</TargetName>
|
||||
<IncludePath>D:\qgis\osgeo4w\include;D:\qgis\osgeo4w\apps\Qt5\include;D:\qgis\osgeo4w\apps\qgis_build_sdk\include;D:\qgis\osgeo4w\apps\Qt5\include\QtXml;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>D:\qgis\osgeo4w\lib;D:\qgis\osgeo4w\apps\Qt5\lib;D:\qgis\osgeo4w\apps\qgis_build_sdk\lib;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Link>
|
||||
<AdditionalDependencies>qgis_gui.lib;qgis_analysis.lib;qgis_core.lib;qgis_native.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>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<QtRcc Include="DEM_Fill.qrc" />
|
||||
<QtUic Include="DEM_Fill.ui" />
|
||||
<QtMoc Include="DEM_Fill.h" />
|
||||
<ClCompile Include="DEM_Fill.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="SrsMainPluginInterFace.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="x64\Release\uic\ui_DEM_Fill.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="DEM_Fill.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>
|
59
DEM_Fill/DEM_Fill.vcxproj.filters
Normal file
59
DEM_Fill/DEM_Fill.vcxproj.filters
Normal file
@ -0,0 +1,59 @@
|
||||
<?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>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtRcc Include="DEM_Fill.qrc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</QtRcc>
|
||||
<QtUic Include="DEM_Fill.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
<QtMoc Include="DEM_Fill.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<ClCompile Include="DEM_Fill.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="SrsMainPluginInterFace.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="x64\Release\uic\ui_DEM_Fill.h">
|
||||
<Filter>Form Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="DEM_Fill.qss">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
58
DEM_Fill/SrsMainPluginInterFace.h
Normal file
58
DEM_Fill/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>
|
||||
/// 返回pannel的名字
|
||||
/// </summary>
|
||||
virtual QString PannelName() = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 返回Category名字
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
virtual QString CategoryName() = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 返回插件的英文名字
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
virtual QString EnglishName() = 0;
|
||||
/// <summary>
|
||||
/// 返回插件的中文名字
|
||||
/// </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)
|
10
DEM_Fill/main.cpp
Normal file
10
DEM_Fill/main.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include "DEM_Fill.h"
|
||||
#include <QtWidgets/QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
DataFilling w;
|
||||
w.CenterWidget()->show();
|
||||
return a.exec();
|
||||
}
|
1
DEM_Fill/resources/fill.svg
Normal file
1
DEM_Fill/resources/fill.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><svg width="26" height="26" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="6" y="6" width="36" height="36" rx="3" fill="none" stroke="#2c2c2c" stroke-width="3" stroke-linecap="butt" stroke-linejoin="round"/><rect x="14" y="14" width="20" height="20" fill="none" stroke="#2c2c2c" stroke-width="3" stroke-linecap="butt" stroke-linejoin="round"/><path d="M34 23L23 34" stroke="#2c2c2c" stroke-width="3" stroke-linecap="butt" stroke-linejoin="round"/><path d="M25 14L14 25" stroke="#2c2c2c" stroke-width="3" stroke-linecap="butt" stroke-linejoin="round"/><path d="M34 14L14 34" stroke="#2c2c2c" stroke-width="3" stroke-linecap="butt" stroke-linejoin="round"/><path d="M14 22V34H26" stroke="#2c2c2c" stroke-width="3" stroke-linecap="butt" stroke-linejoin="round"/><path d="M22 14H34V26" stroke="#2c2c2c" stroke-width="3" stroke-linecap="butt" stroke-linejoin="round"/></svg>
|
After Width: | Height: | Size: 936 B |
Loading…
Reference in New Issue
Block a user