XAAL Documentation - Positioning

Positioning

For positioning the objects, Xaal uses the notation defined by the ITiCSE XML Working Group. The language supports the specification of coordinates either in absolute coordinates or as offsets relative to a given location. A location can be based on

  • the bounding box of an object,
  • a node of a polygon/polyline object,
  • last used location, or
  • the baseline of a text component

The following listing and the figure illustrate these different approaches.

Positioning example.<!-- point i -->
<coordinate> 
  <offset x="10" y="-10" base-object="triangle" 
   anchor="NW"/>
</coordinate>
<!-- point ii -->
<coordinate>
  <offset x="5" y="10" base-object="triangle" 
   node="2"/>
</coordinate>
<!-- point iii -->
<coordinate>
  <offset x="-10" y="5"/>
</coordinate>
<!-- point iv -->
<coordinate>
  <offset x="-20" y="-5" baseline-of="text1" 
   mode="end"/>
</coordinate>
<!-- point v -->
<coordinate x="35" y="5"/>

In the example, the dashed rectangle is the bounding box of the triangle. Point i is positioned relative to the north-west (NW) corner of the bounding box. Point ii is relative to the node 2 of the triangle. Point iii only specifies an offset, in which case it is drawn relative to the last used location (point ii). Point iv is positioned relative to the end of the baseline of text text1. Point v uses absolute coordinates. As can be seen from the example, the positive x-axis is to the right and positive y-axis down.