use addsp() to consolidate some existing code
This commit is contained in:
parent
3a9eca91b5
commit
1b400605b1
@ -413,9 +413,8 @@ class Pattern(LockableImpl, AnnotatableImpl, metaclass=AutoSlots):
|
|||||||
|
|
||||||
for i, values in shape_table[label][1]:
|
for i, values in shape_table[label][1]:
|
||||||
(offset, scale, rotation, mirror_x, dose) = values
|
(offset, scale, rotation, mirror_x, dose) = values
|
||||||
subpat = SubPattern(pattern=pat, offset=offset, scale=scale,
|
self.addsp(pattern=pat, offset=offset, scale=scale,
|
||||||
rotation=rotation, dose=dose, mirrored=(mirror_x, False))
|
rotation=rotation, dose=dose, mirrored=(mirror_x, False))
|
||||||
self.subpatterns.append(subpat)
|
|
||||||
shapes_to_remove.append(i)
|
shapes_to_remove.append(i)
|
||||||
|
|
||||||
# Remove any shapes for which we have created subpatterns.
|
# Remove any shapes for which we have created subpatterns.
|
||||||
@ -600,20 +599,18 @@ class Pattern(LockableImpl, AnnotatableImpl, metaclass=AutoSlots):
|
|||||||
if pat is None:
|
if pat is None:
|
||||||
return pat
|
return pat
|
||||||
|
|
||||||
new_subpatterns = []
|
|
||||||
for shape in pat.shapes:
|
for shape in pat.shapes:
|
||||||
if shape.repetition is None:
|
if shape.repetition is None:
|
||||||
continue
|
continue
|
||||||
new_subpatterns.append(SubPattern(Pattern(name_func(pat, shape), shapes=[shape])))
|
pat.addsp(Pattern(name_func(pat, shape), shapes=[shape]))
|
||||||
shape.repetition = None
|
shape.repetition = None
|
||||||
|
|
||||||
for label in self.labels:
|
for label in self.labels:
|
||||||
if label.repetition is None:
|
if label.repetition is None:
|
||||||
continue
|
continue
|
||||||
new_subpatterns.append(SubPattern(Pattern(name_func(pat, shape), labels=[label])))
|
pat.addsp(Pattern(name_func(pat, shape), labels=[label]))
|
||||||
label.repetition = None
|
label.repetition = None
|
||||||
|
|
||||||
pat.subpatterns += new_subpatterns
|
|
||||||
return pat
|
return pat
|
||||||
|
|
||||||
if recursive:
|
if recursive:
|
||||||
|
Loading…
Reference in New Issue
Block a user