VDA Tool Technology

By David A. Sayed

31 March 1996


Abstract

This white paper gives an overview of the exciting new features of PV-WAVE 6.0. The VDA Tool Architecture is a framework for developing cross-platform applications with graphic user interfaces (GUIs) in PV-WAVE.

It is intended to put the VDA Tool Architecture into context and position the PV-WAVE Environment as a development tool. It is not intended to give detailed technical information on writing applications in PV-WAVE or to teach VDA Tool programming.

Further information on VDA Tool programming and the PV-WAVE Language can be found in the PV-WAVE Programmer's Reference and in the PV-WAVE Advanced Training Course.


Overview

Today's computer user expects ease-of-use. For software this means applications should work with users to accomplish their objectives. From a design point of view, software needs to employ graphical user interfaces, on-line help, icons, etc. Another notable trend in general desktop software is that users are interacting with applications in their own language. These trends are now moving up from the desktop office application to scientific and engineering applications.

All of this may be immensely beneficial to users but usually represents a significant resource drain for application developers, because it is seen as a distraction from the task of developing the core product.

The latest releases of general purpose development environments have facilitated the development of "modern" applications, but they don't ease the development of applications for technical data analysis.

History and Evolution

Figure 1 - PV-WAVE Slicer Tool

For several years, Visual Numerics has brought professional software development tools to the technical software community. In successive versions of the PV-WAVE data analysis and visualization environment, we added a number of tools to enable application developers to create easier-to-use software. The first of these was the introduction of PV-WAVE Widgets in version 4.2. For users, widget-based tools such as WgSliceTool and WgSurfaceTool enabled slicing through a three-dimensional volume (see Figure 1) or displaying data as a surface using a single command. For programmers, PV-WAVE Widgets gave them the ability to use Motif widgets within their PV-WAVE applications, or create their own widget-based tools.

VDA Tools

Version 6.0 of PV-WAVE introduces a number of exciting new features. For end-users, there is the PV-WAVE:NAVIGATOR, which contains thirteen graphical tools giving users a familiar point-and-click interface from which they can load, view and edit datasets. Each one of these operations is performed by a Visual Data Analysis (VDA) Tool. The Navigator allows a user to invoke VDA Tools without having to use the command line.

So what are VDA Tools? They are essentially a natural progression from PV­WAVE Widgets. They differ in that they are mini-applications in their own right, complete with a user-interface, graphical elements, a message dispatch and processing mechanism, inter-tool communication and a tool manager. From a developer's point of view, a VDA Tool is rather like an application framework. The surface tool WzSurface shown in Figure 2 illustrates some of these components.

VDA Tools bring a number of significant features to PV-WAVE:

Figure 2 - PV-WAVE Navigator

Figure 3 - Surface VDA Tool

  • Building-block approach to application development

VDA Tools can be strung together; through inter-tool communication and a shared clipboard, data and graphical elements can be moved between tools. A tool may have a variety of outputs: from modified input data to completely different data types. In addition, the output from one tool can serve as the input to another.

  • Reusable tool components

Each tool is built up from underlying PV-WAVE elements. These include graphical elements for decorating a window (lines, bitmaps, boxes, etc.), menu bars, tool bars, message handlers. To write a new tool, a developer simply needs to re-use these components and fit them into the application framework.

  • Easy customisation

PV-WAVE source code is supplied for each VDA Tool. In some cases, customising a tool is as easy as modifying a line of code. In others, it is simply a matter of deciding which messages to respond to and filling in the blanks in the application framework.

  • Cross-platform development and deployment

PV-WAVE 6.0 runs identically across all supported environments. Developers can write and test their code on one environment and deploy on another. VDA Tools appear on different environments according to the native look and feel of the particular environment. Functionality is completely unchanged.

  • National language support

We've taken the opportunity to split up application code from application strings. That is, from a developer's point of view, source code and resources are separate. If you're producing applications for international markets, you can localize any text by simply translating the resource file.

  • Extensions to PV-WAVE kernel

In addition to new dynamic data types such as associative arrays and lists, the PV-WAVE kernel has been made nonblocking. That is, VDA Tools and Widget applications can execute without tying up the command-line, which means that more than one VDA Tool can execute at the same time.

VDA Tools can be used together to build applets, complete with their own custom navigator, making them ideal for developing products for specific markets. For example, a navigator for financial engineering could be built, consisting of VDA tools for alalyzing risk or pricing derivatives.

