Skip to content

Commit 92c6751

Browse files
committedNov 13, 2013
Merge remote-tracking branch 'origin/Issue_9062' into Issue_8725-OGR
2 parents 2f35a7b + d3cd331 commit 92c6751

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
 

‎src/providers/ogr/qgsogrfeatureiterator.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,31 @@ void QgsOgrFeatureIterator::ensureRelevantFields()
9191
{
9292
mFetchGeometry = ( mRequest.filterType() == QgsFeatureRequest::FilterRect ) || !( mRequest.flags() & QgsFeatureRequest::NoGeometry );
9393
QgsAttributeList attrs = ( mRequest.flags() & QgsFeatureRequest::SubsetOfAttributes ) ? mRequest.subsetOfAttributes() : P->attributeIndexes();
94+
95+
// Assigns to Layer managed the relevant fields of the current FeatureRequest.
96+
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1800
97+
if ( OGR_L_TestCapability( ogrLayer, OLCIgnoreFields ) )
98+
{
99+
QVector<const char*> ignoredFields;
100+
OGRFeatureDefnH featDefn = OGR_L_GetLayerDefn( ogrLayer );
101+
102+
for ( int i = 0, fieldCount = OGR_FD_GetFieldCount( featDefn ); i < fieldCount; i++ )
103+
{
104+
if ( !attrs.contains( i ) )
105+
{
106+
// add to ignored fields
107+
ignoredFields.append( OGR_Fld_GetNameRef( OGR_FD_GetFieldDefn( featDefn, i ) ) );
108+
}
109+
}
110+
111+
if ( !mFetchGeometry ) ignoredFields.append( "OGR_GEOMETRY" );
112+
ignoredFields.append( "OGR_STYLE" ); // not used by QGIS
113+
ignoredFields.append( NULL );
114+
115+
OGR_L_SetIgnoredFields( ogrLayer, ignoredFields.data() );
116+
}
117+
#endif
118+
94119
P->setRelevantFields( mFetchGeometry, attrs );
95120
P->mRelevantFieldsForNextFeature = true;
96121
}

0 commit comments

Comments
 (0)
Please sign in to comment.