Skip to content

Commit

Permalink
Convert missing from[Geometry]XY calls
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Oct 30, 2017
1 parent e0025b6 commit d2c1011
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/Delaunay.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/algs/qgis/GridPolygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)

Expand Down Expand Up @@ -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))
Expand All @@ -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))
Expand Down Expand Up @@ -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))
Expand All @@ -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))
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/qgis/ServiceAreaFromLayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/processing/algs/qgis/ServiceAreaFromPoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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}
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/VoronoiPolygons.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.