Skip to content
Permalink
Browse files

Merge pull request #602 from 3nids/selectall

add selectall features method for vector layers
  • Loading branch information
NathanW2 committed May 22, 2013
2 parents 3306c7c + e741ec9 commit c9f43f9eb539fd62aeb60003d9a5938b96d855cc
Showing with 23 additions and 0 deletions.
  1. +3 −0 python/core/qgsvectorlayer.sip
  2. +17 −0 src/core/qgsvectorlayer.cpp
  3. +3 −0 src/core/qgsvectorlayer.h
@@ -239,6 +239,9 @@ class QgsVectorLayer : QgsMapLayer

/** Select not selected features and deselect selected ones */
void invertSelection();

/** Select all the features */
void selectAll();

/** Invert selection of features found within the search rectangle (in layer's coordinates) */
void invertSelectionInRectangle( QgsRectangle & rect );
@@ -812,6 +812,23 @@ void QgsVectorLayer::invertSelection()
setSelectedFeatures( ids );
}

void QgsVectorLayer::selectAll()
{
QgsFeatureIterator fit = getFeatures( QgsFeatureRequest()
.setFlags( QgsFeatureRequest::NoGeometry )
.setSubsetOfAttributes( QgsAttributeList() ) );

QgsFeatureIds ids;

QgsFeature fet;
while ( fit.nextFeature( fet ) )
{
ids << fet.id();
}

setSelectedFeatures( ids );
}

void QgsVectorLayer::invertSelectionInRectangle( QgsRectangle & rect )
{
// normalize the rectangle
@@ -619,6 +619,9 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
/** Select not selected features and deselect selected ones */
void invertSelection();

/** Select all the features */
void selectAll();

/**
* Invert selection of features found within the search rectangle (in layer's coordinates)
*

0 comments on commit c9f43f9

Please sign in to comment.
You can’t perform that action at this time.