本文整理汇总了C++中OGRGeometryCollection::removeGeometry方法的典型用法代码示例。如果您正苦于以下问题:C++ OGRGeometryCollection::removeGeometry方法的具体用法?C++ OGRGeometryCollection::removeGeometry怎么用?C++ OGRGeometryCollection::removeGeometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OGRGeometryCollection
的用法示例。
在下文中一共展示了OGRGeometryCollection::removeGeometry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OGRMultiPolygon
OGRGeometry *OGRGeometryFactory::forceToMultiPolygon( OGRGeometry *poGeom )
{
if( poGeom == NULL )
return NULL;
/* -------------------------------------------------------------------- */
/* Check for the case of a geometrycollection that can be */
/* promoted to MultiPolygon. */
/* -------------------------------------------------------------------- */
if( wkbFlatten(poGeom->getGeometryType()) == wkbGeometryCollection )
{
int iGeom;
int bAllPoly = TRUE;
OGRGeometryCollection *poGC = (OGRGeometryCollection *) poGeom;
for( iGeom = 0; iGeom < poGC->getNumGeometries(); iGeom++ )
{
if( wkbFlatten(poGC->getGeometryRef(iGeom)->getGeometryType())
!= wkbPolygon )
bAllPoly = FALSE;
}
if( !bAllPoly )
return poGeom;
OGRMultiPolygon *poMP = new OGRMultiPolygon();
while( poGC->getNumGeometries() > 0 )
{
poMP->addGeometryDirectly( poGC->getGeometryRef(0) );
poGC->removeGeometry( 0, FALSE );
}
delete poGC;
return poMP;
}
/* -------------------------------------------------------------------- */
/* Eventually we should try to split the polygon into component */
/* island polygons. But thats alot of work and can be put off. */
/* -------------------------------------------------------------------- */
if( wkbFlatten(poGeom->getGeometryType()) != wkbPolygon )
return poGeom;
OGRMultiPolygon *poMP = new OGRMultiPolygon();
poMP->addGeometryDirectly( poGeom );
return poMP;
}
示例2: OGRMultiLineString
OGRGeometry *OGRGeometryFactory::forceToMultiLineString( OGRGeometry *poGeom )
{
if( poGeom == NULL )
return NULL;
/* -------------------------------------------------------------------- */
/* Check for the case of a geometrycollection that can be */
/* promoted to MultiLineString. */
/* -------------------------------------------------------------------- */
if( wkbFlatten(poGeom->getGeometryType()) == wkbGeometryCollection )
{
int iGeom;
int bAllLines = TRUE;
OGRGeometryCollection *poGC = (OGRGeometryCollection *) poGeom;
for( iGeom = 0; iGeom < poGC->getNumGeometries(); iGeom++ )
{
if( wkbFlatten(poGC->getGeometryRef(iGeom)->getGeometryType())
!= wkbLineString )
bAllLines = FALSE;
}
if( !bAllLines )
return poGeom;
OGRMultiLineString *poMP = new OGRMultiLineString();
while( poGC->getNumGeometries() > 0 )
{
poMP->addGeometryDirectly( poGC->getGeometryRef(0) );
poGC->removeGeometry( 0, FALSE );
}
delete poGC;
return poMP;
}
if( wkbFlatten(poGeom->getGeometryType()) != wkbLineString )
return poGeom;
OGRMultiLineString *poMP = new OGRMultiLineString();
poMP->addGeometryDirectly( poGeom );
return poMP;
}