mirror of
https://github.com/qgis/QGIS.git
synced 2025-06-19 00:02:48 -04:00
Fix python plugins
This commit is contained in:
parent
881dfef3c9
commit
4ba385d4e1
@ -35,7 +35,7 @@ from qgis.core import (QgsRectangle,
|
||||
QgsField,
|
||||
QgsFeature,
|
||||
QgsGeometry,
|
||||
QgsPoint,
|
||||
QgsPointXY,
|
||||
QgsLineString,
|
||||
QgsWkbTypes,
|
||||
QgsFields)
|
||||
@ -150,8 +150,8 @@ class GridLine(GeoAlgorithm):
|
||||
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))
|
||||
@ -177,8 +177,8 @@ class GridLine(GeoAlgorithm):
|
||||
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))
|
||||
|
@ -34,7 +34,7 @@ from qgis.core import (QgsApplication,
|
||||
QgsFeature,
|
||||
QgsGeometry,
|
||||
QgsWkbTypes,
|
||||
QgsPoint,
|
||||
QgsPointXY,
|
||||
QgsProcessingUtils)
|
||||
from qgis.PyQt.QtCore import QVariant
|
||||
from processing.core.GeoAlgorithm import GeoAlgorithm
|
||||
@ -118,7 +118,7 @@ class PointsFromPolygons(GeoAlgorithm):
|
||||
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)
|
||||
|
||||
|
@ -27,7 +27,7 @@ __revision__ = '$Format:%H$'
|
||||
|
||||
from qgis.core import (QgsApplication,
|
||||
QgsWkbTypes,
|
||||
QgsPoint,
|
||||
QgsPointXY,
|
||||
QgsCoordinateReferenceSystem,
|
||||
QgsGeometry,
|
||||
QgsProcessingUtils)
|
||||
@ -120,7 +120,7 @@ class PointsLayerFromTable(GeoAlgorithm):
|
||||
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:
|
||||
|
@ -35,7 +35,7 @@ from qgis.core import (QgsApplication,
|
||||
QgsField,
|
||||
QgsGeometry,
|
||||
QgsSpatialIndex,
|
||||
QgsPoint,
|
||||
QgsPointXY,
|
||||
NULL,
|
||||
QgsProcessingUtils)
|
||||
|
||||
@ -234,7 +234,7 @@ class ColoringAlgorithm:
|
||||
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}
|
||||
@ -243,7 +243,7 @@ class ColoringAlgorithm:
|
||||
# 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]:
|
||||
|
Loading…
x
Reference in New Issue
Block a user