Scroll to navigation

Grid(3U) InterViews Reference Manual Grid(3U)


Grid - displays a grid in a viewer and constrains points to lie on it


#include <Unidraw/grid.h>


The Grid object performs two functions: it displays a grid in a viewer, and it can constrain points to lie on the grid. The base class draws the grid as a simple array of dots; subclasses can draw arbitrarily complex grids.


The constructor parameters correspond to a width, a height, and independent units of graduation for the horizontal and vertical axes, all in pixels. The Grid base class employs a special-purpose graphic to render itself, one that draws an array of dots based on the information supplied in this constructor.
Return the graphic used to render the grid.
Constrain the given coordinate pair to fall on the grid. The pair is changed to fall on the nearest grid point by default.
Make the grid visible (specify true) or invisible (specify false).
Return whether the grid is visible or not.
Reset the grid's units of graduation.


The protected constructor allows subclasses to specify an arbitrary graphic for rendering the grid. Subclasses that use this constructor must also redefine the Constrain operation.


Graphic(3U), Viewer(3U)

30 July 1990 Unidraw