Interactive Modification of NCAR Graphics Plots via Macintosh Applications

Version 1.0, November 1990

Author: Fred Clare

Technical Writer/Editor: Nancy Dawson

Documentation Production:Christine Guzy

The author thanks Herb Poppe of SCD and Paul Bailey of ACD for many helpful conversations on Mac hardware and software during the preparation of this document.

Copyright 1994 University Corporation for Atmospheric Research (UCAR)

All Rights Reserved

Canvas is a trademark of Denebra Systems. Illustrator is a trademark of Adobe Systems. Macintosh is a trademark of Apple Computer, Inc. MetaPICT and GraphPorter are trademarks of GSC Associates. Microsoft Word is a trademark of Microsoft. PageMaker and FreeHand are trademarks of Aldus Corp. PICTure This is a trademark of FMG, Inc.

The National Center for Atmospheric Research is operated by the University Corporation for Atmospheric Research and is sponsored by the National Science Foundation. Any opinions, findings, and conclusions or recommendations expressed in this publication are those of the author and do not necessarily reflect the views of the National Science Foundation.


Interactive Modification of NCAR Graphics Plots via Macintosh Applications

There has been an increasing demand for the ability to interactively enhance output from the NCAR Graphics package. Users want to do such things as insert and move text, change text fonts and the colors of filled areas, add annotations using arrows and labels, delete parts of a plot, and move lines around interactively without having to recompile and execute the same code (with minor modifications) dozens of times. Also, users want to easily incorporate NCAR plots into output from word processing and layout packages. For SCD to provide this functionality directly by writing new software would require significant effort.

Solution Available via Macintosh Computers

One solution already available is to use existing tools on Apple Macintosh computers. Such Mac applications as Canvas and FreeHand offer sophisticated tools for interactive modification of plots; word processors such as Microsoft Word and layout packages such as PageMaker can easily incorporate output from other Macintosh applications such as Canvas and FreeHand.

Format Conversion

The first task in using such packages with NCAR Graphics plots is to get the NCAR plots into a format acceptable by Mac applications. The graphics format used by most Mac graphics applications is called PICT. However, the format used by NCAR Graphics to store pictures is the binary encoding of the American National Standards Institute (ANSI) Computer Graphics Metafile (CGM) standard. To get NCAR plots into most Mac applications, it is necessary to convert the NCAR CGM format into the PICT format. Fortunately, there are several moderately priced commercial packages available that perform the CGM to PICT conversion. Since the CGM is an ANSI standard, these converters will work for any CGM files, not just the NCAR CGM.

CGM to PICT Conversion Packages Compared

The Scientific Visualization Group within SCD has performed a thorough comparative analysis of four commercial packages that convert CGM to PICT format. The four products analyzed were MetaPICT (from GSC Associates), GraphicsVu (from Perkland Associates), a conversion package from PIXELIX, and "PICTure This" (from FGM). The products were compared in 44 separate categories. The document you are now reading provides a detailed accounting of the comparative analysis and hints on how best to utilize the available products. Package ordering information is included under Product Summary, near the end of this document.

The PIXELIX package also contains an application to make the reverse conversion-Mac PICT files into CGM format. GSC offers a similar application as a separate application (GraphPorter) at an additional cost. Neither of these applications was tested by the SVG staff. (The other two products do not have this capability.)

Test Results

All four packages were tested with the same test files. All test CGMs were created using Release 3.01 of the NCAR Graphical Kernel System (GKS) package and converted from the NCAR private encoding of the CGM to a generic binary encoding by using the SCD-supported filter "ncgm2cgm." (Note that for GraphicsVu this conversion from the NCAR private encoding is not required.)

Of the four products reviewed, we were unable to complete the test of "PICTure This" because it would only accept 3 of the 14 files. Of 14 test files submitted to "PICTure This," 6 of the files locked up the workstation completely, 5 of the files were reported as being corrupt, 1 produced a blank picture, 1 had so many drawing errors as to be barely recognizable, and the final 1 had incorrect colors and text positions. All of these test files are known to be correctly coded and have been successfully interpreted by four independent CGM interpreters. For the above reasons, "PICTure This" is not included in any of the following discussion.

