break apart and polyline issues (#1313)

pull/1322/head
Kaalleen 2021-08-10 18:14:30 +02:00 zatwierdzone przez GitHub
rodzic d6e20fae8a
commit 107c547e6e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -49,7 +49,7 @@ class Polyline(EmbroideryElement):
def points(self):
# example: "1,2 0,0 1.5,3 4,2"
points = self.node.get('points')
points = self.node.get('points').strip()
points = points.split(" ")
points = [[float(coord) for coord in point.split(",")] for point in points]

Wyświetl plik

@ -7,7 +7,7 @@ import logging
from copy import copy
import inkex
from shapely.geometry import LineString, MultiPolygon, Polygon
from shapely.geometry import LinearRing, MultiPolygon, Polygon
from shapely.ops import polygonize, unary_union
from ..elements import EmbroideryElement
@ -63,10 +63,10 @@ class BreakApart(InkstitchExtension):
for path in paths:
if len(path) < 3:
continue
linestring = LineString(path)
if not linestring.is_simple:
linestring = unary_union(linestring)
for polygon in polygonize(linestring):
linearring = LinearRing(path)
if not linearring.is_simple:
linearring = unary_union(linearring)
for polygon in polygonize(linearring):
polygons.append(polygon)
else:
polygon = Polygon(path).buffer(0)