Skip to content

Commit

Permalink
[ftools] Fix basic statistics (Fix #8105)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Jun 19, 2013
1 parent cfadfb5 commit 419d8ee
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions python/plugins/fTools/tools/doVisual.py
Expand Up @@ -271,8 +271,10 @@ def basic_statistics( self, vlayer, myField ):
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0 )
self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
for f in selection:
atMap = f.attributes()
lenVal = float( len( atMap[ index ] ) )
try:
lenVal = float( len( f[ index ] ) )
except TypeError:
lenVal = 0
if first:
minVal = lenVal
maxVal = lenVal
Expand All @@ -295,8 +297,10 @@ def basic_statistics( self, vlayer, myField ):
self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
fit = vprovider.getFeatures()
while fit.nextFeature( feat ):
atMap = feat.attributes()
lenVal = float( len( atMap[ index ] ) )
try:
lenVal = float( len( feat[ index ] ) )
except TypeError:
lenVal = 0
if first:
minVal = lenVal
maxVal = lenVal
Expand Down Expand Up @@ -340,8 +344,7 @@ def basic_statistics( self, vlayer, myField ):
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0 )
self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
for f in selection:
atMap = f.attributes()
value = float( atMap[ index ] )
value = float( f[ index ] )
if first:
minVal = value
maxVal = value
Expand All @@ -361,8 +364,7 @@ def basic_statistics( self, vlayer, myField ):
self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
fit = vprovider.getFeatures()
while fit.nextFeature( feat ):
atMap = feat.attributes()
value = float( atMap[ index ] )
value = float( feat[ index ] )
if first:
minVal = value
maxVal = value
Expand Down

0 comments on commit 419d8ee

Please sign in to comment.