Skip to content

Commit

Permalink
Merge pull request #358 from slarosa/sextante-issue
Browse files Browse the repository at this point in the history
fix for sextante/convexhull tool based on field
  • Loading branch information
volaya committed Dec 14, 2012
2 parents d997863 + 7e34355 commit 46016e2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions python/plugins/sextante/ftools/ConvexHull.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,28 @@ def processAlgorithm(self, progress):
if not FEATURE_EXCEPT:
SextanteLog.addToLog(SextanteLog.LOG_WARNING, "Feature exception while computing convex hull")

def simpleMeasure(self, inGeom ):
measure = QgsDistanceArea()
attr1 = measure.measure(inGeom)
if inGeom.type() == QGis.Polygon:
attr2 = self.perimMeasure( inGeom, measure )
else:
attr2 = attr1
return ( attr1, attr2 )

def perimMeasure(self, inGeom, measure ):
value = 0.00
if inGeom.isMultipart():
poly = inGeom.asMultiPolygon()
for k in poly:
for j in k:
value = value + measure.measureLine( j )
else:
poly = inGeom.asPolygon()
for k in poly:
value = value + measure.measureLine( k )
return value

def defineCharacteristics(self):
self.name = "Convex hull"
self.group = "Geoprocessing tools"
Expand Down

0 comments on commit 46016e2

Please sign in to comment.