Skip to content
Permalink
Browse files

Applied patch #1290 with modifications

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11257 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Aug 3, 2009
1 parent e321aa8 commit 3110fef93591a98be40154a793ccacded34973cd
Showing with 25 additions and 3 deletions.
  1. +1 −1 src/core/qgsvectordataprovider.cpp
  2. +24 −2 src/providers/ogr/qgsogrprovider.cpp
@@ -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() );
@@ -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 )];
@@ -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;
}

@@ -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

0 comments on commit 3110fef

Please sign in to comment.
You can’t perform that action at this time.