Convert missing from[Geometry]XY calls

This commit is contained in:
Matthias Kuhn 2017-10-30 09:13:04 +01:00
parent e0025b65b1
commit d2c1011a13
No known key found for this signature in database
GPG Key ID: A0E766808764D73F
8 changed files with 24 additions and 24 deletions

View File

@ -148,7 +148,7 @@ class Delaunay(QgisAlgorithm):
attrs.append(ids[index])
step += 1
feat.setAttributes(attrs)
geometry = QgsGeometry().fromPolygon([polygon])
geometry = QgsGeometry().fromPolygonXY([polygon])
feat.setGeometry(geometry)
sink.addFeature(feat, QgsFeatureSink.FastInsert)
feedback.setProgress(int(current * total))

View File

@ -190,7 +190,7 @@ class GridPolygon(QgisAlgorithm):
polyline.append(QgsPointXY(x1, y2))
polyline.append(QgsPointXY(x1, y1))
ft.setGeometry(QgsGeometry.fromPolygon([polyline]))
ft.setGeometry(QgsGeometry.fromPolygonXY([polyline]))
ft.setAttributes([x1, y1, x2, y2, id])
sink.addFeature(ft, QgsFeatureSink.FastInsert)
@ -245,7 +245,7 @@ class GridPolygon(QgisAlgorithm):
polyline.append(QgsPointXY(x2, y3))
polyline.append(QgsPointXY(x1, y2))
ft.setGeometry(QgsGeometry.fromPolygon([polyline]))
ft.setGeometry(QgsGeometry.fromPolygonXY([polyline]))
ft.setAttributes([x1, y1, x3, y3, id])
sink.addFeature(ft, QgsFeatureSink.FastInsert)
id += 1
@ -312,7 +312,7 @@ class GridPolygon(QgisAlgorithm):
polyline.append(QgsPointXY(x2, y3))
polyline.append(QgsPointXY(x1, y2))
ft.setGeometry(QgsGeometry.fromPolygon([polyline]))
ft.setGeometry(QgsGeometry.fromPolygonXY([polyline]))
ft.setAttributes([x1, y1, x4, y3, id])
sink.addFeature(ft, QgsFeatureSink.FastInsert)
id += 1

View File

@ -134,7 +134,7 @@ class RectanglesOvalsDiamondsFixed(QgisAlgorithm):
polygon = [[QgsPointXY(i[0] * math.cos(phi) + i[1] * math.sin(phi) + x,
-i[0] * math.sin(phi) + i[1] * math.cos(phi) + y) for i in points]]
ft.setGeometry(QgsGeometry.fromPolygon(polygon))
ft.setGeometry(QgsGeometry.fromPolygonXY(polygon))
ft.setAttributes(feat.attributes())
sink.addFeature(ft, QgsFeatureSink.FastInsert)
@ -153,7 +153,7 @@ class RectanglesOvalsDiamondsFixed(QgisAlgorithm):
points = [(-xOffset, -yOffset), (-xOffset, yOffset), (xOffset, yOffset), (xOffset, -yOffset)]
polygon = [[QgsPointXY(i[0] + x, i[1] + y) for i in points]]
ft.setGeometry(QgsGeometry.fromPolygon(polygon))
ft.setGeometry(QgsGeometry.fromPolygonXY(polygon))
ft.setAttributes(feat.attributes())
sink.addFeature(ft, QgsFeatureSink.FastInsert)
@ -183,7 +183,7 @@ class RectanglesOvalsDiamondsFixed(QgisAlgorithm):
polygon = [[QgsPointXY(i[0] * math.cos(phi) + i[1] * math.sin(phi) + x,
-i[0] * math.sin(phi) + i[1] * math.cos(phi) + y) for i in points]]
ft.setGeometry(QgsGeometry.fromPolygon(polygon))
ft.setGeometry(QgsGeometry.fromPolygonXY(polygon))
ft.setAttributes(feat.attributes())
sink.addFeature(ft, QgsFeatureSink.FastInsert)
feedback.setProgress(int(current * total))
@ -201,7 +201,7 @@ class RectanglesOvalsDiamondsFixed(QgisAlgorithm):
points = [(0.0, -yOffset), (-xOffset, 0.0), (0.0, yOffset), (xOffset, 0.0)]
polygon = [[QgsPointXY(i[0] + x, i[1] + y) for i in points]]
ft.setGeometry(QgsGeometry.fromPolygon(polygon))
ft.setGeometry(QgsGeometry.fromPolygonXY(polygon))
ft.setAttributes(feat.attributes())
sink.addFeature(ft, QgsFeatureSink.FastInsert)
feedback.setProgress(int(current * total))
@ -232,7 +232,7 @@ class RectanglesOvalsDiamondsFixed(QgisAlgorithm):
polygon = [[QgsPointXY(i[0] * math.cos(phi) + i[1] * math.sin(phi) + x,
-i[0] * math.sin(phi) + i[1] * math.cos(phi) + y) for i in points]]
ft.setGeometry(QgsGeometry.fromPolygon(polygon))
ft.setGeometry(QgsGeometry.fromPolygonXY(polygon))
ft.setAttributes(feat.attributes())
sink.addFeature(ft, QgsFeatureSink.FastInsert)
feedback.setProgress(int(current * total))
@ -252,7 +252,7 @@ class RectanglesOvalsDiamondsFixed(QgisAlgorithm):
points.append((xOffset * math.cos(t), yOffset * math.sin(t)))
polygon = [[QgsPointXY(i[0] + x, i[1] + y) for i in points]]
ft.setGeometry(QgsGeometry.fromPolygon(polygon))
ft.setGeometry(QgsGeometry.fromPolygonXY(polygon))
ft.setAttributes(feat.attributes())
sink.addFeature(ft, QgsFeatureSink.FastInsert)
feedback.setProgress(int(current * total))

