mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Applied patch #1290 with modifications
git-svn-id: http://svn.osgeo.org/qgis/trunk@11257 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
37fef1b145
commit
a0addcee64
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user