Skip to content

Commit

Permalink
Invalidate cache whenever the selection changes
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@12189 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Nov 19, 2009
1 parent c905427 commit 7d636dd
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/core/qgsvectorlayer.cpp
Expand Up @@ -992,6 +992,9 @@ void QgsVectorLayer::select( int number, bool emitSignal )

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

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

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

emit selectionChanged();
}
}
Expand All @@ -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
}

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

// invalidate cache
setCacheImage( 0 );

emit selectionChanged();
}

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

// invalidate cache
setCacheImage( 0 );

emit selectionChanged();
}

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

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

emit selectionChanged();
}
}

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

// invalidate cache
setCacheImage( 0 );

emit selectionChanged();

triggerRepaint();
Expand Down Expand Up @@ -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();
}

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

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

emit selectionChanged();
}

Expand Down

0 comments on commit 7d636dd

Please sign in to comment.