本文整理汇总了C++中GDALRasterBand::ComputeRasterMinMax方法的典型用法代码示例。如果您正苦于以下问题:C++ GDALRasterBand::ComputeRasterMinMax方法的具体用法?C++ GDALRasterBand::ComputeRasterMinMax怎么用?C++ GDALRasterBand::ComputeRasterMinMax使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GDALRasterBand
的用法示例。
在下文中一共展示了GDALRasterBand::ComputeRasterMinMax方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetMinimum
CPLErr VRTSourcedRasterBand::ComputeRasterMinMax( int bApproxOK, double* adfMinMax )
{
double dfMin = 0.0;
double dfMax = 0.0;
/* -------------------------------------------------------------------- */
/* Does the driver already know the min/max? */
/* -------------------------------------------------------------------- */
if( bApproxOK )
{
int bSuccessMin, bSuccessMax;
dfMin = GetMinimum( &bSuccessMin );
dfMax = GetMaximum( &bSuccessMax );
if( bSuccessMin && bSuccessMax )
{
adfMinMax[0] = dfMin;
adfMinMax[1] = dfMax;
return CE_None;
}
}
/* -------------------------------------------------------------------- */
/* If we have overview bands, use them for min/max. */
/* -------------------------------------------------------------------- */
if ( bApproxOK && GetOverviewCount() > 0 && !HasArbitraryOverviews() )
{
GDALRasterBand *poBand;
poBand = GetRasterSampleOverview( GDALSTAT_APPROX_NUMSAMPLES );
if ( poBand != this )
return poBand->ComputeRasterMinMax( FALSE, adfMinMax );
}
/* -------------------------------------------------------------------- */
/* Try with source bands. */
/* -------------------------------------------------------------------- */
if ( bAntiRecursionFlag )
{
CPLError( CE_Failure, CPLE_AppDefined,
"VRTSourcedRasterBand::ComputeRasterMinMax() called recursively on the same band. "
"It looks like the VRT is referencing itself." );
return CE_Failure;
}
bAntiRecursionFlag = TRUE;
adfMinMax[0] = 0.0;
adfMinMax[1] = 0.0;
for( int iSource = 0; iSource < nSources; iSource++ )
{
double adfSourceMinMax[2];
CPLErr eErr = papoSources[iSource]->ComputeRasterMinMax(GetXSize(), GetYSize(), bApproxOK, adfSourceMinMax);
if (eErr != CE_None)
{
eErr = GDALRasterBand::ComputeRasterMinMax(bApproxOK, adfMinMax);
bAntiRecursionFlag = FALSE;
return eErr;
}
if (iSource == 0 || adfSourceMinMax[0] < adfMinMax[0])
adfMinMax[0] = adfSourceMinMax[0];
if (iSource == 0 || adfSourceMinMax[1] > adfMinMax[1])
adfMinMax[1] = adfSourceMinMax[1];
}
bAntiRecursionFlag = FALSE;
return CE_None;
}