Add copy() method to Shape

This commit is contained in:
jan 2017-09-06 21:04:44 -07:00
parent 723944018e
commit 10cd0778b8

View File

@ -1,5 +1,6 @@
from typing import List, Tuple, Callable
from abc import ABCMeta, abstractmethod
import copy
import numpy
from .. import PatternError
@ -151,6 +152,14 @@ class Shape(metaclass=ABCMeta):
self._dose = val
# ---- Non-abstract methods
def copy(self) -> 'Shape':
"""
Returns a deep copy of the shape.
:return: Deep copy of self
"""
return copy.deepcopy(self)
def translate(self, offset: vector2) -> 'Shape':
"""
Translate the shape by the given offset