本文整理汇总了C++中OGRGeometry::IsMeasured方法的典型用法代码示例。如果您正苦于以下问题:C++ OGRGeometry::IsMeasured方法的具体用法?C++ OGRGeometry::IsMeasured怎么用?C++ OGRGeometry::IsMeasured使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OGRGeometry
的用法示例。
在下文中一共展示了OGRGeometry::IsMeasured方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: importFromWktInternal
OGRErr OGRGeometryCollection::importFromWktInternal( const char ** ppszInput,
int nRecLevel )
{
// Arbitrary value, but certainly large enough for reasonable usages.
if( nRecLevel == 32 )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Too many recursion levels (%d) while parsing WKT geometry.",
nRecLevel );
return OGRERR_CORRUPT_DATA;
}
int bHasZ = FALSE;
int bHasM = FALSE;
bool bIsEmpty = false;
OGRErr eErr = importPreambleFromWkt(ppszInput, &bHasZ, &bHasM, &bIsEmpty);
if( eErr != OGRERR_NONE )
return eErr;
if( bHasZ ) flags |= OGR_G_3D;
if( bHasM ) flags |= OGR_G_MEASURED;
if( bIsEmpty )
return OGRERR_NONE;
char szToken[OGR_WKT_TOKEN_MAX] = {};
const char *pszInput = *ppszInput;
// Skip first '('.
pszInput = OGRWktReadToken( pszInput, szToken );
/* ==================================================================== */
/* Read each subgeometry in turn. */
/* ==================================================================== */
do
{
OGRGeometry *poGeom = nullptr;
/* -------------------------------------------------------------------- */
/* Get the first token, which should be the geometry type. */
/* -------------------------------------------------------------------- */
OGRWktReadToken( pszInput, szToken );
/* -------------------------------------------------------------------- */
/* Do the import. */
/* -------------------------------------------------------------------- */
if( STARTS_WITH_CI(szToken, "GEOMETRYCOLLECTION") )
{
OGRGeometryCollection* poGC = new OGRGeometryCollection();
poGeom = poGC;
eErr = poGC->importFromWktInternal( &pszInput,
nRecLevel + 1 );
}
else
eErr = OGRGeometryFactory::createFromWkt( &pszInput,
nullptr, &poGeom );
if( eErr == OGRERR_NONE )
{
// If this has M, but not Z, it is an error if poGeom does
// not have M.
if( !Is3D() && IsMeasured() && !poGeom->IsMeasured() )
eErr = OGRERR_CORRUPT_DATA;
else
eErr = addGeometryDirectly( poGeom );
}
if( eErr != OGRERR_NONE )
{
delete poGeom;
return eErr;
}
/* -------------------------------------------------------------------- */
/* Read the delimiter following the ring. */
/* -------------------------------------------------------------------- */
pszInput = OGRWktReadToken( pszInput, szToken );
} while( szToken[0] == ',' );
/* -------------------------------------------------------------------- */
/* freak if we don't get a closing bracket. */
/* -------------------------------------------------------------------- */
if( szToken[0] != ')' )
return OGRERR_CORRUPT_DATA;
*ppszInput = pszInput;
return OGRERR_NONE;
}