[Label / Ref / Grid] add raw constructors

This commit is contained in:
Jan Petykiewicz 2026-04-02 15:46:53 -07:00
commit 46a15e2f0f
3 changed files with 52 additions and 0 deletions

View file

@ -86,6 +86,26 @@ class Ref(
self.repetition = repetition
self.annotations = annotations if annotations is not None else {}
@classmethod
def _from_raw(
cls,
*,
offset: NDArray[numpy.float64],
rotation: float,
mirrored: bool,
scale: float,
repetition: Repetition | None,
annotations: annotations_t | None,
) -> Self:
new = cls.__new__(cls)
new._offset = offset
new._rotation = rotation % (2 * pi)
new._scale = scale
new._mirrored = mirrored
new._repetition = repetition
new._annotations = annotations if annotations is not None else {}
return new
def __copy__(self) -> 'Ref':
new = Ref(
offset=self.offset.copy(),