Table 1 summarizes the capabilities of the other packages, indicates whether the package supports the listed functionality, and if so, whether it does so correctly. Throughout this document, the name of the Mac converter from PIXELIX will be identified as "PIXELIX," since the product does not have a separate name.

Table 1. Comparison of Basic Functionality

Functions                          MetaPICT  GraphicsVu  PIXELIX

All line types supported?          yes       no          yes
Line widths correct?               yes       no          no
Line colors correct?               yes       yes         yes
Lines always correctly             yes       yes         no

ll standardized markers           yes       no          yes
Markers correctly positioned?      yes       yes         no
Default marker 3 correct?          yes       no          no
Marker colors correct?             yes       no          yes
Marker size scale factor correct?  yes       no          no

Fill Area
Fill colors correct?               yes       yes         yes
Fill algorithm correctly           yes       yes         yes
Hatch patterns supported?          yes       no          yes
Default hatch index 1 correct?     yes       no          no
Default edge visibility correct?   yes       yes         no

Horizontal text alignment          yes       yes         no
Vertical text alignment correct?   yes       no          no
Text color correct?                yes       yes         yes
Text paths correct?                yes       no          no
Character spacing honored?         no        no          no
Character expansion factor         no        no          no
Character height correct?          yes       yes         no
Characters drawn at angles         yes       no          no

Cell Array
Full cell array support?           yes       no          no
Boundary around cell array if no   N/A       no          no
cell array support?

Background Color
Option for identifying color       yes       no          no
index 0 with background?
Possible to specify an overriding  yes       no          no
background color?
Reverse background color without   no        yes         no

Clipping correct?                  yes       yes         no
Possible to get a human-readable   yes       no          yes
Possible to go from PICT to CGM?   yes       no          yes
Correctly interpret CGM            yes       no          no
Support for generic binary         yes       yes         yes
encoded CGMs?
Support for NCAR privately         no        yes         no
encoded CGMs?
Display PICT file from within the  yes       yes         no
Non-default picture sizes          yes       yes         yes
Arbitrary resizing of pictures     yes       yes         no
Possible to complement black-and-  no        no          no
white intensities?
Able to cancel the conversion      yes       no          yes
once it has started?
Possible to select pictures at     yes       yes         no
Progress status reports issued     yes       yes         yes
during conversion?
Metafile information available?    yes       yes         no
Possible to merge random frames?   no        yes         no
Display a random frame in a        no        yes         no
different window?
Does not require 32-bit color      yes       no          yes

Discussion of the Test Results

In Table 1, all "yes" answers indicate supported functionality and all "no" answers represent an area for improvement. Comparison of the packages is much more than just totaling up the number of "yes" entries, however. For example, the fact that PIXELIX has no capability for viewing the converted PICT file from within the conversion application is a drawback. It is frequently the case that, based on the current picture, you will want to change an option and redraw it. Using PIXELIX, you have to exit the application, draw the picture using some other application, then get back into PIXELIX to change the options and redraw.

Interpreting CGM Elements

In the area of correctly interpreting CGM elements, both MetaPICT and GraphicsVu are good, but MetaPICT is much further along in terms of how many CGM elements it interprets. In addition to CGM elements supported by GraphicsVu, MetaPICT supports line types, line widths, all polymarkers and marker attributes, all fill hatch patterns, all text angles, alignments, and paths, as well as cell array. If the additional CGM elements supported by MetaPICT are of little use in your application, then it doesn't matter that they are supported. However, keep in mind that MetaPICT supports cell array; GraphicsVu does not.

Setting the Background Color

