The gsurf library, consisting of approximately 20,000 lines of C code, contains some 180 public functions and about twice as many internal functions for run-time data storage, manipulation, querying, and visualization using OpenGL. The library handles all drawing and lighting operations, including use of user-defined clipping planes and drawing various style "fences" on clipping planes when drawing multiple surfaces, and treats datasets as objects which can be used for various attributes of the rendering. It allows data sharing (e.g., same data for more than one attribute of same or different surfaces), separate masking for each surface, multiple surfaces, vector sets, or point sets, and will also allow multiple volumes. The library provides all query features such as 3D "point on surface", keyframe animation routines, and full state saving functionality. Database-specific routines for interfacing with the GRASS GISlib are kept isolated for easier library reuse with other databases. The gsurf library is not dependent upon any particular interface library, and has been used successfully with both Motif and Tcl/Tk.
The library is designed to provide a unique "handle" or
identifier number to the calling program for each new
geographic object added to the model. The object could
be a surface, vector set, or point set, which could each
be defined by one or more database files. Once created,
the application only needs to keep track of the "handles"
to the objects (which are returned by the creation routines);
for example, to draw a surface the application would make the call:
GS_draw_surf(id)
GV_select_surf(vid, sid) GS_alldraw_surf() GV_draw_vect(vid)
GV_set_vectmode(id, mem, color, width)
Programmers' documentation is currently incomplete, but see the following for more details of the library design and capabilities in the appendix: