Skip to content
Permalink
Browse files

Merge remote-tracking branch 'origin/Issue_9062' into Issue_8725-OGR

  • Loading branch information
ahuarte47 committed Nov 13, 2013
2 parents 2f35a7b + d3cd331 commit 92c6751c4744798c87f12b95a3f4b5c54120768c
Showing with 25 additions and 0 deletions.
  1. +25 −0 src/providers/ogr/qgsogrfeatureiterator.cpp
@@ -91,6 +91,31 @@ void QgsOgrFeatureIterator::ensureRelevantFields()
{
mFetchGeometry = ( mRequest.filterType() == QgsFeatureRequest::FilterRect ) || !( mRequest.flags() & QgsFeatureRequest::NoGeometry );
QgsAttributeList attrs = ( mRequest.flags() & QgsFeatureRequest::SubsetOfAttributes ) ? mRequest.subsetOfAttributes() : P->attributeIndexes();

// Assigns to Layer managed the relevant fields of the current FeatureRequest.
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1800
if ( OGR_L_TestCapability( ogrLayer, OLCIgnoreFields ) )
{
QVector<const char*> ignoredFields;
OGRFeatureDefnH featDefn = OGR_L_GetLayerDefn( ogrLayer );

for ( int i = 0, fieldCount = OGR_FD_GetFieldCount( featDefn ); i < fieldCount; i++ )
{
if ( !attrs.contains( i ) )
{
// add to ignored fields
ignoredFields.append( OGR_Fld_GetNameRef( OGR_FD_GetFieldDefn( featDefn, i ) ) );
}
}

if ( !mFetchGeometry ) ignoredFields.append( "OGR_GEOMETRY" );
ignoredFields.append( "OGR_STYLE" ); // not used by QGIS
ignoredFields.append( NULL );

OGR_L_SetIgnoredFields( ogrLayer, ignoredFields.data() );
}
#endif

P->setRelevantFields( mFetchGeometry, attrs );
P->mRelevantFieldsForNextFeature = true;
}

0 comments on commit 92c6751

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