Skip to content
Permalink
Browse files

[processing] support MultiPoint geometries in Delaunay triangulation

  • Loading branch information
p0cisk authored and m-kuhn committed Oct 19, 2016
1 parent ee9e1c3 commit 41fafd69823cd72d9f4599ef80f94996640ddaaa
Showing with 16 additions and 8 deletions.
  1. +16 −8 python/plugins/processing/algs/qgis/Delaunay.py
@@ -82,12 +82,16 @@ def processAlgorithm(self, progress):
total = 100.0 / len(features)
for current, inFeat in enumerate(features):
geom = inFeat.geometry()
point = geom.asPoint()
x = point.x()
y = point.y()
pts.append((x, y))
ptNdx += 1
ptDict[ptNdx] = inFeat.id()
if geom.isMultipart():
points = geom.asMultiPoint()
else:
points = [ geom.asPoint() ]
for n, point in enumerate(points):
x = point.x()
y = point.y()
pts.append((x, y))
ptNdx += 1
ptDict[ptNdx] = (inFeat.id(), n)
progress.setPercentage(int(current * total))

if len(pts) < 3:
@@ -111,10 +115,14 @@ def processAlgorithm(self, progress):
attrs = []
step = 0
for index in indicies:
request = QgsFeatureRequest().setFilterFid(ptDict[ids[index]])
fid, n = ptDict[ids[index]]
request = QgsFeatureRequest().setFilterFid(fid)
inFeat = next(layer.getFeatures(request))
geom = inFeat.geometry()
point = QgsPoint(geom.asPoint())
if geom.isMultipart():
point = QgsPoint(geom.asMultiPoint()[n])
else:
point = QgsPoint(geom.asPoint())
polygon.append(point)
if step <= 3:
attrs.append(ids[index])

0 comments on commit 41fafd6

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