Architecture

How do VDA Tools work, and how easy is it to build one?

The entire VDA Tool architecture is built on top of the new PV-WAVE kernel out of components. The architecture essentially represents an additional application programming interface (API) that encapsulates PV-WAVE functions and procedures as well as PV-WAVE Widgets. Therefore, VDA Tools can be written entirely in PV­WAVE.

Figure 4 - VDA Tool Architecture

Let's take a look at the anatomy of a VDA Tool.

VDA Tools Manager

The Tools Manager oversees instances of VDA Tools in a PV-WAVE session and provides registration and initialization functions. A VDA Tool consists of re-entrant code, so it is possible to have multiple instances of each tool, each instance working on separate data.

The Tools Manager is essentially a data structure that holds information about the names, methods, graphical elements, variables and attributes that constitute a VDA Tool.

To the application developer, the Tools Manager consists of a set of functions, each prefixed with Tm.

Functions

The Tool Manager API isolates applications from the underlying complexity of the Tool Manager. These functions consist of calls to initialise, obtain unique names, register, enumerate tools, communicate between tools, etc.

Methods

Methods actually make a VDA Tool do something useful. They can be thought of as the call-back procedure that is triggered in response to a message sent by the Tool Manager. A VDA Tool can choose to handle standard methods (shown in Table 1) or handle custom methods which are specific to that VDA Tool.

Method

Action

Caller

TM_DISPLAY Performs the graphics commands to display data Redraw events, window expose events
TM_CODEGEN Generates PV-WAVE Language code to display graphics Menu command call-back
TM_CONVERT Co-ordinates conversion for copy-and-paste operations between windows Data export, resize, graphical element routines
TM_VIEWATTRIBUTES Creates a dialogue box for setting view attributes Menu command call-backs, graphical element routines
TM_DATA_EXPORT Creates a dialogue box for exporting a variable from a VDA Tool Menu command call-back
TM_DATA_SELECTION Called when data selection is complete and verifies that data were selected Menu command and button bar call-backs, graphical element routines
TM_VARATTRIBUTES Creates a dialogue box for setting variable attributes Menu command call-backs and graphical element routines
TM_DATA_IMPORT Validates data being imported into VDA Tool Target VDA Tool

Attributes

VDA Tools attributes are internal data (such as background color, font, etc.) stored for each tool. We provide a very simple interface to accessing VDA Tool attributes. Two functions are available for storing and retrieving attributes, while another is provided for enumerating into a string array of VDA Tool attributes.

VDA Objects

Objects for common user-interface components such as dialogue boxes, menu bars, tool bars, etc. are all provided. Each of these has a default behavior that may be added to or overridden in favor of custom response to events.

In addition to these objects, other graphical elements (graels) such as axes, bitmaps, legends and lines are available. Just like VDA Tools themselves, graels have methods, attributes, etc. A variety of standard methods are provided for user actions in a window: bring to front, send to back, group, ungroup, cut, copy, paste, etc.

In addition to graels, there are objects and utilities (prefixed by Wo). These consist of functions for adding menus, button bars, bitmaps, etc., as well as loading string resources. Using this layer of the VDA Tools API helps you to maintain a common and consistent look and feel between your VDA Tools on any supported platform.

Implementation

To build a VDA Tool, a developer needs to alalyze the problem and decide how to implement its solution in the VDA Tool framework. Using a combination of attributes, functions, methods and objects, developers can rapidly and efficiently create elegant solutions for visual data analysis.

Sample VDA Tool

Objective

The Wz_Histogram tool is fairly simple and serves as a good starting point for understanding how to add to and write VDA Tools.

Source code as well as compiled versions of VDA Tools is located in the lib directory of a PV-WAVE installation and associated resource files containing text strings are in the xres directory.

Design

VDA Tool source code is split into a main section and call-backs. It is this main section that defines the VDA Tool, its appearance, attributes, etc. Here are the key elements:

Initialize TM -> TmInit
Assign tool name -> unique_name = TmGetUniqueToolName(root)
Register tool with TM -> TmRegister, unique_name, top
Assign icon -> WoSetToolIcon, unique_name, 'wzhisto'
Set up menu bar -> bar = WoMenuBar(layout , unique_name, wzhistogram_menubar)
Set up button bar -> tb = WoButtonBar(layout , unique_name)
Bind method to a message -> TmSetMethod, unique_name, 'TM_DISPLAY', WzHistogramDisplay'

