Ver código fonte

- 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

Marius Stanciu 5 anos atrás
pai
commit
66a3e36701

+ 1 - 0
CHANGELOG.md

@@ -18,6 +18,7 @@ CHANGELOG for FlatCAM beta
 - fixed crash on using shortcut for creating a new Document Object
 - fixed crash on using shortcut for creating a new Document Object
 - fixed Cutout Tool to work with the endxy parameter
 - fixed Cutout Tool to work with the endxy parameter
 - added the exclusion parameters for Drilling Tool to the Preferences area
 - added the exclusion parameters for Drilling Tool to the Preferences area
+- 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
 
 
 20.10.2020
 20.10.2020
 
 

+ 3 - 3
appEditors/AppGeoEditor.py

@@ -21,7 +21,7 @@ from appGUI.GUIElements import OptionalInputSection, FCCheckBox, FCEntry, FCComb
 from appParsers.ParseFont import *
 from appParsers.ParseFont import *
 
 
 from shapely.geometry import LineString, LinearRing, MultiLineString, Polygon, MultiPolygon
 from shapely.geometry import LineString, LinearRing, MultiLineString, Polygon, MultiPolygon
-from shapely.ops import cascaded_union, unary_union, linemerge
+from shapely.ops import unary_union, linemerge
 import shapely.affinity as affinity
 import shapely.affinity as affinity
 from shapely.geometry.polygon import orient
 from shapely.geometry.polygon import orient
 
 
@@ -3147,7 +3147,7 @@ class FCEraser(FCShapeTool):
             temp_shape = eraser_shape.buffer(0.0000001)
             temp_shape = eraser_shape.buffer(0.0000001)
             temp_shape = Polygon(temp_shape.exterior)
             temp_shape = Polygon(temp_shape.exterior)
             eraser_sel_shapes.append(temp_shape)
             eraser_sel_shapes.append(temp_shape)
-        eraser_sel_shapes = cascaded_union(eraser_sel_shapes)
+        eraser_sel_shapes = unary_union(eraser_sel_shapes)
 
 
         for obj_shape in self.storage.get_objects():
         for obj_shape in self.storage.get_objects():
             try:
             try:
@@ -5134,7 +5134,7 @@ class AppGeoEditor(QtCore.QObject):
                     return
                     return
 
 
                 # add the result to the results list
                 # add the result to the results list
-                results.append(cascaded_union(local_results))
+                results.append(unary_union(local_results))
 
 
         # This is a dirty patch:
         # This is a dirty patch:
         for r in results:
         for r in results:

+ 3 - 3
appEditors/AppGerberEditor.py

@@ -9,7 +9,7 @@ from PyQt5 import QtGui, QtCore, QtWidgets
 from PyQt5.QtCore import Qt, QSettings
 from PyQt5.QtCore import Qt, QSettings
 
 
 from shapely.geometry import LineString, LinearRing, MultiLineString, Point, Polygon, MultiPolygon, box
 from shapely.geometry import LineString, LinearRing, MultiLineString, Point, Polygon, MultiPolygon, box
-from shapely.ops import cascaded_union
+from shapely.ops import unary_union
 import shapely.affinity as affinity
 import shapely.affinity as affinity
 
 
 from vispy.geometry import Rect
 from vispy.geometry import Rect
@@ -2235,7 +2235,7 @@ class FCEraser(FCShapeTool):
             temp_shape = eraser_shape['solid'].buffer(0.0000001)
             temp_shape = eraser_shape['solid'].buffer(0.0000001)
             temp_shape = Polygon(temp_shape.exterior)
             temp_shape = Polygon(temp_shape.exterior)
             eraser_sel_shapes.append(temp_shape)
             eraser_sel_shapes.append(temp_shape)
-        eraser_sel_shapes = cascaded_union(eraser_sel_shapes)
+        eraser_sel_shapes = unary_union(eraser_sel_shapes)
 
 
         for storage in self.draw_app.storage_dict:
         for storage in self.draw_app.storage_dict:
             try:
             try:
@@ -4968,7 +4968,7 @@ class AppGerberEditor(QtCore.QObject):
                 if 'solid' in actual_geo:
                 if 'solid' in actual_geo:
                     edit_geo.append(actual_geo['solid'])
                     edit_geo.append(actual_geo['solid'])
 
 
-        all_geo = cascaded_union(edit_geo)
+        all_geo = unary_union(edit_geo)
 
 
         # calculate the bounds values for the edited Gerber object
         # calculate the bounds values for the edited Gerber object
         xmin, ymin, xmax, ymax = all_geo.bounds
         xmin, ymin, xmax, ymax = all_geo.bounds

+ 1 - 1
appObjects/FlatCAMCNCJob.py

@@ -2568,7 +2568,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
                 #         g['geom'] = affinity.scale(g['geom'], factor, factor, origin=(0, 0))
                 #         g['geom'] = affinity.scale(g['geom'], factor, factor, origin=(0, 0))
                 #
                 #
                 #     tool_dia_copy['gcode_parsed'] = deepcopy(dia_value)
                 #     tool_dia_copy['gcode_parsed'] = deepcopy(dia_value)
