本文整理汇总了C++中OGRGeometry::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ OGRGeometry::empty方法的具体用法?C++ OGRGeometry::empty怎么用?C++ OGRGeometry::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OGRGeometry
的用法示例。
在下文中一共展示了OGRGeometry::empty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: importFromWkt_Bracketed
OGRErr OGRMultiPoint::importFromWkt_Bracketed( char ** ppszInput, int bHasM, int bHasZ )
{
char szToken[OGR_WKT_TOKEN_MAX];
const char *pszInput = *ppszInput;
OGRErr eErr = OGRERR_NONE;
/* -------------------------------------------------------------------- */
/* Skip MULTIPOINT keyword. */
/* -------------------------------------------------------------------- */
pszInput = OGRWktReadToken( pszInput, szToken );
if (bHasZ || bHasM)
{
/* Skip Z, M or ZM */
pszInput = OGRWktReadToken( pszInput, szToken );
}
/* -------------------------------------------------------------------- */
/* Read points till we get to the closing bracket. */
/* -------------------------------------------------------------------- */
int nMaxPoint = 0;
int nPointCount = 0;
OGRRawPoint *paoPoints = NULL;
double *padfZ = NULL;
while( (pszInput = OGRWktReadToken( pszInput, szToken )) != NULL
&& (EQUAL(szToken,"(") || EQUAL(szToken,",")) )
{
OGRGeometry *poGeom;
const char* pszNext = OGRWktReadToken( pszInput, szToken );
if (EQUAL(szToken,"EMPTY"))
{
poGeom = new OGRPoint(0,0);
poGeom->empty();
eErr = addGeometryDirectly( poGeom );
if( eErr != OGRERR_NONE )
return eErr;
pszInput = pszNext;
continue;
}
pszInput = OGRWktReadPoints( pszInput, &paoPoints, &padfZ, &nMaxPoint,
&nPointCount );
if( pszInput == NULL || nPointCount != 1 )
{
OGRFree( paoPoints );
OGRFree( padfZ );
return OGRERR_CORRUPT_DATA;
}
/* Ignore Z array when we have a MULTIPOINT M */
if( padfZ && !(bHasM && !bHasZ))
poGeom = new OGRPoint( paoPoints[0].x,
paoPoints[0].y,
padfZ[0] );
else
poGeom = new OGRPoint( paoPoints[0].x,
paoPoints[0].y );
eErr = addGeometryDirectly( poGeom );
if( eErr != OGRERR_NONE )
return eErr;
}
/* -------------------------------------------------------------------- */
/* Cleanup. */
/* -------------------------------------------------------------------- */
OGRFree( paoPoints );
if( padfZ )
OGRFree( padfZ );
if( !EQUAL(szToken,")") )
return OGRERR_CORRUPT_DATA;
*ppszInput = (char *) pszInput;
return OGRERR_NONE;
}