- 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

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

View File

@@ -3,7 +3,7 @@ from tclCommands.TclCommand import TclCommand
import collections
import logging
from shapely.ops import cascaded_union
from shapely.ops import unary_union
from shapely.geometry import LineString
log = logging.getLogger('base')
@@ -134,7 +134,7 @@ class TclCommandCutout(TclCommand):
[pts[6], pts[7], pts[8]],
[pts[9], pts[10], pts[11]]]}
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:
self.app.app_obj.new_object("geometry", outname, geo_init_me, plot=False)

View File

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

View File

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