View File

@ -156,7 +156,7 @@ class RectanglesOvalsDiamondsVariable(QgisAlgorithm):
polygon = [[QgsPointXY(i[0] * math.cos(phi) + i[1] * math.sin(phi) + x,
-i[0] * math.sin(phi) + i[1] * math.cos(phi) + y) for i in points]]
ft.setGeometry(QgsGeometry.fromPolygon(polygon))
ft.setGeometry(QgsGeometry.fromPolygonXY(polygon))
ft.setAttributes(feat.attributes())
sink.addFeature(ft, QgsFeatureSink.FastInsert)
@ -186,7 +186,7 @@ class RectanglesOvalsDiamondsVariable(QgisAlgorithm):
points = [(-xOffset, -yOffset), (-xOffset, yOffset), (xOffset, yOffset), (xOffset, -yOffset)]
polygon = [[QgsPointXY(i[0] + x, i[1] + y) for i in points]]
ft.setGeometry(QgsGeometry.fromPolygon(polygon))
ft.setGeometry(QgsGeometry.fromPolygonXY(polygon))
ft.setAttributes(feat.attributes())
sink.addFeature(ft, QgsFeatureSink.FastInsert)
@ -225,7 +225,7 @@ class RectanglesOvalsDiamondsVariable(QgisAlgorithm):
polygon = [[QgsPointXY(i[0] * math.cos(phi) + i[1] * math.sin(phi) + x,
-i[0] * math.sin(phi) + i[1] * math.cos(phi) + y) for i in points]]
ft.setGeometry(QgsGeometry.fromPolygon(polygon))
ft.setGeometry(QgsGeometry.fromPolygonXY(polygon))
ft.setAttributes(feat.attributes())
sink.addFeature(ft, QgsFeatureSink.FastInsert)
feedback.setProgress(int(current * total))
@ -254,7 +254,7 @@ class RectanglesOvalsDiamondsVariable(QgisAlgorithm):
points = [(0.0, -yOffset), (-xOffset, 0.0), (0.0, yOffset), (xOffset, 0.0)]
polygon = [[QgsPointXY(i[0] + x, i[1] + y) for i in points]]
ft.setGeometry(QgsGeometry.fromPolygon(polygon))
ft.setGeometry(QgsGeometry.fromPolygonXY(polygon))
ft.setAttributes(feat.attributes())
sink.addFeature(ft, QgsFeatureSink.FastInsert)
feedback.setProgress(int(current * total))
@ -294,7 +294,7 @@ class RectanglesOvalsDiamondsVariable(QgisAlgorithm):
polygon = [[QgsPointXY(i[0] * math.cos(phi) + i[1] * math.sin(phi) + x,
-i[0] * math.sin(phi) + i[1] * math.cos(phi) + y) for i in points]]
ft.setGeometry(QgsGeometry.fromPolygon(polygon))
ft.setGeometry(QgsGeometry.fromPolygonXY(polygon))
ft.setAttributes(feat.attributes())
sink.addFeature(ft, QgsFeatureSink.FastInsert)
feedback.setProgress(int(current * total))
@ -325,7 +325,7 @@ class RectanglesOvalsDiamondsVariable(QgisAlgorithm):
points.append((xOffset * math.cos(t), yOffset * math.sin(t)))
polygon = [[QgsPointXY(i[0] + x, i[1] + y) for i in points]]
ft.setGeometry(QgsGeometry.fromPolygon(polygon))
ft.setGeometry(QgsGeometry.fromPolygonXY(polygon))
ft.setAttributes(feat.attributes())
sink.addFeature(ft, QgsFeatureSink.FastInsert)
feedback.setProgress(int(current * total))

