Plotting

Plotting and Replotting in IPlot are handled at the topmost level by the TCL function Ipl_Plot which takes one argument, flag

Ipl_IPlot first sends a message to be printed letting the user know that the screen is redrawing and is not locked up. This is necessary because Tk screen updates can be rather far inbetween when there are many thousands of lines to be drawn.

If the passed argument flag is equal to the string "new" then then function must replot everything because the reason for the call to Ipl_Plot was that the user either zoomed in or out. The function therefore finds all parameters that are equal to 0 and sets them to 1. A value of 1 indicates that they are need of replotting. A plotting parameters which is set to -1 indicates that it should not be plotted regardless of the flag and are therefore left alone.

If the flag is not set to "new" it is likely set to "hold" which indicates that the scale is being held still and the reason for the call to Ipl_Plot is probably just a change in information being plotted. e.g. the user selected Hide Mesh from the Plot menu.

Next the function calls PlotSetUp which ensures that the proper transformation parameters are set. If the global variable ipl_fullzoomout is set to true (1) then the PlotSetUp is instructed to use the maximum and minimum extents stored for the data set, as opposed to whatever the current setting may be.

Then Ipl_Plot calls, in turn, each of the following plot functions. All of these functions are C functions, as indicated by the prefix C_

These functions typically run through an IPlot Data Set List and plot everything required. The C_PlotGeometry function is the most complex and is discussed below.

Next the accessories are drawn. Ipl_IPlot makes calls to the following TCL functions

These functions check their corresponding flags to see whether or not each property should be drawn or be left hidden.

Finally, any property which was plotted (its flag had a value of 1) has its flag set to 0 to indicate that it is a plotted property but does not currently need to be plotted.

C_PlotGeometry

The geometry is plotted by looping through each region, each region's boundaries and each boundaries edges. This function makes use of the polygon capability of Tk.

The first complication arises because if one follows the edges around a boundary, one discovers that not all edges lie the same way. For example, if a boundary consists of points 1,2,3 and 4, it is possible that the edges are stored as (1->2) (3->2) (3->4) (1->4) rather than a nice neat (1->2) (2->3) (3->4) and (4->1). Therefore some care is taken in making sure that the set of points that define the polygon are listed in the proper order.

Next, the polygon is defined by concatenating a string of points. The command in Tk to build a polygon is as follows

.c create polygon (x1,y1) (x2,y2) (x3,y3) . . . (xn,yn)
As each edge is unraveled, the coordinates of the points are scaled and concatenated to the end of the above string. When all of the points in one boundary are found, the properties of the polygon (color etc) are also concatenated to the string and then the whole thing is sent off to the Tcl Primer.

Unfortunately this technique doesn't work very well for black and white. ( See Things To Do )


IPlot Home Page Technical Doc's User's Guide
IPlot and its accompanying WWW pages were written by Gene McKenna
a member of Stanford University's famous TCAD Group