Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix exception in TopoColor algorithm
  • Loading branch information
nyalldawson committed Aug 13, 2017
1 parent 47fe2a1 commit a056e24
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/qgis/TopoColors.py
Expand Up @@ -244,7 +244,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 = QgsPointXY(features[feature_id].geometry().centroid().geometry())
this_feature_centroid = 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 @@ -256,7 +256,7 @@ def balanced(features, graph, feedback, balance=0, min_colors=4):
break

other_geometry = features[other_feature_id].geometry()
other_centroid = QgsPointXY(other_geometry.centroid().geometry())
other_centroid = other_geometry.centroid().geometry()

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

0 comments on commit a056e24

Please sign in to comment.