Skip to content

Commit

Permalink
Qt5 compilation fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jul 20, 2021
1 parent 35511ff commit 26ede99
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
29 changes: 28 additions & 1 deletion src/analysis/interpolation/qgsgridfilewriter.cpp
Expand Up @@ -73,7 +73,11 @@ int QgsGridFileWriter::writeFile( QgsFeedback *feedback )
}
currentXValue += mCellSizeX;
}
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
outStream << endl;
#else
outStream << Qt::endl;
#endif
currentYValue -= mCellSizeY;

if ( feedback )
Expand Down Expand Up @@ -101,28 +105,51 @@ int QgsGridFileWriter::writeFile( QgsFeedback *feedback )
}
QTextStream prjStream( &prjFile );
prjStream << crs;
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
prjStream << endl;
#else
prjStream << Qt::endl;
#endif
prjFile.close();

return 0;
}

int QgsGridFileWriter::writeHeader( QTextStream &outStream )
{
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
outStream << "NCOLS " << mNumColumns << endl;
outStream << "NROWS " << mNumRows << endl;
outStream << "XLLCORNER " << mInterpolationExtent.xMinimum() << endl;
outStream << "YLLCORNER " << mInterpolationExtent.yMinimum() << endl;
#else
outStream << "NCOLS " << mNumColumns << Qt::endl;
outStream << "NROWS " << mNumRows << Qt::endl;
outStream << "XLLCORNER " << mInterpolationExtent.xMinimum() << Qt::endl;
outStream << "YLLCORNER " << mInterpolationExtent.yMinimum() << Qt::endl;
#endif
if ( mCellSizeX == mCellSizeY ) //standard way
{
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
outStream << "CELLSIZE " << mCellSizeX << endl;
#else
outStream << "CELLSIZE " << mCellSizeX << Qt::endl;
#endif
}
else //this is supported by GDAL but probably not by other products
{
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
outStream << "DX " << mCellSizeX << endl;
outStream << "DY " << mCellSizeY << endl;
#else
outStream << "DX " << mCellSizeX << Qt::endl;
outStream << "DY " << mCellSizeY << Qt::endl;
#endif
}
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
outStream << "NODATA_VALUE -9999" << endl;
#else
outStream << "NODATA_VALUE -9999" << Qt::endl;

#endif
return 0;
}
4 changes: 4 additions & 0 deletions src/analysis/raster/qgsrelief.cpp
Expand Up @@ -548,7 +548,11 @@ bool QgsRelief::exportFrequencyDistributionToCsv( const QString &file )
#endif
for ( int i = 0; i < 252; ++i )
{
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
outstream << QString::number( i ) + ',' + QString::number( frequency[i] ) << endl;
#else
outstream << QString::number( i ) + ',' + QString::number( frequency[i] ) << Qt::endl;
#endif
}
outFile.close();
return true;
Expand Down

0 comments on commit 26ede99

Please sign in to comment.