本文整理汇总了C++中GDALRasterBand::SetMetadata方法的典型用法代码示例。如果您正苦于以下问题:C++ GDALRasterBand::SetMetadata方法的具体用法?C++ GDALRasterBand::SetMetadata怎么用?C++ GDALRasterBand::SetMetadata使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GDALRasterBand
的用法示例。
在下文中一共展示了GDALRasterBand::SetMetadata方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TryLoadAux
CPLErr GDALPamDataset::TryLoadAux()
{
/* -------------------------------------------------------------------- */
/* Initialize PAM. */
/* -------------------------------------------------------------------- */
PamInitialize();
if( psPam == NULL )
return CE_None;
/* -------------------------------------------------------------------- */
/* What is the name of the physical file we are referencing? */
/* We allow an override via the psPam->pszPhysicalFile item. */
/* -------------------------------------------------------------------- */
const char *pszPhysicalFile = psPam->osPhysicalFilename;
if( strlen(pszPhysicalFile) == 0 && GetDescription() != NULL )
pszPhysicalFile = GetDescription();
if( strlen(pszPhysicalFile) == 0 )
return CE_None;
/* -------------------------------------------------------------------- */
/* Try to open .aux file. */
/* -------------------------------------------------------------------- */
GDALDataset *poAuxDS = GDALFindAssociatedAuxFile( pszPhysicalFile,
GA_ReadOnly, this );
if( poAuxDS == NULL )
return CE_None;
/* -------------------------------------------------------------------- */
/* Do we have an SRS on the aux file? */
/* -------------------------------------------------------------------- */
if( strlen(poAuxDS->GetProjectionRef()) > 0 )
GDALPamDataset::SetProjection( poAuxDS->GetProjectionRef() );
/* -------------------------------------------------------------------- */
/* 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() );
//.........这里部分代码省略.........