Skip to content

Commit

Permalink
Fix python plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Jun 2, 2017
1 parent 881dfef commit 4ba385d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions python/plugins/processing/algs/qgis/GridLine.py
Expand Up @@ -35,7 +35,7 @@
QgsField,
QgsFeature,
QgsGeometry,
QgsPoint,
QgsPointXY,
QgsLineString,
QgsWkbTypes,
QgsFields)
Expand Down Expand Up @@ -150,8 +150,8 @@ def processAlgorithm(self, context, feedback):
count_update = count_max * 0.10
y = bbox.yMaximum()
while y >= bbox.yMinimum():
pt1 = QgsPoint(bbox.xMinimum(), y)
pt2 = QgsPoint(bbox.xMaximum(), y)
pt1 = QgsPointXY(bbox.xMinimum(), y)
pt2 = QgsPointXY(bbox.xMaximum(), y)
line = QgsLineString()
line.setPoints([pt1, pt2])
feat.setGeometry(QgsGeometry(line))
Expand All @@ -177,8 +177,8 @@ def processAlgorithm(self, context, feedback):
count_update = count_max * 0.10
x = bbox.xMinimum()
while x <= bbox.xMaximum():
pt1 = QgsPoint(x, bbox.yMaximum())
pt2 = QgsPoint(x, bbox.yMinimum())
pt1 = QgsPointXY(x, bbox.yMaximum())
pt2 = QgsPointXY(x, bbox.yMinimum())
line = QgsLineString()
line.setPoints([pt1, pt2])
feat.setGeometry(QgsGeometry(line))
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/qgis/PointsFromPolygons.py
Expand Up @@ -34,7 +34,7 @@
QgsFeature,
QgsGeometry,
QgsWkbTypes,
QgsPoint,
QgsPointXY,
QgsProcessingUtils)
from qgis.PyQt.QtCore import QVariant
from processing.core.GeoAlgorithm import GeoAlgorithm
Expand Down Expand Up @@ -118,7 +118,7 @@ def processAlgorithm(self, context, feedback):
for row in range(startRow, endRow + 1):
for col in range(startColumn, endColumn + 1):
(x, y) = raster.pixelToMap(row, col, geoTransform)
point = QgsPoint()
point = QgsPointXY()
point.setX(x)
point.setY(y)

Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/qgis/PointsLayerFromTable.py
Expand Up @@ -27,7 +27,7 @@

from qgis.core import (QgsApplication,
QgsWkbTypes,
QgsPoint,
QgsPointXY,
QgsCoordinateReferenceSystem,
QgsGeometry,
QgsProcessingUtils)
Expand Down Expand Up @@ -120,7 +120,7 @@ def processAlgorithm(self, context, feedback):
x = float(attrs[x_field_index])
y = float(attrs[y_field_index])

point = QgsPoint(x, y)
point = QgsPointXY(x, y)

if z_field_index is not None:
try:
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/algs/qgis/TopoColors.py
Expand Up @@ -35,7 +35,7 @@
QgsField,
QgsGeometry,
QgsSpatialIndex,
QgsPoint,
QgsPointXY,
NULL,
QgsProcessingUtils)

Expand Down Expand Up @@ -234,7 +234,7 @@ def balanced(features, graph, feedback, balance=0, min_colors=4):
color_areas[feature_color] += features[feature_id].geometry().area()
elif balance == 2:
min_distances = {c: sys.float_info.max for c in available_colors}
this_feature_centroid = QgsPoint(features[feature_id].geometry().centroid().geometry())
this_feature_centroid = QgsPointXY(features[feature_id].geometry().centroid().geometry())

# find features for all available colors
other_features = {f_id: c for (f_id, c) in feature_colors.items() if c in available_colors}
Expand All @@ -243,7 +243,7 @@ def balanced(features, graph, feedback, balance=0, min_colors=4):
# feature with each assigned color
for other_feature_id, c in other_features.items():
other_geometry = features[other_feature_id].geometry()
other_centroid = QgsPoint(other_geometry.centroid().geometry())
other_centroid = QgsPointXY(other_geometry.centroid().geometry())

distance = this_feature_centroid.distanceSquared(other_centroid)
if distance < min_distances[c]:
Expand Down

0 comments on commit 4ba385d

Please sign in to comment.