Skip to content

Commit

Permalink
Merge pull request #585 from vinayan/randomsel
Browse files Browse the repository at this point in the history
[Fix #7785] - ftools-random selection broken in master
  • Loading branch information
vinayan committed May 11, 2013
2 parents bbdeceb + 2ad5707 commit adb2653
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions python/plugins/fTools/tools/doSubsetSelect.py
Expand Up @@ -81,8 +81,9 @@ def accept(self):

def compute(self, inVect, inField, value, perc, progressBar):
mlayer = ftools_utils.getMapLayerByName(inVect)
mlayer.removeSelection(True)
mlayer.removeSelection()
vlayer = ftools_utils.getVectorLayerByName(inVect)
vprovider = vlayer.dataProvider()
index = vprovider.fieldNameIndex(inField)
#unique = []
#vprovider.uniqueValues(index, unique)
Expand All @@ -93,7 +94,7 @@ def compute(self, inVect, inField, value, perc, progressBar):
nElement = 0
self.progressBar.setValue(0)
self.progressBar.setRange(0, nFeat)
fit = vprovider.getFeatures()
fit = vprovider.getFeatures()
if not len(unique) == mlayer.featureCount():
for i in unique:
fit.rewind()
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/sextante/algs/ftools/RandomSelection.py
Expand Up @@ -72,7 +72,7 @@ def processAlgorithm(self, progress):
featureCount = layer.featureCount()
value = int(self.getParameterValue(self.NUMBER))

layer.removeSelection(True)
layer.removeSelection()

if method == 0:
if value > featureCount:
Expand Down
Expand Up @@ -72,7 +72,7 @@ def processAlgorithm(self, progress):
field = self.getParameterValue(self.FIELD)
method = self.getParameterValue(self.METHOD)

layer.removeSelection(True)
layer.removeSelection()
index = layer.fieldNameIndex(field)

unique = utils.getUniqueValues(layer, index)
Expand Down

0 comments on commit adb2653

Please sign in to comment.