Skip to content
Permalink
Browse files

Fix exception in TopoColor algorithm

  • Loading branch information
nyalldawson committed Aug 9, 2017
1 parent 47fe2a1 commit a056e24a020e0e0bd977ecba9c2fe3213abab661
Showing with 2 additions and 2 deletions.
  1. +2 −2 python/plugins/processing/algs/qgis/TopoColors.py
@@ -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}
@@ -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]:

0 comments on commit a056e24

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