Navigation Menu

Skip to content

Commit

Permalink
Applied patch #1290 with modifications
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11257 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Aug 3, 2009
1 parent e321aa8 commit 3110fef
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/qgsvectordataprovider.cpp
Expand Up @@ -28,7 +28,7 @@
QgsVectorDataProvider::QgsVectorDataProvider( QString uri )
: QgsDataProvider( uri ),
mCacheMinMaxDirty( TRUE ),
mFetchFeaturesWithoutGeom( FALSE )
mFetchFeaturesWithoutGeom( TRUE )
{
QSettings settings;
setEncoding( settings.value( "/UI/encoding", QString( "System" ) ).toString() );
Expand Down
26 changes: 24 additions & 2 deletions src/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -318,11 +318,19 @@ bool QgsOgrProvider::featureAtId( int featureId,
return false;

feature.setFeatureId( OGR_F_GetFID( fet ) );
// skip features without geometry
if ( OGR_F_GetGeometryRef( fet ) == NULL && !mFetchFeaturesWithoutGeom )
{
OGR_F_Destroy( fet );
return false;
}


/* fetch geometry */
if ( fetchGeometry )
{
OGRGeometryH geom = OGR_F_GetGeometryRef( fet );
// skip features without geometry

// get the wkb representation
unsigned char *wkb = new unsigned char[OGR_G_WkbSize( geom )];
Expand All @@ -337,8 +345,15 @@ bool QgsOgrProvider::featureAtId( int featureId,
getFeatureAttribute( fet, feature, *it );
}

if ( OGR_F_GetGeometryRef( fet ) != NULL )
{
feature.setValid( true );
}
else
{
feature.setValid( false );
}
OGR_F_Destroy( fet );
feature.setValid( true );
return true;
}

Expand Down Expand Up @@ -414,8 +429,15 @@ bool QgsOgrProvider::nextFeature( QgsFeature& feature )

if ( fet )
{
if ( OGR_F_GetGeometryRef( fet ) != NULL )
{
feature.setValid( true );
}
else
{
feature.setValid( false );
}
OGR_F_Destroy( fet );
feature.setValid( true );
return true;
}
else
Expand Down

0 comments on commit 3110fef

Please sign in to comment.