本文整理汇总了C++中VRTDataset::GetRasterCount方法的典型用法代码示例。如果您正苦于以下问题:C++ VRTDataset::GetRasterCount方法的具体用法?C++ VRTDataset::GetRasterCount怎么用?C++ VRTDataset::GetRasterCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VRTDataset
的用法示例。
在下文中一共展示了VRTDataset::GetRasterCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProxyMain
//.........这里部分代码省略.........
if (strcmp(pszSource, pszDest) == 0)
{
fprintf(stderr, "Source and destination datasets must be different.\n");
GDALDestroyDriverManager();
exit(1);
}
if (strcmp(pszDest, "/vsistdout/") == 0)
{
bQuiet = TRUE;
pfnProgress = GDALDummyProgress;
}
/* -------------------------------------------------------------------- */
/* Attempt to open source file. */
/* -------------------------------------------------------------------- */
hDataset = GDALOpenShared(pszSource, GA_ReadOnly);
if (hDataset == NULL)
{
fprintf(stderr,
"GDALOpen failed - %d\n%s\n",
CPLGetLastErrorNo(), CPLGetLastErrorMsg());
GDALDestroyDriverManager();
exit(1);
}
/* -------------------------------------------------------------------- */
/* Handle subdatasets. */
/* -------------------------------------------------------------------- */
if (!bCopySubDatasets
&& CSLCount(GDALGetMetadata(hDataset, "SUBDATASETS")) > 0
&& GDALGetRasterCount(hDataset) == 0)
{
fprintf(stderr,
"Input file contains subdatasets. Please, select one of them for reading.\n");
GDALClose(hDataset);
GDALDestroyDriverManager();
exit(1);
}
if (CSLCount(GDALGetMetadata(hDataset, "SUBDATASETS")) > 0
&& bCopySubDatasets)
{
char **papszSubdatasets = GDALGetMetadata(hDataset, "SUBDATASETS");
char *pszSubDest = (char*) CPLMalloc(strlen(pszDest) + 32);
int i;
int bOldSubCall = bSubCall;
char **papszDupArgv = CSLDuplicate(argv);
int nRet = 0;
CPLFree(papszDupArgv[iDstFileArg]);
papszDupArgv[iDstFileArg] = pszSubDest;
bSubCall = TRUE;
for (i = 0; papszSubdatasets[i] != NULL; i += 2)
{
CPLFree(papszDupArgv[iSrcFileArg]);
papszDupArgv[iSrcFileArg] = CPLStrdup(strstr(papszSubdatasets[i], "=") + 1);
sprintf(pszSubDest, "%s%d", pszDest, i / 2 + 1);
nRet = ProxyMain(argc, papszDupArgv);
if (nRet != 0)
break;
}