Implementing VDA Tool functionality takes place in the call-back section of the file. The call-backs or methods define actions to be performed as a result of a message. This message mapping is set up using the TmSetMethod function shown above.

Methods can be thought of as black boxes with well-defined inputs and outputs. Therefore, if you only need to modify the behavior of a certain aspect of a VDA Tool, you may only need to change some code in one method. Similarly, if you are creating a new VDA Tool based on an existing one, you can change and add methods that you need to but leave other methods unchanged. This concept of code components and re-use reduces your application development effort significantly.

The Navigator

The PV-WAVE:NAVIGATOR is very often the first thing that an "end-user" of PV-WAVE sees. The Navigator is itself a "super VDA Tool" and holds a collection of other VDA Tools. Because full source code for The Navigator is supplied, developers can easily modify it to suit their requirements, or those of their employer. For example, some organizations may not want to allow saving of files - it is a simple matter to disable the data export VDA Tool. Alternatively, developers can add custom VDA Tools to The Navigator. Again, this is easily accomplished by adding to the source code.

Summary

This brief overview has shown how you can leverage the powerful new API that PV-WAVE 6.0 gives to developers. The VDA Tools API can be used to develop entire applications in a fraction of the time required with other systems, while enabling developers to localize and maintain versions of their applications.

Appendix

Tools Manager API

Function Name

Action

TmAddSelectedVars Adds selected variables from a VDA Tool to the list of selected variables in Tools Manager
TmAddVar Adds a variable to a VDA Tool
TmCodeGen Writes a specified string to the code generation file
TmCopy Copies the selected graphical elements from the specified VDA Tool to the clipboard.
TmCut Cuts the selected graphical elements from the specified VDA Tool and moves them to the clipboard.
TmDelVar Removes variables from a VDA Tool.
TmDelete Permanently deletes the selected graphical elements from the specified VDA Tool.
TmDeselectVars Clears the current list of selected variables.
TmDynamicDisplay Displays selected data in all active VDA Tools, provided that the VDA Tools can display the related variable(s).
TmEndCodeGen Closes the file in which generated code is written.
TmEnumerateAttributes Obtains the attributes for a specified graphical element, variable, or other item in a VDA Tool.
TmEnumerateMethods Obtains the methods that were set for a VDA Tool.
TmEnumerateSelectedVars Returns the names of variables on the selected variables list.
TmEnumerateToolNames Returns all the registered VDA Tool names.
TmEnumerateVars Returns all the variables associated with an instance of a VDA Tool.
TmExecuteMethod Executes a method that was set by TmSetMethod.
TmExport Exports $MAIN$-level variables to specified VDA Tools or to all currently active VDA Tools.
TmExportSelection Exports the contents of the variable selection list to specified VDA Tools.
TmGetAttribute Returns the value that was set for an attribute in a VDA Tool instance.
TmGetMessage Loads a string resource file into the resource database and extracts a message string from the database.
TmGetMethod Returns the data structure of the specified method.
TmGetTop Gets the top-level widget ID for a VDA Tool.
TmGetUniqueToolName Returns a unique name for a particular instance of a specified VDA Tool.
TmGetVarMainName Returns the $MAIN$ level name of a variable.
TmInit Initializes the VDA Tools Manager layer.
TmPaste Pastes the graphical elements from the clipboard to the specified VDA Tool.
TmRegister Registers a VDA Tool with the Tools Manager.
TmRestoreTemplate Restores a saved VDA Tool template.
TmRestoreTools Restores the VDA Tools that were saved with the TmSaveTools procedure.
TmSaveTools Saves the specified VDA Tools in a file.
TmSetAttribute Sets an attribute for an item in the given VDA Tool.
TmSetMethod Sets a method for a given VDA Tool.
TmStartCodeGen Opens a file into which PV-WAVE code is written.
TmUnregister Removes the specified VDA Tool from the Tools Manager registry.

Graphical Elements API

Function Name

Action

