Skip to content
Permalink
Browse files
fix #3001
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14228 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Sep 14, 2010
1 parent 5334d37 commit 603cff843f4bd807a5a8bfd48ef7210799a76976
Showing with 21 additions and 8 deletions.
  1. +10 −8 src/core/qgsvectordataprovider.cpp
  2. +1 −0 src/core/qgsvectordataprovider.h
  3. +10 −0 src/providers/ogr/qgsogrprovider.cpp
@@ -305,10 +305,7 @@ QVariant QgsVectorDataProvider::minimumValue( int index )
return QVariant();
}

if ( mCacheMinMaxDirty )
{
fillMinMaxCache();
}
fillMinMaxCache();

if ( !mCacheMinValues.contains( index ) )
return QVariant();
@@ -324,10 +321,7 @@ QVariant QgsVectorDataProvider::maximumValue( int index )
return QVariant();
}

if ( mCacheMinMaxDirty )
{
fillMinMaxCache();
}
fillMinMaxCache();

if ( !mCacheMaxValues.contains( index ) )
return QVariant();
@@ -358,8 +352,16 @@ void QgsVectorDataProvider::uniqueValues( int index, QList<QVariant> &values, in
}
}

void QgsVectorDataProvider::clearMinMaxCache()
{
mCacheMinMaxDirty = true;
}

void QgsVectorDataProvider::fillMinMaxCache()
{
if ( !mCacheMinMaxDirty )
return;

const QgsFieldMap& flds = fields();
for ( QgsFieldMap::const_iterator it = flds.begin(); it != flds.end(); ++it )
{
@@ -356,6 +356,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
protected:
QVariant convertValue( QVariant::Type type, QString value );

void clearMinMaxCache();
void fillMinMaxCache();

bool mCacheMinMaxDirty;
@@ -843,6 +843,9 @@ bool QgsOgrProvider::addFeatures( QgsFeatureList & flist )
}
recalculateFeatureCount();

if ( returnvalue )
clearMinMaxCache();

return returnvalue;
}

@@ -888,6 +891,11 @@ bool QgsOgrProvider::addAttributes( const QList<QgsField> &attributes )

bool QgsOgrProvider::changeAttributeValues( const QgsChangedAttributesMap & attr_map )
{
if ( attr_map.isEmpty() )
return true;

clearMinMaxCache();

for ( QgsChangedAttributesMap::const_iterator it = attr_map.begin(); it != attr_map.end(); ++it )
{
long fid = ( long ) it.key();
@@ -1049,6 +1057,8 @@ bool QgsOgrProvider::deleteFeatures( const QgsFeatureIds & id )

recalculateFeatureCount();

clearMinMaxCache();

if ( extent_ )
{
free( extent_ );

0 comments on commit 603cff8

Please sign in to comment.