Working Widgets
Without
Code
Introduction
TSIPP is a 3-D image
specification and rendering toolkit for use with Tcl and Tk
used by the TSIPP Workbench. The main goal of TSIPP is visualization; the
understanding of data in science or engineering (see ref. [2] p. 9). Towards
this objective, the TSIPP Workbench can be used to create a class of megawidgets
which:
-
have the appearance of visual scenes with photographic realism;
-
can vary with time (animation) or other control stimulus;
-
are interactive in that they may solicit input.
An example of this would be to create a "hydraulic widget" that indicates
the water level in a reservoir. During an interactive session the image
of the widget is defined, as well as the methods to be supported and their
effect on the image. The result is a regular Tk widget that can be immediately
used with minimal code (this file can be found in the "examples" directory,
named "hydraulic_animate"):
#!/bin/sh
# standard executable Tcl file ...
\
exec tksipp "$0" "$@"
set env(TSIPPwb) [file dir [info script]]/..
lappend auto_path $env(TSIPPwb)/tcl
package require RLE_animate
class hydraulic {
inherit RLE_animate
}
pack [hydraulic .r]
-side left
pack [scale .s
\
-to
1
\
-from
[.r cget -n_frame] \
-command {.r show}
\
-label "Water
Level"] -side right
...
which changes to ... as
the slider is moved.
The animation of the image encompasses more than just movements of the
objects in the scene. Camera positions, positions of light sources, and
the intensity and characteristics of the image can all be controlled by
methods of the widget. In the following example, a representation of activity
in a nuclear reactor is related to control rod position:
raise
the control rods, and see that core cook! ...
Subsystem Interfaces
The TSIPP Workbench comprises an incr-Tcl program which interfaces to TSIPP,
which at present is statically linked to the wish executable. This in turn
provides a Tcl command interface to SIPP, the
SImple Polygon
Processor
library. The state of the TSIPP Workbench can be saved as a plain-text
incr-Tcl source file, which may be reloaded to restore the state of the
tool. This Tcl source file can be thought of as the "source" for the image.
As a human readable incr-Tcl program it provides the potential for interfacing
to other image processing systems, or of implementing recovery from tool
problems which make the file unreadable, which would be significantly more
difficult if the image source was in binary format.
Still images may be written to a PPM format file, as defined
by the PBMPlus toolkit, while animated images are written out as
an RLE file, as defined by the Utah Raster Toolkit.
To fulfill its role as a widget creator, it is intended that the tool
will generate incr-Tcl class definitions for a widget that has the appearance
of the image as drawn, complete with methods which vary the appearance
as defined using the tool. This has not yet been implemented, and as can
be seen in the example code for the desk widget above, a standard widget
is used through inheritance. The widget loads an RLE file with a name which
by default is derived from the name of the widget, but may be specified
explicitly as a parameter to the constructor.