TmAddGrael Adds a graphical element to the graphical element list for the specified instance of a VDA Tool.
TmAddSelectedGrael Adds a graphical element to the graphical element selection list.
TmAxis Adds axes to a VDA Tool.
TmBitmap Adds a bitmap (2D array) to a VDA Tool.
TmBottomGrael Sets the specified graphical element to be on the bottom of the display list (displayed behind the other graphical elements).
TmDelGrael Removes a specified graphical element from the list of graphical elements associated with a VDA Tool instance.
TmDelSelectedGraels Deletes a graphical element from the list of selected graphical elements.
TmEnumerateGraelMethods Obtain a list of all the methods set for a graphical element in a specified VDA Tool.
TmEnumerateGraels Returns all the graphical elements that were set for a given VDA Tool.
TmEnumerateSelectedGraels Obtains a list of graphical elements or other items currently on the graphical items selection list.
TmExecuteGraelMethod Executes a method for a graphical method based on the method name.
TmGetGraelMethod Obtains the data structure for the specified method.
TmGetGraelRectangle Returns the rectangular boundary of a graphical element.
TmGetUniqueGraelName Obtains a unique name based on the name of the specified graphical element.
TmGroupGraels Groups a number of selected graphical elements as one graphical element with a unique name.
TmLegend Adds a legend to a VDA Tool. The exact size and position of the legend is determined interactively by the user.
TmLine Adds a line to a VDA Tool. The exact length and position of the line is determined interactively by the user.
TmRect Adds a rectangle to a VDA Tool. The exact size and position of the rectangle are determined interactively by the user.
TmSetGraelMethod Sets the name of the method procedure for a given method name and graphical element.
TmSetGraelRectangle Sets the selection rectangle for a graphical element, or a set of graphical elements.
TmText Adds text to a VDA Tool. The position of the text and the text itself are determined interactively by the user.
TmTopGrael Sets the specified graphical element to be at the top of the display list (displayed in front of other graphical elements).
TmUngroupGraels Ungroups a group of graphical elements.

Utilities API

Function Name

Action

WoAddButtons Adds a bank of buttons to a button bar.
WoAddMessage Adds a message to a message area created by WoMessage.
WoAddStatus Display's a message in the status bar of a VDA Tool.
WoBuildResourceFilename Returns the full path name for a specified resource file.
WoButtonBar Creates a predefined, two-row button bar that can be included in a VDA Tool.
WoButtonBarSet Changes the setting of a button in a button bar.
WoButtonBarSetSensitivity Sets the sensitivity of one or more buttons on a button bar.
WoCheckFile Confirms if a file is readable or writable.
WoColorButton Creates a button that brings up a color table dialogue box used to set colors in a VDA Tool. The button has an associated color pixmap that reflects the currently selected color.
WoColorButtonGetValue Gets the currently selected color index from a color button created by WoColorButton.
WoColorButtonSetValue Sets the current color index for a color button created by WoColorButton, and updates the color button's color pixmap.
WoColorWheel Creates a color wheel that can be used to modify a single color in the current color table.
WoConfirmClose Displays a dialogue box requiring the user to confirm a window close action.
WoDialogStatus Saves or restores the status of a dialogue box by saving or restoring the state of its widgets as stored in the Tools Manager.
WoFontOptionMenu Creates an option menu with the standard list of software (vector-drawn) fonts found in PV-WAVE.
WoFontOptionMenuGetValue Gets the software font command for the currently selected font.
WoFontOptionMenuSetValue Sets the current font and updates the font option menu.
WoGenericDialog Creates a generic dialogue box for use in VDA Tools.
WoLabeledText Creates a group of aligned text widgets (widgets with a label and a text field).
WoLinestyleOptionMenu Creates an option menu for selecting linestyles.
WoLinestyleOptionMenuGetValue Gets the currently selected linestyle.
WoLoadResources Loads resources and strings from a file for VDA tools.
WoLoadStrings Loads strings from a resource file for use by the VDA tools.
WoMenuBar Create a menu bar for a VDA Tool.
WoMenuBarSetSensitivity Sets the sensitivity of one or more items in a menu.
WoMessage Creates a message area for a VDA Tool
WoSaveAsPixmap Saves graphics from a specified VDA Tool as a pixmap.
WoSetCursor Changes the cursor for a VDA Tool.
WoSetToolIcon Assigns a pixmap to be the icon for a VDA Tool.
WoStatus Create a status bar for a VDA Tool.
WoVariableOptionMenu Creates an option menu containing the names of all of the variables associated with the current tool.
WoVariableOptionMenuGetValue Gets the currently selected variable name from an option menu that was created with the WoVariableOptionMenu function.
WoVariableOptionMenuSetValue Sets the current selection in the variable option menu.

Company Products & Services Solutions Success Stories Support Downloads Email this page
© Copyright 2010 Visual Numerics, Inc. All Rights Reserved Legal Privacy Sitemap