Skip to content

Commit 46016e2

Browse files
committed
Merge pull request #358 from slarosa/sextante-issue
fix for sextante/convexhull tool based on field
2 parents d997863 + 7e34355 commit 46016e2

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

python/plugins/sextante/ftools/ConvexHull.py

+22
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,28 @@ def processAlgorithm(self, progress):
184184
if not FEATURE_EXCEPT:
185185
SextanteLog.addToLog(SextanteLog.LOG_WARNING, "Feature exception while computing convex hull")
186186

187+
def simpleMeasure(self, inGeom ):
188+
measure = QgsDistanceArea()
189+
attr1 = measure.measure(inGeom)
190+
if inGeom.type() == QGis.Polygon:
191+
attr2 = self.perimMeasure( inGeom, measure )
192+
else:
193+
attr2 = attr1
194+
return ( attr1, attr2 )
195+
196+
def perimMeasure(self, inGeom, measure ):
197+
value = 0.00
198+
if inGeom.isMultipart():
199+
poly = inGeom.asMultiPolygon()
200+
for k in poly:
201+
for j in k:
202+
value = value + measure.measureLine( j )
203+
else:
204+
poly = inGeom.asPolygon()
205+
for k in poly:
206+
value = value + measure.measureLine( k )
207+
return value
208+
187209
def defineCharacteristics(self):
188210
self.name = "Convex hull"
189211
self.group = "Geoprocessing tools"

0 commit comments

Comments
 (0)