Show in Frame No Frame
Up Previous Next Title Page Index Contents Search

6.6.1 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/relationship 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.

For a movable dynamic port that has been connected to and moved, x and y commands will answer the coordinates of the role's target point; if not moved, the answer is empty. This is intended for use in a symbol generator for a dynamic port. The next element on the stack must be the main object whose port the role connects to, i.e. the object whose template displays the dynamic port. The closest graph on the stack must be the graph whose diagram shows this binding. Note that this requires that the dynamic port object is not also directly in the current graph: in that case the x and y coordinates of that object's representation will be used instead.

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.

Show in Frame No Frame
Up Previous Next Title Page Index Contents Search