MetaPICT offers the widest range of options to accommodate various problems in setting of background color, although scheduled improvements to GraphicsVu and PIXELIX may soon make their options on a par with those offered by MetaPICT.

It is useful to have control over changing the background color, since some metafiles may specify a foreground color of white but not specify the background color. The default background color on the Mac is white, so white lines will disappear into the background by default. As of September 1990, MetaPICT is the only package that allows setting of a user-specified background color, which overrides any setting in the metafile. However, GraphicsVu allows for reversal of the background color without reconverting the input file and both GraphicsVu and MetaPICT group the background as an object in Mac applications so that its color can be changed interactively (see the section Using Mac Utilities to Alter NCAR Plots below). It is the intent of the CGM standard to identify the setting of color index 0 with the background color and NCAR CGMs have assumed this identification. The next release of GraphicsVu is scheduled to allow this; the failure of PIXELIX to recognize this has caused problems in picture representations, but future releases of the PIXELIX product are scheduled to allow for this identification.

Black-and-white Monitors

Identical plots produced with MetaPICT, GraphicsVu, and PIXELIX cause different results on black-and-white monitors. Of the three, MetaPICT is the only product that simulated color values with gray-scale patterns on a black-and-white monitor. GraphicsVu does not support low-end Macs and the PIXELIX package maps all colors to black on a black-and- white monitor. We suggest that you discuss current functionality with any of these companies before purchasing a product.

Dump Programs

The lack of a CGM dump program in GraphicsVu may be a drawback for some users. When an error message is issued, it is often exceedingly difficult to make much headway in determining the problem without some form of human-readable dump to point out where the error is occurring. GraphicsVu rejected a couple of valid CGMs as being incorrectly coded and it was difficult to analyze just what the problem was.

Speed Comparisons

The times to convert a typical contour plot on a Mac IIcx were:
                 MetaPICT       GraphicsVu      PIXELIX
     Times       32 seconds     38 seconds      148 seconds
These times are representative of other timings done with different files and on different machines, but they are not completely accurate in the sense that timing only the conversion step was not possible for two of the packages.

What was actually timed is as follows:

Using Mac Utilities to Alter NCAR Plots

The three products produced PICT files that had varying degrees of usefulness in working with Mac tools for interactive modification. For the purposes of this document, the Mac application Canvas was used in testing the PICT output.

Schemes for Grouping Objects

The primary difference in the three packages is in how the objects are grouped for the purpose of interactive modification. Canvas allows interactive modification of basic groups of objects. For example, several polylines could constitute a group of objects and whenever the foreground color for this group is changed, all lines will change color to that which is specified. A variety of possibilities exists for grouping objects coming from a CGM, but ultimately you should be able to get at each of the CGM primitives of text, lines, markers, and filled areas as individual objects.

Objects can also be grouped in hierarchies. For example, a polyline can constitute a group at one level, and several polylines can constitute a group at a higher level. GraphicsVu is the only package to take advantage of hierarchical grouping. At the highest level, GraphicsVu groups all CGM objects into one group, so everything in the picture can be modified at once if that group is selected. At the next level of grouping in GraphicsVu, all polylines are grouped into a single group, as well as all polymarkers, text strings, and filled areas, so that changes can be made to groups of primitives at this level. At the next level, each individual polyline, polymarker, filled area and text string constitutes a group, so they can be changed at this level. For example, an individual text string can be selected and its font, size, position, color, and so on can be changed. Also, as incorporated into Canvas, the background constitutes a group in GraphicsVu and MetaPICT, so its color can easily be changed interactively.

It takes a bit of time to fully understand the groupings offered by GraphicsVu, but once mastered they offer much flexibility. MetaPICT basically groups each individual CGM primitive in its own group, so each polyline is a group, each text string is a group, and so on. This is a reasonable approach, but if you want to make changes on a more global basis, then you will have to build new groups from the basic primitives by using Canvas tools by hand. The groupings used in PIXELIX may not meet your requirements, since the basic objects are on a small scale. For example, each individual marker of a polymarker is in its own group, so you have to manually regroup the markers to form a single group that contains the original polymarker. Similarly, each line of each polyline is a group of its own in PIXELIX.

