kopia lustrzana https://github.com/inkstitch/inkstitch
break apart and polyline issues (#1313)
rodzic
d6e20fae8a
commit
107c547e6e
|
@ -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]
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Ładowanie…
Reference in New Issue