Scroll to navigation

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

NAME

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

SYNOPSIS

#include <Unidraw/grid.h>

DESCRIPTION

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.

PUBLICOPERATIONS

Grid(float w, float h, float xincr, float yincr)
The constructor parameters correspond to a width, a height, andindependent 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.
virtual Graphic* GetGraphic()
Return the graphic used to render the grid.
virtual void Constrain(Coord&, Coord&)
Constrain the given coordinate pair to fall on the grid. The pair ischanged to fall on the nearest grid point by default.
virtual void Visiblity(boolean)
Make the grid visible (specify true) or invisible (specify false).
virtual boolean IsVisible()
Return whether the grid is visible or not.
virtual void SetSpacing(float xincr, float yincr)
Reset the grid's units of graduation.

PROTECTEDOPERATIONS

Grid(Graphic*)
The protected constructor allows subclasses to specify an arbitrarygraphic for rendering the grid. Subclasses that use this constructor must also redefine the Constrain operation.

SEEALSO

Graphic(3U), Viewer(3U)
30 July 1990 Unidraw