Preparing NCAR Graphics Files for Conversion

If you are targeting an NCAR plot for interactive modification on a Mac, then you will probably want to do some things differently. For example, there is a problem with using the higher quality characters produced by PLOTCHAR. These characters are stroked out as individual lines and consequently cannot be selected as a single object. If you are targeting an NCAR plot as input to an interactive Mac tool, then you should use either the GKS GTX call to produce text, or the System Plot Package Simulator (SPPS) WTSTR call. In either of these cases, the text string goes into the resultant metafile as an ASCII string rather than as a sequence of line draws and will be incorporated as a group in Canvas.

There are several changes that could be made to NCAR Graphics to make its output more compatible with interactive modification by Mac tools. For example, when NCAR Graphics draws dashed lines, each dash in the line is drawn as a polyline. This means that to change the color of a single dashed line interactively, all of the little dashes have to be changed individually or manually grouped. Ultimately there should perhaps be a global setting for the NCAR Graphics package that would flag using features appropriate for incorporation into an interactive tool.


The plots in Figures 1 and 2 are meant to illustrate some of the power of a tool like Canvas (Figure 2 may have lost some of the gray-scale gradation in the printing process.) All of the differences between Figure 1 and Figure 2 were obtained by using Canvas tools. For example, the figures illustrate the ability to: Figure 1: Conpack plot before Modification

Figure 2: Conpack plot after modification

These are only some of the possibilities. A skilled Canvas user could easily make all of the modifications in going from Figure 1 to Figure 2 in less than a half hour.

Product Summary

Of the four products reviewed, we were unable to complete the test of "PICTure This" because it would accept only 3 of the 14 test files. The remaining three products, MetaPICT, GraphicsVu, and the PIXELIX package, would be useful in converting NCAR CGMs to PICT.

As of September 1990, MetaPICT is the most fully developed commercial product. However, for the purposes of working exclusively with NCAR Graphics, GraphicsVu may offer the functionality you need. PIXELIX offers less functionality than either MetaPICT or GraphicsVu. Of the three, MetaPICT is the only product that simulates color values with gray- scale patterns on a black-and-white monitor. GraphicsVu does not support low-end Macs and the PIXELIX package maps all colors to black on a black-and-white monitor.

Keep in mind that all of these products are moving targets and are actively being developed. For example, GraphicsVu developers have said that they plan to support all marker types and colors as well as the hatch fill patterns in the near future. PIXELIX supports more CGM functionality than GraphicsVu, but many CGM elements are not interpreted correctly. In PIXELIX, there are errors in text positioning; clipping causes drawing errors; and polymarkers are incorrectly positioned and improperly scaled.

All three vendors responded promptly to questions and suggestions. The sources and prices of the four tested packages for converting CGM to PICT format are shown in Table 2.

Table 2: Sources and Prices of Conversion Packages

     Package        Source                          Price as of
                                                    September 1990

     MetaPICT       GSC Associates Inc.
                    2304 Artesia Boulevard,
                    Suite 201
                    Redondo Beach, CA 90278-3114
                    (213) 379-2113                  $179

     GraphicsVu     Perkland Associates, Ltd.
                    224 Warren Avenue
                    Berwyn, PA 19312
                    (215) 889-1674                  $125

     CGM            PIXELIX
     conversion     P.O. Box 58
     package        Carnegie
                    Victoria 3163
                    BH: (03) 609-3473
                    AH: (03) 571-5910               $150

     PICTure This   FGM Inc.
                    131 Elden Street, Suite 108i
                    Herndon, VA 22070
                    (703) 478-9881                  $ 65
Note: These prices are subject to change and some vendors offer group discounts. Before any purchase, you should contact the vendor for the current prices and the status of any functionality you need.

Key Words