Skip to content
Permalink
Browse files

Merge pull request #585 from vinayan/randomsel

[Fix #7785] - ftools-random selection broken in master
  • Loading branch information
vinayan committed May 11, 2013
2 parents bbdeceb + 2ad5707 commit adb2653402fd3283f55fdc046bb1474e09231096
@@ -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)
@@ -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()
@@ -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:
@@ -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)

0 comments on commit adb2653

Please sign in to comment.
You can’t perform that action at this time.