Avoid some mixing enum types warnings

This commit is contained in:
Nyall Dawson 2015-02-18 17:34:50 +11:00
parent 7c4de560a6
commit d4f509f7a2
3 changed files with 26 additions and 2 deletions

View File

@ -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;
}
@ -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;
}

View File

@ -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;
};

View File

@ -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() ) );