mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-17 00:09:36 -04:00
fix #3001
git-svn-id: http://svn.osgeo.org/qgis/trunk@14228 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
b420878d7f
commit
a2fd4ea818
@ -305,10 +305,7 @@ QVariant QgsVectorDataProvider::minimumValue( int index )
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mCacheMinMaxDirty )
|
|
||||||
{
|
|
||||||
fillMinMaxCache();
|
fillMinMaxCache();
|
||||||
}
|
|
||||||
|
|
||||||
if ( !mCacheMinValues.contains( index ) )
|
if ( !mCacheMinValues.contains( index ) )
|
||||||
return QVariant();
|
return QVariant();
|
||||||
@ -324,10 +321,7 @@ QVariant QgsVectorDataProvider::maximumValue( int index )
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mCacheMinMaxDirty )
|
|
||||||
{
|
|
||||||
fillMinMaxCache();
|
fillMinMaxCache();
|
||||||
}
|
|
||||||
|
|
||||||
if ( !mCacheMaxValues.contains( index ) )
|
if ( !mCacheMaxValues.contains( index ) )
|
||||||
return QVariant();
|
return QVariant();
|
||||||
@ -358,8 +352,16 @@ void QgsVectorDataProvider::uniqueValues( int index, QList<QVariant> &values, in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QgsVectorDataProvider::clearMinMaxCache()
|
||||||
|
{
|
||||||
|
mCacheMinMaxDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
void QgsVectorDataProvider::fillMinMaxCache()
|
void QgsVectorDataProvider::fillMinMaxCache()
|
||||||
{
|
{
|
||||||
|
if ( !mCacheMinMaxDirty )
|
||||||
|
return;
|
||||||
|
|
||||||
const QgsFieldMap& flds = fields();
|
const QgsFieldMap& flds = fields();
|
||||||
for ( QgsFieldMap::const_iterator it = flds.begin(); it != flds.end(); ++it )
|
for ( QgsFieldMap::const_iterator it = flds.begin(); it != flds.end(); ++it )
|
||||||
{
|
{
|
||||||
|
@ -356,6 +356,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
|
|||||||
protected:
|
protected:
|
||||||
QVariant convertValue( QVariant::Type type, QString value );
|
QVariant convertValue( QVariant::Type type, QString value );
|
||||||
|
|
||||||
|
void clearMinMaxCache();
|
||||||
void fillMinMaxCache();
|
void fillMinMaxCache();
|
||||||
|
|
||||||
bool mCacheMinMaxDirty;
|
bool mCacheMinMaxDirty;
|
||||||
|
@ -843,6 +843,9 @@ bool QgsOgrProvider::addFeatures( QgsFeatureList & flist )
|
|||||||
}
|
}
|
||||||
recalculateFeatureCount();
|
recalculateFeatureCount();
|
||||||
|
|
||||||
|
if ( returnvalue )
|
||||||
|
clearMinMaxCache();
|
||||||
|
|
||||||
return returnvalue;
|
return returnvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -888,6 +891,11 @@ bool QgsOgrProvider::addAttributes( const QList<QgsField> &attributes )
|
|||||||
|
|
||||||
bool QgsOgrProvider::changeAttributeValues( const QgsChangedAttributesMap & attr_map )
|
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 )
|
for ( QgsChangedAttributesMap::const_iterator it = attr_map.begin(); it != attr_map.end(); ++it )
|
||||||
{
|
{
|
||||||
long fid = ( long ) it.key();
|
long fid = ( long ) it.key();
|
||||||
@ -1049,6 +1057,8 @@ bool QgsOgrProvider::deleteFeatures( const QgsFeatureIds & id )
|
|||||||
|
|
||||||
recalculateFeatureCount();
|
recalculateFeatureCount();
|
||||||
|
|
||||||
|
clearMinMaxCache();
|
||||||
|
|
||||||
if ( extent_ )
|
if ( extent_ )
|
||||||
{
|
{
|
||||||
free( extent_ );
|
free( extent_ );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user