[QGIS Commit] r14228 - in trunk/qgis/src: core providers/ogr

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Sep 14 16:06:38 EDT 2010


Author: jef
Date: 2010-09-14 20:06:38 +0000 (Tue, 14 Sep 2010)
New Revision: 14228

Modified:
   trunk/qgis/src/core/qgsvectordataprovider.cpp
   trunk/qgis/src/core/qgsvectordataprovider.h
   trunk/qgis/src/providers/ogr/qgsogrprovider.cpp
Log:
fix #3001

Modified: trunk/qgis/src/core/qgsvectordataprovider.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectordataprovider.cpp	2010-09-14 18:18:57 UTC (rev 14227)
+++ trunk/qgis/src/core/qgsvectordataprovider.cpp	2010-09-14 20:06:38 UTC (rev 14228)
@@ -305,10 +305,7 @@
     return QVariant();
   }
 
-  if ( mCacheMinMaxDirty )
-  {
-    fillMinMaxCache();
-  }
+  fillMinMaxCache();
 
   if ( !mCacheMinValues.contains( index ) )
     return QVariant();
@@ -324,10 +321,7 @@
     return QVariant();
   }
 
-  if ( mCacheMinMaxDirty )
-  {
-    fillMinMaxCache();
-  }
+  fillMinMaxCache();
 
   if ( !mCacheMaxValues.contains( index ) )
     return QVariant();
@@ -358,8 +352,16 @@
   }
 }
 
+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 )
   {

Modified: trunk/qgis/src/core/qgsvectordataprovider.h
===================================================================
--- trunk/qgis/src/core/qgsvectordataprovider.h	2010-09-14 18:18:57 UTC (rev 14227)
+++ trunk/qgis/src/core/qgsvectordataprovider.h	2010-09-14 20:06:38 UTC (rev 14228)
@@ -356,6 +356,7 @@
   protected:
     QVariant convertValue( QVariant::Type type, QString value );
 
+    void clearMinMaxCache();
     void fillMinMaxCache();
 
     bool mCacheMinMaxDirty;

Modified: trunk/qgis/src/providers/ogr/qgsogrprovider.cpp
===================================================================
--- trunk/qgis/src/providers/ogr/qgsogrprovider.cpp	2010-09-14 18:18:57 UTC (rev 14227)
+++ trunk/qgis/src/providers/ogr/qgsogrprovider.cpp	2010-09-14 20:06:38 UTC (rev 14228)
@@ -843,6 +843,9 @@
   }
   recalculateFeatureCount();
 
+  if ( returnvalue )
+    clearMinMaxCache();
+
   return returnvalue;
 }
 
@@ -888,6 +891,11 @@
 
 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 @@
 
   recalculateFeatureCount();
 
+  clearMinMaxCache();
+
   if ( extent_ )
   {
     free( extent_ );



More information about the QGIS-commit mailing list