Skip to content

Commit

Permalink
SpatiaLite support in Select by Location tool (fix #5264)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed May 1, 2012
1 parent e16419f commit 0b8e113
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/plugins/fTools/tools/doSelectByLocation.py
Expand Up @@ -51,7 +51,7 @@ def __init__(self, iface):
self.updateUI()
self.connect(self.inPoint, SIGNAL("currentIndexChanged(QString)"), self.updateCheck)
self.cmbModify.addItems([self.tr("creating new selection"), self.tr("adding to current selection"), self.tr("removing from current selection")])

def updateCheck(self, text):
vlayer = ftools_utils.getVectorLayerByName(text)
if vlayer.selectedFeatureCount() > 0:
Expand Down Expand Up @@ -107,6 +107,8 @@ def compute(self, inPoly, inPts, modify, selection):
geom = QgsGeometry()
selectedSet = []
index = ftools_utils.createIndex(inputProvider)
inputProvider.rewind()
inputProvider.select(inputProvider.attributeIndexes())
if selection:
features = selectLayer.selectedFeatures()
self.progressBar.setMaximum(len(features))
Expand All @@ -119,7 +121,7 @@ def compute(self, inPoly, inPts, modify, selection):
if geom.intersects(tmpGeom):
selectedSet.append(infeat.id())
self.progressBar.setValue(self.progressBar.value()+1)
else:
else:
self.progressBar.setMaximum(selectProvider.featureCount())
while selectProvider.nextFeature(feat):
geom = QgsGeometry(feat.geometry())
Expand Down
1 change: 1 addition & 0 deletions python/plugins/fTools/tools/ftools_utils.py
Expand Up @@ -230,6 +230,7 @@ def createIndex( provider ):
feat = QgsFeature()
index = QgsSpatialIndex()
provider.rewind()
provider.select()
while provider.nextFeature( feat ):
index.insertFeature( feat )
return index
Expand Down

0 comments on commit 0b8e113

Please sign in to comment.