Skip to content

Commit

Permalink
Fix build on older Qt
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Feb 14, 2022
1 parent 7be6cd2 commit 23b68cd
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions src/app/georeferencer/qgsgcplist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "qgsgcplist.h"
#include <QDir>
#include <QTextStream>

void QgsGCPList::createGCPVectors( QVector<QgsPointXY> &sourcePoints, QVector<QgsPointXY> &destinationPoints, const QgsCoordinateReferenceSystem &targetCrs, const QgsCoordinateTransformContext &context ) const
{
Expand Down Expand Up @@ -82,8 +83,20 @@ bool QgsGCPList::saveGcps( const QString &filePath, const QgsCoordinateReference
if ( pointFile.open( QIODevice::WriteOnly | QIODevice::Truncate ) )
{
QTextStream points( &pointFile );
points << QStringLiteral( "#CRS: %1" ).arg( targetCrs.toWkt( QgsCoordinateReferenceSystem::WKT_PREFERRED ) ) << endl;
points << "mapX,mapY,sourceX,sourceY,enable,dX,dY,residual" << endl;
points << QStringLiteral( "#CRS: %1" ).arg( targetCrs.toWkt( QgsCoordinateReferenceSystem::WKT_PREFERRED ) );
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
points << endl;
#else
points << Qt::endl;
#endif

points << "mapX,mapY,sourceX,sourceY,enable,dX,dY,residual";
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
points << endl;
#else
points << Qt::endl;
#endif

for ( QgsGeorefDataPoint *pt : *this )
{
const QgsPointXY transformedDestinationPoint = pt->transformedDestinationPoint( targetCrs, context );
Expand All @@ -95,8 +108,12 @@ bool QgsGCPList::saveGcps( const QString &filePath, const QgsCoordinateReference
.arg( pt->isEnabled() )
.arg( qgsDoubleToString( pt->residual().x() ),
qgsDoubleToString( pt->residual().y() ),
qgsDoubleToString( std::sqrt( pt->residual().x() * pt->residual().x() + pt->residual().y() * pt->residual().y() ) ) )
<< endl;
qgsDoubleToString( std::sqrt( pt->residual().x() * pt->residual().x() + pt->residual().y() * pt->residual().y() ) ) );
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
points << endl;
#else
points << Qt::endl;
#endif
}
return true;
}
Expand Down

0 comments on commit 23b68cd

Please sign in to comment.