Skip to content
Permalink
Browse files

Convert missing from[Geometry]XY calls

  • Loading branch information
m-kuhn committed Oct 30, 2017
1 parent e0025b6 commit d2c1011a13822f3247e96890db6ad27f7e923008
@@ -148,7 +148,7 @@ def processAlgorithm(self, parameters, context, feedback):
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))
@@ -190,7 +190,7 @@ def _rectangleGrid(self, sink, width, height, originX, originY,
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 @@ def _diamondGrid(self, sink, width, height, originX, originY,
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 @@ def _hexagonGrid(self, sink, width, height, originX, originY,
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
@@ -134,7 +134,7 @@ def rectangles(self, sink, source, width, height, rotation, feedback):
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 @@ def rectangles(self, sink, source, width, height, rotation, feedback):
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 @@ def diamonds(self, sink, source, width, height, rotation, feedback):
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 @@ def diamonds(self, sink, source, width, height, rotation, feedback):
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 @@ def ovals(self, sink, source, width, height, rotation, segments, feedback):
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 @@ def ovals(self, sink, source, width, height, rotation, segments, feedback):
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))
@@ -156,7 +156,7 @@ def rectangles(self, sink, source, width, height, rotation, feedback):
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 @@ def rectangles(self, sink, source, width, height, rotation, feedback):
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 @@ def diamonds(self, sink, source, width, height, rotation, feedback):
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 @@ def diamonds(self, sink, source, width, height, rotation, feedback):
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 @@ def ovals(self, sink, source, width, height, rotation, segments, feedback):
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 @@ def ovals(self, sink, source, width, height, rotation, segments, feedback):
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))
@@ -253,8 +253,8 @@ def processAlgorithm(self, parameters, context, feedback):
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'
@@ -227,8 +227,8 @@ def processAlgorithm(self, parameters, context, feedback):
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 @@ def processAlgorithm(self, parameters, context, feedback):

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}
@@ -135,7 +135,7 @@ def processAlgorithm(self, parameters, context, feedback):
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())
@@ -39,7 +39,7 @@
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)

0 comments on commit d2c1011

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