Package-level declarations
The tree: the sealed Node with its two kinds — ShapeNode, a styled, tagged leaf that subclasses its CGA shape, and GroupNode, an ordered sub-tree with optional bounds. A leaf reads and operates as its shape: geometric operations accept it as-is, and the shape-preserving ones (*, the coerce pair, canonical) return through the leaf's copy override — the leaf comes back as its own class, style and tags riding along; everything else returns plain shapes — the decoration drops by contract. This package adds the ShapeNode * Versor dispatch for leaves typed only as ShapeNode, and GroupNode * Versor over whole sub-trees — generic over the receiver and returning through the group's own copy hook, so a GroupNode subclass comes back as its own class too.
ShapeNode itself is not sealed; every leaf belongs to one of the two sealed families one package down — PrimitiveNode, the blade leaves, and CompositeNode, the composite leaves — so exhaustive dispatch splits on the families and nests a when over each.
The node-preserving transforms
| Pairing | Result |
|---|---|
node * Versor | the leaf with its geometry moved — each leaf class comes back as itself, style and tags untouched; the ShapeNode-typed dispatch widens the static type only |
GroupNode * Versor | the group with every leaf in the sub-tree moved — structure, order, styles, and bounds preserved; a group subclass comes back as its own class through its copy hook |
Functions
Returns every ShapeNode in the tree — a depth-first, source-order traversal, so the resulting order is the paint order.