The Base and Current Frames

At all times, one of the Frames in a FrameSetFrameSet is designated to be its base FrameFrame and one to be its current Frame (Figure 14). These Frames are identified by two integer FrameSet attributes, BaseBase and CurrentCurrent, which hold the indices of the nominated Frames within the FrameSet.

The existence of the base and current Frames reflects an important application of FrameSets, which is to attach coordinate systems to entities such as data arrays, data files, plotting surfaces (for graphics), etc. In this context, the base Frame represents the “native” coordinate system of the attached entity—for example, the pixel coordinates of an image or the intrinsic coordinates of a plotting surface. The other Frames within the FrameSet represent alternative coordinate systems which may also be used to refer to positions within that entity. The current Frame represents the particular coordinate system which is currently selected for use. For instance, if an image were being displayed, you would aim to label it with coordinates corresponding to the current Frame. In order to see a different coordinate system, a software user would arrange for a different Frame to be made current.

The choice of base and current Frames may be changed at any time, simply by assigning new values to the FrameSet's Base and Current attributes. For example, to make the Frame with index 3 become the current Frame, you could use:


\begin{terminalv}
astSetI( frameset, ''Current'', 3 );
\end{terminalv}

You can nominate the same Frame to be both the base and current Frame if you wish.

By default (i.e. if the Base or Current attribute is un-set), the first Frame added to a FrameSet becomes its base Frame and the last one added becomes its current Frame.[*] Whenever a new Frame is added to a FrameSet, the Current attribute is modified so that the new Frame becomes the current one. This behaviour is reflected in the state of the example FrameSet in Figure 14.