Skip to content
Permalink
Browse files

Invalidate cache whenever the selection changes

git-svn-id: http://svn.osgeo.org/qgis/trunk@12189 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed Nov 19, 2009
1 parent c905427 commit 7d636dd28936860a533c93947e42a8ef0ab02ae6
Showing with 30 additions and 0 deletions.
  1. +30 −0 src/core/qgsvectorlayer.cpp
@@ -992,6 +992,9 @@ void QgsVectorLayer::select( int number, bool emitSignal )

if ( emitSignal )
{
// invalidate cache
setCacheImage( 0 );

emit selectionChanged();
}
}
@@ -1002,6 +1005,9 @@ void QgsVectorLayer::deselect( int number, bool emitSignal )

if ( emitSignal )
{
// invalidate cache
setCacheImage( 0 );

emit selectionChanged();
}
}
@@ -1025,6 +1031,9 @@ void QgsVectorLayer::select( QgsRectangle & rect, bool lock )
select( f.id(), false ); // don't emit signal (not to redraw it everytime)
}

// invalidate cache
setCacheImage( 0 );

emit selectionChanged(); // now emit signal to redraw layer
}

@@ -1048,6 +1057,9 @@ void QgsVectorLayer::invertSelection()
mSelectedFeatureIds.remove( *iter );
}

// invalidate cache
setCacheImage( 0 );

emit selectionChanged();
}

@@ -1071,6 +1083,9 @@ void QgsVectorLayer::invertSelectionInRectangle( QgsRectangle & rect )
}
}

// invalidate cache
setCacheImage( 0 );

emit selectionChanged();
}

@@ -1079,7 +1094,12 @@ void QgsVectorLayer::removeSelection( bool emitSignal )
mSelectedFeatureIds.clear();

if ( emitSignal )
{
// invalidate cache
setCacheImage( 0 );

emit selectionChanged();
}
}

void QgsVectorLayer::triggerRepaint()
@@ -1765,6 +1785,9 @@ bool QgsVectorLayer::deleteSelectedFeatures()
deleteFeature( fid ); // removes from selection
}

// invalidate cache
setCacheImage( 0 );

emit selectionChanged();

triggerRepaint();
@@ -3355,6 +3378,10 @@ void QgsVectorLayer::setSelectedFeatures( const QgsFeatureIds& ids )
{
// TODO: check whether features with these ID exist
mSelectedFeatureIds = ids;

// invalidate cache
setCacheImage( 0 );

emit selectionChanged();
}

@@ -3448,6 +3475,9 @@ bool QgsVectorLayer::addFeatures( QgsFeatureList features, bool makeSelected )

if ( makeSelected )
{
// invalidate cache
setCacheImage( 0 );

emit selectionChanged();
}

0 comments on commit 7d636dd

Please sign in to comment.