mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
fix #3542
git-svn-id: http://svn.osgeo.org/qgis/trunk@15395 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
432d4ce6e4
commit
53475e2819
@ -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 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user