Skip to content

Commit

Permalink
Rename method for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Feb 9, 2022
1 parent ee1b3e9 commit 8d083ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/app/georeferencer/qgsgeoreftransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ bool QgsGeorefTransform::transformRasterToWorld( const QgsPointXY &raster, QgsPo
{
// flip y coordinate due to different CS orientation
const QgsPointXY raster_flipped( raster.x(), -raster.y() );
return gdal_transform( raster_flipped, world, 0 );
return transformPrivate( raster_flipped, world, false );
}

bool QgsGeorefTransform::transformWorldToRaster( const QgsPointXY &world, QgsPointXY &raster )
{
const bool success = gdal_transform( world, raster, 1 );
const bool success = transformPrivate( world, raster, true );
// flip y coordinate due to different CS orientation
raster.setY( -raster.y() );
return success;
Expand Down Expand Up @@ -186,13 +186,13 @@ bool QgsGeorefTransform::getOriginScaleRotation( QgsPointXY &origin, double &sca
}


bool QgsGeorefTransform::gdal_transform( const QgsPointXY &src, QgsPointXY &dst, int dstToSrc ) const
bool QgsGeorefTransform::transformPrivate( const QgsPointXY &src, QgsPointXY &dst, bool inverseTransform ) const
{
// Copy the source coordinate for inplace transform
double x = src.x();
double y = src.y();

if ( !QgsGcpTransformerInterface::transform( x, y, dstToSrc == 1 ) )
if ( !QgsGcpTransformerInterface::transform( x, y, inverseTransform ) )
return false;

dst.setX( x );
Expand Down
3 changes: 1 addition & 2 deletions src/app/georeferencer/qgsgeoreftransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ class APP_EXPORT QgsGeorefTransform : public QgsGcpTransformerInterface
QgsGeorefTransform( const QgsGeorefTransform &other );
QgsGeorefTransform &operator= ( const QgsGeorefTransform & ) = delete;

// convenience wrapper around GDALTransformerFunc
bool gdal_transform( const QgsPointXY &src, QgsPointXY &dst, int dstToSrc ) const;
bool transformPrivate( const QgsPointXY &src, QgsPointXY &dst, bool inverseTransform ) const;

QVector<QgsPointXY> mSourceCoordinates;
QVector<QgsPointXY> mDestinationCoordinates;
Expand Down

0 comments on commit 8d083ac

Please sign in to comment.