View File

@ -253,8 +253,8 @@ class ServiceAreaFromLayer(QgisAlgorithm):
upperBoundary.append(graph.vertex(graph.edge(tree[j]).inVertex()).point())
lowerBoundary.append(graph.vertex(graph.edge(tree[j]).outVertex()).point())
geomUpper = QgsGeometry.fromMultiPoint(upperBoundary)
geomLower = QgsGeometry.fromMultiPoint(lowerBoundary)
geomUpper = QgsGeometry.fromMultiPointXY(upperBoundary)
geomLower = QgsGeometry.fromMultiPointXY(lowerBoundary)
feat.setGeometry(geomUpper)
feat['type'] = 'upper'

View File

@ -227,8 +227,8 @@ class ServiceAreaFromPoint(QgisAlgorithm):
feat = QgsFeature()
feat.setFields(fields)
geomUpper = QgsGeometry.fromMultiPoint(upperBoundary)
geomLower = QgsGeometry.fromMultiPoint(lowerBoundary)
geomUpper = QgsGeometry.fromMultiPointXY(upperBoundary)
geomLower = QgsGeometry.fromMultiPointXY(lowerBoundary)
(sink, dest_id) = self.parameterAsSink(parameters, self.OUTPUT, context,
fields, QgsWkbTypes.MultiPoint, network.sourceCrs())
@ -245,7 +245,7 @@ class ServiceAreaFromPoint(QgisAlgorithm):
upperBoundary.append(startPoint)
lowerBoundary.append(startPoint)
geomUpper = QgsGeometry.fromMultiPoint(upperBoundary)
geomLower = QgsGeometry.fromMultiPoint(lowerBoundary)
geomUpper = QgsGeometry.fromMultiPointXY(upperBoundary)
geomLower = QgsGeometry.fromMultiPointXY(lowerBoundary)
return {self.OUTPUT: dest_id}

View File

@ -135,7 +135,7 @@ class VoronoiPolygons(QgisAlgorithm):
inFeat = next(source.getFeatures(request))
lines = self.clip_voronoi(edges, c, width, height, extent, extraX, extraY)
geom = QgsGeometry.fromMultiPoint(lines)
geom = QgsGeometry.fromMultiPointXY(lines)
geom = QgsGeometry(geom.convexHull())
outFeat.setGeometry(geom)
outFeat.setAttributes(inFeat.attributes())

View File

@ -39,7 +39,7 @@ for n, feat in enumerate(Polygons.getFeatures()):
else:
features.setGeometry(geom)
geomres = [geoms[i].asPolygon() for i, a in geomarea[-1 * To_keep:]]
features.setGeometry(QgsGeometry.fromMultiPolygon(geomres))
features.setGeometry(QgsGeometry.fromMultiPolygonXY(geomres))
sink.addFeature(features)
else:
sink.addFeature(feat)