[Gdal-dev] GDALScaledProgress confusion
Frank Warmerdam
warmerdam at pobox.com
Thu Jun 7 10:14:38 EDT 2007
Stefan Klug wrote:
> Hi,
>
> I'm trying to use GDALScaledProgress and GDALCreateScaledProgress and
> I'm a bit confused by its correct usage.
>
> The docs say at http://www.gdal.org/gdal_8h.html
>
> pScaledProgress = GDALCreateScaledProgress
> <http://www.gdal.org/gdal_8h.html#462c1d7aa414cdacd608d62e1830ef43>(
> 0.0, 0.5, pfnProgress, pProgressData );
> GDALDoLongSlowOperation( ..., GDALScaledProgressFunc, pProgressData );
> GDALDestroyScaledProgress
> <http://www.gdal.org/gdal_8h.html#f1ac4100ae77f94983d45a33fc1b6fcd>(
> pScaledProgress );
>
> shouldn't pScaledProgress be passed to GDALDoLongSlowOperation() instead
> of pProgressData?
> This is the way it is used in /frmts/gtiff/geotiff.cpp.
>
> I even got more confused when I read /frmts/gtiff/gt_overview.cpp where
> in line 330... it is used like this:
> pScaledProgressData = GDALCreateScaledProgress( ...,pfnProgress,
> pProgressData );
> GDALRegenerateOverviews( ...,pfnProgress,pProgressData);
> GDALDestroyScaledProgress( pScaledProgressData );
>
> Here the scaled progress seems to be completely left out.
> To me it looks like a small bug...
>
> Would be nice if someone could shed some light on this.
Stefan,
You are completely correct. I have corrected the documentation and it
should be reflected on the website in the upcoming hours. It should be:
* int MyOperation( ..., GDALProgressFunc pfnProgress, void *pProgressData );
*
* {
* void *pScaledProgress;
*
* pScaledProgress = GDALCreateScaledProgress( 0.0, 0.5, pfnProgress,
* pProgressData );
* GDALDoLongSlowOperation(...,GDALScaledProgressFunc, pScaledProgress );
* GDALDestroyScaledProgress( pScaledProgress );
*
* pScaledProgress = GDALCreateScaledProgress( 0.5, 1.0, pfnProgress,
* pProgressData );
* GDALDoAnotherOperation(..., GDALScaledProgressFunc, pScaledProgress );
* GDALDestroyScaledProgress( pScaledProgress );
*
* return ...;
* }
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | President OSGeo, http://osgeo.org
More information about the Gdal-dev
mailing list