| Version 1.9 Build 803
|
|
Next: Motion and Position Events
Up: Events
Previous: Events
The refresh event mechanism is used to synchronise the display
of data to the user. For example, when a parameter is changed in a
DisplayData, a refresh event should be generated such that all
WorldCanvases displaying that DisplayData are redrawn if necessary.
Or, if a PixelCanvasColorTable is physically resized, all
PixelCanvases using that ColorTable must be cleared and redrawn.
Any class in the Display Library can register its interest in refresh
events in one of the following ways:
- it can inherit from the PCRefreshEH or WCRefreshEH classes;
- it can create an instance of a helper class which forwards
events to the class itself; or
- it can attach predefined event handlers, or Tools, to
itself.
Having taken one of the options above, the class need simply then
register itself, or its helper class, as an event handler with all
potential sources of the event of interest. A specific example is
the WorldCanvas class, which wishes to know when its underlying
PixelCanvas is resized, so that it can resize itself accordingly.
To this end, the WorldCanvas class creates a helper class, called
``WCOnPCRefreshEH'', an instance of which can be registered as a
handler of PixelCanvas refresh events, and whose only function is to
add World Coordinate information to the event and pass it on to its
parent WorldCanvas. The function called on the WorldCanvas can then
look at the type of the refresh, and if it is a size change, will then
act accordingly.
There are many possible reasons for a refresh event to be generated,
and indeed such an event can be generated by any class which allows
other objects to register themselves as handlers of refresh events.
The types of refresh event are listed in DisplayEnums.h, and
include:
- UserCommand - this is reserved for explicit refresh
requests from the user.
- ColorTableChange - the allocation of hardware resources
has changed, probably at the level of the PixelCanvasColorTable,
and consequently most drawings on PixelCanvases sharing the
ColorTable of interest will need to be redrawn.
- ColormapChange - some internal change to a single
Colormap has occurred, which may mean that data being drawn with
the particular Colormap needs to be redrawn.
- PixelCoordinateChange - the PixelCanvas has changed
shape. All WorldCanvases on top of this PixelCanvas will need to
erase themselves and redraw to the new geometry.
- LinearCoordinateChange - presently unused, this type of
refresh might be required if the WorldCanvas elects to
re-negotiate its linear coordinate system.
- WorldCoordinateChange - presently unused, this type of
refresh could be used if the WorldCanvas elects somehow to
re-negotiate its world coordinate system.
- BackCopiedToFront - a saved image of the PixelCanvas has
been restored to the display, and drawings which are not cached on
the (back) buffer may need to be redrawn.
- ClearPriorToColorChange - all Pixel and WorldCanvases
need to be cleared before a PixelCanvasColorTable change is
applied. This can be used to remove drawings before a new
Colormap is mapped into the ColorTable, so that invalid images are
not left on the screen.
Next: Motion and Position Events
Up: Events
Previous: Events
Contents
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc.,
Washington, D.C.
Return to AIPS++ Home Page
2004-08-28