diff options
| author | Lex Neva <github.com@lexneva.name> | 2018-07-04 21:17:20 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2018-07-12 20:13:46 -0400 |
| commit | 62ef2850a2f57d64d0e65fbfc055b85e3c940031 (patch) | |
| tree | 5c16d38ac0fff6651e44d06924adbcdcea77af48 /lib/elements/polyline.py | |
| parent | d090fa003830f117918fac201ca527d513507a70 (diff) | |
generalize Element.shape and implement in all element types
Diffstat (limited to 'lib/elements/polyline.py')
| -rw-r--r-- | lib/elements/polyline.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/elements/polyline.py b/lib/elements/polyline.py index 5c474237..b9ffdc0b 100644 --- a/lib/elements/polyline.py +++ b/lib/elements/polyline.py @@ -1,3 +1,5 @@ +from shapely import geometry as shgeo + from .element import param, EmbroideryElement, Patch from ..i18n import _ from ..utils.geometry import Point @@ -28,6 +30,11 @@ class Polyline(EmbroideryElement): return points @property + @cache + def shape(self): + return shgeo.LineString(self.points) + + @property def path(self): # A polyline is a series of connected line segments described by their # points. In order to make use of the existing logic for incorporating |
