summaryrefslogtreecommitdiff
path: root/lib/elements
diff options
context:
space:
mode:
authorLex Neva <lexelby@users.noreply.github.com>2019-07-27 15:48:50 -0400
committerGitHub <noreply@github.com>2019-07-27 15:48:50 -0400
commit833a8a971d8a73fbc42468a89d083e37a0bd6d8d (patch)
tree4c38fd49d7cf813a2df1d07dbd32160d0e36373f /lib/elements
parent03af8b37276870efd97f7049ced006f6e01ef935 (diff)
parent7ce4387ff6f8d4302ff374921d0b93b7b491b9a5 (diff)
Merge pull request #487 from inkstitch/no_import_jumps
remove additional jump stitches on import
Diffstat (limited to 'lib/elements')
-rw-r--r--lib/elements/stroke.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/elements/stroke.py b/lib/elements/stroke.py
index 3ae2b143..e0a0aacc 100644
--- a/lib/elements/stroke.py
+++ b/lib/elements/stroke.py
@@ -1,11 +1,13 @@
import sys
+
import shapely.geometry
-from .element import param, EmbroideryElement, Patch
from ..i18n import _
-from ..utils import cache, Point
from ..stitches import running_stitch, bean_stitch
from ..svg import parse_length_with_units
+from ..utils import cache, Point
+from .element import param, EmbroideryElement, Patch
+
warned_about_legacy_running_stitch = False
@@ -85,7 +87,11 @@ class Stroke(EmbroideryElement):
@cache
def shape(self):
line_strings = [shapely.geometry.LineString(path) for path in self.paths]
- return shapely.geometry.MultiLineString(line_strings)
+
+ # Using convex_hull here is an important optimization. Otherwise
+ # complex paths cause operations on the shape to take a long time.
+ # This especially happens when importing machine embroidery files.
+ return shapely.geometry.MultiLineString(line_strings).convex_hull
@property
@param('manual_stitch',