Skip to content

Commit

Permalink
debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
blazek committed Oct 11, 2012
1 parent 7cb523a commit f0aca15
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/providers/gdal/qgsgdalprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2032,7 +2032,7 @@ bool QgsGdalProvider::hasStatistics( int theBandNo,
if ( !( theStats & QgsRasterBandStats::StdDev ) ) pdfStdDev = NULL;

// try to fetch the cached stats (bForce=FALSE)
CPLErr myerval = GDALGetRasterStatistics( myGdalBand, bApproxOK, FALSE, pdfMin, pdfMax, pdfMean, pdfStdDev );
CPLErr myerval = GDALGetRasterStatistics( myGdalBand, bApproxOK, false, pdfMin, pdfMax, pdfMean, pdfStdDev );

if ( CE_None == myerval ) // CE_Warning if cached not found
{
Expand Down Expand Up @@ -2095,6 +2095,8 @@ QgsRasterBandStats QgsGdalProvider::bandStatistics( int theBandNo, int theStats,
}
}

QgsDebugMsg( QString( "bApproxOK = %1" ).arg( bApproxOK ) );

double pdfMin;
double pdfMax;
double pdfMean;
Expand All @@ -2105,15 +2107,21 @@ QgsRasterBandStats QgsGdalProvider::bandStatistics( int theBandNo, int theStats,

// try to fetch the cached stats (bForce=FALSE)
CPLErr myerval =
GDALGetRasterStatistics( myGdalBand, bApproxOK, FALSE, &pdfMin, &pdfMax, &pdfMean, &pdfStdDev );
GDALGetRasterStatistics( myGdalBand, bApproxOK, false, &pdfMin, &pdfMax, &pdfMean, &pdfStdDev );

QgsDebugMsg( QString( "myerval = %1" ).arg( myerval ) );
// if cached stats are not found, compute them
if ( CE_Warning == myerval )
if ( CE_None != myerval )
{
QgsDebugMsg( "Calculating statistics by GDAL" );
myerval = GDALComputeRasterStatistics( myGdalBand, bApproxOK,
&pdfMin, &pdfMax, &pdfMean, &pdfStdDev,
progressCallback, &myProg ) ;
}
else
{
QgsDebugMsg( "Using GDAL cached statistics" );
}

// if stats are found populate the QgsRasterBandStats object
if ( CE_None == myerval )
Expand Down

0 comments on commit f0aca15

Please sign in to comment.