-                #     tool_dia_copy['solid_geometry'] = cascaded_union([geo['geom'] for geo in dia_value])
+                #     tool_dia_copy['solid_geometry'] = unary_union([geo['geom'] for geo in dia_value])
 
 
             temp_tools_dict.update({
             temp_tools_dict.update({
                 tooluid_key: deepcopy(tool_dia_copy)
                 tooluid_key: deepcopy(tool_dia_copy)

+ 2 - 2
appObjects/FlatCAMGeometry.py

@@ -2052,7 +2052,7 @@ class GeometryObject(FlatCAMObj, Geometry):
                 # TODO this serve for bounding box creation only; should be optimized
                 # TODO this serve for bounding box creation only; should be optimized
                 # commented this; there is no need for the actual GCode geometry - the original one will serve as well
                 # commented this; there is no need for the actual GCode geometry - the original one will serve as well
                 # for bounding box values
                 # for bounding box values
-                # dia_cnc_dict['solid_geometry'] = cascaded_union([geo['geom'] for geo in dia_cnc_dict['gcode_parsed']])
+                # dia_cnc_dict['solid_geometry'] = unary_union([geo['geom'] for geo in dia_cnc_dict['gcode_parsed']])
                 try:
                 try:
                     dia_cnc_dict['solid_geometry'] = tool_solid_geometry
                     dia_cnc_dict['solid_geometry'] = tool_solid_geometry
                     self.app.inform.emit('[success] %s...' % _("Finished G-Code processing"))
                     self.app.inform.emit('[success] %s...' % _("Finished G-Code processing"))
@@ -2202,7 +2202,7 @@ class GeometryObject(FlatCAMObj, Geometry):
                 # TODO this serve for bounding box creation only; should be optimized
                 # TODO this serve for bounding box creation only; should be optimized
                 # commented this; there is no need for the actual GCode geometry - the original one will serve as well
                 # commented this; there is no need for the actual GCode geometry - the original one will serve as well
                 # for bounding box values
                 # for bounding box values
-                # geo_for_bound_values = cascaded_union([
+                # geo_for_bound_values = unary_union([
                 #     geo['geom'] for geo in dia_cnc_dict['gcode_parsed'] if geo['geom'].is_valid is True
                 #     geo['geom'] for geo in dia_cnc_dict['gcode_parsed'] if geo['geom'].is_valid is True
                 # ])
                 # ])
                 try:
                 try:

+ 3 - 3
appObjects/FlatCAMGerber.py

@@ -12,7 +12,7 @@
 
 
 
 
 from shapely.geometry import Point, Polygon, MultiPolygon, MultiLineString, LineString, LinearRing
 from shapely.geometry import Point, Polygon, MultiPolygon, MultiLineString, LineString, LinearRing
-from shapely.ops import cascaded_union
+from shapely.ops import unary_union
 
 
 from appParsers.ParseGerber import Gerber
 from appParsers.ParseGerber import Gerber
 from appObjects.FlatCAMObj import *
 from appObjects.FlatCAMObj import *
@@ -386,7 +386,7 @@ class GerberObject(FlatCAMObj, Gerber):
                 try:
                 try:
                     self.solid_geometry = MultiPolygon(self.solid_geometry)
                     self.solid_geometry = MultiPolygon(self.solid_geometry)
                 except Exception:
                 except Exception:
-                    self.solid_geometry = cascaded_union(self.solid_geometry)
+                    self.solid_geometry = unary_union(self.solid_geometry)
 
 
             bounding_box = self.solid_geometry.envelope.buffer(float(self.options["noncoppermargin"]))
             bounding_box = self.solid_geometry.envelope.buffer(float(self.options["noncoppermargin"]))
             if not self.options["noncopperrounded"]:
             if not self.options["noncopperrounded"]:
@@ -412,7 +412,7 @@ class GerberObject(FlatCAMObj, Gerber):
                 try:
                 try:
                     self.solid_geometry = MultiPolygon(self.solid_geometry)
                     self.solid_geometry = MultiPolygon(self.solid_geometry)
                 except Exception:
                 except Exception:
-                    self.solid_geometry = cascaded_union(self.solid_geometry)
+                    self.solid_geometry = unary_union(self.solid_geometry)
 
 
             # Bounding box with rounded corners
             # Bounding box with rounded corners
             bounding_box = self.solid_geometry.envelope.buffer(float(self.options["bboxmargin"]))
             bounding_box = self.solid_geometry.envelope.buffer(float(self.options["bboxmargin"]))

+ 2 - 2
appParsers/ParseGerber.py

@@ -374,7 +374,7 @@ class Gerber(Geometry):
         geo_f = None
         geo_f = None
 
 
         # Polygons are stored here until there is a change in polarity.
         # Polygons are stored here until there is a change in polarity.
-        # Only then they are combined via cascaded_union and added or
+        # Only then they are combined via unary_union and added or
         # subtracted from solid_geometry. This is ~100 times faster than
         # subtracted from solid_geometry. This is ~100 times faster than
         # applying a union for every new polygon.
         # applying a union for every new polygon.
         poly_buffer = []
         poly_buffer = []
@@ -1680,7 +1680,7 @@ class Gerber(Geometry):
         #
         #
         # self.do_flashes()
         # self.do_flashes()
         #
         #
-        # self.solid_geometry = cascaded_union(self.buffered_paths +
+        # self.solid_geometry = unary_union(self.buffered_paths +
         #                                      [poly['polygon'] for poly in self.regions] +
         #                                      [poly['polygon'] for poly in self.regions] +
         #                                      self.flash_geometry)
         #                                      self.flash_geometry)
 
 

+ 7 - 7
appTools/ToolCopperThieving.py

@@ -12,7 +12,7 @@ from appTool import AppTool
 from appGUI.GUIElements import FCDoubleSpinner, RadioSet, FCEntry, FCComboBox
 from appGUI.GUIElements import FCDoubleSpinner, RadioSet, FCEntry, FCComboBox
 
 
 import shapely.geometry.base as base
 import shapely.geometry.base as base
-from shapely.ops import cascaded_union, unary_union
+from shapely.ops import unary_union
 from shapely.geometry import Polygon, MultiPolygon, Point, LineString
 from shapely.geometry import Polygon, MultiPolygon, Point, LineString
 from shapely.geometry import box as box
 from shapely.geometry import box as box
 import shapely.affinity as affinity
 import shapely.affinity as affinity
@@ -428,7 +428,7 @@ class ToolCopperThieving(AppTool):
             if len(self.sel_rect) == 0:
             if len(self.sel_rect) == 0:
                 return
                 return
 
 
-            self.sel_rect = cascaded_union(self.sel_rect)
+            self.sel_rect = unary_union(self.sel_rect)
 
 
             if not isinstance(self.sel_rect, Iterable):
             if not isinstance(self.sel_rect, Iterable):
                 self.sel_rect = [self.sel_rect]
                 self.sel_rect = [self.sel_rect]
@@ -606,9 +606,9 @@ class ToolCopperThieving(AppTool):
                             env_obj = geo_n.convex_hull
                             env_obj = geo_n.convex_hull
                         elif (isinstance(geo_n, MultiPolygon) and len(geo_n) == 1) or \
                         elif (isinstance(geo_n, MultiPolygon) and len(geo_n) == 1) or \
                                 (isinstance(geo_n, list) and len(geo_n) == 1) and isinstance(geo_n[0], Polygon):
                                 (isinstance(geo_n, list) and len(geo_n) == 1) and isinstance(geo_n[0], Polygon):
-                            env_obj = cascaded_union(geo_n)
+                            env_obj = unary_union(geo_n)
                         else:
                         else:
-                            env_obj = cascaded_union(geo_n)
+                            env_obj = unary_union(geo_n)
                             env_obj = env_obj.convex_hull
                             env_obj = env_obj.convex_hull
                         bounding_box = env_obj.buffer(distance=margin, join_style=base.JOIN_STYLE.mitre)
                         bounding_box = env_obj.buffer(distance=margin, join_style=base.JOIN_STYLE.mitre)
                     else:
                     else:
@@ -660,10 +660,10 @@ class ToolCopperThieving(AppTool):
                             raise grace
                             raise grace
                         geo_buff_list.append(poly.buffer(distance=margin, join_style=base.JOIN_STYLE.mitre))
                         geo_buff_list.append(poly.buffer(distance=margin, join_style=base.JOIN_STYLE.mitre))
 
 
-                    bounding_box = cascaded_union(geo_buff_list)
+                    bounding_box = unary_union(geo_buff_list)
                 elif working_obj.kind == 'gerber':
                 elif working_obj.kind == 'gerber':
-                    geo_n = cascaded_union(geo_n).convex_hull
-                    bounding_box = cascaded_union(thieving_obj.solid_geometry).convex_hull.intersection(geo_n)
+                    geo_n = unary_union(geo_n).convex_hull
+                    bounding_box = unary_union(thieving_obj.solid_geometry).convex_hull.intersection(geo_n)
                     bounding_box = bounding_box.buffer(distance=margin, join_style=base.JOIN_STYLE.mitre)
                     bounding_box = bounding_box.buffer(distance=margin, join_style=base.JOIN_STYLE.mitre)
                 else:
                 else:
                     app_obj.app.inform.emit('[ERROR_NOTCL] %s' % _("The reference object type is not supported."))
                     app_obj.app.inform.emit('[ERROR_NOTCL] %s' % _("The reference object type is not supported."))

+ 3 - 3
appTools/ToolCutOut.py

@@ -11,7 +11,7 @@ from appGUI.GUIElements import FCDoubleSpinner, FCCheckBox, RadioSet, FCComboBox
     FCLabel
     FCLabel
 
 
 from shapely.geometry import box, MultiPolygon, Polygon, LineString, LinearRing, MultiLineString
 from shapely.geometry import box, MultiPolygon, Polygon, LineString, LinearRing, MultiLineString
-from shapely.ops import cascaded_union, unary_union, linemerge
+from shapely.ops import unary_union, linemerge
 import shapely.affinity as affinity
 import shapely.affinity as affinity
 
 
 from matplotlib.backend_bases import KeyEvent as mpl_key_event
 from matplotlib.backend_bases import KeyEvent as mpl_key_event
@@ -1834,7 +1834,7 @@ class CutOut(AppTool):
         log.debug("%d paths" % len(flat_geometry))
         log.debug("%d paths" % len(flat_geometry))
 
 
         polygon = Polygon(points)
         polygon = Polygon(points)
-        toolgeo = cascaded_union(polygon)
+        toolgeo = unary_union(polygon)
         diffs = []
         diffs = []
         for target in flat_geometry:
         for target in flat_geometry:
             if type(target) == LineString or type(target) == LinearRing:
             if type(target) == LineString or type(target) == LinearRing:
@@ -1908,7 +1908,7 @@ class CutOut(AppTool):
 
 
         :param target_geo:      geometry from which to subtract
         :param target_geo:      geometry from which to subtract
         :param subtractor:      a list of Points, a LinearRing or a Polygon that will be subtracted from target_geo
         :param subtractor:      a list of Points, a LinearRing or a Polygon that will be subtracted from target_geo
-        :return:                a cascaded union of the resulting geometry
+        :return:                a unary_union of the resulting geometry
         """
         """
 
 
         if target_geo is None:
         if target_geo is None:

+ 3 - 3
appTools/ToolDistanceMin.py

@@ -11,7 +11,7 @@ from appGUI.GUIElements import FCEntry
 
 
 from shapely.ops import nearest_points
 from shapely.ops import nearest_points
 from shapely.geometry import Point, MultiPolygon
 from shapely.geometry import Point, MultiPolygon
-from shapely.ops import cascaded_union
+from shapely.ops import unary_union
 
 
 import math
 import math
 import logging
 import logging
@@ -113,12 +113,12 @@ class DistanceMin(AppTool):
                     try:
                     try:
                         selected_objs[0].solid_geometry = MultiPolygon(selected_objs[0].solid_geometry)
                         selected_objs[0].solid_geometry = MultiPolygon(selected_objs[0].solid_geometry)
                     except Exception:
                     except Exception:
-                        selected_objs[0].solid_geometry = cascaded_union(selected_objs[0].solid_geometry)
+                        selected_objs[0].solid_geometry = unary_union(selected_objs[0].solid_geometry)
 
 
                     try:
                     try:
                         selected_objs[1].solid_geometry = MultiPolygon(selected_objs[1].solid_geometry)
                         selected_objs[1].solid_geometry = MultiPolygon(selected_objs[1].solid_geometry)
                     except Exception:
                     except Exception:
-                        selected_objs[1].solid_geometry = cascaded_union(selected_objs[1].solid_geometry)
+                        selected_objs[1].solid_geometry = unary_union(selected_objs[1].solid_geometry)
 
 
                 first_pos, last_pos = nearest_points(selected_objs[0].solid_geometry, selected_objs[1].solid_geometry)
                 first_pos, last_pos = nearest_points(selected_objs[0].solid_geometry, selected_objs[1].solid_geometry)
 
 

+ 7 - 7
appTools/ToolIsolation.py

@@ -19,7 +19,7 @@ import numpy as np
 import simplejson as json
 import simplejson as json
 import sys
 import sys
 
 
-from shapely.ops import cascaded_union, nearest_points
+from shapely.ops import unary_union, nearest_points
 from shapely.geometry import MultiPolygon, Polygon, MultiLineString, LineString, LinearRing, Point
 from shapely.geometry import MultiPolygon, Polygon, MultiLineString, LineString, LinearRing, Point
 
 
 from matplotlib.backend_bases import KeyEvent as mpl_key_event
 from matplotlib.backend_bases import KeyEvent as mpl_key_event
@@ -1474,8 +1474,8 @@ class ToolIsolation(AppTool, Gerber):
 
 
         elif selection == _("Reference Object"):
         elif selection == _("Reference Object"):
             ref_obj = self.app.collection.get_by_name(self.ui.reference_combo.get_value())
             ref_obj = self.app.collection.get_by_name(self.ui.reference_combo.get_value())
-            ref_geo = cascaded_union(ref_obj.solid_geometry)
-            use_geo = cascaded_union(isolated_obj.solid_geometry).difference(ref_geo)
+            ref_geo = unary_union(ref_obj.solid_geometry)
+            use_geo = unary_union(isolated_obj.solid_geometry).difference(ref_geo)
             self.isolate(isolated_obj=isolated_obj, geometry=use_geo)
             self.isolate(isolated_obj=isolated_obj, geometry=use_geo)
 
 
     def isolate(self, isolated_obj, geometry=None, limited_area=None, negative_dia=None, plot=True):
     def isolate(self, isolated_obj, geometry=None, limited_area=None, negative_dia=None, plot=True):
@@ -2048,11 +2048,11 @@ class ToolIsolation(AppTool, Gerber):
         target_geo = geo
         target_geo = geo
 
 
         if subtraction_geo:
         if subtraction_geo:
-            sub_union = cascaded_union(subtraction_geo)
+            sub_union = unary_union(subtraction_geo)
         else:
         else:
             name = self.ui.exc_obj_combo.currentText()
             name = self.ui.exc_obj_combo.currentText()
             subtractor_obj = self.app.collection.get_by_name(name)
             subtractor_obj = self.app.collection.get_by_name(name)
-            sub_union = cascaded_union(subtractor_obj.solid_geometry)
+            sub_union = unary_union(subtractor_obj.solid_geometry)
 
 
         try:
         try:
             for geo_elem in target_geo:
             for geo_elem in target_geo:
@@ -2106,7 +2106,7 @@ class ToolIsolation(AppTool, Gerber):
         new_geometry = []
         new_geometry = []
         target_geo = geo
         target_geo = geo
 
 
-        intersect_union = cascaded_union(intersection_geo)
+        intersect_union = unary_union(intersection_geo)
 
 
         try:
         try:
             for geo_elem in target_geo:
             for geo_elem in target_geo:
@@ -2427,7 +2427,7 @@ class ToolIsolation(AppTool, Gerber):
             if len(self.sel_rect) == 0:
             if len(self.sel_rect) == 0:
                 return
                 return
 
 
-            self.sel_rect = cascaded_union(self.sel_rect)
+            self.sel_rect = unary_union(self.sel_rect)
             self.isolate(isolated_obj=self.grb_obj, limited_area=self.sel_rect, plot=True)
             self.isolate(isolated_obj=self.grb_obj, limited_area=self.sel_rect, plot=True)
             self.sel_rect = []
             self.sel_rect = []
 
 

+ 1 - 1
appTools/ToolMilling.py

@@ -17,7 +17,7 @@ from copy import deepcopy
 # import numpy as np
 # import numpy as np
 # import math
 # import math
 
 
-# from shapely.ops import cascaded_union
+# from shapely.ops import unary_union
 from shapely.geometry import Point, LineString
 from shapely.geometry import Point, LineString
 
 
 from matplotlib.backend_bases import KeyEvent as mpl_key_event
 from matplotlib.backend_bases import KeyEvent as mpl_key_event

+ 24 - 24
appTools/ToolNCC.py

@@ -18,7 +18,7 @@ from copy import deepcopy
 
 
 import numpy as np
 import numpy as np
 from shapely.geometry import base
 from shapely.geometry import base
-from shapely.ops import cascaded_union, nearest_points
+from shapely.ops import unary_union, nearest_points
 from shapely.geometry import MultiPolygon, Polygon, MultiLineString, LineString, LinearRing
 from shapely.geometry import MultiPolygon, Polygon, MultiLineString, LineString, LinearRing
 
 
 from matplotlib.backend_bases import KeyEvent as mpl_key_event
 from matplotlib.backend_bases import KeyEvent as mpl_key_event
@@ -1461,7 +1461,7 @@ class NonCopperClear(AppTool, Gerber):
             if len(self.sel_rect) == 0:
             if len(self.sel_rect) == 0:
                 return
                 return
 
 
-            self.sel_rect = cascaded_union(self.sel_rect)
+            self.sel_rect = unary_union(self.sel_rect)
 
 
             self.clear_copper(ncc_obj=self.ncc_obj, sel_obj=self.bound_obj, ncctooldia=self.ncc_dia_list,
             self.clear_copper(ncc_obj=self.ncc_obj, sel_obj=self.bound_obj, ncctooldia=self.ncc_dia_list,
                               isotooldia=self.iso_dia_list, outname=self.o_name)
                               isotooldia=self.iso_dia_list, outname=self.o_name)
@@ -1623,16 +1623,16 @@ class NonCopperClear(AppTool, Gerber):
                     env_obj = geo_n.convex_hull
                     env_obj = geo_n.convex_hull
                 elif (isinstance(geo_n, MultiPolygon) and len(geo_n) == 1) or \
                 elif (isinstance(geo_n, MultiPolygon) and len(geo_n) == 1) or \
                         (isinstance(geo_n, list) and len(geo_n) == 1) and isinstance(geo_n[0], Polygon):
                         (isinstance(geo_n, list) and len(geo_n) == 1) and isinstance(geo_n[0], Polygon):
-                    env_obj = cascaded_union(geo_n)
+                    env_obj = unary_union(geo_n)
                 else:
                 else:
-                    env_obj = cascaded_union(geo_n)
+                    env_obj = unary_union(geo_n)
                     env_obj = env_obj.convex_hull
                     env_obj = env_obj.convex_hull
             except Exception as e:
             except Exception as e:
                 log.debug("NonCopperClear.calculate_bounding_box() 'itself'  --> %s" % str(e))
                 log.debug("NonCopperClear.calculate_bounding_box() 'itself'  --> %s" % str(e))
                 self.app.inform.emit('[ERROR_NOTCL] %s' % _("No object available."))
                 self.app.inform.emit('[ERROR_NOTCL] %s' % _("No object available."))
                 return None
                 return None
         elif ncc_select == _("Area Selection"):
         elif ncc_select == _("Area Selection"):
-            env_obj = cascaded_union(self.sel_rect)
+            env_obj = unary_union(self.sel_rect)
             try:
             try:
                 __ = iter(env_obj)
                 __ = iter(env_obj)
             except Exception:
             except Exception:
@@ -1650,8 +1650,8 @@ class NonCopperClear(AppTool, Gerber):
                     env_obj = [box_geo]
                     env_obj = [box_geo]
 
 
             elif box_kind == 'gerber':
             elif box_kind == 'gerber':
-                box_geo = cascaded_union(box_obj.solid_geometry).convex_hull
-                ncc_geo = cascaded_union(ncc_obj.solid_geometry).convex_hull
+                box_geo = unary_union(box_obj.solid_geometry).convex_hull
+                ncc_geo = unary_union(ncc_obj.solid_geometry).convex_hull
                 env_obj = ncc_geo.intersection(box_geo)
                 env_obj = ncc_geo.intersection(box_geo)
             else:
             else:
                 self.app.inform.emit('[ERROR_NOTCL] %s' % _("The reference object type is not supported."))
                 self.app.inform.emit('[ERROR_NOTCL] %s' % _("The reference object type is not supported."))
@@ -1693,7 +1693,7 @@ class NonCopperClear(AppTool, Gerber):
                     # graceful abort requested by the user
                     # graceful abort requested by the user
                     raise grace
                     raise grace
                 geo_buff_list.append(poly.buffer(distance=ncc_margin, join_style=base.JOIN_STYLE.mitre))
                 geo_buff_list.append(poly.buffer(distance=ncc_margin, join_style=base.JOIN_STYLE.mitre))
-            new_bounding_box = cascaded_union(geo_buff_list)
+            new_bounding_box = unary_union(geo_buff_list)
         elif ncc_select == _("Reference Object"):
         elif ncc_select == _("Reference Object"):
             if box_kind == 'geometry':
             if box_kind == 'geometry':
                 geo_buff_list = []
                 geo_buff_list = []
@@ -1703,7 +1703,7 @@ class NonCopperClear(AppTool, Gerber):
                         raise grace
                         raise grace
                     geo_buff_list.append(poly.buffer(distance=ncc_margin, join_style=base.JOIN_STYLE.mitre))
                     geo_buff_list.append(poly.buffer(distance=ncc_margin, join_style=base.JOIN_STYLE.mitre))
 
 
-                new_bounding_box = cascaded_union(geo_buff_list)
+                new_bounding_box = unary_union(geo_buff_list)
             elif box_kind == 'gerber':
             elif box_kind == 'gerber':
                 new_bounding_box = bbox.buffer(distance=ncc_margin, join_style=base.JOIN_STYLE.mitre)
                 new_bounding_box = bbox.buffer(distance=ncc_margin, join_style=base.JOIN_STYLE.mitre)
             else:
             else:
@@ -1874,7 +1874,7 @@ class NonCopperClear(AppTool, Gerber):
                         geo_obj.tools[current_uid] = dict(tools_storage[current_uid])
                         geo_obj.tools[current_uid] = dict(tools_storage[current_uid])
                         break
                         break
 
 
-            sol_geo = cascaded_union(isolated_geo)
+            sol_geo = unary_union(isolated_geo)
             if has_offset is True:
             if has_offset is True:
                 self.app.inform.emit('[WARNING_NOTCL] %s ...' % _("Buffering"))
                 self.app.inform.emit('[WARNING_NOTCL] %s ...' % _("Buffering"))
                 sol_geo = sol_geo.buffer(distance=ncc_offset)
                 sol_geo = sol_geo.buffer(distance=ncc_offset)
@@ -1887,7 +1887,7 @@ class NonCopperClear(AppTool, Gerber):
                 return 'fail'
                 return 'fail'
 
 
         elif ncc_obj.kind == 'geometry':
         elif ncc_obj.kind == 'geometry':
-            sol_geo = cascaded_union(ncc_obj.solid_geometry)
+            sol_geo = unary_union(ncc_obj.solid_geometry)
             if has_offset is True:
             if has_offset is True:
                 self.app.inform.emit('[WARNING_NOTCL] %s ...' % _("Buffering"))
                 self.app.inform.emit('[WARNING_NOTCL] %s ...' % _("Buffering"))
                 sol_geo = sol_geo.buffer(distance=ncc_offset)
                 sol_geo = sol_geo.buffer(distance=ncc_offset)
@@ -2431,7 +2431,7 @@ class NonCopperClear(AppTool, Gerber):
                             log.debug("There are no geometries in the cleared polygon.")
                             log.debug("There are no geometries in the cleared polygon.")
 
 
                 # Area to clear next
                 # Area to clear next
-                buffered_cleared = cascaded_union(cleared_geo).buffer(tool / 2.0)
+                buffered_cleared = unary_union(cleared_geo).buffer(tool / 2.0)
                 area = area.difference(buffered_cleared)
                 area = area.difference(buffered_cleared)
 
 
                 if not area or area.is_empty:
                 if not area or area.is_empty:
@@ -2443,7 +2443,7 @@ class NonCopperClear(AppTool, Gerber):
                 #     new_area = [p.buffer(buff_distance) for p in area if not p.is_empty]
                 #     new_area = [p.buffer(buff_distance) for p in area if not p.is_empty]
                 # except TypeError:
                 # except TypeError:
                 #     new_area = [area.buffer(tool * ncc_overlap)]
                 #     new_area = [area.buffer(tool * ncc_overlap)]
-                # area = cascaded_union(area)
+                # area = unary_union(area)
 
 
             geo_obj.multigeo = True
             geo_obj.multigeo = True
             geo_obj.options["cnctooldia"] = '0.0'
             geo_obj.options["cnctooldia"] = '0.0'
@@ -2616,9 +2616,9 @@ class NonCopperClear(AppTool, Gerber):
                     env_obj = geo_n.convex_hull
                     env_obj = geo_n.convex_hull
                 elif (isinstance(geo_n, MultiPolygon) and len(geo_n) == 1) or \
                 elif (isinstance(geo_n, MultiPolygon) and len(geo_n) == 1) or \
                         (isinstance(geo_n, list) and len(geo_n) == 1) and isinstance(geo_n[0], Polygon):
                         (isinstance(geo_n, list) and len(geo_n) == 1) and isinstance(geo_n[0], Polygon):
-                    env_obj = cascaded_union(geo_n)
+                    env_obj = unary_union(geo_n)
                 else:
                 else:
-                    env_obj = cascaded_union(geo_n)
+                    env_obj = unary_union(geo_n)
                     env_obj = env_obj.convex_hull
                     env_obj = env_obj.convex_hull
 
 
                 bounding_box = env_obj.buffer(distance=ncc_margin, join_style=base.JOIN_STYLE.mitre)
                 bounding_box = env_obj.buffer(distance=ncc_margin, join_style=base.JOIN_STYLE.mitre)
@@ -2628,7 +2628,7 @@ class NonCopperClear(AppTool, Gerber):
                 return 'fail'
                 return 'fail'
 
 
         elif ncc_select == 'area':
         elif ncc_select == 'area':
-            geo_n = cascaded_union(self.sel_rect)
+            geo_n = unary_union(self.sel_rect)
             try:
             try:
                 __ = iter(geo_n)
                 __ = iter(geo_n)
             except Exception as e:
             except Exception as e:
@@ -2642,7 +2642,7 @@ class NonCopperClear(AppTool, Gerber):
                     raise grace
                     raise grace
                 geo_buff_list.append(poly.buffer(distance=ncc_margin, join_style=base.JOIN_STYLE.mitre))
                 geo_buff_list.append(poly.buffer(distance=ncc_margin, join_style=base.JOIN_STYLE.mitre))
 
 
-            bounding_box = cascaded_union(geo_buff_list)
+            bounding_box = unary_union(geo_buff_list)
 
 
         elif ncc_select == _("Reference Object"):
         elif ncc_select == _("Reference Object"):
             geo_n = ncc_sel_obj.solid_geometry
             geo_n = ncc_sel_obj.solid_geometry
@@ -2660,10 +2660,10 @@ class NonCopperClear(AppTool, Gerber):
                         raise grace
                         raise grace
                     geo_buff_list.append(poly.buffer(distance=ncc_margin, join_style=base.JOIN_STYLE.mitre))
                     geo_buff_list.append(poly.buffer(distance=ncc_margin, join_style=base.JOIN_STYLE.mitre))
 
 
-                bounding_box = cascaded_union(geo_buff_list)
+                bounding_box = unary_union(geo_buff_list)
             elif ncc_sel_obj.kind == 'gerber':
             elif ncc_sel_obj.kind == 'gerber':
-                geo_n = cascaded_union(geo_n).convex_hull
-                bounding_box = cascaded_union(self.ncc_obj.solid_geometry).convex_hull.intersection(geo_n)
+                geo_n = unary_union(geo_n).convex_hull
+                bounding_box = unary_union(self.ncc_obj.solid_geometry).convex_hull.intersection(geo_n)
                 bounding_box = bounding_box.buffer(distance=ncc_margin, join_style=base.JOIN_STYLE.mitre)
                 bounding_box = bounding_box.buffer(distance=ncc_margin, join_style=base.JOIN_STYLE.mitre)
             else:
             else:
                 self.app.inform.emit('[ERROR_NOTCL] %s' % _("The reference object type is not supported."))
                 self.app.inform.emit('[ERROR_NOTCL] %s' % _("The reference object type is not supported."))
@@ -2838,7 +2838,7 @@ class NonCopperClear(AppTool, Gerber):
                                 break
                                 break
                         geo_obj.tools[current_uid] = dict(tools_storage[current_uid])
                         geo_obj.tools[current_uid] = dict(tools_storage[current_uid])
 
 
-                sol_geo = cascaded_union(isolated_geo)
+                sol_geo = unary_union(isolated_geo)
                 if has_offset is True:
                 if has_offset is True:
                     app_obj.inform.emit('[WARNING_NOTCL] %s ...' % _("Buffering"))
                     app_obj.inform.emit('[WARNING_NOTCL] %s ...' % _("Buffering"))
                     sol_geo = sol_geo.buffer(distance=ncc_offset)
                     sol_geo = sol_geo.buffer(distance=ncc_offset)
@@ -2853,7 +2853,7 @@ class NonCopperClear(AppTool, Gerber):
                     return 'fail'
                     return 'fail'
 
 
             elif ncc_obj.kind == 'geometry':
             elif ncc_obj.kind == 'geometry':
-                sol_geo = cascaded_union(ncc_obj.solid_geometry)
+                sol_geo = unary_union(ncc_obj.solid_geometry)
                 if has_offset is True:
                 if has_offset is True:
                     app_obj.inform.emit('[WARNING_NOTCL] %s ...' % _("Buffering"))
                     app_obj.inform.emit('[WARNING_NOTCL] %s ...' % _("Buffering"))
                     sol_geo = sol_geo.buffer(distance=ncc_offset)
                     sol_geo = sol_geo.buffer(distance=ncc_offset)
@@ -3220,7 +3220,7 @@ class NonCopperClear(AppTool, Gerber):
                                 break
                                 break
                         geo_obj.tools[current_uid] = dict(tools_storage[current_uid])
                         geo_obj.tools[current_uid] = dict(tools_storage[current_uid])
 
 
-                sol_geo = cascaded_union(isolated_geo)
+                sol_geo = unary_union(isolated_geo)
                 if has_offset is True:
                 if has_offset is True:
                     app_obj.inform.emit('[WARNING_NOTCL] %s ...' % _("Buffering"))
                     app_obj.inform.emit('[WARNING_NOTCL] %s ...' % _("Buffering"))
                     sol_geo = sol_geo.buffer(distance=ncc_offset)
                     sol_geo = sol_geo.buffer(distance=ncc_offset)
@@ -3235,7 +3235,7 @@ class NonCopperClear(AppTool, Gerber):
                     return 'fail'
                     return 'fail'
 
 
             elif ncc_obj.kind == 'geometry':
             elif ncc_obj.kind == 'geometry':
-                sol_geo = cascaded_union(ncc_obj.solid_geometry)
+                sol_geo = unary_union(ncc_obj.solid_geometry)
                 if has_offset is True:
                 if has_offset is True:
                     app_obj.inform.emit('[WARNING_NOTCL] %s ...' % _("Buffering"))
                     app_obj.inform.emit('[WARNING_NOTCL] %s ...' % _("Buffering"))
                     sol_geo = sol_geo.buffer(distance=ncc_offset)
                     sol_geo = sol_geo.buffer(distance=ncc_offset)

+ 10 - 10
appTools/ToolPaint.py

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

+ 2 - 2
appTools/ToolPanelize.py

@@ -589,8 +589,8 @@ class Panelize(AppTool):
                         obj_fin.source_file = self.app.export_dxf(obj_name=self.outname, filename=None,
                         obj_fin.source_file = self.app.export_dxf(obj_name=self.outname, filename=None,
                                                                      local_use=obj_fin, use_thread=False)
                                                                      local_use=obj_fin, use_thread=False)
 
 
-                    # obj_fin.solid_geometry = cascaded_union(obj_fin.solid_geometry)
-                    # app_obj.log.debug("Finished creating a cascaded union for the panel.")
+                    # obj_fin.solid_geometry = unary_union(obj_fin.solid_geometry)
+                    # app_obj.log.debug("Finished creating a unary_union for the panel.")
                     app_obj.proc_container.update_view_text('')
                     app_obj.proc_container.update_view_text('')
 
 
                 self.app.inform.emit('%s: %d' % (_("Generating panel... Spawning copies"), (int(rows * columns))))
                 self.app.inform.emit('%s: %d' % (_("Generating panel... Spawning copies"), (int(rows * columns))))

+ 7 - 7
appTools/ToolProperties.py

@@ -10,7 +10,7 @@ from appTool import AppTool
 from appGUI.GUIElements import FCTree
 from appGUI.GUIElements import FCTree
 
 
 from shapely.geometry import MultiPolygon, Polygon
 from shapely.geometry import MultiPolygon, Polygon
-from shapely.ops import cascaded_union
+from shapely.ops import unary_union
 
 
 from copy import deepcopy
 from copy import deepcopy
 import math
 import math
@@ -237,7 +237,7 @@ class Properties(AppTool):
                 if obj_prop.kind.lower() == 'cncjob':
                 if obj_prop.kind.lower() == 'cncjob':
                     try:
                     try:
                         for tool_k in obj_prop.exc_cnc_tools:
                         for tool_k in obj_prop.exc_cnc_tools:
-                            x0, y0, x1, y1 = cascaded_union(obj_prop.exc_cnc_tools[tool_k]['solid_geometry']).bounds
+                            x0, y0, x1, y1 = unary_union(obj_prop.exc_cnc_tools[tool_k]['solid_geometry']).bounds
                             xmin.append(x0)
                             xmin.append(x0)
                             ymin.append(y0)
                             ymin.append(y0)
                             xmax.append(x1)
                             xmax.append(x1)
@@ -247,7 +247,7 @@ class Properties(AppTool):
 
 
                     try:
                     try:
                         for tool_k in obj_prop.cnc_tools:
                         for tool_k in obj_prop.cnc_tools:
-                            x0, y0, x1, y1 = cascaded_union(obj_prop.cnc_tools[tool_k]['solid_geometry']).bounds
+                            x0, y0, x1, y1 = unary_union(obj_prop.cnc_tools[tool_k]['solid_geometry']).bounds
                             xmin.append(x0)
                             xmin.append(x0)
                             ymin.append(y0)
                             ymin.append(y0)
                             xmax.append(x1)
                             xmax.append(x1)
@@ -257,7 +257,7 @@ class Properties(AppTool):
                 else:
                 else:
                     try:
                     try:
                         for tool_k in obj_prop.tools:
                         for tool_k in obj_prop.tools:
-                            x0, y0, x1, y1 = cascaded_union(obj_prop.tools[tool_k]['solid_geometry']).bounds
+                            x0, y0, x1, y1 = unary_union(obj_prop.tools[tool_k]['solid_geometry']).bounds
                             xmin.append(x0)
                             xmin.append(x0)
                             ymin.append(y0)
                             ymin.append(y0)
                             xmax.append(x1)
                             xmax.append(x1)
@@ -308,10 +308,10 @@ class Properties(AppTool):
                             env_obj = geo.convex_hull
                             env_obj = geo.convex_hull
                         elif (isinstance(geo, MultiPolygon) and len(geo) == 1) or \
                         elif (isinstance(geo, MultiPolygon) and len(geo) == 1) or \
                                 (isinstance(geo, list) and len(geo) == 1) and isinstance(geo[0], Polygon):
                                 (isinstance(geo, list) and len(geo) == 1) and isinstance(geo[0], Polygon):
-                            env_obj = cascaded_union(geo)
+                            env_obj = unary_union(geo)
                             env_obj = env_obj.convex_hull
                             env_obj = env_obj.convex_hull
                         else:
                         else:
-                            env_obj = cascaded_union(geo)
+                            env_obj = unary_union(geo)
                             env_obj = env_obj.convex_hull
                             env_obj = env_obj.convex_hull
 
 
                         area_chull = env_obj.area
                         area_chull = env_obj.area
@@ -321,7 +321,7 @@ class Properties(AppTool):
                     try:
                     try:
                         area_chull = []
                         area_chull = []
                         for tool_k in obj_prop.tools:
                         for tool_k in obj_prop.tools:
-                            area_el = cascaded_union(obj_prop.tools[tool_k]['solid_geometry']).convex_hull
+                            area_el = unary_union(obj_prop.tools[tool_k]['solid_geometry']).convex_hull
                             area_chull.append(area_el.area)
                             area_chull.append(area_el.area)
                         area_chull = max(area_chull)
                         area_chull = max(area_chull)
                     except Exception as er:
                     except Exception as er:

+ 2 - 2
appTools/ToolSolderPaste.py

@@ -19,7 +19,7 @@ from copy import deepcopy
 from datetime import datetime
 from datetime import datetime
 
 
 from shapely.geometry import Polygon, LineString
 from shapely.geometry import Polygon, LineString
-from shapely.ops import cascaded_union
+from shapely.ops import unary_union
 
 
 import traceback
 import traceback
 from io import StringIO
 from io import StringIO
@@ -941,7 +941,7 @@ class SolderPaste(AppTool):
                 tool_cnc_dict['gcode_parsed'] = job_obj.gcode_parse()
                 tool_cnc_dict['gcode_parsed'] = job_obj.gcode_parse()
 
 
                 # TODO this serve for bounding box creation only; should be optimized
                 # TODO this serve for bounding box creation only; should be optimized
-                tool_cnc_dict['solid_geometry'] = cascaded_union([geo['geom'] for geo in tool_cnc_dict['gcode_parsed']])
+                tool_cnc_dict['solid_geometry'] = unary_union([geo['geom'] for geo in tool_cnc_dict['gcode_parsed']])
 
 
                 # tell gcode_parse from which point to start drawing the lines depending on what kind of
                 # tell gcode_parse from which point to start drawing the lines depending on what kind of
                 # object is the source of gcode
                 # object is the source of gcode

+ 3 - 3
appTools/ToolSub.py

@@ -11,7 +11,7 @@ from appTool import AppTool
 from appGUI.GUIElements import FCCheckBox, FCButton, FCComboBox
 from appGUI.GUIElements import FCCheckBox, FCButton, FCComboBox
 
 
 from shapely.geometry import Polygon, MultiPolygon, MultiLineString, LineString
 from shapely.geometry import Polygon, MultiPolygon, MultiLineString, LineString
-from shapely.ops import cascaded_union
+from shapely.ops import unary_union
 
 
 import traceback
 import traceback
 from copy import deepcopy
 from copy import deepcopy
@@ -396,7 +396,7 @@ class ToolSub(AppTool):
         else:
         else:
             self.promises.append("single")
             self.promises.append("single")
 
 
-        self.sub_union = cascaded_union(self.sub_geo_obj.solid_geometry)
+        self.sub_union = unary_union(self.sub_geo_obj.solid_geometry)
 
 
         # start the QTimer to check for promises with 0.5 second period check
         # start the QTimer to check for promises with 0.5 second period check
         self.periodic_check(500, reset=True)
         self.periodic_check(500, reset=True)
@@ -421,7 +421,7 @@ class ToolSub(AppTool):
         with self.app.proc_container.new(text):
         with self.app.proc_container.new(text):
             # resulting paths are closed resulting into Polygons
             # resulting paths are closed resulting into Polygons
             if self.ui.close_paths_cb.isChecked():
             if self.ui.close_paths_cb.isChecked():
-                new_geo = (cascaded_union(geo)).difference(self.sub_union)
+                new_geo = (unary_union(geo)).difference(self.sub_union)
                 if new_geo:
                 if new_geo:
                     if not new_geo.is_empty:
                     if not new_geo.is_empty:
                         new_geometry.append(new_geo)
                         new_geometry.append(new_geo)

+ 20 - 20
camlib.py

@@ -25,7 +25,7 @@ from lxml import etree as ET
 from shapely.geometry import Polygon, Point, LinearRing
 from shapely.geometry import Polygon, Point, LinearRing
 
 
 from shapely.geometry import box as shply_box
 from shapely.geometry import box as shply_box
-from shapely.ops import cascaded_union, unary_union, substring, linemerge
+from shapely.ops import unary_union, substring, linemerge
 import shapely.affinity as affinity
 import shapely.affinity as affinity
 from shapely.wkt import loads as sloads
 from shapely.wkt import loads as sloads
 from shapely.wkt import dumps as sdumps
 from shapely.wkt import dumps as sdumps
@@ -413,13 +413,13 @@ class ApertureMacro:
             if r <= 0:
             if r <= 0:
                 break
                 break
             ring = Point((x, y)).buffer(r).exterior.buffer(thickness / 2.0)
             ring = Point((x, y)).buffer(r).exterior.buffer(thickness / 2.0)
-            result = cascaded_union([result, ring])
+            result = unary_union([result, ring])
             i += 1
             i += 1
 
 
         # ## Crosshair
         # ## Crosshair
         hor = LineString([(x - cross_len, y), (x + cross_len, y)]).buffer(cross_th / 2.0, cap_style=2)
         hor = LineString([(x - cross_len, y), (x + cross_len, y)]).buffer(cross_th / 2.0, cap_style=2)
         ver = LineString([(x, y - cross_len), (x, y + cross_len)]).buffer(cross_th / 2.0, cap_style=2)
         ver = LineString([(x, y - cross_len), (x, y + cross_len)]).buffer(cross_th / 2.0, cap_style=2)
-        result = cascaded_union([result, hor, ver])
+        result = unary_union([result, hor, ver])
 
 
         return {"pol": 1, "geometry": result}
         return {"pol": 1, "geometry": result}
 
 
@@ -726,7 +726,7 @@ class Geometry(object):
             polygon = Polygon(points)
             polygon = Polygon(points)
         else:
         else:
             polygon = points
             polygon = points
-        toolgeo = cascaded_union(polygon)
+        toolgeo = unary_union(polygon)
         diffs = []
         diffs = []
         for target in flat_geometry:
         for target in flat_geometry:
             if isinstance(target, LineString) or isinstance(target, LineString) or isinstance(target, MultiLineString):
             if isinstance(target, LineString) or isinstance(target, LineString) or isinstance(target, MultiLineString):
@@ -838,7 +838,7 @@ class Geometry(object):
         #         if len(self.solid_geometry) == 0:
         #         if len(self.solid_geometry) == 0:
         #             log.debug('solid_geometry is empty []')
         #             log.debug('solid_geometry is empty []')
         #             return 0, 0, 0, 0
         #             return 0, 0, 0, 0
-        #         return cascaded_union(flatten(self.solid_geometry)).bounds
+        #         return unary_union(flatten(self.solid_geometry)).bounds
         #     else:
         #     else:
         #         return self.solid_geometry.bounds
         #         return self.solid_geometry.bounds
         # except Exception as e:
         # except Exception as e:
@@ -853,7 +853,7 @@ class Geometry(object):
         #     if len(self.solid_geometry) == 0:
         #     if len(self.solid_geometry) == 0:
         #         log.debug('solid_geometry is empty []')
         #         log.debug('solid_geometry is empty []')
         #         return 0, 0, 0, 0
         #         return 0, 0, 0, 0
-        #     return cascaded_union(self.solid_geometry).bounds
+        #     return unary_union(self.solid_geometry).bounds
         # else:
         # else:
         #     return self.solid_geometry.bounds
         #     return self.solid_geometry.bounds
 
 
@@ -1376,7 +1376,7 @@ class Geometry(object):
             self.solid_geometry = []
             self.solid_geometry = []
 
 
         if type(self.solid_geometry) is list:
         if type(self.solid_geometry) is list:
-            # self.solid_geometry.append(cascaded_union(geos))
+            # self.solid_geometry.append(unary_union(geos))
             if type(geos) is list:
             if type(geos) is list:
                 self.solid_geometry += geos
                 self.solid_geometry += geos
             else:
             else:
@@ -1386,7 +1386,7 @@ class Geometry(object):
 
 
         # flatten the self.solid_geometry list for import_svg() to import SVG as Gerber
         # flatten the self.solid_geometry list for import_svg() to import SVG as Gerber
         self.solid_geometry = list(self.flatten_list(self.solid_geometry))
         self.solid_geometry = list(self.flatten_list(self.solid_geometry))
-        self.solid_geometry = cascaded_union(self.solid_geometry)
+        self.solid_geometry = unary_union(self.solid_geometry)
 
 
         # self.solid_geometry = MultiPolygon(self.solid_geometry)
         # self.solid_geometry = MultiPolygon(self.solid_geometry)
         # self.solid_geometry = self.solid_geometry.buffer(0.00000001)
         # self.solid_geometry = self.solid_geometry.buffer(0.00000001)
@@ -2262,12 +2262,12 @@ class Geometry(object):
 
 
     def union(self):
     def union(self):
         """
         """
-        Runs a cascaded union on the list of objects in
+        Runs a unary_union on the list of objects in
         solid_geometry.
         solid_geometry.
 
 
         :return: None
         :return: None
         """
         """
-        self.solid_geometry = [cascaded_union(self.solid_geometry)]
+        self.solid_geometry = [unary_union(self.solid_geometry)]
 
 
     def export_svg(self, scale_stroke_factor=0.00,
     def export_svg(self, scale_stroke_factor=0.00,
                    scale_factor_x=None, scale_factor_y=None,
                    scale_factor_x=None, scale_factor_y=None,
@@ -2286,11 +2286,11 @@ class Geometry(object):
             if self.multigeo:
             if self.multigeo:
                 for tool in self.tools:
                 for tool in self.tools:
                     flat_geo += self.flatten(self.tools[tool]['solid_geometry'])
                     flat_geo += self.flatten(self.tools[tool]['solid_geometry'])
-                geom_svg = cascaded_union(flat_geo)
+                geom_svg = unary_union(flat_geo)
             else:
             else:
-                geom_svg = cascaded_union(self.flatten())
+                geom_svg = unary_union(self.flatten())
         else:
         else:
-            geom_svg = cascaded_union(self.flatten())
+            geom_svg = unary_union(self.flatten())
 
 
         skew_ref = 'center'
         skew_ref = 'center'
         if skew_reference != 'center':
         if skew_reference != 'center':
@@ -6869,7 +6869,7 @@ class CNCjob(Geometry):
         # This takes forever. Too much data?
         # This takes forever. Too much data?
         # self.app.inform.emit('%s: %s' % (_("Unifying Geometry from parsed Geometry segments"),
         # self.app.inform.emit('%s: %s' % (_("Unifying Geometry from parsed Geometry segments"),
         #                                  str(len(self.gcode_parsed))))
         #                                  str(len(self.gcode_parsed))))
-        # self.solid_geometry = cascaded_union([geo['geom'] for geo in self.gcode_parsed])
+        # self.solid_geometry = unary_union([geo['geom'] for geo in self.gcode_parsed])
 
 
         # This is much faster but not so nice to look at as you can see different segments of the geometry
         # This is much faster but not so nice to look at as you can see different segments of the geometry
         self.solid_geometry = [geo['geom'] for geo in self.gcode_parsed]
         self.solid_geometry = [geo['geom'] for geo in self.gcode_parsed]
@@ -7475,18 +7475,18 @@ class CNCjob(Geometry):
                 travels.append(g)
                 travels.append(g)
 
 
         # Used to determine the overall board size
         # Used to determine the overall board size
-        self.solid_geometry = cascaded_union([geo['geom'] for geo in self.gcode_parsed])
+        self.solid_geometry = unary_union([geo['geom'] for geo in self.gcode_parsed])
 
 
         # Convert the cuts and travels into single geometry objects we can render as svg xml
         # Convert the cuts and travels into single geometry objects we can render as svg xml
         if travels:
         if travels:
-            travelsgeom = cascaded_union([geo['geom'] for geo in travels])
+            travelsgeom = unary_union([geo['geom'] for geo in travels])
 
 
         if self.app.abort_flag:
         if self.app.abort_flag:
             # graceful abort requested by the user
             # graceful abort requested by the user
             raise grace
             raise grace
 
 
         if cuts:
         if cuts:
-            cutsgeom = cascaded_union([geo['geom'] for geo in cuts])
+            cutsgeom = unary_union([geo['geom'] for geo in cuts])
 
 
         # Render the SVG Xml
         # Render the SVG Xml
         # The scale factor affects the size of the lines, and the stroke color adds different formatting for each set
         # The scale factor affects the size of the lines, and the stroke color adds different formatting for each set
@@ -7753,7 +7753,7 @@ class CNCjob(Geometry):
                         self.app.proc_container.update_view_text(' %d%%' % disp_number)
                         self.app.proc_container.update_view_text(' %d%%' % disp_number)
                         self.old_disp_number = disp_number
                         self.old_disp_number = disp_number
 
 
-                v['solid_geometry'] = cascaded_union([geo['geom'] for geo in v['gcode_parsed']])
+                v['solid_geometry'] = unary_union([geo['geom'] for geo in v['gcode_parsed']])
         self.create_geometry()
         self.create_geometry()
         self.app.proc_container.new_text = ''
         self.app.proc_container.new_text = ''
 
 
@@ -7862,7 +7862,7 @@ class CNCjob(Geometry):
                         self.old_disp_number = disp_number
                         self.old_disp_number = disp_number
 
 
                 # for the bounding box
                 # for the bounding box
-                v['solid_geometry'] = cascaded_union([geo['geom'] for geo in v['gcode_parsed']])
+                v['solid_geometry'] = unary_union([geo['geom'] for geo in v['gcode_parsed']])
 
 
         self.app.proc_container.new_text = ''
         self.app.proc_container.new_text = ''
 
 
@@ -8234,7 +8234,7 @@ def dict2obj(d):
 #
 #
 #     m = MultiLineString(edge_points)
 #     m = MultiLineString(edge_points)
 #     triangles = list(polygonize(m))
 #     triangles = list(polygonize(m))
-#     return cascaded_union(triangles), edge_points
+#     return unary_union(triangles), edge_points
 
 
 # def voronoi(P):
 # def voronoi(P):
 #     """
 #     """

+ 2 - 2
tclCommands/TclCommandBbox.py

@@ -1,7 +1,7 @@
 import collections
 import collections
 from tclCommands.TclCommand import TclCommand
 from tclCommands.TclCommand import TclCommand
 
 
-from shapely.ops import cascaded_union
+from shapely.ops import unary_union
 
 
 import gettext
 import gettext
 import appTranslation as fcTranslate
 import appTranslation as fcTranslate
@@ -94,7 +94,7 @@ class TclCommandBbox(TclCommand):
                 # assert geo_obj.kind == 'geometry'
                 # assert geo_obj.kind == 'geometry'
 
 
                 # Bounding box with rounded corners
                 # Bounding box with rounded corners
-                geo = cascaded_union(obj.solid_geometry)
+                geo = unary_union(obj.solid_geometry)
                 bounding_box = geo.envelope.buffer(float(margin))
                 bounding_box = geo.envelope.buffer(float(margin))
                 if not rounded:  # Remove rounded corners
                 if not rounded:  # Remove rounded corners
                     bounding_box = bounding_box.envelope
                     bounding_box = bounding_box.envelope

+ 2 - 2
tclCommands/TclCommandCutout.py

@@ -3,7 +3,7 @@ from tclCommands.TclCommand import TclCommand
 import collections
 import collections
 import logging
 import logging
 
 
-from shapely.ops import cascaded_union
+from shapely.ops import unary_union
 from shapely.geometry import LineString
 from shapely.geometry import LineString
 
 
 log = logging.getLogger('base')
 log = logging.getLogger('base')
@@ -134,7 +134,7 @@ class TclCommandCutout(TclCommand):
                            [pts[6], pts[7], pts[8]],
                            [pts[6], pts[7], pts[8]],
                            [pts[9], pts[10], pts[11]]]}
                            [pts[9], pts[10], pts[11]]]}
             cuts = cases[gaps_par]
             cuts = cases[gaps_par]
-            geo_obj.solid_geometry = cascaded_union([LineString(segment) for segment in cuts])
+            geo_obj.solid_geometry = unary_union([LineString(segment) for segment in cuts])
 
 
         try:
         try:
             self.app.app_obj.new_object("geometry", outname, geo_init_me, plot=False)
             self.app.app_obj.new_object("geometry", outname, geo_init_me, plot=False)

+ 3 - 3
tclCommands/TclCommandGeoCutout.py

@@ -3,7 +3,7 @@ from tclCommands.TclCommand import TclCommandSignaled
 import logging
 import logging
 import collections
 import collections
 from copy import deepcopy
 from copy import deepcopy
-from shapely.ops import cascaded_union
+from shapely.ops import unary_union
 from shapely.geometry import Polygon, LineString, LinearRing
 from shapely.geometry import Polygon, LineString, LinearRing
 
 
 import gettext
 import gettext
@@ -131,14 +131,14 @@ class TclCommandGeoCutout(TclCommandSignaled):
             flat_geometry = flatten(geo, pathonly=True)
             flat_geometry = flatten(geo, pathonly=True)
 
 
             polygon = Polygon(pts)
             polygon = Polygon(pts)
-            toolgeo = cascaded_union(polygon)
+            toolgeo = unary_union(polygon)
             diffs = []
             diffs = []
             for target in flat_geometry:
             for target in flat_geometry:
                 if type(target) == LineString or type(target) == LinearRing:
                 if type(target) == LineString or type(target) == LinearRing:
                     diffs.append(target.difference(toolgeo))
                     diffs.append(target.difference(toolgeo))
                 else:
                 else:
                     log.warning("Not implemented.")
                     log.warning("Not implemented.")
-            return cascaded_union(diffs)
+            return unary_union(diffs)
 
 
         if 'name' in args:
         if 'name' in args:
             name = args['name']
             name = args['name']

+ 2 - 2
tclCommands/TclCommandNregions.py

@@ -1,6 +1,6 @@
 from tclCommands.TclCommand import TclCommand
 from tclCommands.TclCommand import TclCommand
 
 
-from shapely.ops import cascaded_union
+from shapely.ops import unary_union
 
 
 import collections
 import collections
 
 
@@ -92,7 +92,7 @@ class TclCommandNregions(TclCommand):
             def geo_init(geo_obj, app_obj):
             def geo_init(geo_obj, app_obj):
                 assert geo_obj.kind == 'geometry'
                 assert geo_obj.kind == 'geometry'
 
 
-                geo = cascaded_union(obj.solid_geometry)
+                geo = unary_union(obj.solid_geometry)
                 bounding_box = geo.envelope.buffer(float(margin))
                 bounding_box = geo.envelope.buffer(float(margin))
                 if not rounded:
                 if not rounded:
                     bounding_box = bounding_box.envelope
                     bounding_box = bounding_box.envelope

+ 1 - 1
tests/other/test_plotg.py

@@ -1,5 +1,5 @@
 from shapely.geometry import LineString, Polygon
 from shapely.geometry import LineString, Polygon
-from shapely.ops import cascaded_union, unary_union
+from shapely.ops import unary_union
 from matplotlib.pyplot import plot, subplot, show, axes
 from matplotlib.pyplot import plot, subplot, show, axes
 from matplotlib.axes import *
 from matplotlib.axes import *
 from camlib import *
 from camlib import *

+ 1 - 1
tests/test_paint.py

@@ -1,7 +1,7 @@
 import unittest
 import unittest
 
 
 from shapely.geometry import LineString, Polygon
 from shapely.geometry import LineString, Polygon
-from shapely.ops import cascaded_union, unary_union
+from shapely.ops import unary_union
 from matplotlib.pyplot import plot, subplot, show, cla, clf, xlim, ylim, title
 from matplotlib.pyplot import plot, subplot, show, cla, clf, xlim, ylim, title
 from matplotlib.axes import *
 from matplotlib.axes import *
 from camlib import *
 from camlib import *

+ 1 - 1
tests/test_pathconnect.py

@@ -1,7 +1,7 @@
 import unittest
 import unittest
 
 
 from shapely.geometry import LineString, Polygon
 from shapely.geometry import LineString, Polygon
-from shapely.ops import cascaded_union, unary_union
+from shapely.ops import unary_union
 from matplotlib.pyplot import plot, subplot, show, cla, clf, xlim, ylim, title
 from matplotlib.pyplot import plot, subplot, show, cla, clf, xlim, ylim, title
 from camlib import *
 from camlib import *
 from random import random
 from random import random