5.3.7 Representation commands
Outputting representation position information
To output the x coordinate of an object or a relationship,
simply write
x
Similarly, use y for the y coordinate. The output
depends on the available representations of the object/relationship in the
following way. First the representation graph is chosen: the oldest diagram, or
if there are no diagrams the oldest matrix, or then the oldest table. In a
diagram, the values are based on the co-ordinates of the default connectable
target point of the first object/relationaship representation (based on Z order,
back to front i.e. normally oldest first). The co-ordinate scale maps one-to-one
to pixels at 100% zoom.
If there is no diagram, the answer is empty for a
relationship. In a matrix, the horizontal axis is examined first and if there is
a representation, its x co-ordinate is its index (starting at 1) and its y
co-ordinate is 0. If there is no representation there, but there is one on the
vertical axis, the x co-ordinate is 0 and the y co-ordinate is the index. In a
table the x co-ordinate is 0 and the y co-ordinate is the index: the table
effectively has only a vertical axis. If no such representation is found, the
value is empty.
To output the left co-ordinate of an element
use:
left
In the same way you can use
right,
top and
bottom keywords. These commands work
like x and
y but answer the co-ordinate of the
size of the first representation of the current object or relationship in the
oldest diagram representation of the current graph. Note that these commands
only make sense for diagram representations, not for matrices or
tables.
To output the x co-ordinate of the center of an element
use:
centerX
The command outputs the midpoint of
left and
right. You can use
centerY to get the midpoint of
top and
bottom, respectively. This command is
different from x and
y, which output the positions of the
default connectable target point.
To output the width of an element use:
width
The output of
width equals right minus left.
Similarly you can use height (bottom
– top) and area (width *
height).
These commands all count as simple commands, and can be
followed by a translator, e.g.
left%dotToComma. They can also be
followed by a level number, e.g.
left;1, but only where the current
graph is the same as the graph at that level. If the graph has changed in an
intervening loop, e.g. do
decompositions, the representation of the element from the outer
loop will be searched for in the graph of the current loop, rather than in its
original context.
Outputting element symbol nesting
To output the object(s) that contain the current
object’s or relationship’s symbol use:
containers
which answers the objects whose
representations contain the first (from back to front) representation of the
current object or relationship, in the oldest diagram representation of the
current graph. The elements are sorted by area (smallest first), then by normal
sorting order (type, id, oid).
Similarly, to output the objects contained in the current
object’s symbol use:
contents
The elements are sorted by area (largest
first), then by normal sorting order (type, id,
oid).