Skip to content

Commit

Permalink
Avoid some mixing enum types warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Feb 18, 2015
1 parent 7c4de56 commit d4f509f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
24 changes: 23 additions & 1 deletion src/plugins/georeferencer/qgsimagewarper.cpp
Expand Up @@ -67,7 +67,7 @@ bool QgsImageWarper::openSrcDSAndGetWarpOpt( const QString &input, const Resampl
}
psWarpOptions->pfnProgress = GDALTermProgress;
psWarpOptions->pfnTransformer = pfnTransform;
psWarpOptions->eResampleAlg = GDALResampleAlg( resampling );
psWarpOptions->eResampleAlg = toGDALResampleAlg( resampling );

return true;
}
Expand Down Expand Up @@ -360,3 +360,25 @@ int CPL_STDCALL QgsImageWarper::updateWarpProgress( double dfComplete, const cha
mWarpCanceled = false;
return true;
}

GDALResampleAlg QgsImageWarper::toGDALResampleAlg( const QgsImageWarper::ResamplingMethod method ) const
{
switch ( method )
{
case NearestNeighbour:
return GRA_NearestNeighbour;
case Bilinear:
return GRA_Bilinear;
case Cubic:
return GRA_Cubic;
case CubicSpline:
return GRA_CubicSpline;
case Lanczos:
return GRA_Lanczos;
default:
return GRA_NearestNeighbour;
};

//avoid warning
return GRA_NearestNeighbour;
}
2 changes: 2 additions & 0 deletions src/plugins/georeferencer/qgsimagewarper.h
Expand Up @@ -95,6 +95,8 @@ class QgsImageWarper
static int CPL_STDCALL updateWarpProgress( double dfComplete, const char *pszMessage, void *pProgressArg );

static bool mWarpCanceled;

GDALResampleAlg toGDALResampleAlg( const ResamplingMethod method ) const;
};


Expand Down
2 changes: 1 addition & 1 deletion tests/bench/qgsbench.cpp
Expand Up @@ -315,7 +315,7 @@ QString QgsBench::serialize( QMap<QString, QVariant> theMap, int level )
QMap<QString, QVariant>::const_iterator i = theMap.constBegin();
while ( i != theMap.constEnd() )
{
switch ( i.value().type() )
switch ( (QMetaType::Type)i.value().type() )
{
case QMetaType::Int:
list.append( space2 + "\"" + i.key() + "\": " + QString( "%1" ).arg( i.value().toInt() ) );
Expand Down

0 comments on commit d4f509f

Please sign in to comment.