Skip to content
Permalink
Browse files

Merge pull request #1826 from jbuonagurio/master

WCS: pass user-supplied progress function to curl HTTP request when u…
  • Loading branch information...
rouault committed Sep 10, 2019
2 parents 16d7b9e + 7c465a0 commit bd215c2ace83211aadadab0554d6ea3945c46789
Showing with 18 additions and 6 deletions.
  1. +16 −5 gdal/frmts/wcs/wcsdataset.cpp
  2. +1 −0 gdal/frmts/wcs/wcsdataset.h
  3. +1 −1 gdal/frmts/wcs/wcsrasterband.cpp
@@ -230,7 +230,7 @@ WCSDataset::DirectRasterIO( CPL_UNUSED GDALRWFlag eRWFlag,
int *panBandMap,
GSpacing nPixelSpace, GSpacing nLineSpace,
GSpacing nBandSpace,
CPL_UNUSED GDALRasterIOExtraArg* psExtraArg)
GDALRasterIOExtraArg* psExtraArg)
{
CPLDebug( "WCS", "DirectRasterIO(%d,%d,%d,%d) -> (%d,%d) (%d bands)\n",
nXOff, nYOff, nXSize, nYSize,
@@ -253,7 +253,7 @@ WCSDataset::DirectRasterIO( CPL_UNUSED GDALRWFlag eRWFlag,
CPLHTTPResult *psResult = nullptr;
CPLErr eErr =
GetCoverage( nXOff, nYOff, nXSize, nYSize, nBufXSize, nBufYSize,
band_count, panBandMap, &psResult );
band_count, panBandMap, psExtraArg, &psResult );

if( eErr != CE_None )
return eErr;
@@ -339,6 +339,7 @@ static bool ProcessError( CPLHTTPResult *psResult );
CPLErr WCSDataset::GetCoverage( int nXOff, int nYOff, int nXSize, int nYSize,
int nBufXSize, int nBufYSize,
int nBandCount, int *panBandList,
GDALRasterIOExtraArg *psExtraArg,
CPLHTTPResult **ppsResult )

{
@@ -378,8 +379,18 @@ CPLErr WCSDataset::GetCoverage( int nXOff, int nYOff, int nXSize, int nYSize,
/* Fetch the result. */
/* -------------------------------------------------------------------- */
CPLErrorReset();
*ppsResult = CPLHTTPFetch( osRequest, papszHttpOptions );

if( psExtraArg && psExtraArg->pfnProgress != nullptr)
{
*ppsResult = CPLHTTPFetchEx( osRequest, papszHttpOptions,
psExtraArg->pfnProgress,
psExtraArg->pProgressData,
nullptr, nullptr);
}
else
{
*ppsResult = CPLHTTPFetch( osRequest, papszHttpOptions );
}

if( ProcessError( *ppsResult ) )
return CE_Failure;
else
@@ -583,7 +594,7 @@ int WCSDataset::EstablishRasterDetails()
CPLHTTPResult *psResult = nullptr;
CPLErr eErr;

eErr = GetCoverage( 0, 0, 2, 2, 2, 2, 0, nullptr, &psResult );
eErr = GetCoverage( 0, 0, 2, 2, 2, 2, 0, nullptr, nullptr, &psResult );
if( eErr != CE_None )
return false;

@@ -101,6 +101,7 @@ class WCSDataset CPL_NON_FINAL: public GDALPamDataset
int nXSize, int nYSize,
int nBufXSize, int nBufYSize,
int nBandCount, int *panBandList,
GDALRasterIOExtraArg *psExtraArg,
CPLHTTPResult **ppsResult );

virtual CPLString DescribeCoverageRequest() {return "";}
@@ -155,7 +155,7 @@ CPLErr WCSRasterBand::IReadBlock( int nBlockXOff, int nBlockYOff,
nBlockXSize * nResFactor,
nBlockYSize * nResFactor,
nBlockXSize, nBlockYSize,
band_count, &nBand, &psResult );
band_count, &nBand, nullptr, &psResult );
if( eErr != CE_None )
return eErr;

0 comments on commit bd215c2

Please sign in to comment.
You can’t perform that action at this time.