#include "gp.h" #include "etx.h" #include "etmeta.h" int gpemcreate(set, name, dim, xfm) SETP set; char *name; DIMP dim; ETXFORM xfm; int emseti(code, val) int code; int val; int emsetr(code, val) int code; double val; int emposit(code, line, samp) int code; double line; double samp; int emdraw(line, samp) double line; double samp; int emtext(text) char *text; int emnumtext(num, dp) double num; int dp; int emwedge(line0, samp0, line1, samp1, basefrac, stepfrac, dir) double line0, samp0; double line1, samp1; double basefrac; double stepfrac; int dir; int gpemclose()
These routines are used to generate TeraScan ET and XY metafiles. Metafiles are implemented as one-dimensional dataset variables containing a stream of metafile primitive codes and their integer, real, and text values. Integer and real values are stored using 4 bytes each. Primitive codes are always aligned on 4-byte boundaries. See metafiles.
gpemcreate creates a metafile variable with dimension dim and name name in the open dataset set. name must have length no greater than GP_MAX_NAME. dim must have unlimited size. If xfm is NULL, the metafile is assumed to be an XY metafile. If xfm is an earth transform array, the metafile created will be an ET metafile.
Only one metafile can be created at a time.
emseti appends an integer-valued primitive to the metafile. The primitive code must be one of the integer-valued primitive codes defined in include/etmeta.h. The primitive value val is not checked for validity.
emseti appends a real-valued primitive to the metafile. The primitive code must be one of the real-valued primitive codes defined in include/etmeta.h. The primitive value val is not checked for validity.
emposit establishes the starting position for text, polylines, polymarkers, and polygons. code must be either TEXT_START, POLYLINE, POLYMARKER, or POLYGON. These codes are defined in include/etmeta.h.
If the metafile is an ET metafile, (line,sample) are assumed to be dataset coordinates; they are converted internally to earth transform (y,x) coordinates using the earth transform's affine mapping. If the metafile is an XY metafile, (line,sample) are assumed to be unit square (x,y) coordinates which are not modified internally.
emposit appends code and the pair of coordinates to the metafile.
emdraw adds points to polylines, polymarkers, and polygons initialized by emposit. (line,sample) are interpreted as described above. emdraw adds the code DRAW_NEXT to the metafile, followed by the pair of coordinates.
emtext adds string text to the metafile. Metafile text is represented by the TEXT_DATA primitive, followed by the text characters.
emnumtext formats the number num with decimal places dp and adds the resulting string to the metafile. If dp is zero, no decimal point will appear in the resulting string.
emwedge defines a rectangular color bar (wedge) that will be rendered using image colors as opposed to metafile colors. (line0, samp0) is one corner of the wedge. (line1, samp1) is the opposite corner. basefrac is a number in the range [0, 1] that determines the first image color to appear in the wedge. The first image color to be used in the wedge is
least image color + nint(basefrac*(num image colors -1)).
stepfrac is a number in the range [0, 1] that determines the number of image colors used to draw the wedge. If stepfrac is zero, as many image colors as possible, starting with the one determined by basefrac, are used. If stepfrac is non-zero, the increment between image colors used in the wedge will be approximately
stepfrac * num image colors
dir is the direction in which image colors are increasing in the wedge. Direction codes are defined in include\tmeta.h.
gpemclose terminates a metafile with the ETMETA_END primitive and flushes any unwritten metafile data to disk. gpemclose must be called prior to closing the dataset containing the dataset.
All of the above functions return -1 on error, with the error code in terrno. If successful, they return 0.
The following error codes are defined in include/etmeta.h.
Error occurred while defining metafile variable
Error occurred while writing metafile variable
Unknown or inappropriate primitive
Metafile not open
Too many metafiles open
Text too long
If an error occurs while writing a metafile variable data, the metafile is considered trashed. All subsequent calls are ignored until the metafile is closed using gpemclose.
include/gp.h, include/etx.h, include/etmeta.h, lib/libetmeta.a
Last Update: $Date: 1999/05/10 20:56:33 $