INTERFACE ScreenPlot; (* A window that displays a geometric drawing. Two coordinate systems are relevant to this module: * the "client" system, used for most coordinate passed to the procedures; * the "screen" system, whose coordinates are in pixels. *) IMPORT LR3; TYPE Axis = {X, Y, Z}; BOOL = BOOLEAN; LONG = LONGREAL; KeySym = INTEGER; (* See "VBT.KeySym" and the "Latin1Key" interface *) TYPE T <: Public; Public = OBJECT METHODS init(nPoints: CARDINAL): T; (* Initializes internal structures for "nPoints" points and installs the window on the display. *) alive(): BOOLEAN; (* TRUE after initialization and until the underlying window is destroyed. The methods below will be ineffective, and will return immediately, if the window is not alive. *) setScale(axis: Axis; min, max: LONG); (* Sets the client-to-screen coordinate scale along the given axis. Except where noted otherwise, all "axis" coordinates below are assumed to lie in the interval "[min_max]", which gets approximately mapped to the width of the drawing area. *) setCoords(start: CARDINAL; READONLY c: ARRAY OF LR3.T); (* Sets coordinates of points "[start]", "[start+1]", ... to "c[0]", "c[1]", .... *) setCoord(p: CARDINAL; READONLY c: LR3.T); (* Modifies one element of the coordinate vector. *) point(p: CARDINAL; size: REAL); (* Draws point, depicted as a circle with center "p" and diameter "size" (in pixels). *) segment(p, q: CARDINAL; width: REAL); (* Draws a segment from point number "p" to "q", with the specified linewidth (in pixels). *) pause(); (* Stops plotting temporarily. Useful supressing repaints while doing a batch of updates. *) resume(); (* Resumes plotting. *) waitDone(); (* Waits until painting of all changes made is complete, or the window is destroyed or becomes iconified. *) waitKey(): KeySym; (* Waits until user presses any key, or the window gets destroyed. *) END; END ScreenPlot.