本文整理汇总了C++中GDALRasterBand::GetDefaultHistogram方法的典型用法代码示例。如果您正苦于以下问题:C++ GDALRasterBand::GetDefaultHistogram方法的具体用法?C++ GDALRasterBand::GetDefaultHistogram怎么用?C++ GDALRasterBand::GetDefaultHistogram使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GDALRasterBand
的用法示例。
在下文中一共展示了GDALRasterBand::GetDefaultHistogram方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TryLoadAux
//.........这里部分代码省略.........
/* -------------------------------------------------------------------- */
/* Geotransform. */
/* -------------------------------------------------------------------- */
if( poAuxDS->GetGeoTransform( psPam->adfGeoTransform ) == CE_None )
psPam->bHaveGeoTransform = TRUE;
/* -------------------------------------------------------------------- */
/* GCPs */
/* -------------------------------------------------------------------- */
if( poAuxDS->GetGCPCount() > 0 )
{
psPam->nGCPCount = poAuxDS->GetGCPCount();
psPam->pasGCPList = GDALDuplicateGCPs( psPam->nGCPCount,
poAuxDS->GetGCPs() );
}
/* -------------------------------------------------------------------- */
/* Apply metadata. We likely ought to be merging this in rather */
/* than overwriting everything that was there. */
/* -------------------------------------------------------------------- */
char **papszMD = poAuxDS->GetMetadata();
if( CSLCount(papszMD) > 0 )
{
char **papszMerged =
CSLMerge( CSLDuplicate(GetMetadata()), papszMD );
GDALPamDataset::SetMetadata( papszMerged );
CSLDestroy( papszMerged );
}
papszMD = poAuxDS->GetMetadata("XFORMS");
if( CSLCount(papszMD) > 0 )
{
char **papszMerged =
CSLMerge( CSLDuplicate(GetMetadata("XFORMS")), papszMD );
GDALPamDataset::SetMetadata( papszMerged, "XFORMS" );
CSLDestroy( papszMerged );
}
/* ==================================================================== */
/* Process bands. */
/* ==================================================================== */
int iBand;
for( iBand = 0; iBand < poAuxDS->GetRasterCount(); iBand++ )
{
if( iBand >= GetRasterCount() )
break;
GDALRasterBand *poAuxBand = poAuxDS->GetRasterBand( iBand+1 );
GDALRasterBand *poBand = GetRasterBand( iBand+1 );
papszMD = poAuxBand->GetMetadata();
if( CSLCount(papszMD) > 0 )
{
char **papszMerged =
CSLMerge( CSLDuplicate(poBand->GetMetadata()), papszMD );
poBand->SetMetadata( papszMerged );
CSLDestroy( papszMerged );
}
if( poAuxBand->GetCategoryNames() != NULL )
poBand->SetCategoryNames( poAuxBand->GetCategoryNames() );
if( poAuxBand->GetColorTable() != NULL
&& poBand->GetColorTable() == NULL )
poBand->SetColorTable( poAuxBand->GetColorTable() );
// histograms?
double dfMin, dfMax;
int nBuckets, *panHistogram=NULL;
if( poAuxBand->GetDefaultHistogram( &dfMin, &dfMax,
&nBuckets, &panHistogram,
FALSE, NULL, NULL ) == CE_None )
{
poBand->SetDefaultHistogram( dfMin, dfMax, nBuckets,
panHistogram );
CPLFree( panHistogram );
}
// RAT
if( poAuxBand->GetDefaultRAT() != NULL )
poBand->SetDefaultRAT( poAuxBand->GetDefaultRAT() );
// NoData
int bSuccess = FALSE;
double dfNoDataValue = poAuxBand->GetNoDataValue( &bSuccess );
if( bSuccess )
poBand->SetNoDataValue( dfNoDataValue );
}
GDALClose( poAuxDS );
/* -------------------------------------------------------------------- */
/* Mark PAM info as clean. */
/* -------------------------------------------------------------------- */
nPamFlags &= ~GPF_DIRTY;
return CE_Failure;
}