summaryrefslogtreecommitdiff
path: root/lib/stitch_plan
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stitch_plan')
-rw-r--r--lib/stitch_plan/color_block.py6
-rw-r--r--lib/stitch_plan/stitch_plan.py4
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/stitch_plan/color_block.py b/lib/stitch_plan/color_block.py
index fdef5eb8..a0f9d43f 100644
--- a/lib/stitch_plan/color_block.py
+++ b/lib/stitch_plan/color_block.py
@@ -80,6 +80,12 @@ class ColorBlock(object):
return sum(1 for stitch in self if stitch.trim)
@property
+ def num_jumps(self):
+ """Number of jumps in this color block."""
+
+ return sum(1 for stitch in self if stitch.jump)
+
+ @property
def stop_after(self):
if self.last_stitch is not None:
return self.last_stitch.stop
diff --git a/lib/stitch_plan/stitch_plan.py b/lib/stitch_plan/stitch_plan.py
index 68d52699..8067749a 100644
--- a/lib/stitch_plan/stitch_plan.py
+++ b/lib/stitch_plan/stitch_plan.py
@@ -173,6 +173,10 @@ class StitchPlan(object):
return sum(block.num_stitches for block in self)
@property
+ def num_jumps(self):
+ return sum(block.num_jumps for block in self)
+
+ @property
def bounding_box(self):
color_block_bounding_boxes = [cb.bounding_box for cb in self]
minx = min(bb[0] for bb in color_block_bounding_boxes)