Skip to content
Permalink
Browse files

fix #3542

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15395 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Mar 8, 2011
1 parent 3f71eaa commit 772bd2f6100b66087cb01d10ae83ad9efd5ccc22
Showing with 9 additions and 8 deletions.
  1. +7 −6 src/providers/ogr/qgsogrprovider.cpp
  2. +2 −2 src/providers/ogr/qgsogrprovider.h
@@ -416,7 +416,7 @@ QString QgsOgrProvider::storageType() const
return ogrDriverName;
}

void QgsOgrProvider::setIgnoredFields( bool fetchGeometry, const QgsAttributeList& fetchAttributes )
void QgsOgrProvider::setRelevantFields( bool fetchGeometry, const QgsAttributeList &fetchAttributes )
{
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1800
if ( OGR_L_TestCapability( ogrLayer, OLCIgnoreFields ) )
@@ -447,7 +447,7 @@ bool QgsOgrProvider::featureAtId( int featureId,
bool fetchGeometry,
QgsAttributeList fetchAttributes )
{
setIgnoredFields( fetchGeometry, fetchAttributes );
setRelevantFields( fetchGeometry, fetchAttributes );

OGRFeatureH fet = OGR_L_GetFeature( ogrLayer, featureId );
if ( fet == NULL )
@@ -462,7 +462,6 @@ bool QgsOgrProvider::featureAtId( int featureId,
return false;
}


/* fetch geometry */
if ( fetchGeometry )
{
@@ -633,7 +632,7 @@ void QgsOgrProvider::select( QgsAttributeList fetchAttributes, QgsRectangle rect
OGR_G_DestroyGeometry( filter );
}

setIgnoredFields( fetchGeometry, fetchAttributes );
setRelevantFields( fetchGeometry, fetchAttributes );

//start with first feature
OGR_L_ResetReading( ogrLayer );
@@ -875,6 +874,8 @@ bool QgsOgrProvider::addFeature( QgsFeature& f )

bool QgsOgrProvider::addFeatures( QgsFeatureList & flist )
{
setRelevantFields( true, mAttributeFields.keys() );

bool returnvalue = true;
for ( QgsFeatureList::iterator it = flist.begin(); it != flist.end(); ++it )
{
@@ -943,7 +944,7 @@ bool QgsOgrProvider::changeAttributeValues( const QgsChangedAttributesMap & attr

clearMinMaxCache();

setIgnoredFields( true, QgsAttributeList() );
setRelevantFields( true, mAttributeFields.keys() );

for ( QgsChangedAttributesMap::const_iterator it = attr_map.begin(); it != attr_map.end(); ++it )
{
@@ -1014,7 +1015,7 @@ bool QgsOgrProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
OGRFeatureH theOGRFeature = 0;
OGRGeometryH theNewGeometry = 0;

setIgnoredFields( true, QgsAttributeList() );
setRelevantFields( true, mAttributeFields.keys() );

for ( QgsGeometryMap::iterator it = geometry_map.begin(); it != geometry_map.end(); ++it )
{
@@ -251,8 +251,8 @@ class QgsOgrProvider : public QgsVectorDataProvider
/** find out the number of features of the whole layer */
void recalculateFeatureCount();

/** tell OGR which fields not to fetch in nextFeature/featureAtId */
void setIgnoredFields( bool fetchGeometry, const QgsAttributeList& fetchAttributes );
/** tell OGR, which fields to fetch in nextFeature/featureAtId (ie. which not to ignore) */
void setRelevantFields( bool fetchGeometry, const QgsAttributeList& fetchAttributes );

private:
unsigned char *getGeometryPointer( OGRFeatureH fet );

0 comments on commit 772bd2f

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