[gdal-dev] Using OGRLayer::GetNextFeature() to read Dgn file ?
taibc
taibc_coltech at yahoo.com
Fri Jun 14 01:02:32 PDT 2013
Hi everyone,
I am trying read features in a dgn file and convert to shape file.
Everything is ok before I adding the last while loop. After adding this
while loop, I can't exit the program. Please see my below codes.
Do you know why ?
OGRRegisterAll();
OGRDataSource *poDS, *poSHPDS;
OGRLayer *poLayer;
poLayer = poDS->GetLayer(0);
...
OGRFeature *poFeature;
while( (poFeature = poLayer->GetNextFeature()) != NULL )
{
OGRGeometry *poGeometry;
poGeometry = poFeature->GetGeometryRef();
if( poGeometry != NULL && (wkbFlatten(poGeometry->getGeometryType()) ==
wkbPolygon) && (poFeature->GetFieldAsInteger ("Level") == 62)
&& (strstr(poFeature->GetStyleString (), "BRUSH") != NULL))
{
poLayer->SetSpatialFilter(poGeometry);
// .............
// .............
OGRFeature *poTempFeature;
while((poTempFeature = poLayer->GetNextFeature()) != NULL)
{
if ((poTempFeature->GetGeometryRef () != NULL) &&
(poTempFeature->GetGeometryRef()->getGeometryType() == wkbPolygon)
&& (strstr(poTempFeature->GetStyleString (),
"BRUSH") != NULL)
&& poTempFeature->GetGeometryRef
()->Within(poGeometry)
{
poLayer->SetSpatialFilter(poTempFeature->GetGeometryRef
());
.....
OGRFeature *poSubFeature;
while ((poSubFeature = poLayer->GetNextFeature ()) !=
NULL)
{
// do something
// Can't exit the programe after adding this while
loop
}
}
}
}
}
Thanks and regards,
Tai
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Using-OGRLayer-GetNextFeature-to-read-Dgn-file-tp5060084.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
More information about the gdal-dev
mailing list