Skip to content

Commit 0b8e113

Browse files
committedMay 1, 2012
SpatiaLite support in Select by Location tool (fix #5264)
1 parent e16419f commit 0b8e113

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed
 

‎python/plugins/fTools/tools/doSelectByLocation.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def __init__(self, iface):
5151
self.updateUI()
5252
self.connect(self.inPoint, SIGNAL("currentIndexChanged(QString)"), self.updateCheck)
5353
self.cmbModify.addItems([self.tr("creating new selection"), self.tr("adding to current selection"), self.tr("removing from current selection")])
54-
54+
5555
def updateCheck(self, text):
5656
vlayer = ftools_utils.getVectorLayerByName(text)
5757
if vlayer.selectedFeatureCount() > 0:
@@ -107,6 +107,8 @@ def compute(self, inPoly, inPts, modify, selection):
107107
geom = QgsGeometry()
108108
selectedSet = []
109109
index = ftools_utils.createIndex(inputProvider)
110+
inputProvider.rewind()
111+
inputProvider.select(inputProvider.attributeIndexes())
110112
if selection:
111113
features = selectLayer.selectedFeatures()
112114
self.progressBar.setMaximum(len(features))
@@ -119,7 +121,7 @@ def compute(self, inPoly, inPts, modify, selection):
119121
if geom.intersects(tmpGeom):
120122
selectedSet.append(infeat.id())
121123
self.progressBar.setValue(self.progressBar.value()+1)
122-
else:
124+
else:
123125
self.progressBar.setMaximum(selectProvider.featureCount())
124126
while selectProvider.nextFeature(feat):
125127
geom = QgsGeometry(feat.geometry())

‎python/plugins/fTools/tools/ftools_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ def createIndex( provider ):
230230
feat = QgsFeature()
231231
index = QgsSpatialIndex()
232232
provider.rewind()
233+
provider.select()
233234
while provider.nextFeature( feat ):
234235
index.insertFeature( feat )
235236
return index

0 commit comments

Comments
 (0)
Please sign in to comment.