本文整理汇总了C++中VRTDataset::SetMaskBand方法的典型用法代码示例。如果您正苦于以下问题:C++ VRTDataset::SetMaskBand方法的具体用法?C++ VRTDataset::SetMaskBand怎么用?C++ VRTDataset::SetMaskBand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VRTDataset
的用法示例。
在下文中一共展示了VRTDataset::SetMaskBand方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CPLAssert
//.........这里部分代码省略.........
{
poVRTDS->SetGeoTransform( adfGeoTransform );
}
/* -------------------------------------------------------------------- */
/* Copy projection */
/* -------------------------------------------------------------------- */
poVRTDS->SetProjection( poSrcDS->GetProjectionRef() );
/* -------------------------------------------------------------------- */
/* Emit dataset level metadata. */
/* -------------------------------------------------------------------- */
poVRTDS->SetMetadata( poSrcDS->GetMetadata() );
/* -------------------------------------------------------------------- */
/* Copy any special domains that should be transportable. */
/* -------------------------------------------------------------------- */
char **papszMD = poSrcDS->GetMetadata( "RPC" );
if( papszMD )
poVRTDS->SetMetadata( papszMD, "RPC" );
papszMD = poSrcDS->GetMetadata( "IMD" );
if( papszMD )
poVRTDS->SetMetadata( papszMD, "IMD" );
papszMD = poSrcDS->GetMetadata( "GEOLOCATION" );
if( papszMD )
poVRTDS->SetMetadata( papszMD, "GEOLOCATION" );
/* -------------------------------------------------------------------- */
/* GCPs */
/* -------------------------------------------------------------------- */
if( poSrcDS->GetGCPCount() > 0 )
{
poVRTDS->SetGCPs( poSrcDS->GetGCPCount(),
poSrcDS->GetGCPs(),
poSrcDS->GetGCPProjection() );
}
/* -------------------------------------------------------------------- */
/* Loop over all the bands. */
/* -------------------------------------------------------------------- */
for( int iBand = 0; iBand < poSrcDS->GetRasterCount(); iBand++ )
{
GDALRasterBand *poSrcBand = poSrcDS->GetRasterBand( iBand+1 );
/* -------------------------------------------------------------------- */
/* Create the band with the appropriate band type. */
/* -------------------------------------------------------------------- */
poVRTDS->AddBand( poSrcBand->GetRasterDataType(), NULL );
VRTSourcedRasterBand *poVRTBand
= reinterpret_cast<VRTSourcedRasterBand *>(
poVRTDS->GetRasterBand( iBand+1 ) );
/* -------------------------------------------------------------------- */
/* Setup source mapping. */
/* -------------------------------------------------------------------- */
poVRTBand->AddSimpleSource( poSrcBand );
/* -------------------------------------------------------------------- */
/* Emit various band level metadata. */
/* -------------------------------------------------------------------- */
poVRTBand->CopyCommonInfoFrom( poSrcBand );
/* -------------------------------------------------------------------- */
/* Add specific mask band. */
/* -------------------------------------------------------------------- */
if( (poSrcBand->GetMaskFlags()
& (GMF_PER_DATASET | GMF_ALL_VALID | GMF_NODATA)) == 0)
{
VRTSourcedRasterBand* poVRTMaskBand = new VRTSourcedRasterBand(
poVRTDS, 0,
poSrcBand->GetMaskBand()->GetRasterDataType(),
poSrcDS->GetRasterXSize(), poSrcDS->GetRasterYSize());
poVRTMaskBand->AddMaskBandSource( poSrcBand );
poVRTBand->SetMaskBand( poVRTMaskBand );
}
}
/* -------------------------------------------------------------------- */
/* Add dataset mask band */
/* -------------------------------------------------------------------- */
if( poSrcDS->GetRasterCount() != 0 &&
poSrcDS->GetRasterBand(1) != NULL &&
poSrcDS->GetRasterBand(1)->GetMaskFlags() == GMF_PER_DATASET )
{
GDALRasterBand *poSrcBand = poSrcDS->GetRasterBand(1);
VRTSourcedRasterBand* poVRTMaskBand = new VRTSourcedRasterBand(
poVRTDS, 0,
poSrcBand->GetMaskBand()->GetRasterDataType(),
poSrcDS->GetRasterXSize(), poSrcDS->GetRasterYSize() );
poVRTMaskBand->AddMaskBandSource( poSrcBand );
poVRTDS->SetMaskBand( poVRTMaskBand );
}
poVRTDS->FlushCache();
return poVRTDS;
}