Subdiagrams

A Subdiagram represents a diagram embedded within the context
of a larger diagram. Essentially, it consists of a diagram
paired with any accumulated information from the larger context
(transformations, attributes, etc.).

Create a "point subdiagram", that is, a pointDiagram (with no
content and a point envelope) treated as a subdiagram with local
origin at the given point. Note this is not the same as
mkSubdiagram . pointDiagram, which would result in a subdiagram
with local origin at the parent origin, rather than at the given
point.

Turn a subdiagram into a normal diagram, including the enclosing
context. Concretely, a subdiagram is a pair of (1) a diagram and
(2) a "context" consisting of an extra transformation and
attributes. getSub simply applies the transformation and
attributes to the diagram to get the corresponding "top-level"
diagram.

SubMaps form a monoid with the empty map as the identity, and
map union as the binary operation. No information is ever lost:
if two maps have the same name in their domain, the resulting map
will associate that name to the concatenation of the information
associated with that name.

Look for the given name in a name map, returning a list of
subdiagrams associated with that name. If no names match the
given name exactly, return all the subdiagrams associated with
names of which the given name is a suffix.

Given a name and a diagram transformation indexed by a
subdiagram, perform the transformation using the most recent
subdiagram associated with (some qualification of) the name,
or perform the identity transformation if the name does not exist.

Given a name and a diagram transformation indexed by a list of
subdiagrams, perform the transformation using the
collection of all such subdiagrams associated with (some
qualification of) the given name.

Given a list of names and a diagram transformation indexed by a
list of subdiagrams, perform the transformation using the
list of most recent subdiagrams associated with (some qualification
of) each name. Do nothing (the identity transformation) if any
of the names do not exist.