NAME
d.graph -
Program for generating and displaying simple graphics to the
graphics display monitor.
(GRASS Display Program)
SYNOPSIS
d.graph
d.graph help
d.graph [input=name] [color=name]
DESCRIPTION
d.graph
draws graphics that are described either from standard input (default),
or within a file (if an input file name is identified on the
command line). If graphics commands are entered from standard input,
a ctrl-d is used to signal the end of input to d.graph.
The program can be run interactively or non-interactively.
The user can run the program completely non-interactively
by specifying the name of a graphics file containing
d.graph
graphics commands and the values of all needed parameters on the command line.
The user can instead elect to run the program partially interactively,
by specifying any/all of the parameters except
the graphics file=name parameter on the command line.
In this case, d.graph will expect the user to input d.graph
graphics commands from standard input (i.e., the keyboard) and
will (silently) prompt the user for these graphics commands.
Alternately, the user can simply type d.graph on the command line,
and be prompted for the values of all parameters (the user can still
input graphics commands from either an input file or standard input
using this form). In this case, the user is presented with the standard
GRASS parser interface.
Parameters:
- file=name
- Name of file containing graphics commands. This is a UNIX file name; the
file must be located in the user's current working directory or be specified
by its full path name.
If no filename is specified commands are taken from the standard input.
- color=name
- Starting color desired for graphics.
Options: red, orange, yellow, green, blue, indigo, violet,
magenta, brown, gray, white, and black.
Default: white
The coordinate system used is 0-100 in x and 0-100 in y,
regardless of the graphics monitor display frame size and aspect.
The (0,0) location is the lower left corner of the active graphics
monitor display frame. All values may be floating point.
The graphics language is simple, and uses the following commands:
- # comment
- A line of comment which is ignored in the processing.
- move xpos ypos
- The current location is updated to xpos ypos.
Values are stated as a percent of the active display frame's
horizontal (xpos) and vertical (ypos) size,
and may be floating point values. Values are between 0-100.
Note. A space must separate xpos and ypos.
- draw xpos ypos
- A line is drawn in the current color from the current location to the new
location xpos ypos, which then becomes the current location.
Values are stated as a percent of the active display frame's
horizontal (xpos) and vertical (ypos) size,
and may be floating point values. Values are between 0-100.
Note. A space must separate xpos and ypos.
- color color
- Sets the current color to that stated; subsequent graphics will be drawn
in the stated color, until the current color is set to a different color.
Options are red,
orange,
yellow,
green,
blue,
indigo,
violet,
brown,
magenta,
gray,
white,
and
black.
- size xper yper
- Subsequent text will be drawn such that the text is
xper
percent of the graphics monitor display frame wide and
yper
percent of the frame high. By default, the text size is set to
1 percent of the active frame's width and 1 percent of the frame's height
if unspecified by the user (this may be too small to be seen by the user).
Note. A space must separate xper and yper.
- text line-of-text
- The stated text is drawn at the current location using the current color,
and the new current location is then positioned at the end of the text string.
- icon type size x y
- Draws an icon of types o, x, or +
with specified size at location x,y.
Note: type o designates a square.
- polygon
xpos ypos
xpos ypos
...
- The coordinates appearing beneath the word polygon,
one pair per line,
circumscribe a polygon that is to be filled with the current color.
EXAMPLE
For an example use of d.graph, examine the contents of the macro
command $GISBASE/bin/grass.logo.sh
located in the GRASS command bin
(which draws a GRASS logo by inputting d.graph graphics commands
that are stored in a shell file).
Note that the coordinates in the grass.logo.sh macro were
taken directly off an image drawn by hand on graph paper.
NOTES
d.graph remembers the last screen location (xpos ypos) to which
the user moved, even after the user erases the display frame.
If the user runs d.graph repeatedly, and wishes to start anew with
the default (xpos ypos) screen location, the user should clear the
display frame between runs of d.graph.
LIMITATIONS
There are no automated ways of generating graphic images. It is anticipated
that GRASS user sites will write programs to convert output from a resident
graphics editor into GRASS d.graph format.
SEE ALSO
d.font
d.mapgraph
d.text
grass.logo.sh
parser
AUTHOR
James Westervelt, U.S. Army Construction Engineering Research Laboratory