Skip to content
Permalink
Browse files
SpatiaLite support in Select by Location tool (fix #5264)
  • Loading branch information
alexbruy committed May 1, 2012
1 parent e16419f commit 0b8e1130f1176f20b4d1c8de9c320da6e24b829e
Showing with 5 additions and 2 deletions.
  1. +4 −2 python/plugins/fTools/tools/doSelectByLocation.py
  2. +1 −0 python/plugins/fTools/tools/ftools_utils.py
@@ -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:
@@ -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))
@@ -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())
@@ -230,6 +230,7 @@ def createIndex( provider ):
feat = QgsFeature()
index = QgsSpatialIndex()
provider.rewind()
provider.select()
while provider.nextFeature( feat ):
index.insertFeature( feat )
return index

0 comments on commit 0b8e113

Please sign in to comment.