本文整理汇总了C++中CPLStringList::size方法的典型用法代码示例。如果您正苦于以下问题:C++ CPLStringList::size方法的具体用法?C++ CPLStringList::size怎么用?C++ CPLStringList::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPLStringList
的用法示例。
在下文中一共展示了CPLStringList::size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GDALOpenVerticalShiftGrid
/** Load proj.4 geoidgrids as GDAL dataset
*
* @param pszProj4Geoidgrids Value of proj.4 geoidgrids parameter.
* @param pbError If not NULL, the pointed value will be set to TRUE if an
* error occurred.
*
* @return a dataset. If not NULL, it must be closed with GDALClose().
*
* @since GDAL 2.2
*/
GDALDatasetH GDALOpenVerticalShiftGrid( const char* pszProj4Geoidgrids,
int* pbError )
{
char** papszGrids = CSLTokenizeString2( pszProj4Geoidgrids, ",", 0);
const int nGridCount = CSLCount(papszGrids);
if( nGridCount == 1 )
{
CSLDestroy(papszGrids);
bool bMissingOk = false;
if( *pszProj4Geoidgrids == '@' )
{
pszProj4Geoidgrids ++;
bMissingOk = true;
}
const CPLString osFilename(GetProj4Filename(pszProj4Geoidgrids));
const char* const papszOpenOptions[] =
{ "@SHIFT_ORIGIN_IN_MINUS_180_PLUS_180=YES", nullptr };
GDALDatasetH hDS = GDALOpenEx(osFilename, 0, nullptr, papszOpenOptions, nullptr);
if( hDS == nullptr )
{
CPLDebug("GDAL", "Cannot find file corresponding to %s",
pszProj4Geoidgrids);
}
if( pbError )
*pbError = (!bMissingOk && hDS == nullptr);
return hDS;
}
CPLStringList aosFilenames;
for( int i = nGridCount - 1; i >= 0; i-- )
{
const char* pszName = papszGrids[i];
bool bMissingOk = false;
if( *pszName == '@' )
{
pszName ++;
bMissingOk = true;
}
const CPLString osFilename(GetProj4Filename(pszName));
VSIStatBufL sStat;
if( osFilename.empty() || VSIStatL(osFilename, &sStat) != 0 )
{
CPLDebug("GDAL", "Cannot find file corresponding to %s",
pszName);
if( !bMissingOk )
{
if( pbError )
*pbError = true;
CSLDestroy(papszGrids);
return nullptr;
}
}
else
{
aosFilenames.AddString(osFilename);
}
}
CSLDestroy(papszGrids);
if( aosFilenames.empty() )
{
if( pbError )
*pbError = false;
return nullptr;
}
char** papszArgv = nullptr;
papszArgv = CSLAddString(papszArgv, "-resolution");
papszArgv = CSLAddString(papszArgv, "highest");
papszArgv = CSLAddString(papszArgv, "-vrtnodata");
papszArgv = CSLAddString(papszArgv, "-inf");
papszArgv = CSLAddString(papszArgv, "-oo");
papszArgv = CSLAddString(papszArgv, "@SHIFT_ORIGIN_IN_MINUS_180_PLUS_180=YES");
GDALBuildVRTOptions* psOptions = GDALBuildVRTOptionsNew(papszArgv, nullptr);
CSLDestroy(papszArgv);
GDALDatasetH hDS =
GDALBuildVRT( "", aosFilenames.size(), nullptr, aosFilenames.List(),
psOptions, nullptr );
GDALBuildVRTOptionsFree( psOptions );
if( pbError )
*pbError = hDS != nullptr;
return hDS;
}