mirror of
https://github.com/qgis/QGIS.git
synced 2025-11-03 00:14:12 -05:00
[processing] support MultiPoint geometries in Delaunay triangulation
This commit is contained in:
parent
ee9e1c3328
commit
41fafd6982
@ -82,12 +82,16 @@ class Delaunay(GeoAlgorithm):
|
||||
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 @@ class Delaunay(GeoAlgorithm):
|
||||
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])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user