2010/11/9 Barry Rowlingson <[email protected]> > > That's an interesting approach! My selectplus plugin has a 'select > all' function which does this: >
I love coding : there is never one way to achieve things :) > > def doit(self): > layer = self.iface.mapCanvas().currentLayer() > layer.setSelectedFeatures(layerIds(layer)) > return None > > where layerIds is: > > def layerIds(layer): > ids = [] > p = layer.dataProvider() > allAttrs = p.attributeIndexes() > p.select(allAttrs) > f = QgsFeature() > while p.nextFeature(f): > ids.append(f.id()) > return ids > > Your rectangle overlay should be pretty quick, but maybe my collecting > all the feature IDs is quicker? > I don't know :) I tried to have a compact code, so I reused the api method that seemed simplier, in a spatial approach.
_______________________________________________ Qgis-developer mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-developer
