Grid - displays a grid in a viewer and constrains points to lie on it
Contents
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.
Name
Grid - displays a grid in a viewer and constrains points to lie on it
Protected Operations
Grid(Graphic*)
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.
Public Operations
Grid(floatw,floath,floatxincr,floatyincr)
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.
virtualGraphic*GetGraphic()
Return the graphic used to render the grid.
virtualvoidConstrain(Coord&,Coord&)
Constrain the given coordinate pair to fall on the grid. The pair is changed to fall on the
nearest grid point by default.
virtualvoidVisiblity(boolean)
Make the grid visible (specify true) or invisible (specify false).
virtualbooleanIsVisible()
Return whether the grid is visible or not.
virtualvoidSetSpacing(floatxincr,floatyincr)
Reset the grid's units of graduation.
See Also
Graphic(3U), Viewer(3U) Unidraw 30 July 1990 Grid(3U)
Synopsis
#include<Unidraw/grid.h>
