本文整理汇总了C++中VRTDataset::CreateMaskBand方法的典型用法代码示例。如果您正苦于以下问题:C++ VRTDataset::CreateMaskBand方法的具体用法?C++ VRTDataset::CreateMaskBand怎么用?C++ VRTDataset::CreateMaskBand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VRTDataset
的用法示例。
在下文中一共展示了VRTDataset::CreateMaskBand方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateMaskBand
CPLErr VRTRasterBand::CreateMaskBand( int nFlags )
{
VRTDataset* poGDS = (VRTDataset *)poDS;
if (poGDS->poMaskBand)
{
CPLError( CE_Failure, CPLE_AppDefined,
"Cannot create mask band at raster band level when a dataset mask band already exists." );
return CE_Failure;
}
if (poMaskBand != NULL)
{
CPLError(CE_Failure, CPLE_AppDefined,
"This VRT band has already a mask band");
return CE_Failure;
}
if ((nFlags & GMF_PER_DATASET) != 0)
return poGDS->CreateMaskBand(nFlags);
SetMaskBand(new VRTSourcedRasterBand( poGDS, 0 ));
return CE_None;
}
示例2: ProxyMain
//.........这里部分代码省略.........
case GDT_Int32:
CLAMP(dfVal, GInt32, -2147483648.0, 2147483647.0);
break;
case GDT_UInt32:
CLAMP(dfVal, GUInt32, 0.0, 4294967295.0);
break;
default:
break;
}
if (bClamped)
{
printf("for band %d, nodata value has been clamped "
"to %.0f, the original value being out of range.\n",
i + 1, dfVal);
}
else if (bRounded)
{
printf("for band %d, nodata value has been rounded "
"to %.0f, %s being an integer datatype.\n",
i + 1, dfVal,
GDALGetDataTypeName(eBandType));
}
poVRTBand->SetNoDataValue(dfVal);
}
if (eMaskMode == MASK_AUTO &&
(GDALGetMaskFlags(GDALGetRasterBand(hDataset, 1)) & GMF_PER_DATASET) == 0 &&
(poSrcBand->GetMaskFlags() & (GMF_ALL_VALID | GMF_NODATA)) == 0)
{
if (poVRTBand->CreateMaskBand(poSrcBand->GetMaskFlags()) == CE_None)
{
VRTSourcedRasterBand *hMaskVRTBand =
(VRTSourcedRasterBand*)poVRTBand->GetMaskBand();
hMaskVRTBand->AddMaskBandSource(poSrcBand,
anSrcWin[0], anSrcWin[1],
anSrcWin[2], anSrcWin[3],
0, 0, nOXSize, nOYSize);
}
}
}
if (eMaskMode == MASK_USER)
{
GDALRasterBand *poSrcBand =
(GDALRasterBand*)GDALGetRasterBand(hDataset, ABS(nMaskBand));
if (poSrcBand && poVDS->CreateMaskBand(GMF_PER_DATASET) == CE_None)
{
VRTSourcedRasterBand *hMaskVRTBand = (VRTSourcedRasterBand*)
GDALGetMaskBand(GDALGetRasterBand((GDALDatasetH)poVDS, 1));
if (nMaskBand > 0)
hMaskVRTBand->AddSimpleSource(poSrcBand,
anSrcWin[0], anSrcWin[1],
anSrcWin[2], anSrcWin[3],
0, 0, nOXSize, nOYSize);
else
hMaskVRTBand->AddMaskBandSource(poSrcBand,
anSrcWin[0], anSrcWin[1],
anSrcWin[2], anSrcWin[3],
0, 0, nOXSize, nOYSize);
}
}
else if (eMaskMode == MASK_AUTO && nSrcBandCount > 0 &&