修复了DEM插值bug
parent
46df94f994
commit
0ab8617983
|
@ -1890,7 +1890,7 @@ int ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int
|
||||||
}
|
}
|
||||||
|
|
||||||
// GDALDestroyGenImgProjTransformer(hTransformArg);
|
// GDALDestroyGenImgProjTransformer(hTransformArg);
|
||||||
|
qDebug() << "create init GDALDataset " ;
|
||||||
GDALDataset* pDDst =
|
GDALDataset* pDDst =
|
||||||
pDriver->Create(pszOutFile, new_width, new_height, nBandCount, dataType, NULL);
|
pDriver->Create(pszOutFile, new_width, new_height, nBandCount, dataType, NULL);
|
||||||
if(pDDst == NULL) {
|
if(pDDst == NULL) {
|
||||||
|
|
|
@ -28,7 +28,7 @@ void customMessageHandler(QtMsgType type, const QMessageLogContext& context, con
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case QtDebugMsg:
|
case QtDebugMsg:
|
||||||
{
|
{
|
||||||
QString logMessage = QString("%1 Debug: %2 (%3:%4, %5)\n")
|
QString logMessage = QString("%1 Debug: %2 (%3:%4, %5)")
|
||||||
.arg(dateTime) // Assuming dateTime is a QDateTime object and needs to be converted to string
|
.arg(dateTime) // Assuming dateTime is a QDateTime object and needs to be converted to string
|
||||||
.arg(QString::fromLocal8Bit(localMsg.constData()))
|
.arg(QString::fromLocal8Bit(localMsg.constData()))
|
||||||
.arg(file)
|
.arg(file)
|
||||||
|
@ -40,7 +40,7 @@ void customMessageHandler(QtMsgType type, const QMessageLogContext& context, con
|
||||||
}
|
}
|
||||||
case QtInfoMsg:
|
case QtInfoMsg:
|
||||||
{
|
{
|
||||||
QString logMessage = QString("%1 Info: %2 (%3:%4, %5)\n")
|
QString logMessage = QString("%1 Info: %2 (%3:%4, %5)")
|
||||||
.arg(dateTime)
|
.arg(dateTime)
|
||||||
.arg(QString::fromLocal8Bit(localMsg.constData()))
|
.arg(QString::fromLocal8Bit(localMsg.constData()))
|
||||||
.arg(file)
|
.arg(file)
|
||||||
|
@ -52,7 +52,7 @@ void customMessageHandler(QtMsgType type, const QMessageLogContext& context, con
|
||||||
}
|
}
|
||||||
case QtWarningMsg:
|
case QtWarningMsg:
|
||||||
{
|
{
|
||||||
QString logMessage = QString("%1 Warning: %2 (%3:%4, %5)\n")
|
QString logMessage = QString("%1 Warning: %2 (%3:%4, %5)")
|
||||||
.arg(dateTime)
|
.arg(dateTime)
|
||||||
.arg(QString::fromLocal8Bit(localMsg.constData()))
|
.arg(QString::fromLocal8Bit(localMsg.constData()))
|
||||||
.arg(file)
|
.arg(file)
|
||||||
|
@ -63,7 +63,7 @@ void customMessageHandler(QtMsgType type, const QMessageLogContext& context, con
|
||||||
}
|
}
|
||||||
case QtCriticalMsg:
|
case QtCriticalMsg:
|
||||||
{
|
{
|
||||||
QString logMessage = QString("%1 Critical: %2 (%3:%4, %5)\n")
|
QString logMessage = QString("%1 Critical: %2 (%3:%4, %5)")
|
||||||
.arg(dateTime)
|
.arg(dateTime)
|
||||||
.arg(QString::fromLocal8Bit(localMsg.constData()))
|
.arg(QString::fromLocal8Bit(localMsg.constData()))
|
||||||
.arg(file)
|
.arg(file)
|
||||||
|
@ -75,7 +75,7 @@ void customMessageHandler(QtMsgType type, const QMessageLogContext& context, con
|
||||||
}
|
}
|
||||||
case QtFatalMsg:
|
case QtFatalMsg:
|
||||||
{
|
{
|
||||||
QString logMessage = QString("%1 Fatal: %2 (%3:%4, %5)\n")
|
QString logMessage = QString("%1 Fatal: %2 (%3:%4, %5)")
|
||||||
.arg(dateTime)
|
.arg(dateTime)
|
||||||
.arg(QString::fromLocal8Bit(localMsg.constData()))
|
.arg(QString::fromLocal8Bit(localMsg.constData()))
|
||||||
.arg(file)
|
.arg(file)
|
||||||
|
|
|
@ -203,7 +203,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>906</width>
|
<width>906</width>
|
||||||
<height>22</height>
|
<height>23</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="projectMenu">
|
<widget class="QMenu" name="projectMenu">
|
||||||
|
@ -333,6 +333,12 @@
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTextBrowser" name="textBrowserMessage">
|
<widget class="QTextBrowser" name="textBrowserMessage">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">line-height:1</string>
|
||||||
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
<property name="html">
|
<property name="html">
|
||||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
|
|
|
@ -65,14 +65,14 @@ void QDEMResampleDialog::onAccepted()
|
||||||
|
|
||||||
Eigen::MatrixXd srcgt = demimg.gt;
|
Eigen::MatrixXd srcgt = demimg.gt;
|
||||||
//
|
//
|
||||||
QString srcgtstr= "src gt\n";
|
|
||||||
srcgtstr += "----- src gt ------------------------------------\n";
|
|
||||||
srcgtstr += QString("%1 %2 %3\n").arg(srcgt(0, 0)).arg(srcgt(0, 1)).arg(srcgt(0, 2));
|
|
||||||
srcgtstr += QString("%1 %2 %3\n").arg(srcgt(1, 0)).arg(srcgt(1, 1)).arg(srcgt(1, 2));
|
|
||||||
srcgtstr += "-----------------------------------------\n";
|
|
||||||
|
|
||||||
double Xscale = gridx / srcgt(0, 1);
|
qDebug() << "----- src gt ------------------------------------";
|
||||||
double Yscale = gridy / srcgt(1, 2);
|
qDebug() << QString("%1\t%2\t%3").arg(srcgt(0, 0)).arg(srcgt(0, 1)).arg(srcgt(0, 2));
|
||||||
|
qDebug() << QString("%1\t%2\t%3").arg(srcgt(1, 0)).arg(srcgt(1, 1)).arg(srcgt(1, 2));
|
||||||
|
qDebug() << "-----------------------------------------";
|
||||||
|
|
||||||
|
double Xscale = srcgt(0, 1)/gridx;
|
||||||
|
double Yscale = srcgt(1, 2)/gridy;
|
||||||
|
|
||||||
int new_width = ceil(Xscale * demimg.width) + 1;
|
int new_width = ceil(Xscale * demimg.width) + 1;
|
||||||
int new_height = ceil(Yscale * demimg.height) + 1;
|
int new_height = ceil(Yscale * demimg.height) + 1;
|
||||||
|
@ -81,12 +81,12 @@ void QDEMResampleDialog::onAccepted()
|
||||||
srcgt(1, 2) = gridy;
|
srcgt(1, 2) = gridy;
|
||||||
|
|
||||||
|
|
||||||
srcgtstr = "target gt\n";
|
qDebug() << "target gt";
|
||||||
srcgtstr += "----- target gt ------------------------------------\n";
|
qDebug() << "----- target gt ------------------------------------";
|
||||||
srcgtstr += QString("%1 %2 %3\n").arg(srcgt(0, 0)).arg(srcgt(0, 1)).arg(srcgt(0, 2));
|
qDebug() << QString("%1\t%2\t%3").arg(srcgt(0, 0)).arg(srcgt(0, 1)).arg(srcgt(0, 2));
|
||||||
srcgtstr += QString("%1 %2 %3\n").arg(srcgt(1, 0)).arg(srcgt(1, 1)).arg(srcgt(1, 2));
|
qDebug() << QString("%1\t%2\t%3").arg(srcgt(1, 0)).arg(srcgt(1, 1)).arg(srcgt(1, 2));
|
||||||
srcgtstr += "-----------------------------------------\n";
|
qDebug() << "-----------------------------------------";
|
||||||
qDebug() << srcgtstr;
|
|
||||||
std::shared_ptr<double> gt(new double[6]);
|
std::shared_ptr<double> gt(new double[6]);
|
||||||
gt.get()[0] = srcgt(0, 0);
|
gt.get()[0] = srcgt(0, 0);
|
||||||
gt.get()[1] = srcgt(0, 1);
|
gt.get()[1] = srcgt(0, 1);
|
||||||
|
@ -96,7 +96,10 @@ void QDEMResampleDialog::onAccepted()
|
||||||
gt.get()[5] = srcgt(1, 2);
|
gt.get()[5] = srcgt(1, 2);
|
||||||
|
|
||||||
qDebug() << "DEM ReSample start ...";
|
qDebug() << "DEM ReSample start ...";
|
||||||
ResampleGDAL(inDEMPath.toLocal8Bit().constData(),
|
qDebug() << "height:\t" << new_height;
|
||||||
|
qDebug() << "width:\t" << new_width;
|
||||||
|
|
||||||
|
qDebug() << ResampleGDAL(inDEMPath.toLocal8Bit().constData(),
|
||||||
outDEMPath.toLocal8Bit().constData(), gt.get(), new_width, new_height, GDALResampleAlg::GRA_Bilinear);
|
outDEMPath.toLocal8Bit().constData(), gt.get(), new_width, new_height, GDALResampleAlg::GRA_Bilinear);
|
||||||
|
|
||||||
qDebug() << "DEM ReSample finished!!!";
|
qDebug() << "DEM ReSample finished!!!";
|
||||||
|
|
|
@ -105,7 +105,16 @@
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="decimals">
|
<property name="decimals">
|
||||||
<number>8</number>
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>-720.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>720.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>0.000010000000000</double>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -118,7 +127,16 @@
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="decimals">
|
<property name="decimals">
|
||||||
<number>8</number>
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>-720.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>720.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>-0.000010000000000</double>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Reference in New Issue