diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2021-10-09 10:04:13 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-09 10:04:13 +0200 |
| commit | 0224794a0815f22a719d2880e175077b77214513 (patch) | |
| tree | 63aa87718b78b771f1a6916feada83ef5aa577aa /lib/elements | |
| parent | c75b90154b5bf6e40bb6286dc1e42949311fe240 (diff) | |
fix multipolygon issue (#1364)
Diffstat (limited to 'lib/elements')
| -rw-r--r-- | lib/elements/fill.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/elements/fill.py b/lib/elements/fill.py index 442922b6..51a6d703 100644 --- a/lib/elements/fill.py +++ b/lib/elements/fill.py @@ -158,10 +158,13 @@ class Fill(EmbroideryElement): message = re.match(r".+?(?=\[)", why) if message.group(0) == "Self-intersection": buffered = polygon.buffer(0) + # if we receive a multipolygon, only use the first one of it + if type(buffered) == shgeo.MultiPolygon: + buffered = buffered[0] # we do not want to break apart into multiple objects (possibly in the future?!) # best way to distinguish the resulting polygon is to compare the area size of the two # and make sure users will not experience significantly altered shapes without a warning - if math.isclose(polygon.area, buffered.area): + if type(buffered) == shgeo.Polygon and math.isclose(polygon.area, buffered.area, abs_tol=0.5): polygon = shgeo.MultiPolygon([buffered]) return polygon |
