- cascaded_union() method will be deprecated in Shapely 1.8 in favor of unary_union; replaced the usage of cascaded_union with unary_union in all the app

This commit is contained in:
Marius Stanciu
2020-10-21 13:55:41 +03:00
committed by Marius
parent 265028de76
commit 66a3e36701
26 changed files with 116 additions and 115 deletions

View File

@@ -17,7 +17,7 @@ from appGUI.GUIElements import FCTable, FCDoubleSpinner, FCCheckBox, FCInputDial
FCLabel
from shapely.geometry import base, Polygon, MultiPolygon, LinearRing, Point
from shapely.ops import cascaded_union, unary_union, linemerge
from shapely.ops import unary_union, linemerge
from matplotlib.backend_bases import KeyEvent as mpl_key_event
@@ -1294,7 +1294,7 @@ class ToolPaint(AppTool, Gerber):
if len(self.sel_rect) == 0:
return
self.sel_rect = cascaded_union(self.sel_rect)
self.sel_rect = unary_union(self.sel_rect)
self.paint_poly_area(obj=self.paint_obj, tooldia=self.tooldia_list, sel_obj=self.sel_rect,
outname=self.o_name)
@@ -1881,7 +1881,7 @@ class ToolPaint(AppTool, Gerber):
geo_obj.tools.clear()
geo_obj.tools = dict(tools_storage)
geo_obj.solid_geometry = cascaded_union(final_solid_geometry)
geo_obj.solid_geometry = unary_union(final_solid_geometry)
try:
if isinstance(geo_obj.solid_geometry, list):
@@ -1935,7 +1935,7 @@ class ToolPaint(AppTool, Gerber):
except TypeError:
poly_buf.append(buffered_pol)
poly_buf = cascaded_union(poly_buf)
poly_buf = unary_union(poly_buf)
if not poly_buf:
self.app.inform.emit('[WARNING_NOTCL] %s' % _("Margin parameter too big. Tool is not used"))
@@ -2001,7 +2001,7 @@ class ToolPaint(AppTool, Gerber):
prog_plot=prog_plot)
geo_elems = list(geo_res.get_objects())
# See if the polygon was completely cleared
pp_cleared = cascaded_union(geo_elems).buffer(tool_dia / 2.0)
pp_cleared = unary_union(geo_elems).buffer(tool_dia / 2.0)
rest = pp.difference(pp_cleared)
if rest and not rest.is_empty:
try:
@@ -2041,7 +2041,7 @@ class ToolPaint(AppTool, Gerber):
geo_elems = list(geo_res.get_objects())
# See if the polygon was completely cleared
pp_cleared = cascaded_union(geo_elems).buffer(tool_dia / 2.0)
pp_cleared = unary_union(geo_elems).buffer(tool_dia / 2.0)
rest = poly_buf.difference(pp_cleared)
if rest and not rest.is_empty:
try:
@@ -2095,7 +2095,7 @@ class ToolPaint(AppTool, Gerber):
poly_buf = MultiPolygon(tmp)
if not poly_buf.is_valid:
poly_buf = cascaded_union(tmp)
poly_buf = unary_union(tmp)
if not poly_buf or poly_buf.is_empty or not poly_buf.is_valid:
log.debug("Rest geometry empty. Breaking.")
@@ -2135,7 +2135,7 @@ class ToolPaint(AppTool, Gerber):
"Change the painting parameters and try again.")
)
return "fail"
geo_obj.solid_geometry = cascaded_union(final_solid_geometry)
geo_obj.solid_geometry = unary_union(final_solid_geometry)
else:
return 'fail'
try:
@@ -2447,9 +2447,9 @@ class ToolPaint(AppTool, Gerber):
env_obj = geo.convex_hull
elif (isinstance(geo, MultiPolygon) and len(geo) == 1) or \
(isinstance(geo, list) and len(geo) == 1) and isinstance(geo[0], Polygon):
env_obj = cascaded_union(self.bound_obj.solid_geometry)
env_obj = unary_union(self.bound_obj.solid_geometry)
else:
env_obj = cascaded_union(self.bound_obj.solid_geometry)
env_obj = unary_union(self.bound_obj.solid_geometry)
env_obj = env_obj.convex_hull
sel_rect = env_obj.buffer(distance=0.0000001, join_style=base.JOIN_STYLE.mitre)
except Exception as e: