C++ Classes for Common Scientific Visualization Tasks
Programming a scientific visualization GUI (SVGUI) in raw Motif is not an easy task. Motif was designed for general-purpose use, and its widgets require a lot of effort to be adapted for a specific application. Scientific visualization, although a wide area in itself, has some common tasks which should be identified and addressed. We describe here a library of tools tailored for most common SVGUI tasks which should make writing an SVGUI easier and more uniform.
This library and a more complete description of it can be obtained through anonymous ftp in:
Pseudo-widgets for number and identifier input
One of the most common tasks in an SVGUI is clearly the input of floating-point numbers, integers, and identifiers (names). An assembly of widgets (label, text field, scale or another graphical input widget) used for the above tasks must act essentially as a single specialized widget. An identifier or a number typed in a text field must be checked for the correct syntax. The scale and the text field must be kept synchronized, the appropriate action must be taken when the typed number is outside the scale limits. A pop-up or fold-out device for scale interval adjustment must be provided.
We achieve this behavior by encapsulating a combination of widgets in a set of C++ classes. The set of classes forms an acyclic graph, displayed in Figure . The edges show the inheritance relationships between the classes.
Because in C++ these classes become actually new types, their use is almost as simple as that of integers and floating point numbers. Assignment operators for the classes are defined in such a way that they can be used in expressions and assignments exactly as the corresponding base type. For example, an instance of ScaleFloatText class can be created and used as following.
Event Processing with User-Definable Callbacks
This class can be useful when different parts of a program must react synchronously to a certain event which can be triggered in several different places. While semantically we want a program to act as one piece, as programmers we always strive to make different parts of the program as self-contained as possible. EventProc helps to a programmer to kill both birds by one stone. It uses the mechanism of callbacks familiar to Motif programmers. Another area of application are libraries which have event-driven parts, for example high-level graphics libraries containing graphical user interface features.