[GRASS-SVN] r31313 - grass/trunk/lib/ogsf
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun May 11 05:50:09 EDT 2008
Author: martinl
Date: 2008-05-11 05:50:09 -0400 (Sun, 11 May 2008)
New Revision: 31313
Modified:
grass/trunk/lib/ogsf/GK2.c
grass/trunk/lib/ogsf/GP2.c
grass/trunk/lib/ogsf/GS2.c
grass/trunk/lib/ogsf/GSX.c
grass/trunk/lib/ogsf/GS_util.c
grass/trunk/lib/ogsf/GV2.c
grass/trunk/lib/ogsf/GVL2.c
grass/trunk/lib/ogsf/Gp3.c
grass/trunk/lib/ogsf/Gs3.c
grass/trunk/lib/ogsf/Gv3.c
grass/trunk/lib/ogsf/Gvl3.c
grass/trunk/lib/ogsf/gk.c
grass/trunk/lib/ogsf/gp.c
grass/trunk/lib/ogsf/gpd.c
grass/trunk/lib/ogsf/gs.c
grass/trunk/lib/ogsf/gs_bm.c
grass/trunk/lib/ogsf/gs_norms.c
grass/trunk/lib/ogsf/gs_query.c
grass/trunk/lib/ogsf/gsd_cplane.c
grass/trunk/lib/ogsf/gsd_fonts.c
grass/trunk/lib/ogsf/gsd_fringe.c
grass/trunk/lib/ogsf/gsd_img_mpeg.c
grass/trunk/lib/ogsf/gsd_img_ppm.c
grass/trunk/lib/ogsf/gsd_img_tif.c
grass/trunk/lib/ogsf/gsd_label.c
grass/trunk/lib/ogsf/gsd_legend.c
grass/trunk/lib/ogsf/gsd_objs.c
grass/trunk/lib/ogsf/gsd_prim.c
grass/trunk/lib/ogsf/gsd_surf.c
grass/trunk/lib/ogsf/gsd_views.c
grass/trunk/lib/ogsf/gsd_wire.c
grass/trunk/lib/ogsf/gsdiff.c
grass/trunk/lib/ogsf/gsdrape.c
grass/trunk/lib/ogsf/gsds.c
grass/trunk/lib/ogsf/gsget.c
grass/trunk/lib/ogsf/gsget.h
grass/trunk/lib/ogsf/gv.c
grass/trunk/lib/ogsf/gv_quick.c
grass/trunk/lib/ogsf/gvd.c
grass/trunk/lib/ogsf/gvl.c
grass/trunk/lib/ogsf/gvl_calc.c
grass/trunk/lib/ogsf/gvl_calc2.c
grass/trunk/lib/ogsf/gvl_file.c
grass/trunk/lib/ogsf/gvld.c
grass/trunk/lib/ogsf/mc33_table.h
grass/trunk/lib/ogsf/ogsflib.dox
grass/trunk/lib/ogsf/rgbpack.h
grass/trunk/lib/ogsf/rowcol.h
grass/trunk/lib/ogsf/trans.c
Log:
ogsf sync'ed with devbr6: initial code doxygenization, minor library cleaning (r31312, r31304, r31271)
Modified: grass/trunk/lib/ogsf/GK2.c
===================================================================
--- grass/trunk/lib/ogsf/GK2.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/GK2.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,5 +1,18 @@
-/*
-* $Id$
+/*!
+ \file GK2.c
+
+ \brief OGSF library - setting and manipulating keyframes animation
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL, GMSL/University of Illinois
*/
#include <stdlib.h>
@@ -7,6 +20,7 @@
#include <grass/gstypes.h>
#include <grass/keyframe.h>
#include <grass/kftypes.h>
+#include <grass/glocale.h>
static int _add_key(Keylist *, int, float);
static void _remove_key(Keylist *);
@@ -115,6 +129,14 @@
return;
}
+/*!
+ \brief Set interpolation mode
+
+ \param mode interpolation mode (KF_LINEAR or KF_SPLINE)
+
+ \return 1 on success
+ \return -1 on error (invalid interpolation mode)
+*/
int GK_set_interpmode(int mode)
{
if (KF_LEGAL_MODE(mode)) {
@@ -125,6 +147,11 @@
return (-1);
}
+/*!
+ \brief Set value for tension when interpmode is KF_SPLINE.
+
+ \param tens value tens should be between 0.0; 1.0.
+*/
void GK_set_tension(float tens)
{
Tension = tens > 1.0 ? 1.0 : (tens < 0.0 ? 0.0 : tens);
@@ -150,11 +177,21 @@
return;
}
+/*!
+ \brief Show tension stop ?
+
+ Use GK_showtension_start/GK_update_tension/GK_showtension_stop to
+ initialize and stop multi-view display of path when changing
+ tension.
+*/
void GK_showtension_stop(void)
{
return;
}
+/*!
+ \brief Update tension
+*/
void GK_update_tension(void)
{
if (Views) {
@@ -164,8 +201,11 @@
return;
}
+/*!
+ \brief Print keyframe info
-
+ \param name filename
+*/
void GK_print_keys(char *name)
{
Keylist *k;
@@ -173,7 +213,7 @@
int cnt = 1;
if (NULL == (fp = fopen(name, "w"))) {
- fprintf(stderr, "Cannot open file for output\n"), exit(1);
+ G_fatal_error (_("Unable to open file <%s> for writing"), name);
}
/* write a default frame rate of 30 at top of file */
fprintf(fp, "30 \n");
@@ -194,6 +234,12 @@
}
+/*!
+ \brief Recalculate path using the current number of frames requested.
+
+ Call after changing number of frames or when
+ Keyframes change.
+*/
void GK_update_frames(void)
{
Keylist *k;
@@ -223,8 +269,7 @@
Views = gk_make_linear_framesfromkeys(Keys, Numkeys, Viewsteps, loop);
if (!Views) {
- fprintf(stderr,
- "Check no. of frames requested and keyframes marked\n");
+ G_warning(_("Check no. of frames requested and keyframes marked"));
}
}
else if (Numkeys > 2) {
@@ -237,14 +282,18 @@
(Keys, Numkeys, Viewsteps, loop, 1.0 - Tension);
if (!Views) {
- fprintf(stderr,
- "Check no. of frames requested and keyframes marked\n");
+ G_warning(_("Check no. of frames requested and keyframes marked"));
}
}
return;
}
+/*!
+ \brief Set the number of frames to be interpolated from keyframes
+
+ \param newsteps number of frames
+*/
void GK_set_numsteps(int newsteps)
{
Viewsteps = newsteps;
@@ -253,7 +302,11 @@
return;
}
+/*!
+ \brief Deletes all keyframes, resets field masks.
+ Doesn't change number of frames requested.
+*/
void GK_clear_keys(void)
{
gk_free_key(Keys);
@@ -268,6 +321,18 @@
return;
}
+/*!
+ \brief Move keyframe
+
+ Precis works as in other functions - to identify keyframe to move.
+ Only the first keyframe in the precis range will be moved.
+
+ \param oldpos old position
+ \param precis precision value
+ \param newpos new position
+
+ \return number of keys moved (1 or 0)
+*/
int GK_move_key(float oldpos, float precis, float newpos)
{
Keylist *k;
@@ -285,7 +350,20 @@
return (0);
}
-/* returns number of keys deleted */
+/*!
+ Delete keyframe
+
+ The values pos and precis are used to determine which keyframes to
+ delete. Any keyframes with their position within precis of pos will
+ be deleted if justone is zero. If justone is non-zero, only the first
+ (lowest pos) keyframe in the range will be deleted.
+
+ \param pos position
+ \param precis precision
+ \param justone delete only one keyframe
+
+ \return number of keys deleted.
+*/
int GK_delete_key(float pos, float precis, int justone)
{
Keylist *k, *next;
@@ -310,7 +388,44 @@
return (cnt);
}
-/* returns 1 if key added, otherwise -1 */
+/*!
+ \brief Add keyframe
+
+ The pos value is the relative position in the animation for this
+ particular keyframe - used to compare relative distance to neighboring
+ keyframes, it can be any floating point value.
+
+ The fmask value can be any of the following or'd together:
+ - KF_FROMX_MASK
+ - KF_FROMY_MASK
+ - KF_FROMZ_MASK
+ - KF_FROM_MASK (KF_FROMX_MASK | KF_FROMY_MASK | KF_FROMZ_MASK)
+
+ - KF_DIRX_MASK
+ - KF_DIRY_MASK
+ - KF_DIRZ_MASK
+ - KF_DIR_MASK (KF_DIRX_MASK | KF_DIRY_MASK | KF_DIRZ_MASK)
+
+ - KF_FOV_MASK
+ - KF_TWIST_MASK
+
+ - KF_ALL_MASK (KF_FROM_MASK | KF_DIR_MASK | KF_FOV_MASK | KF_TWIST_MASK)
+
+ Other fields will be added later.
+
+ The value precis and the boolean force_replace are used to determine
+ if a keyframe should be considered to be at the same position as a
+ pre-existing keyframe. e.g., if anykey.pos - newkey.pos <= precis,
+ GK_add_key() will fail unless force_replace is TRUE.
+
+ \param pos postion
+ \param fmaks
+ \param force_replace
+ \param precis precision value
+
+ \return 1 if key is added
+ \return -1 key not added
+*/
int GK_add_key(float pos, unsigned long fmask, int force_replace,
float precis)
{
@@ -329,16 +444,12 @@
newk->fields[KF_FROMY] = tmp[Y];
newk->fields[KF_FROMZ] = tmp[Z];
-#ifdef KDEBUG
- {
- fprintf(stderr, "KEY FROM: %f %f %f\n", tmp[X], tmp[Y], tmp[Z]);
- }
-#endif
+ G_debug (3, "KEY FROM: %f %f %f", tmp[X], tmp[Y], tmp[Z]);
/* Instead of View Dir try get_focus (view center) */
/* View Dir is implied from eye and center position */
/* GS_get_viewdir(tmp); */
-
+
/* ACS 1 line: was GS_get_focus(tmp);
with this kanimator works also for flythrough navigation
also changed in gk.c
@@ -363,6 +474,15 @@
return (-1);
}
+/*!
+ \brief Moves the animation to frame number "step".
+
+ Step should be a value between 1 and the number of frames. If
+ render is non-zero, calls draw_all.
+
+ \param step step value
+ \param render
+*/
void GK_do_framestep(int step, int render)
{
if (Views) {
@@ -374,7 +494,11 @@
return;
}
+/*!
+ \brief Draw the current path
+ \param flag
+*/
void GK_show_path(int flag)
{
if (flag) {
@@ -397,6 +521,11 @@
return;
}
+/*!
+ \brief Show vector sets
+
+ \param flag
+*/
void GK_show_vect(int flag)
{
if (flag) {
@@ -418,6 +547,11 @@
return;
}
+/*!
+ \brief Show point sets
+
+ \param flag
+*/
void GK_show_site(int flag)
{
if (flag) {
@@ -441,6 +575,11 @@
return;
}
+/*!
+ \brief Show volumes
+
+ \param flag
+*/
void GK_show_vol(int flag)
{
if (flag) {
@@ -464,24 +603,23 @@
return;
}
+/*!
+ \brief Show list
+ \param flag
+*/
void GK_show_list( int flag)
{
+ if (flag) {
+ Fmode |= FM_LABEL;
+
+ if (Views) {
+ GS_draw_all_list();
+ }
+ }
+ else {
+ Fmode &= ~FM_LABEL;
+ }
- if (flag) {
-
- Fmode |= FM_LABEL;
-
- if (Views) {
-
- GS_draw_all_list();
-
- }
- }
- else {
- Fmode &= ~FM_LABEL;
- }
-
- return;
+ return;
}
-
Modified: grass/trunk/lib/ogsf/GP2.c
===================================================================
--- grass/trunk/lib/ogsf/GP2.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/GP2.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,12 +1,21 @@
-/*
-* $Id$
+/*!
+ \file GP2.c
+
+ \brief OGSF library - loading and manipulating point sets (higher level functions)
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL (January 1994)
+ Doxygenized by Martin landa <landa.martin gmail.com> (May 2008)
*/
-/* GP.c
- Bill Brown, USACERL
- January 1994
-*/
-
#include <stdlib.h>
#include <string.h>
#include <grass/gis.h>
@@ -17,7 +26,14 @@
static int Site_ID[MAX_SITES];
static int Next_site = 0;
-/***********************************************************************/
+/*!
+ \brief Check if point set exists
+
+ \param id point set id
+
+ \return 1 found
+ \return 0 not found
+*/
int GP_site_exists(int id)
{
int i, found = 0;
@@ -41,7 +57,12 @@
return (found);
}
-/***********************************************************************/
+/*!
+ \brief Register new point set
+
+ \return point set id
+ \return -1 on error (number of point sets exceeded)
+*/
int GP_new_site(void)
{
geosite *np;
@@ -63,14 +84,26 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Get number of available point sets
+
+ \return number of point sets
+*/
int GP_num_sites(void)
{
return (gp_num_sites());
}
-/***********************************************************************/
-/* USER must free!! */
+/*!
+ \brief Get list of point sets
+
+ Must freed when no longer needed!
+
+ \param numsites number of point sets
+
+ \return pointer to list of points sets
+ \return NULL on error
+*/
int *GP_get_site_list(int *numsites)
{
int i, *ret;
@@ -78,8 +111,8 @@
*numsites = Next_site;
if (Next_site) {
- if (NULL == (ret = (int *) malloc(Next_site * sizeof(int)))) {
- fprintf(stderr, "can't malloc\n");
+ ret = (int *) G_malloc(Next_site * sizeof(int)); /* G_fatal_error */
+ if (!ret) {
return (NULL);
}
@@ -93,7 +126,14 @@
return (NULL);
}
-/***********************************************************************/
+/*!
+ \brief Delete registrated point set
+
+ \param id point set id
+
+ \return 1 on success
+ \return -1 on error (point sets not available)
+*/
int GP_delete_site(int id)
{
int i, j, found = 0;
@@ -125,16 +165,25 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Load point set from file
+
+ Check to see if handle already loaded, if so - free before loading new
+ for now, always load to memory
+
+ \todo load file handle & ready for reading instead of using
+ memory
+
+ \param id point set id
+ \param filename point set filename
+
+ \return -1 on error
+ \return 1 on success
+*/
int GP_load_site(int id, char *filename)
{
geosite *gp;
- /* check to see if handle already loaded, if so - free before loading new */
- /* for now, always load to memory */
- /* TODO SOON: load file handle & ready for reading instead of using */
- /* memory */
-
if (NULL == (gp = gp_get_site(id))) {
return (-1);
}
@@ -155,7 +204,15 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Get point set filename
+
+ \param id point set id
+ \param[out] filename point set filename
+
+ \return -1 on error (point set not found)
+ \return 1 on success
+*/
int GP_get_sitename(int id, char *filename)
{
geosite *gp;
@@ -169,7 +226,9 @@
return (1);
}
-/***********************************************************************/
+/*!
+ \brief Get point set mode
+*/
int GP_get_sitemode(int id, int *atmod, int *color, int *width, float *size,
int *marker)
{
@@ -188,7 +247,18 @@
return (1);
}
-/***********************************************************************/
+/*!
+ \brief Set mode for point set
+
+ \param id point set id
+ \param atmod
+ \param color color value
+ \param width
+ \param size point size
+ \param marker marker symbol
+
+ \return -1 on error (point set not found)
+*/
int GP_set_sitemode(int id, int atmod, int color, int width, float size,
int marker)
{
@@ -207,9 +277,18 @@
return (1);
}
-/***********************************************************************/
-/* TODO: make similar routines for attmode_size, attmode_marker (use transform) */
-/* return 1 for success, 0 for no attribute info, -1 for bad parameter */
+/*!
+ \brief Set attribute mode color
+
+ \todo make similar routines for attmode_size, attmode_marker (use transform)
+
+ \param id surface id
+ \param filename filename
+
+ \return 1 for success
+ \return 0 for no attribute info
+ \return -1 for bad parameter
+*/
int GP_attmode_color(int id, char *filename)
{
geosite *gp;
@@ -230,7 +309,14 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Set attribute mode to none
+
+ \param id point set id
+
+ \return -1 on error (invalid point set id)
+ \return 1 on success
+*/
int GP_attmode_none(int id)
{
geosite *gp;
@@ -244,7 +330,16 @@
return (1);
}
-/***********************************************************************/
+/*!
+ \brief Set z-mode
+
+ \param id poin set id
+ \param use_z use z ?
+
+ \return 1 on success
+ \return 0 no z
+ \return -1 on error (invalid point set id)
+*/
int GP_set_zmode(int id, int use_z)
{
geosite *gp;
@@ -266,7 +361,15 @@
return (1);
}
-/***********************************************************************/
+/*!
+ \brief Get z-mode
+
+ \param id point set id
+ \param[out] use_z use z
+
+ \return -1 on error (invalid point set id)
+ \return 1 on success
+*/
int GP_get_zmode(int id, int *use_z)
{
geosite *gp;
@@ -279,7 +382,12 @@
return (1);
}
-/***********************************************************************/
+/*!
+ \brief Set trans ?
+
+ \param id point set id
+ \param xtrans,ytrans,ztrans x/y/z trans values
+*/
void GP_set_trans(int id, float xtrans, float ytrans, float ztrans)
{
geosite *gp;
@@ -300,7 +408,12 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Get trans
+
+ \param id point set id
+ \param xtrans,ytrans,ztrans x/y/z trans values
+*/
void GP_get_trans(int id, float *xtrans, float *ytrans, float *ztrans)
{
geosite *gp;
@@ -322,7 +435,15 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Select surface
+
+ \param hp point set id
+ \param hs surface id
+
+ \return 1 surface selected
+ \return -1 on error
+*/
int GP_select_surf(int hp, int hs)
{
geosite *gp;
@@ -342,7 +463,15 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Unselect surface
+
+ \param hp point set id
+ \param hs surface id
+
+ \return 1 surface unselected
+ \return -1 on error
+*/
int GP_unselect_surf(int hp, int hs)
{
geosite *gp;
@@ -370,7 +499,15 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Check if surface is selected
+
+ \param hp point set id
+ \param hs surface id
+
+ \return 1 selected
+ \return 0 not selected
+*/
int GP_surf_is_selected(int hp, int hs)
{
int i;
@@ -389,7 +526,11 @@
return (0);
}
-/***********************************************************************/
+/*!
+ \brief Draw point set
+
+ \param id point set id
+*/
void GP_draw_site(int id)
{
geosurf *gs;
@@ -412,8 +553,8 @@
if (gs) {
gpd_2dsite(gp, gs, 0);
#ifdef TRACE_GP_FUNCS
- fprintf(stderr, "Drawing site %d on Surf %d\n", id,
- gp->drape_surf_id[i]);
+ G_debug (3, "Drawing site %d on Surf %d", id,
+ gp->drape_surf_id[i]);
print_site_fields(gp);
#endif
}
@@ -424,7 +565,9 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Draw all available point sets
+*/
void GP_alldraw_site(void)
{
int id;
@@ -436,7 +579,15 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Set client data
+
+ \param id point set id
+ \param clientd client data
+
+ \return 1 on success
+ \return -1 on error (invalid point set id)
+*/
int GP_Set_ClientData(int id, void *clientd)
{
geosite *gp;
@@ -451,7 +602,14 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Get client data
+
+ \param id point set id
+
+ \return pointer to client data
+ \return NULL on error
+*/
void *GP_Get_ClientData(int id)
{
geosite *gp;
Modified: grass/trunk/lib/ogsf/GS2.c
===================================================================
--- grass/trunk/lib/ogsf/GS2.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/GS2.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,17 +1,33 @@
-/*
-* $Id$
-*/
+/*!
+ \file GS2.c
+
+ \brief OGSF library - loading and manipulating surfaces (higher level functions)
+
+ GRASS OpenGL gsurf OGSF Library
-/* updated 24 oct. 1999
- - Pierre de Mouveaux
- p_de_mouveaux at hotmail.com
+ Plans for handling color maps:
+ NOW:
+ if able to load as unsigned char, make lookup table containing palette
+ otherwise, load directly as packed color, set lookup = NULL
+ MAYBE LATER:
+ if able to load as POSITIVE short, make lookup table containing palette
+ - may want to calculate savings first (ie, numcells > 32768)
+ (not exactly, it's Friday & time to go home - figure it later)
+ otherwise, load directly as packed color, set lookup = NULL
+ MESSY! - need to fix up!
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL (1993)
+ Pierre de Mouveaux <p_de_mouveaux hotmail.com> (updated October 1999)
+ Doxygenized by Martin Landa <landa.martin gmail.com> (May 2008)
*/
-/* GS.c
- Bill Brown, USACERL
- January 1993
-*/
-
#include <stdlib.h>
#include <string.h>
#include <math.h>
@@ -28,15 +44,12 @@
#include <grass/gis.h>
#include <grass/gstypes.h>
+#include <grass/glocale.h>
#include "gsget.h"
#include "rowcol.h"
#include "rgbpack.h"
-#ifdef TRACE_FUNCS
-#define TRACE_GS_FUNCS
-#endif
-
/* Hack to make NVIZ2.2 query functions.("What's Here" and "Look at")
* to work.
* Uses gs_los_intersect1() instead of gs_los_intersect().
@@ -46,13 +59,17 @@
int gsd_getViewport(GLint *, GLint *);
+/* array of surface ids */
static int Surf_ID[MAX_SURFS];
static int Next_surf = 0;
static int SDref_surf = 0;
+/* attributes array */
static float Default_const[MAX_ATTS];
static float Default_nulls[MAX_ATTS];
+/* largest dimension */
static float Longdim;
-static float Region[4]; /* N, S, W, E */
+/* N, S, W, E */
+static float Region[4];
static geoview Gv;
static geodisplay Gd;
static struct Cell_head wind;
@@ -60,13 +77,17 @@
static int Numlights = 0;
static int Modelshowing = 0;
-/***********************************************************************/
void void_func(void)
{
return;
}
-/***********************************************************************/
+/*!
+ \brief Library initialization
+
+ Get region settings - wind, Region (NSWE array)
+ Compute scale
+*/
void GS_libinit(void)
{
static int first = 1;
@@ -100,14 +121,26 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Get largest dimension
+
+ \param[out] dim dimension
+
+ \return 1
+*/
int GS_get_longdim(float *dim)
{
*dim = Longdim;
return (1);
}
-/***********************************************************************/
+/*!
+ \brief Get 2D region extent
+
+ \param[out] n,s,w,e extent values
+
+ \return 1
+*/
int GS_get_region(float *n, float *s, float *w, float *e)
{
*n = Region[0];
@@ -118,16 +151,17 @@
return (1);
}
-/***********************************************************************/
+/*!
+ \brief Set attributes to default
+
+ \param defs attributes array (dim MAX_ATTS)
+ \param null_defs null attributes array (dim MAX_ATTS)
+*/
void GS_set_att_defaults(float *defs, float *null_defs)
{
int i;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_set_att_defaults");
- }
-#endif
+ G_debug (3, "GS_set_att_defaults");
for (i = 0; i < MAX_ATTS; i++) {
Default_const[i] = defs[i];
@@ -137,17 +171,21 @@
return;
}
-/***********************************************************************/
+/*!
+ Check if surface exists
+
+ \param id surface id
+
+ \return 0 not found
+ \return 1 found
+*/
int GS_surf_exists(int id)
{
int i, found = 0;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_surf_exists");
- }
-#endif
+ G_debug(3, "GS_surf_exists");
+
if (NULL == gs_get_surf(id)) {
return (0);
}
@@ -161,20 +199,21 @@
return (found);
}
-/***********************************************************************/
-/* note that origin has 1/2 cell added to represent center of cells
- because library assumes that east - west = (cols - 1) * ew_res,
- since left and right columns are on the edges.
+/*!
+ \brief Add new surface
+
+ Note that origin has 1/2 cell added to represent center of cells
+ because library assumes that east - west = (cols - 1) * ew_res,
+ since left and right columns are on the edges.
+
+ \return surface id
+ \return -1 on error (MAX_SURFS exceded)
*/
int GS_new_surface(void)
{
geosurf *ns;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_new_surface");
- }
-#endif
+ G_debug(3, "GS_new_surface");
if (Next_surf < MAX_SURFS) {
ns = gs_get_new_surface();
@@ -195,7 +234,12 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Add new light model
+
+ \return light model id
+ \return -1 on error (MAX_LIGHTS exceded)
+*/
int GS_new_light(void)
{
static int first = 1;
@@ -228,8 +272,15 @@
return (-1);
}
-/* FIX THIS: i think lights array doesnt match sgi_light array */
-/***********************************************************************/
+/*!
+ \brief Set light position
+
+ \bug I think lights array doesnt match sgi_light array
+
+ \param num light id (starts with 1?)
+ \param xpos,ypos,zpos coordinates
+ \param local ?
+*/
void GS_setlight_position(int num, float xpos, float ypos, float zpos,
int local)
{
@@ -249,7 +300,13 @@
}
-/***********************************************************************/
+/*!
+ \brief Get light position
+
+ \param num light id (starts with 1?)
+ \param[out] xpos,ypos,zpos coordinates
+ \param[out] local ?
+*/
void GS_getlight_position(int num, float *xpos, float *ypos, float *zpos,
int *local)
{
@@ -267,7 +324,12 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Set light color
+
+ \param num light id (starts with 1?)
+ \param red,green,blue color values (from 0.0 to 1.0)
+*/
void GS_setlight_color(int num, float red, float green, float blue)
{
if (num) {
@@ -284,7 +346,12 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Get light color
+
+ \param num light id (starts with 1?)
+ \param[out] red,green,blue color values
+*/
void GS_getlight_color(int num, float *red, float *green, float *blue)
{
if (num) {
@@ -299,7 +366,14 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Set light ambient
+
+ Red, green, blue from 0.0 to 1.0
+
+ \param num light id (starts with 1?)
+ \param red,green,blue color values
+*/
void GS_setlight_ambient(int num, float red, float green, float blue)
{
if (num) {
@@ -316,7 +390,12 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Get light ambient
+
+ \param num light id (starts with 1?)
+ \param[out] red,green,blue color values
+*/
void GS_getlight_ambient(int num, float *red, float *green, float *blue)
{
if (num) {
@@ -332,7 +411,9 @@
}
-/***********************************************************************/
+/*!
+ \brief Switch off all lights
+*/
void GS_lights_off(void)
{
int i;
@@ -344,7 +425,9 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Switch on all lights
+*/
void GS_lights_on(void)
{
int i;
@@ -356,7 +439,12 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Switch on/off light
+
+ \param num light id (starts with 1?)
+ \param on non-zero for 'on' otherwise 'off'
+*/
void GS_switchlight(int num, int on)
{
if (num) {
@@ -370,13 +458,22 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Check if transparency is set
+
+ \return 0 transparency not set
+ \return 1 transparency is set
+*/
int GS_transp_is_set(void)
{
return (gs_att_is_set(NULL, ATT_TRANSP) || (FC_GREY == gsd_getfc()));
}
-/***********************************************************************/
+/*!
+ \brief Retrieves coordinates for lighting model position, at center of view
+
+ \param pos[out] coordinates
+*/
void GS_get_modelposition1(float pos[])
{
/* TODO: Still needs work to handle other cases */
@@ -390,14 +487,22 @@
gs_get_datacenter(pos);
gs_get_data_avg_zmax(&(pos[Z]));
- fprintf(stderr, "model position: %f %f %f\n", pos[X], pos[Y], pos[Z]);
+ G_debug (1, "GS_get_modelposition1(): model position: %f %f %f",
+ pos[X], pos[Y], pos[Z]);
return;
}
-/***********************************************************************/
-/* position at nearclip * 2: tried nearclip + siz, but since need to
-know position to calculate size, have two dependent variables */
+/*!
+ \brief Retrieves coordinates for lighting model position, at center of view
+
+ Position at nearclip * 2: tried nearclip + siz, but since need to
+ know position to calculate size, have two dependent variables
+ (nearclip * 2) from eye.
+
+ \param siz[out] size
+ \param pos[out] coordinates (X, Y, Z)
+*/
void GS_get_modelposition(float *siz, float *pos)
{
float dist, near_h, dir[3];
@@ -424,10 +529,16 @@
}
-/***********************************************************************/
-/* TODO -- scale used to calculate len of arrow still needs work
- * needs go function that returns center / eye distance
- * gsd_get_los function is not working correctly ??
+/*!
+ \brief Set decoration, north arrow ??
+
+ \todo scale used to calculate len of arrow still needs work
+ needs go function that returns center / eye distance
+ gsd_get_los function is not working correctly ??
+
+ \param pt point value in true world coordinates (?)
+ \param id surface id
+ \param[out] pos2 output coordinates
*/
void GS_set_Narrow(int *pt, int id, float *pos2)
{
@@ -492,8 +603,12 @@
return;
}
-/***********************************************************************/
-/* pt only has to have an X & Y value in true world coordinates */
+/*!
+ \brief ADD
+
+ \param id surface id
+ \param pt point, X, Y value in true world coordinates
+*/
void GS_draw_X(int id, float *pt)
{
geosurf *gs;
@@ -527,7 +642,12 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Draw line on surface
+
+ \param id surface id
+ \param x1,y1,x2,y2 line nodes
+*/
void GS_draw_line_onsurf(int id, float x1, float y1, float x2, float y2)
{
float p1[2], p2[2];
@@ -555,9 +675,17 @@
return;
}
-/***********************************************************************/
-/* Like above but limits points in line to n or points found in segment,
- * whichever is smaller. Returns number of points used.
+/*!
+ \brief Draw multiline on surface
+
+ Like above but limits points in line to n or points found in segment,
+ whichever is smaller.
+
+ \param id surface id
+ \param x1,y1,x2,y2 line nodes
+ \param lasp ?
+ \paran n ?
+ \return number of points used
*/
int GS_draw_nline_onsurf(int id, float x1, float y1, float x2, float y2,
float *lasp, int n)
@@ -588,9 +716,14 @@
return (ret);
}
-/***********************************************************************/
-/* this is slow - should be moved to gs_ but GS_ good for testing
- * and useful for app programmer
+/*!
+ \brief Draw flow-line on surace
+
+ This is slow - should be moved to gs_ but GS_ good for testing
+ and useful for app programmer
+
+ \param id surface id
+ \param x,y coordinates of flow-line
*/
void GS_draw_flowline_at_xy(int id, float x, float y)
{
@@ -645,19 +778,21 @@
p1[Y] = next[Y];
}
-#ifdef DEBUG_MSG
- {
- fprintf(stderr, "dir: %f %f \n", nv[X], nv[Y]);
- }
-#endif
+ G_debug(3, "GS_draw_flowline_at_xy(): dir: %f %f",
+ nv[X], nv[Y]);
}
return;
}
-/*****************************************************************
- * * draw fringe around data at selected corners
- * *****************************************************************/
+/*!
+ \brief Draw fringe around data at selected corners
+
+ \param id surface id
+ \param clr ?
+ \param elev elevation value
+ \param where ?
+*/
void GS_draw_fringe(int id, unsigned long clr, float elev, int *where)
{
geosurf *gs;
@@ -668,54 +803,72 @@
}
-/***********************************************************************/
-int
-GS_draw_legend(char *name, GLuint fontbase, int size, int *flags,
+/*!
+ \brief Draw legend
+
+ \todo add legend from list option
+ make font loading more flexible
+
+ \param name legend name
+ \param fontbase font-base
+ \param size ?
+ \param flags legend flags
+ \param range values range
+ \param pt ?
+*/
+int GS_draw_legend(char *name, GLuint fontbase, int size, int *flags,
float *range, int *pt)
{
int list_no;
-/* TODO - add legend from list option */
-/* make font loading more flexible */
list_no = gsd_put_legend(name, fontbase, size, flags, range, pt);
return (list_no);
}
-/*********************************************************************/
+/*!
+ \brief Draw pre-defined list
+
+ Uses glFlush() to ensure all drawing is complete
+ before returning
+
+ \param list_id list id
+*/
void GS_draw_list(GLuint list_id)
{
-/* Function to draw pre-defined list */
-/* Uses glFlush() to ensure all drawing is complete
- * before returning
-*/
gsd_calllist(list_id);
glFlush();
return;
}
-/*********************************************************************/
+/*!
+ \brief Draw all glLists
+
+ Uses glFlush() to ensure all drawing is complete
+ before returning
+*/
void GS_draw_all_list(void)
{
-/* Function to draw all glLists */
-/* Uses glFlush() to ensure all drawing is complete
- * before returning
-*/
- gsd_calllists(0); /* not sure if 0 is right - MN*/
+ gsd_calllists(0); /* not sure if 0 is right - MN */
glFlush();
return;
}
-/*******************************************************************/
+/*!
+ \brief Delete pre-defined list
+
+ \param list_id list id
+*/
void GS_delete_list(GLuint list_id)
{
- /* Function to draw pre-defined list */
gsd_deletelist(list_id, 1);
return;
}
-/***********************************************************************/
+/*!
+ \brief Draw lighting model
+*/
void GS_draw_lighting_model1(void)
{
static float center[3];
@@ -750,9 +903,12 @@
return;
}
-/***********************************************************************/
-/* Just turn off any cutting planes and draw it just outside near
-clipping plane, since lighting is infinite now */
+/*!
+ \brief Draw lighting model
+
+ Just turn off any cutting planes and draw it just outside near
+ clipping plane, since lighting is infinite now
+*/
void GS_draw_lighting_model(void)
{
static float center[3], size;
@@ -799,10 +955,16 @@
return;
}
-/***********************************************************************/
-/* may be called to update total mask for a surface at convenient times */
-/* instead of waiting until ready to redraw surface */
-/***********************************************************************/
+/*!
+ \brief Update current mask
+
+ May be called to update total mask for a surface at convenient times
+ instead of waiting until ready to redraw surface
+
+ \param id surface id
+
+ \return ?
+*/
int GS_update_curmask(int id)
{
geosurf *gs;
@@ -811,7 +973,16 @@
return (gs_update_curmask(gs));
}
-/***********************************************************************/
+/*!
+ \brief Check if point is masked ?
+
+ \param id surface id
+ \param pt point
+
+ \return 1 masked
+ \return 0 not masked
+ \return -1 on error, invalid surface id
+*/
int GS_is_masked(int id, float *pt)
{
geosurf *gs;
@@ -827,7 +998,9 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Unset ?
+*/
void GS_unset_SDsurf(void)
{
gsdiff_set_SDref(NULL);
@@ -836,7 +1009,14 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Set ?
+
+ \param id surface id
+
+ \return 1 on success
+ \return 0 on error, invalid surface id
+*/
int GS_set_SDsurf(int id)
{
geosurf *gs;
@@ -851,7 +1031,13 @@
return (0);
}
-/***********************************************************************/
+/*!
+ \brief Set ?
+
+ \param scale scale value
+
+ \return 1
+*/
int GS_set_SDscale(float scale)
{
gsdiff_set_SDscale(scale);
@@ -859,7 +1045,14 @@
return (1);
}
-/***********************************************************************/
+/*!
+ \brief Get ?
+
+ \param[out] id ?
+
+ \return 1 on success
+ \return 0 on error
+*/
int GS_get_SDsurf(int *id)
{
geosurf *gs;
@@ -873,7 +1066,13 @@
return (0);
}
-/***********************************************************************/
+/*!
+ \brief Get ?
+
+ \param[out] scale value
+
+ \return 1
+*/
int GS_get_SDscale(float *scale)
{
*scale = gsdiff_get_SDscale();
@@ -881,7 +1080,13 @@
return (1);
}
-/***********************************************************************/
+/*!
+ \brief Update normals
+
+ \param id surface id
+
+ \return ?
+*/
int GS_update_normals(int id)
{
geosurf *gs;
@@ -891,7 +1096,18 @@
return (gs_calc_normals(gs));
}
-/***********************************************************************/
+/*!
+ \brief Get attributes
+
+ \param id surface id
+ \param att
+ \param[out] set
+ \param[out] constant
+ \param[out] mapname
+
+ \return 1 on success
+ \return -1 on error (invalid surface id)
+*/
int GS_get_att(int id, int att, int *set, float *constant, char *mapname)
{
int src;
@@ -920,11 +1136,20 @@
#define CATSREADY
#ifdef CATSREADY
-/***********************************************************************/
-/* prints "no data" or a description (i.e., "coniferous forest") to catstr
-* returns -1 if no category info or point outside of window, otherwise 1
-* Usually call after GS_get_selected_point_on_surface
-* att_src must be MAP_ATT
+/*!
+ \brief Print categories on given position
+
+ prints "no data" or a description (i.e., "coniferous forest") to catstr
+ Usually call after GS_get_selected_point_on_surface
+ att_src must be MAP_ATT
+
+ \param id surface id
+ \param att
+ \param catstr cat string (must be allocated, dim?)
+ \param x,y real coordinates
+
+ \return -1 if no category info or point outside of window
+ \return 1 on success
*/
int GS_get_cat_at_xy(int id, int att, char *catstr, float x, float y)
{
@@ -933,7 +1158,7 @@
typbuff *buff;
geosurf *gs;
- sprintf(catstr, "");
+ catstr[0] = '\0';
gs = gs_get_surf(id);
if (NULL == gs) {
@@ -978,10 +1203,17 @@
return (1);
}
-/***********************************************************************/
-/* gets surface normal at x,y (real coordinates)
-* returns -1 if point outside of window or masked, otherwise 1
-* Usually call after GS_get_selected_point_on_surface
+/*!
+ \brief Get surface normal at x,y (real coordinates)
+
+ Usually call after GS_get_selected_point_on_surface()
+
+ \param id surface id
+ \param x,y real coordinates
+ \param[out] nv surface normal
+
+ \return -1 if point outside of window or masked
+ \return 1 on success
*/
int GS_get_norm_at_xy(int id, float x, float y, float *nv)
{
@@ -1031,11 +1263,23 @@
return (1);
}
-/***********************************************************************/
-/* prints "NULL" or the value (i.e., "921.5") to valstr
-* returns -1 if point outside of window or masked, otherwise 1
-* Colors are translated to rgb and returned as Rxxx Gxxx Bxxx
-* Usually call after GS_get_selected_point_on_surface
+/*!
+ \brief Get RGB color at given point
+
+ Colors are translated to rgb and returned as Rxxx Gxxx Bxxx
+ Usually call after GS_get_selected_point_on_surface()
+
+ Prints "NULL" or the value (i.e., "921.5") to valstr
+
+ Usually call after GS_get_selected_point_on_surface()
+
+ \param id surface id
+ \param att
+ \param[out] valstr value string (allocated, dim?)
+ \param x,y real coordinates
+
+ \return -1 if point outside of window or masked
+ \return 1 on success
*/
int GS_get_val_at_xy(int id, int att, char *valstr, float x, float y)
{
@@ -1044,7 +1288,7 @@
typbuff *buff;
geosurf *gs;
- sprintf(valstr, "");
+ valstr = '\0';
gs = gs_get_surf(id);
if (NULL == gs) {
@@ -1112,7 +1356,14 @@
#endif
-/***********************************************************************/
+/*!
+ \brief Unset attribute
+
+ \param id surface id
+ \param att attribute id
+
+ \return ?
+*/
int GS_unset_att(int id, int att)
{
geosurf *gs;
@@ -1123,7 +1374,15 @@
return (gs_set_att_src(gs, att, NOTSET_ATT));
}
-/***********************************************************************/
+/*!
+ \brief Set attribute constant
+
+ \param id surface id
+ \param att attribute id
+ \param constant value
+
+ \return ?
+*/
int GS_set_att_const(int id, int att, float constant)
{
geosurf *gs;
@@ -1137,8 +1396,17 @@
return (ret);
}
-/***********************************************************************/
-/* mask attribute special: constant is set to indicate invert or no */
+/*!
+ \brief Set mask mode
+
+ Mask attribute special: constant is set to indicate invert or no
+
+ \param id surface id
+ \param mode id
+
+ \return mode id
+ \return -1 on error (invalid surface id)
+*/
int GS_set_maskmode(int id, int mode)
{
geosurf *gs;
@@ -1155,7 +1423,15 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Get mask mode
+
+ \param id surface id
+ \param[out] mode id
+
+ \return 1 on success
+ \return -1 on error (invalid surface id)
+*/
int GS_get_maskmode(int id, int *mode)
{
geosurf *gs;
@@ -1171,7 +1447,15 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Set client data
+
+ \param id surface id
+ \param clientd ?
+
+ \return 1 on success
+ \return -1 on error (invalid surface id)
+*/
int GS_Set_ClientData(int id, void *clientd)
{
geosurf *gs;
@@ -1186,7 +1470,14 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Get client data
+
+ \param id surface id
+
+ \return pointer to client data
+ \return NULL on error
+*/
void *GS_Get_ClientData(int id)
{
geosurf *gs;
@@ -1199,14 +1490,26 @@
return (NULL);
}
-/***********************************************************************/
+/*!
+ \brief Get number of surfaces
+
+ \return number of surfaces
+*/
int GS_num_surfs(void)
{
return (gs_num_surfaces());
}
-/***********************************************************************/
-/* USER must free!! */
+/*!
+ \brief Get surface list
+
+ Must be freed when not neeed!
+
+ \param[out] numsurf number of available surfaces
+
+ \return pointer to surface array
+ \return NULL on error
+*/
int *GS_get_surf_list(int *numsurfs)
{
int i, *ret;
@@ -1214,10 +1517,7 @@
*numsurfs = Next_surf;
if (Next_surf) {
- if (NULL == (ret = (int *) malloc(Next_surf * sizeof(int)))) {
- fprintf(stderr, "can't malloc\n");
- return (NULL);
- }
+ ret = (int *) G_malloc(Next_surf * sizeof(int));
for (i = 0; i < Next_surf; i++) {
ret[i] = Surf_ID[i];
@@ -1229,16 +1529,19 @@
return (NULL);
}
-/***********************************************************************/
+/*!
+ \brief Delete surface
+
+ \param id surface id
+
+ \return 1 on success
+ \return -1 on error
+*/
int GS_delete_surface(int id)
{
int i, j, found = 0;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_delete_surface");
- }
-#endif
+ G_debug(3, "GS_delete_surface");
if (GS_surf_exists(id)) {
gs_delete_surf(id);
@@ -1264,20 +1567,17 @@
return (-1);
}
-/***********************************************************************/
-/* plans for handling color maps:
-NOW:
- if able to load as unsigned char, make lookup table containing palette
- otherwise, load directly as packed color, set lookup = NULL
-MAYBE LATER:
- if able to load as POSITIVE short, make lookup table containing palette
- - may want to calculate savings first (ie, numcells > 32768)
- (not exactly, it's Friday & time to go home - figure it later)
- otherwise, load directly as packed color, set lookup = NULL
-MESSY! - need to fix up!
+
+/*!
+ \brief Load attribute map
+
+ \param id surface id
+ \param filename filename
+ \param att attribute id
+
+ \return -1 on error (invalid surface id)
+ \return ?
*/
-
-/***********************************************************************/
int GS_load_att_map(int id, char *filename, int att)
{
geosurf *gs;
@@ -1288,18 +1588,8 @@
int reuse = 0, begin, hdata, ret, neg = 0, has_null = 0;
typbuff *tbuff;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_load_att_map");
- }
-#endif
+ G_debug (3, "GS_load_att_map(): att_map: %s", filename);
-#ifdef DEBUG_MSG
- {
- fprintf(stderr, "att_map: %s\n", filename);
- }
-#endif
-
gs = gs_get_surf(id);
if (NULL == gs) {
@@ -1322,10 +1612,9 @@
/* Get MAPSET to ensure names are fully qualified */
mapset = G_find_cell2(filename, "");
if (mapset == NULL) {
- /* Check for valid filename */
- fprintf(stderr, "Error: Raster %s does not exist in current Mapset\n", filename);
- fprintf(stderr, "Load Failed\n");
- exit (-1);
+ /* Check for valid filename */
+ G_fatal_error ("Raster map <%s> not found",
+ G_fully_qualified_name(filename, mapset));
}
filename = G_fully_qualified_name(filename, mapset);
@@ -1336,9 +1625,8 @@
rast_head.east <= wind.west ||
rast_head.west >= wind.east)
{
- fprintf(stderr, "Error: Raster %s is outside of current region\n",filename);
- fprintf(stderr, "Load Failed\n");
- exit (-1);
+ G_fatal_error(_("Raster map <%s> is outside of current region. Load failed."),
+ filename);
}
while (!reuse && (0 < hdata)) {
@@ -1346,12 +1634,9 @@
atty = ATTY_FLOAT | ATTY_CHAR | ATTY_INT | ATTY_SHORT | ATTY_MASK;
if (0 < (hdata = gsds_findh(filename, &changed, &atty, begin))) {
-#ifdef DEBUG_MSG
- {
- fprintf(stderr, "%s already has data handle %d.CF=%x\n",
- filename, hdata, changed);
- }
-#endif
+
+ G_debug(3, "GS_load_att_map(): %s already has data handle %d.CF=%x",
+ filename, hdata, changed);
/* handle found */
if (ATT_COLOR == att) {
@@ -1386,21 +1671,13 @@
}
/* TODO: FIX THIS stuff with lookup sharing! */
-#ifdef DEBUG_MSG
- {
- fprintf(stderr, "%s is being reused. hdata=%d\n", filename,
- hdata);
- }
-#endif
+ G_debug(3, "GS_load_att_map(): %s is being reused. hdata=%d",
+ filename, hdata);
}
else {
-#ifdef DEBUG_MSG
- {
- fprintf(stderr, "%s not loaded in correct form - loading now\n",
- filename);
- }
-#endif
-
+ G_debug(3, "GS_load_att_map(): %s not loaded in correct form - loading now",
+ filename);
+
/* not loaded - need to get new dataset handle */
gs->att[att].hdata = gsds_newh(filename);
@@ -1427,15 +1704,13 @@
}
if (0 > gs_malloc_att_buff(gs, att, ATTY_NULL)) {
- Gs_status("Out of memory - Unable to load map");
- exit(0);
+ G_fatal_error (_("GS_load_att_map(): Out of memory. Unable to load map"));
}
switch (atty) {
case ATTY_MASK:
if (0 > gs_malloc_att_buff(gs, att, ATTY_MASK)) {
- Gs_status("Out of memory - Unable to load map");
- exit(0);
+ G_fatal_error (_("GS_load_att_map(): Out of memory. Unable to load map"));
}
ret = Gs_loadmap_as_bitmap(&wind, filename, tbuff->bm);
@@ -1444,8 +1719,7 @@
break;
case ATTY_CHAR:
if (0 > gs_malloc_att_buff(gs, att, ATTY_CHAR)) {
- Gs_status("Out of memory - Unable to load map");
- exit(0);
+ G_fatal_error (_("GS_load_att_map(): Out of memory. Unable to load map"));
}
ret = Gs_loadmap_as_char(&wind, filename, tbuff->cb,
@@ -1455,8 +1729,7 @@
break;
case ATTY_SHORT:
if (0 > gs_malloc_att_buff(gs, att, ATTY_SHORT)) {
- Gs_status("Out of memory - Unable to load map");
- exit(0);
+ G_fatal_error (_("GS_load_att_map(): Out of memory. Unable to load map"));
}
ret = Gs_loadmap_as_short(&wind, filename, tbuff->sb,
@@ -1466,25 +1739,20 @@
break;
case ATTY_FLOAT:
if (0 > gs_malloc_att_buff(gs, att, ATTY_FLOAT)) {
- Gs_status("Out of memory - Unable to load map");
- exit(0);
+ G_fatal_error (_("GS_load_att_map(): Out of memory. Unable to load map"));
}
ret = Gs_loadmap_as_float(&wind, filename, tbuff->fb,
tbuff->nm, &has_null);
filename = G_fully_qualified_name(filename, mapset);
-#ifdef DEBUG_MSG
- {
- fprintf(stderr, "HAS-NULL = %d\n", has_null);
- }
-#endif
+ G_debug(3, "HAS-NULL = %d", has_null);
+
break;
case ATTY_INT:
default:
if (0 > gs_malloc_att_buff(gs, att, ATTY_INT)) {
- Gs_status("Out of memory - Unable to load map");
- exit(0);
+ G_fatal_error (_("GS_load_att_map(): Out of memory. Unable to load map"));
}
ret = Gs_loadmap_as_int(&wind, filename, tbuff->ib,
@@ -1500,11 +1768,7 @@
return (-1);
}
-#ifdef DEBUG_MSG
- {
- fprintf(stderr, "HAS-NULL = %d\n", has_null);
- }
-#endif
+ G_debug(3, "HAS-NULL = %d", has_null);
if (!has_null) {
gsds_free_data_buff(gs->att[att].hdata, ATTY_NULL);
@@ -1541,8 +1805,7 @@
else if (ATTY_FLOAT == atty) {
if (!reuse) {
if (0 > gs_malloc_att_buff(gs, att, ATTY_INT)) {
- Gs_status("Out of memory - Unable to load map");
- exit(0);
+ G_fatal_error (_("GS_load_att_map(): Out of memory. Unable to load map"));
}
Gs_pack_colors_float(filename, tbuff->fb, tbuff->ib,
@@ -1572,32 +1835,29 @@
}
if (ret < 0) {
- fprintf(stderr, "loading error\n");
+ G_warning (_("Loading failed"));
}
if (-1 == Gs_update_attrange(gs, att)) {
- Gs_status("Error finding range");
+ G_warning(_("Error finding range"));
}
-#ifdef DEBUG_MSG
- {
- fprintf(stderr, "Range Updated: %f %f\n", gs->zmin, gs->zmax);
- }
-#endif
+ G_debug (3, "Range Updated: %f %f",
+ gs->zmin, gs->zmax);
return (ret);
}
-/***********************************************************************/
+/*!
+ \brief Draw surface
+
+ \param id surface id
+*/
void GS_draw_surf(int id)
{
geosurf *gs;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_draw_surf");
- }
-#endif
+ G_debug(3, "GS_draw_surf");
gs = gs_get_surf(id);
if (gs) {
@@ -1621,17 +1881,18 @@
return;
}
-/***********************************************************************/
-/* overrides draw_mode for fast display */
+/*!
+ \brief Draw wire
+
+ Overrides draw_mode for fast display
+
+ \param id surface id
+*/
void GS_draw_wire(int id)
{
geosurf *gs;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_draw_wire");
- }
-#endif
+ G_debug(3, "GS_draw_wire");
gs = gs_get_surf(id);
@@ -1642,8 +1903,11 @@
return;
}
-/***********************************************************************/
-/* overrides draw_mode for fast display */
+/*!
+ \brief Draw all wires
+
+ Overrides draw_mode for fast display
+*/
void GS_alldraw_wire(void)
{
geosurf *gs;
@@ -1658,7 +1922,9 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Draw all surfaces
+*/
void GS_alldraw_surf(void)
{
int i;
@@ -1670,16 +1936,17 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Set Z exag for surface
+
+ \param id surface id
+ \param exag z-exag value
+*/
void GS_set_exag(int id, float exag)
{
geosurf *gs;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_set_exag");
- }
-#endif
+ G_debug(3, "GS_set_exag");
gs = gs_get_surf(id);
@@ -1694,15 +1961,15 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Set global z-exag value
+
+ \param exag exag value to be set up
+*/
void GS_set_global_exag(float exag)
{
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_set_global_exag");
- }
-#endif
+ G_debug(3, "GS_set_global_exag");
Gv.vert_exag = exag;
/* GL_NORMALIZE */
@@ -1716,28 +1983,31 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Get global z-exag value
+
+ \return value
+*/
float GS_global_exag(void)
{
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_global_exag");
- }
-#endif
+ G_debug(3, "GS_global_exag");
return (Gv.vert_exag);
}
-/***********************************************************************/
+/*!
+ \brief Set wire color
+
+ \todo error-handling
+
+ \param id surface id
+ \param colr color value
+*/
void GS_set_wire_color(int id, int colr)
{
geosurf *gs;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_set_wire_color");
- }
-#endif
+ G_debug(3, "GS_set_wire_color");
gs = gs_get_surf(id);
@@ -1748,7 +2018,15 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Get wire color
+
+ \param id surface id
+ \param[out] colr color value
+
+ \return 1 on success
+ \return -1 on error
+*/
int GS_get_wire_color(int id, int *colr)
{
geosurf *gs;
@@ -1764,7 +2042,14 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Set all draw-modes
+
+ \param mode mode id
+
+ \return 0 on success
+ \return -1 on error
+*/
int GS_setall_drawmode(int mode)
{
int i;
@@ -1778,16 +2063,20 @@
return (0);
}
-/***********************************************************************/
+/*!
+ \brief Set draw mode
+
+ \param id surface id
+ \param mode mode id
+
+ \return 0 on success
+ \return -1 on error (invalid surface id)
+*/
int GS_set_drawmode(int id, int mode)
{
geosurf *gs;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_set_drawmode");
- }
-#endif
+ G_debug(3, "GS_set_drawmode");
gs = gs_get_surf(id);
@@ -1800,7 +2089,15 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Get draw mode
+
+ \param id surface id
+ \param[out] mode mode id
+
+ \return 1 on success
+ \return -1 on error (invalid surface id)
+*/
int GS_get_drawmode(int id, int *mode)
{
geosurf *gs;
@@ -1816,16 +2113,18 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Set no-zero ?
+
+ \param id surface id
+ \param att attribute id
+ \param mode mode id
+*/
void GS_set_nozero(int id, int att, int mode)
{
geosurf *gs;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_set_nozero");
- }
-#endif
+ G_debug(3, "GS_set_nozero");
gs = gs_get_surf(id);
@@ -1844,16 +2143,21 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Get no-zero ?
+
+ \param id surface id
+ \param att attribute id
+ \param[out] mode mode id
+
+ \return -1 on error (invalid surface id)
+ \return 1 on success
+*/
int GS_get_nozero(int id, int att, int *mode)
{
geosurf *gs;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_set_nozero");
- }
-#endif
+ G_debug(3, "GS_set_nozero");
gs = gs_get_surf(id);
@@ -1874,7 +2178,15 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Set all draw resolutions
+
+ \param xres,yres x/y resolution value
+ \param xwire,ywire x/y wire value
+
+ \return 0 on success
+ \return -1 on error
+*/
int GS_setall_drawres(int xres, int yres, int xwire, int ywire)
{
int i;
@@ -1888,16 +2200,21 @@
return (0);
}
-/***********************************************************************/
+/*!
+ \brief Set draw resolution for surface
+
+ \param id surface id
+ \param xres,yres x/y resolution value
+ \param xwire,ywire x/y wire value
+
+ \return -1 on error
+ \return 0 on success
+*/
int GS_set_drawres(int id, int xres, int yres, int xwire, int ywire)
{
geosurf *gs;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_set_drawres");
- }
-#endif
+ G_debug(3, "GS_set_drawres");
if (xres < 1 || yres < 1 || xwire < 1 || ywire < 1) {
return (-1);
@@ -1919,16 +2236,18 @@
return (0);
}
-/***********************************************************************/
+/*!
+ \brief Get draw resolution of surface
+
+ \param id surface id
+ \param[out] xres,yres x/y resolution value
+ \param[out] xwire,ywire x/y wire value
+*/
void GS_get_drawres(int id, int *xres, int *yres, int *xwire, int *ywire)
{
geosurf *gs;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_get_drawres");
- }
-#endif
+ G_debug(3, "GS_get_drawres");
gs = gs_get_surf(id);
@@ -1942,16 +2261,17 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Get dimension of surface
+
+ \param id surface id
+ \param[out] rows,cols number of rows/cols
+*/
void GS_get_dims(int id, int *rows, int *cols)
{
geosurf *gs;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_get_dims");
- }
-#endif
+ G_debug(3, "GS_get_dims");
gs = gs_get_surf(id);
@@ -1963,10 +2283,19 @@
return;
}
-/***********************************************************************/
-/* Use no_zero range because if zero IS data, then range won't be that
-much off (it's just a GUESS, after all), but if zero is NO data, could
-drastically affect guess */
+/*!
+ \brief Get exag-value guess
+
+ Use no_zero range because if zero IS data, then range won't be that
+ much off (it's just a GUESS, after all), but if zero is NO data, could
+ drastically affect guess
+
+ \param id surface id
+ \param[out] exag exag value
+
+ \return 1 on success
+ \return -1 on error
+*/
int GS_get_exag_guess(int id, float *exag)
{
geosurf *gs;
@@ -1988,32 +2317,21 @@
return (1);
}
-#ifdef DEBUG_MSG
- {
- fprintf(stderr, "%f %f\n", gs->zrange_nz, Longdim);
- G_sleep(1);
- }
-#endif
+ G_debug (3, "GS_get_exag_guess(): %f %f",
+ gs->zrange_nz, Longdim);
while (gs->zrange_nz * guess / Longdim >= .25) {
guess *= .1;
-#ifdef DEBUG_MSG
- {
- fprintf(stderr, "%f\n", guess);
- }
-#endif
-
+ G_debug (3, "GS_get_exag_guess(): %f",
+ guess);
}
while (gs->zrange_nz * guess / Longdim < .025) {
guess *= 10.;
-#ifdef DEBUG_MSG
- {
- fprintf(stderr, "%f\n", guess);
- }
-#endif
+ G_debug (3, "GS_get_exag_guess(): %f",
+ guess);
}
*exag = guess;
@@ -2024,7 +2342,14 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ Get Z extents for all loaded surfaces
+
+ Treating zeros as "no data"
+
+ \param[out] min min value
+ \param[out] max max value
+*/
void GS_get_zrange_nz(float *min, float *max)
{
int i, first = 1;
@@ -2051,16 +2376,17 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Set trans ?
+
+ \param id surface id
+ \param xtrans,ytrans,ztrans real trans coordinates
+*/
void GS_set_trans(int id, float xtrans, float ytrans, float ztrans)
{
geosurf *gs;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_set_trans");
- }
-#endif
+ G_debug(3, "GS_set_trans");
gs = gs_get_surf(id);
@@ -2073,16 +2399,17 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Get trans ?
+
+ \param id surface id
+ \param[out] xtrans,ytrans,ztrans real trans coordinates
+*/
void GS_get_trans(int id, float *xtrans, float *ytrans, float *ztrans)
{
geosurf *gs;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_get_trans");
- }
-#endif
+ G_debug(3, "GS_get_trans");
gs = gs_get_surf(id);
@@ -2096,26 +2423,34 @@
}
-/***********************************************************************/
+/*!
+ \brief Get default draw color
+
+ \return color value
+*/
unsigned int GS_default_draw_color(void)
{
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_default_draw_color");
- }
-#endif
+ G_debug(3, "GS_default_draw_color");
return ((unsigned int) Gd.bgcol);
}
-/***********************************************************************/
+/*!
+ \brief Get background color
+
+ \return color value
+*/
unsigned int GS_background_color(void)
{
return ((unsigned int) Gd.bgcol);
}
-/***********************************************************************/
+/*!
+ \brief Sets which buffer to draw to
+
+ \param where GSD_BOTH, GSD_FRONT, GSD_BACK
+*/
void GS_set_draw(int where)
{
Buffermode = where;
@@ -2142,30 +2477,26 @@
return;
}
-/***********************************************************************/
+/*
+ \brief Ready to draw
+*/
void GS_ready_draw(void)
{
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_ready_draw");
- }
-#endif
+ G_debug(3, "GS_ready_draw");
gsd_set_view(&Gv, &Gd);
return;
}
-/***********************************************************************/
+/*!
+ \brief Draw done
+*/
void GS_done_draw(void)
{
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_done_draw");
- }
-#endif
+ G_debug(3, "GS_done_draw");
if (GSD_BACK == Buffermode) {
gsd_swapbuffers();
@@ -2176,15 +2507,16 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Set focus
+
+ \param realto real coordinates to
+*/
void GS_set_focus(float *realto)
{
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_set_focus");
- }
-#endif
+ G_debug(3, "GS_set_focus");
+
Gv.infocus = 1;
GS_v3eq(Gv.real_to, realto);
@@ -2193,6 +2525,11 @@
return;
}
+/*!
+ \brief Set real focus
+
+ \param realto real coordinates to
+*/
void GS_set_focus_real(float *realto)
{
@@ -2209,16 +2546,19 @@
}
-/***********************************************************************/
-/* OK to call with NULL argument if just want to check state */
+/*!
+ \brief Get focus
+
+ OK to call with NULL argument if just want to check state
+
+ \param realto real coordinates to
+
+ \return ?
+*/
int GS_get_focus(float *realto)
{
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_get_focus");
- }
-#endif
+ G_debug(3, "GS_get_focus");
if (Gv.infocus) {
if (realto) {
@@ -2229,17 +2569,17 @@
return (Gv.infocus);
}
-/***********************************************************************/
+/*!
+ \brief Set focus to map center
+
+ \param id surface id
+*/
void GS_set_focus_center_map(int id)
{
float center[3];
geosurf *gs;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_set_focus_center_map");
- }
-#endif
+ G_debug(3, "GS_set_focus_center_map");
gs = gs_get_surf(id);
@@ -2264,18 +2604,17 @@
}
}
-/***********************************************************************/
+/*!
+ \brief Move position to
+
+ \param pt point model coordinates
+*/
void GS_moveto(float *pt)
{
float ft[3];
+ G_debug(3, "GS_moveto");
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_moveto");
- }
-#endif
-
if (Gv.infocus) {
GS_v3eq(Gv.from_to[FROM], pt);
/*
@@ -2295,7 +2634,11 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Move position to (real)
+
+ \param pt point real coordinates
+*/
void GS_moveto_real(float *pt)
{
gsd_real2model(pt);
@@ -2304,17 +2647,22 @@
return;
}
-/***********************************************************************/
-/* for a single surface */
+/*!
+ \brief Get z-extent for a single surface
+
+ \param id surface id
+ \param[out] min min z-value
+ \param[out] max max z-value
+ \param[out] mid middle z-value ?
+
+ \return -1 on error (invalid surface id)
+ \return ?
+*/
int GS_get_zextents(int id, float *min, float *max, float *mid)
{
geosurf *gs;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_get_zextents");
- }
-#endif
+ G_debug(3, "GS_get_zextents");
if (NULL == (gs = gs_get_surf(id))) {
return (-1);
@@ -2323,58 +2671,65 @@
return (gs_get_zextents(gs, min, max, mid));
}
-/***********************************************************************/
-/* for all surfaces */
+/*!
+ \brief Get z-extent for all loaded surfaces
+
+ \param[out] min min z-value
+ \param[out] max max z-value
+ \param doexag ?
+
+ \return 1 on success
+ \return -1 on error
+*/
int GS_get_zrange(float *min, float *max, int doexag)
{
int ret_surf, ret_vol;
- float surf_min, surf_max;
- float vol_min, vol_max;
-
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_get_zrange");
+ float surf_min, surf_max;
+ float vol_min, vol_max;
+
+ G_debug(3, "GS_get_zrange");
+
+ ret_surf = gs_get_zrange(&surf_min, &surf_max);
+ ret_vol = gvl_get_zrange(&vol_min, &vol_max);
+
+ if (ret_surf > 0 && ret_vol > 0) {
+ *min = (surf_min < vol_min) ? surf_min : vol_min;
+ *max = (surf_max < vol_max) ? surf_max : vol_max;
+ } else if (ret_surf > 0) {
+ *min = surf_min;
+ *max = surf_max;
+ } else if (ret_vol > 0) {
+ *min = vol_min;
+ *max = vol_max;
}
-#endif
-
- ret_surf = gs_get_zrange(&surf_min, &surf_max);
- ret_vol = gvl_get_zrange(&vol_min, &vol_max);
-
- if (ret_surf > 0 && ret_vol > 0) {
- *min = (surf_min < vol_min) ? surf_min : vol_min;
- *max = (surf_max < vol_max) ? surf_max : vol_max;
- } else if (ret_surf > 0) {
- *min = surf_min;
- *max = surf_max;
- } else if (ret_vol > 0) {
- *min = vol_min;
- *max = vol_max;
- }
-
+
if (doexag) {
*min *= Gv.vert_exag;
*max *= Gv.vert_exag;
}
-
+
return ((ret_surf > 0 || ret_vol > 0) ? (1) :(-1));
}
-/***********************************************************************/
+/*!
+ \brief Get 'from' coordinates
+
+ \param[out] fr from model coordinates
+*/
void GS_get_from(float *fr)
{
+ G_debug(3, "GS_get_from");
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_get_from");
- }
-#endif
-
GS_v3eq(fr, Gv.from_to[FROM]);
return;
}
-/***********************************************************************/
+/*!
+ \brief Get 'from' real coordinates
+
+ \param[out] fr 'from' real coordinates
+*/
void GS_get_from_real(float *fr)
{
GS_v3eq(fr, Gv.from_to[FROM]);
@@ -2383,7 +2738,11 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Get 'to' real coordinates
+
+ \param[out] to 'to' real coordinates
+*/
void GS_get_to_real(float *to)
{
float realto[3];
@@ -2398,9 +2757,12 @@
}
-/***********************************************************************/
-/* This function returns current viewport settings (tmp) and */
-/* Max viewport size (num) */
+/*!
+ \brief Get zoom setup
+
+ \param[out] a,b,c,d current viewport settings
+ \param[out] maxx,maxy max viewport size
+*/
void GS_zoom_setup(int *a, int *b, int *c, int *d, int *maxx, int *maxy)
{
GLint tmp[4];
@@ -2416,23 +2778,27 @@
return;
}
-/***********************************************************************/
-/* TODO need set_to? - just use viewdir? */
+/*!
+ \brief Get 'to' model coordinates
+
+ \todo need set_to? - just use viewdir?
+
+ \param[out] to 'to' model coordinates
+*/
void GS_get_to(float *to)
{
+ G_debug(3, "GS_get_to");
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_get_to");
- }
-#endif
-
GS_v3eq(to, Gv.from_to[TO]);
return;
}
-/***********************************************************************/
+/*!
+ \brief Get viewdir
+
+ \param[out] dir viewdir value
+*/
void GS_get_viewdir(float *dir)
{
GS_v3dir(Gv.from_to[FROM], Gv.from_to[TO], dir);
@@ -2440,8 +2806,13 @@
return;
}
-/***********************************************************************/
-/* Automatically turns off focus */
+/*!
+ \brief Set viewdir
+
+ Automatically turns off focus
+
+ \param dir viewdir value
+*/
void GS_set_viewdir(float *dir)
{
float tmp[3];
@@ -2457,7 +2828,11 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Set field of view
+
+ \param fov fov value
+*/
void GS_set_fov(int fov)
{
Gv.fov = fov;
@@ -2465,20 +2840,33 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Get fied of view
+
+ \return field of view, in 10ths of degrees
+*/
int GS_get_fov(void)
{
return (Gv.fov);
}
-/***********************************************************************/
+/*!
+ \brief Get twist value
+
+ 10ths of degrees off twelve o'clock
+*/
int GS_get_twist(void)
{
return (Gv.twist);
}
-/***********************************************************************/
-/* 10ths of degrees off twelve o'clock */
+/*!
+ \brief Set twist value
+
+ 10ths of degrees off twelve o'clock
+
+ \params t tenths of degrees clockwise from 12:00.
+*/
void GS_set_twist(int t)
{
Gv.twist = t;
@@ -2486,34 +2874,27 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Unset focus
+*/
void GS_set_nofocus(void)
{
+ G_debug(3, "GS_set_nofocus");
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_set_nofocus");
- }
-#endif
-
Gv.infocus = 0;
return;
}
-/*******************************************************************
- * Make sure that the center of view is set
-******************************************************************/
+/*!
+ \brief Set focus
+ Make sure that the center of view is set
+*/
void GS_set_infocus(void)
{
+ G_debug(3, "GS_set_infocus");
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_set_infocus");
- }
-#endif
-
Gv.infocus = 1;
return;
@@ -2521,25 +2902,34 @@
-/***********************************************************************/
+/*!
+ \brief Set viewport
+
+ \param left,right,bottom,top viewport extent values
+*/
void GS_set_viewport(int left, int right, int bottom, int top)
{
+ G_debug(3, "GS_set_viewport");
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_set_viewport");
- }
-#endif
-
gsd_viewport(left, right, bottom, top);
return;
}
-/************************************************************************/
-/* Send screen coords sx & sy, lib traces through surfaces & sets new center
-to point of nearest intersection. If no intersection, uses line of
-sight with length of current view ray (eye to center) to set new center */
+/*!
+ \brief Send screen coords sx and sy, lib traces through surfaces; sets
+ new center to point of nearest intersection.
+
+ If no intersection, uses line of sight with length of current view
+ ray (eye to center) to set new center.
+
+ Reset center of view to screen coordinates sx, sy.
+
+ \param sx,sy screen coordinates
+
+ \return 1 on success
+ \return 0 on error (invalid surface id)
+*/
int GS_look_here(int sx, int sy)
{
float x, y, z, len, los[2][3];
@@ -2575,7 +2965,20 @@
return (0);
}
-/************************************************************************/
+/*!
+ \brief Get selected point of surface
+
+ Given screen coordinates sx and sy, find closest intersection of
+ view ray with surfaces and return coordinates of intersection in x, y,
+ z, and identifier of surface in id.
+
+ \param sx,sy screen coordinates
+ \param[out] id surface id
+ \param[out] x,y,z point on surface (model coordinates?)
+
+ \returns 0 if no intersections found
+ \return number of intersections
+*/
int GS_get_selected_point_on_surface(int sx, int sy, int *id, float *x,
float *y, float *z)
{
@@ -2588,13 +2991,12 @@
gsd_get_los(los, (short) sx, (short) sy);
if (!gs_setlos_enterdata(los)) {
- fprintf(stderr, "gs_setlos_enterdata(los) returns false\n");
-
+ G_debug (3, "gs_setlos_enterdata(los): returns false");
return (0);
}
for (i = 0; i < Next_surf; i++) {
- fprintf(stderr, "id=%d ", i);
+ G_debug (3, "id=%d", i);
gs = gs_get_surf(Surf_ID[i]);
@@ -2639,7 +3041,12 @@
return (numhits);
}
-/************************************************************************/
+/*!
+ \brief Set cplace rotation
+
+ \param num cplace id
+ \param dx,dy,dz rotation values
+*/
void GS_set_cplane_rot(int num, float dx, float dy, float dz)
{
gsd_cplane_setrot(num, dx, dy, dz);
@@ -2647,7 +3054,12 @@
return;
}
-/************************************************************************/
+/*!
+ \brief Set cplace trans
+
+ \param num cplace id
+ \param dx,dy,dz rotation values
+*/
void GS_set_cplane_trans(int num, float dx, float dy, float dz)
{
gsd_cplane_settrans(num, dx, dy, dz);
@@ -2656,7 +3068,11 @@
}
-/************************************************************************/
+/*!
+ \brief Draw cplace
+
+ \param num cplace id
+*/
void GS_draw_cplane(int num)
{
geosurf *gsurfs[MAX_SURFS];
@@ -2675,7 +3091,15 @@
return;
}
-/************************************************************************/
+/*!
+ \brief Draw cplace fence ?
+
+ \param hs1,hs2
+ \param num cplane id
+
+ \return 0 on error
+ \return 1 on success
+*/
int GS_draw_cplane_fence(int hs1, int hs2, int num)
{
geosurf *gs1, *gs2;
@@ -2693,7 +3117,9 @@
return (1);
}
-/************************************************************************/
+/*!
+ \brief Draw all cplace fences ?
+*/
void GS_alldraw_cplane_fences(void)
{
int onstate[MAX_CPLANES], i;
@@ -2709,7 +3135,11 @@
return;
}
-/************************************************************************/
+/*!
+ \brief Set cplace
+
+ \param num cplane id
+*/
void GS_set_cplane(int num)
{
gsd_cplane_on(num);
@@ -2717,7 +3147,11 @@
return;
}
-/************************************************************************/
+/*!
+ \brief Unset cplace
+
+ \param num cplane id
+*/
void GS_unset_cplane(int num)
{
gsd_cplane_off(num);
@@ -2725,7 +3159,12 @@
return;
}
-/************************************************************************/
+/*!
+ \brief Get scale
+
+ \param sx,sy,sz x/y/z scale values
+ \param doexag ?
+*/
void GS_get_scale(float *sx, float *sy, float *sz, int doexag)
{
float zexag;
@@ -2737,7 +3176,11 @@
return;
}
-/************************************************************************/
+/*!
+ \brief Set fence color
+
+ \param mode mode id
+*/
void GS_set_fencecolor(int mode)
{
gsd_setfc(mode);
@@ -2745,16 +3188,26 @@
return;
}
-/************************************************************************/
+/*!
+ \brief Get fence color
+
+ \return color value
+*/
int GS_get_fencecolor(void)
{
return gsd_getfc();
}
-/************************************************************************/
-/* measure distance "as the ball rolls" between two points on surface
- returns 0 on error or if one or more points is not in region,
- returns 1 on success.
+/*!
+ \brief Measure distance "as the ball rolls" between two points on surface
+
+ \param hs
+ \param x1,y1,x2,y2 distance line nodes
+ \param dist ?
+ \param use_exag use exag ?
+
+ \return 0 on error or if one or more points is not in region,
+ \return distance following terrain
*/
int GS_get_distance_alongsurf(int hs, float x1, float y1, float x2, float y2,
float *dist, int use_exag)
@@ -2776,13 +3229,27 @@
return (gs_distance_onsurf(gs, p1, p2, dist, use_exag));
}
-/************************************************************************/
+/*!
+ \brief Save 3d view
+
+ \param vname view file name
+ \param surfid surface id
+
+ \return ?
+*/
int GS_save_3dview(char *vname, int surfid)
{
return (Gs_save_3dview(vname, &Gv, &Gd, &wind, gs_get_surf(surfid)));
}
-/************************************************************************/
+/*!
+ \brief Load 3d view
+
+ \param vname view file name
+ \param surfid surface id
+
+ \return ?
+*/
int GS_load_3dview(char *vname, int surfid)
{
@@ -2796,16 +3263,16 @@
* Following routines use Graphics Library
************************************************************************/
-/* TODO: allow to set center? */
+/*!
+ \brief Init view
+
+ \todo allow to set center?
+*/
void GS_init_view(void)
{
static int first = 1;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_init_view");
- }
-#endif
+ G_debug(3, "GS_init_view");
if (first) {
first = 0;
@@ -2864,16 +3331,15 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Clear view
+
+ \param col color value
+*/
void GS_clear(int col)
{
+ G_debug(3, "GS_clear");
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_clear");
- }
-#endif
-
col = col | 0xFF000000;
/* OGLXXX
@@ -2899,17 +3365,15 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Get aspect value
+*/
double GS_get_aspect(void)
{
int left, right, bottom, top;
GLint tmp[4];
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_get_aspect");
- }
-#endif
+ G_debug(3, "GS_get_aspect");
/* OGLXXX
* get GL_VIEWPORT:
@@ -2924,6 +3388,13 @@
return ((double) (right - left) / (top - bottom));
}
+/*!
+ \brief Check for transparency
+
+ Disabled.
+
+ \return 1
+*/
int GS_has_transparency(void)
{
/* OGLXXX
Modified: grass/trunk/lib/ogsf/GSX.c
===================================================================
--- grass/trunk/lib/ogsf/GSX.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/GSX.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,12 +1,20 @@
-/*
-* $Id$
+/*!
+ \file GSX.c
+
+ \brief OGSF library - loading and manipulating surfaces
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL (December 1993)
*/
-/* GSX.c
- Bill Brown, USACERL
- December 1993
-*/
-
#include <grass/gstypes.h>
void (*Cxl_func) ();
Modified: grass/trunk/lib/ogsf/GS_util.c
===================================================================
--- grass/trunk/lib/ogsf/GS_util.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/GS_util.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,12 +1,20 @@
-/*
-* $Id$
+/*!
+ \file GS_util.c
+
+ \brief OGSF library - loading and manipulating surfaces
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL, GMSL/University of Illinois
*/
-/* gs_util.c
- Bill Brown, USACERL
- January 1993
-*/
-
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
@@ -14,7 +22,35 @@
#include <grass/gstypes.h>
-/************************************************************************/
+/*!
+ \brief Calculate distance between 2 coordinates
+
+ Units is one of:
+ - "meters",
+ - "miles",
+ - "kilometers",
+ - "feet",
+ - "yards",
+ - "nmiles" (nautical miles),
+ - "rods",
+ - "inches",
+ - "centimeters",
+ - "millimeters",
+ - "micron",
+ - "nanometers",
+ - "cubits",
+ - "hands",
+ - "furlongs",
+ - "chains"
+
+ Default is meters.
+
+ \param from starting point
+ \param to ending point
+ \param units map units
+
+ \return distance between two geographic coordinates in current projection
+*/
double GS_geodistance(double *from, double *to, char *units)
{
double meters;
@@ -93,7 +129,14 @@
return (meters);
}
-/************************************************************************/
+/*!
+ \brief Calculate distance
+
+ \param from 'from' point (X,Y,Z)
+ \param to 'to' point (X,Y,Z)
+
+ \return distance
+*/
float GS_distance(float *from, float *to)
{
float x, y, z;
@@ -105,7 +148,14 @@
return (float) sqrt(x * x + y * y + z * z);
}
-/************************************************************************/
+/*!
+ \brief Calculate distance in plane
+
+ \param from 'from' point (X,Y)
+ \param to 'to' point (X,Y)
+
+ \return distance
+*/
float GS_P2distance(float *from, float *to)
{
float x, y;
@@ -116,8 +166,14 @@
return (float) sqrt(x * x + y * y);
}
-/************************************************************************/
-/* v1 = v2 */
+/*!
+ \brief Copy vector values
+
+ v1 = v2
+
+ \param[out] v1 first vector
+ \param v2 second vector
+*/
void GS_v3eq(float *v1, float *v2)
{
v1[X] = v2[X];
@@ -127,8 +183,14 @@
return;
}
-/************************************************************************/
-/* v1 += v2 */
+/*!
+ \brief Sum vectors
+
+ v1 += v2
+
+ \param[in,out] v1 first vector
+ \param v2 second vector
+*/
void GS_v3add(float *v1, float *v2)
{
v1[X] += v2[X];
@@ -138,8 +200,14 @@
return;
}
-/************************************************************************/
-/* v1 -= v2 */
+/*!
+ \brief Subtract vectors
+
+ v1 -= v2
+
+ \param[in,out] v1 first vector
+ \param v2 second vector
+*/
void GS_v3sub(float *v1, float *v2)
{
v1[X] -= v2[X];
@@ -149,8 +217,14 @@
return;
}
-/************************************************************************/
-/* v1 *= k */
+/*!
+ \brief Multiple vectors
+
+ v1 *= k
+
+ \param[in,out] v1 vector
+ \param k multiplicator
+*/
void GS_v3mult(float *v1, float k)
{
v1[X] *= k;
@@ -160,8 +234,14 @@
return;
}
-/************************************************************************/
-/* Changes v1 so that it is a unit vector */
+/*!
+ \brief Change v1 so that it is a unit vector (2D)
+
+ \param[in,out] v1 vector
+
+ \return 0 if magnitude of v1 is zero
+ \return 1 if magnitude of v1 > 0
+*/
int GS_v3norm(float *v1)
{
float n;
@@ -179,8 +259,14 @@
return (1);
}
-/************************************************************************/
-/* Changes v1 so that it is a unit vector */
+/*!
+ \brief Change v1 so that it is a unit vector (3D)
+
+ \param[in,out] v1 vector
+
+ \return 0 if magnitude of v1 is zero
+ \return 1 if magnitude of v1 > 0
+*/
int GS_v2norm(float *v1)
{
float n;
@@ -197,8 +283,14 @@
return (1);
}
-/************************************************************************/
-/* Changes v1 so that it is a unit vector */
+/*!
+ \brief Changes v1 so that it is a unit vector
+
+ \param dv1 vector
+
+ \return 0 if magnitude of dv1 is zero
+ \return 1 if magnitude of dv1 > 0
+*/
int GS_dv3norm(double *dv1)
{
double n;
@@ -217,8 +309,15 @@
}
-/************************************************************************/
-/* Changes v2 so that v1v2 is a unit vector */
+/*!
+ \brief Change v2 so that v1v2 is a unit vector
+
+ \param v1 first vector
+ \param v2[in,out] second vector
+
+ \return 0 if magnitude of dx is zero
+ \return 1 if magnitude of dx > 0
+*/
int GS_v3normalize(float *v1, float *v2)
{
float n, dx, dy, dz;
@@ -240,8 +339,16 @@
}
-/************************************************************************/
-/* get a normalized direction from v1 to v2, store in v3 */
+/*!
+ \brief Get a normalized direction from v1 to v2, store in v3
+
+ \param v1 first vector
+ \param v2 second vector
+ \param[out] v3 output vector
+
+ \return 0 if magnitude of dx is zero
+ \return 1 if magnitude of dx > 0
+*/
int GS_v3dir(float *v1, float *v2, float *v3)
{
float n, dx, dy, dz;
@@ -264,8 +371,16 @@
}
-/************************************************************************/
-/* get a normalized direction from v1 to v2, store in v3 */
+/*!
+ \brief Get a normalized direction from v1 to v2, store in v3 (2D)
+
+ \param v1 first vector
+ \param v2 second vector
+ \param[out] v3 output vector
+
+ \return 0 if magnitude of dx is zero
+ \return 1 if magnitude of dx > 0
+*/
void GS_v2dir(float *v1, float *v2, float *v3)
{
float n, dx, dy;
@@ -280,8 +395,13 @@
return;
}
-/************************************************************************/
-/* return the cross product v3 = v1 cross v2 */
+/*!
+ \brief Get the cross product v3 = v1 cross v2
+
+ \param v1 first vector
+ \param v2 second vector
+ \param[out] v3 output vector
+*/
void GS_v3cross(float *v1, float *v2, float *v3)
{
v3[X] = (v1[Y] * v2[Z]) - (v1[Z] * v2[Y]);
@@ -291,8 +411,12 @@
return;
}
-/************************************************************************/
-/* magnitude of vector */
+/*!
+ \brief Magnitude of vector
+
+ \param v1 vector
+ \param[out] mag magnitude value
+*/
void GS_v3mag(float *v1, float *mag)
{
*mag = sqrt(v1[X] * v1[X] + v1[Y] * v1[Y] + v1[Z] * v1[Z]);
@@ -300,9 +424,20 @@
return;
}
-/************************************************************************/
-/* initialize by calling with a number nhist to represent number of
- * previous entrys to check, then call with zero as nhist
+/*!
+ \brief ADD
+
+ Initialize by calling with a number nhist to represent number of
+ previous entrys to check, then call with zero as nhist
+
+ \param p1 first point
+ \param p2 second point
+ \param nhist ?
+
+ \return -1 on error
+ \return -2
+ \return 1
+ \return 9
*/
int GS_coordpair_repeats(float *p1, float *p2, int nhist)
{
@@ -313,13 +448,14 @@
if (nhist) {
if (entrys) {
- free(entrys);
+ G_free(entrys);
}
- if (NULL == (entrys = (float *) malloc(4 * nhist * sizeof(float)))) {
- return (-1);
- }
+ entrys = (float *) G_malloc(4 * nhist * sizeof(float));
+ if (!entrys)
+ return (-1);
+
len = nhist;
next = 0;
}
Modified: grass/trunk/lib/ogsf/GV2.c
===================================================================
--- grass/trunk/lib/ogsf/GV2.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/GV2.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,12 +1,21 @@
-/*
-* $Id$
+/*!
+ \file GV2.c
+
+ \brief OGSF library - loading and manipulating vector sets (higher level functions)
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL, GMSL/University of Illinois
+ Doxygenized by Martin Landa <landa.martin gmail.com>
*/
-/* GV.c
- Bill Brown, USACERL
- October 1993
-*/
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -14,23 +23,22 @@
#include <grass/gstypes.h>
#include "gsget.h"
-#ifdef TRACE_FUNCS
-#define TRACE_GV_FUNCS
-#endif
-
static int Vect_ID[MAX_VECTS];
static int Next_vect = 0;
-/***********************************************************************/
+/*!
+ \brief Check if vector set exists
+
+ \param id vector set id
+
+ \return 0 not found
+ \return 1 found
+*/
int GV_vect_exists(int id)
{
int i, found = 0;
-#ifdef TRACE_GV_FUNCS
- {
- Gs_status("GV_vect_exists");
- }
-#endif
+ G_debug(3, "GV_vect_exists");
if (NULL == gv_get_vect(id)) {
return (0);
@@ -45,16 +53,17 @@
return (found);
}
-/***********************************************************************/
+/*!
+ \brief Register new vector set
+
+ \return vector set id
+ \return -1 on error
+*/
int GV_new_vector(void)
{
geovect *nv;
-#ifdef TRACE_GV_FUNCS
- {
- Gs_status("GV_new_vector");
- }
-#endif
+ G_debug(3, "GV_new_vector");
if (Next_vect < MAX_VECTS) {
nv = gv_get_new_vect();
@@ -68,14 +77,26 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Get number of available vector sets
+
+ \return number of vector sets
+*/
int GV_num_vects(void)
{
return (gv_num_vects());
}
-/***********************************************************************/
-/* USER must free!! */
+/*!
+ \brief Get list of vector sets
+
+ Must free when no longer needed!
+
+ \param numvects number of vector sets
+
+ \return pointer to list of point sets
+ \return NULL on error
+*/
int *GV_get_vect_list(int *numvects)
{
int i, *ret;
@@ -83,32 +104,34 @@
*numvects = Next_vect;
if (Next_vect) {
- if (NULL == (ret = (int *) malloc(Next_vect * sizeof(int)))) {
- fprintf(stderr, "can't malloc\n");
-
+ ret = (int *) G_malloc(Next_vect * sizeof(int));
+ if (!ret) {
return (NULL);
}
-
+
for (i = 0; i < Next_vect; i++) {
ret[i] = Vect_ID[i];
}
-
+
return (ret);
}
return (NULL);
}
-/***********************************************************************/
+/*!
+ \brief Delete vector set from list
+
+ \param id vector set id
+
+ \return 1 on success
+ \return -1 on error
+*/
int GV_delete_vector(int id)
{
int i, j, found = 0;
-#ifdef TRACE_GV_FUNCS
- {
- Gs_status("GV_delete_vect");
- }
-#endif
+ G_debug(3, "GV_delete_vect");
if (GV_vect_exists(id)) {
gv_delete_vect(id);
@@ -132,15 +155,25 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Load vector set
+
+ Check to see if handle already loaded, if so - free before loading
+ new for now, always load to memory
+
+ \todo Load file handle & ready for reading instead of using
+ memory
+
+ \param id vector set id
+ \param filename filename
+
+ \return -1 on error (invalid vector set id)
+ \return 1 on success
+*/
int GV_load_vector(int id, char *filename)
{
geovect *gv;
- /* check to see if handle already loaded, if so - free before loading */
- /* new for now, always load to memory */
- /* TODO SOON: load file handle & ready for reading instead of using */
- /* memory */
if (NULL == (gv = gv_get_vect(id))) {
return (-1);
}
@@ -160,7 +193,15 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Get vector map name
+
+ \param id vector set id
+ \param filename filename
+
+ \return -1 on error (invalid vector set id)
+ \return 1 on success
+*/
int GV_get_vectname(int id, char *filename)
{
geovect *gv;
@@ -174,7 +215,18 @@
return (1);
}
-/***********************************************************************/
+/*!
+ \brief Set vector set mode
+
+ \param id vector set id
+ \param mem
+ \param color color value
+ \param width
+ \param flat
+
+ \return -1 on error (invalid vector set id)
+ \return 1 on success
+*/
int GV_set_vectmode(int id, int mem, int color, int width, int flat)
{
geovect *gv;
@@ -191,7 +243,18 @@
return (1);
}
-/***********************************************************************/
+/*!
+ \brief Get vector set mode
+
+ \param id vector set id
+ \param[out] mem
+ \param[out] color color value
+ \param[out] width
+ \param[out] flat
+
+ \return -1 on error (invalid vector set id)
+ \return 1 on success
+*/
int GV_get_vectmode(int id, int *mem, int *color, int *width, int *flat)
{
geovect *gv;
@@ -208,16 +271,17 @@
return (1);
}
-/***********************************************************************/
+/*!
+ \brief Set trans ?
+
+ \param id vector set id
+ \param xtrans,ytrans,ztrans x/y/z trans values
+*/
void GV_set_trans(int id, float xtrans, float ytrans, float ztrans)
{
geovect *gv;
-#ifdef TRACE_GV_FUNCS
- {
- Gs_status("GV_set_trans");
- }
-#endif
+ G_debug(3, "GV_set_trans");
gv = gv_get_vect(id);
@@ -230,7 +294,12 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Get trans ?
+
+ \param id vector set id
+ \param[out] xtrans,ytrans,ztrans x/y/z trans values
+*/
int GV_get_trans(int id, float *xtrans, float *ytrans, float *ztrans)
{
geovect *gv;
@@ -248,7 +317,16 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Select surface identified by hs to have vector identified
+ by hv draped over it
+
+ \param hv vector set id
+ \param hs surface id
+
+ \return 1 on success
+ \return -1 on error
+*/
int GV_select_surf(int hv, int hs)
{
geovect *gv;
@@ -269,7 +347,15 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Unselect surface
+
+ \param hv vector set id
+ \param hs surface id
+
+ \return 1 on success
+ \return -1 on error
+*/
int GV_unselect_surf(int hv, int hs)
{
geovect *gv;
@@ -298,7 +384,15 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Check if surface is selected
+
+ \param hv vector set id
+ \param hs surface id
+
+ \return 1 selected
+ \return 0 not selected
+*/
int GV_surf_is_selected(int hv, int hs)
{
int i;
@@ -317,7 +411,11 @@
return (0);
}
-/***********************************************************************/
+/*!
+ \brief Draw vector set
+
+ \param vid vector set id
+*/
void GV_draw_vect(int vid)
{
geosurf *gs;
@@ -339,7 +437,9 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Draw all vector sets
+*/
void GV_alldraw_vect(void)
{
int id;
@@ -351,7 +451,11 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Draw vector sets
+
+ \param vid vector set id
+*/
void GV_draw_fastvect(int vid)
{
geosurf *gs;
@@ -373,7 +477,15 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Set client data
+
+ \param id vector set id
+ \param clientd pointer to client data
+
+ \return 1 on success
+ \return -1 on error
+*/
int GV_Set_ClientData(int id, void *clientd)
{
geovect *gv;
@@ -388,7 +500,14 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Get client data
+
+ \param id vector set id
+
+ \return pointer to client data
+ \return NULL on error
+*/
void *GV_Get_ClientData(int id)
{
geovect *gv;
Modified: grass/trunk/lib/ogsf/GVL2.c
===================================================================
--- grass/trunk/lib/ogsf/GVL2.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/GVL2.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,7 +1,19 @@
-/* GVL.c
- Volume access routines
- Bill Brown, UI-GMSL, May 1997
- Tomas Paudits, Februar 2004
+/*!
+ \file GVL2.c
+
+ \brief OGSF library - loading and manipulating volumes
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown UI-GMSL (May 1997)
+ Tomas Paudits (February 2004)
*/
#include <grass/gis.h>
@@ -9,17 +21,17 @@
#include <grass/gstypes.h>
#include "gsget.h"
-#ifdef TRACE_FUNCS
-#define TRACE_GVL_FUNCS
-#endif
-
static int Vol_ID[MAX_VOLS];
static int Next_vol = 0;
static G3D_Region wind3;
static double Region[6];
-/***********************************************************************/
+/*!
+ \brief Library intialization for volumes
+
+ Set region extent (N,S,W,E,T,B)
+*/
void GVL_libinit(void)
{
G3d_initDefaults();
@@ -35,7 +47,14 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Get region extent settings
+
+ \param[out] n,s,w,e north, south, west, east
+ \param[out] t,b top, bottom
+
+ \return 1
+*/
int GVL_get_region(float *n, float *s, float *w, float *e, float *t, float *b)
{
*n = Region[0];
@@ -48,47 +67,56 @@
return (1);
}
-/***********************************************************************/
-/* TODO: gvl_file.c use this - change*/
+/*!
+ \brief Get window
+
+ \todo gvl_file.c use this - change
+
+ \return pointer to G3D_Region struct (static)
+*/
void *GVL_get_window()
{
return &wind3;
}
-/***********************************************************************/
+/*!
+ \brief Check if volume set exists
+
+ \param id volume set id
+
+ \return 1 found
+ \return 0 not found
+*/
int GVL_vol_exists(int id)
{
int i, found = 0;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_vol_exists");
- }
-#endif
+ G_debug(3, "GVL_vol_exists");
if (NULL == gvl_get_vol(id)) {
return (0);
}
for (i = 0; i < Next_vol && !found; i++) {
- if (Vol_ID[i] == id) {
- found = 1;
+ if (Vol_ID[i] == id) {
+ found = 1;
+ }
}
- }
return (found);
}
-/***********************************************************************/
+/*!
+ \brief Add new volume set
+
+ \return volume set id
+ \return -1 on error
+*/
int GVL_new_vol(void)
{
geovol *nvl;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_new_vol");
- }
-#endif
+ G_debug(3, "GVL_new_vol");
if (Next_vol < MAX_VOLS) {
nvl = gvl_get_new_vol();
@@ -106,14 +134,26 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Get number of available volume sets
+
+ \return number of volume sets
+*/
int GVL_num_vols(void)
{
return (gvl_num_vols());
}
-/***********************************************************************/
-/* USER must free!! */
+/*!
+ \brief Get list volume sets
+
+ Must be freed if not needed!
+
+ \param[out] numvols number of volume sets
+
+ \return pointer to list of volume sets
+ \return NULL on error
+*/
int *GVL_get_vol_list(int *numvols)
{
int i, *ret;
@@ -121,162 +161,194 @@
*numvols = Next_vol;
if (Next_vol) {
- if (NULL == (ret = (int *) G_malloc(Next_vol * sizeof(int)))) {
- fprintf(stderr, "can't malloc\n");
+ ret = (int *) G_malloc(Next_vol * sizeof(int));
+ if (!ret)
+ return (NULL);
- return (NULL);
+ for (i = 0; i < Next_vol; i++) {
+ ret[i] = Vol_ID[i];
+ }
+
+ return (ret);
}
- for (i = 0; i < Next_vol; i++) {
- ret[i] = Vol_ID[i];
- }
-
- return (ret);
- }
-
return (NULL);
}
-/***********************************************************************/
+/*!
+ \brief Delete volume set from list
+
+ \param id volume set id
+
+ \return 1 on success
+ \return -1 on error (invalid volume set id)
+*/
int GVL_delete_vol(int id)
{
int i, j, found = 0;
-
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_delete_vol");
- }
-#endif
-
+
+ G_debug(3, "GVL_delete_vol");
+
if (GVL_vol_exists(id)) {
-
- for (i = 0; i < GVL_isosurf_num_isosurfs(id); i++) {
- GVL_isosurf_del(id, 0);
- }
+
+ for (i = 0; i < GVL_isosurf_num_isosurfs(id); i++) {
+ GVL_isosurf_del(id, 0);
+ }
+
for (i = 0; i < GVL_slice_num_slices(id); i++) {
- GVL_slice_del(id, 0);
+ GVL_slice_del(id, 0);
+ }
+
+ gvl_delete_vol(id);
+
+ for (i = 0; i < Next_vol && !found; i++) {
+ if (Vol_ID[i] == id) {
+ found = 1;
+ for (j = i; j < Next_vol; j++) {
+ Vol_ID[j] = Vol_ID[j + 1];
+ }
+ }
+ }
+
+ if (found) {
+ --Next_vol;
+
+ return (1);
+ }
}
-
- gvl_delete_vol(id);
-
- for (i = 0; i < Next_vol && !found; i++) {
- if (Vol_ID[i] == id) {
- found = 1;
- for (j = i; j < Next_vol; j++) {
- Vol_ID[j] = Vol_ID[j + 1];
- }
- }
- }
-
- if (found) {
- --Next_vol;
-
- return (1);
- }
- }
-
+
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Load volume
+
+ \param id volume set id
+ \param filename filename
+
+ \return -1 on error
+ \return 0 on success
+*/
int GVL_load_vol(int id, char *filename)
{
- geovol *gvl;
+ geovol *gvl;
int handle;
-
+
if (NULL == (gvl = gvl_get_vol(id))) {
return (-1);
}
-
+
if (0 > (handle = gvl_file_newh(filename, VOL_FTYPE_G3D)))
return (-1);
-
+
gvl->hfile = handle;
-
- return (0);
+
+ return (0);
}
-/***********************************************************************/
+/*!
+ \brief Get volume set name
+
+ \param id volume set id
+ \param[out] filename name (must be allocated)
+
+ \return -1 on error
+ \return 1 on success
+*/
int GVL_get_volname(int id, char *filename)
{
geovol *gvl;
if (NULL == (gvl = gvl_get_vol(id))) {
- return (-1);
+ return (-1);
}
-
+
if (0 > gvl->hfile) {
- return (-1);
+ return (-1);
}
-
+
G_strcpy(filename, gvl_file_get_name(gvl->hfile));
return (1);
}
-/***********************************************************************/
+/*!
+ \brief Get dimension
+
+ \param id volume set id
+ \param[out] rows,cols,depths number of rows, cols, depth
+*/
void GVL_get_dims(int id, int *rows, int *cols, int *depths)
{
geovol *gvl;
-
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_get_dims");
- }
-#endif
-
+
+ G_debug(3, "GVL_get_dims");
+
gvl = gvl_get_vol(id);
-
+
if (gvl) {
- *rows = gvl->rows;
- *cols = gvl->cols;
- *depths = gvl->depths;
+ *rows = gvl->rows;
+ *cols = gvl->cols;
+ *depths = gvl->depths;
}
-
+
return;
}
-/***********************************************************************/
+/*!
+ \brief Set trans ?
+
+ \param id volume set id
+ \param xtrans,ytrans,ztrans x/y/z trans values
+*/
void GVL_set_trans(int id, float xtrans, float ytrans, float ztrans)
{
geovol *gvl;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_set_trans");
- }
-#endif
+ G_debug(3, "GVL_set_trans");
gvl = gvl_get_vol(id);
if (gvl) {
- gvl->x_trans = xtrans;
- gvl->y_trans = ytrans;
- gvl->z_trans = ztrans;
+ gvl->x_trans = xtrans;
+ gvl->y_trans = ytrans;
+ gvl->z_trans = ztrans;
}
return;
}
-/***********************************************************************/
+/*!
+ \brief Get trans ?
+
+ \param id volume set id
+ \param[out] xtrans,ytrans,ztrans x/y/z trans values
+
+ \return 1 on success
+ \return -1 on error
+*/
int GVL_get_trans(int id, float *xtrans, float *ytrans, float *ztrans)
{
geovol *gvl;
-
+
gvl = gvl_get_vol(id);
-
+
if (gvl) {
- *xtrans = gvl->x_trans;
- *ytrans = gvl->y_trans;
- *ztrans = gvl->z_trans;
-
- return (1);
+ *xtrans = gvl->x_trans;
+ *ytrans = gvl->y_trans;
+ *ztrans = gvl->z_trans;
+
+ return (1);
}
-
+
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Draw volume set
+
+ \param vid volume set id
+*/
void GVL_draw_vol(int vid)
{
geovol *gvl;
@@ -290,16 +362,16 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Draw volume wire mode
+
+ \param id volume set id
+*/
void GVL_draw_wire(int id)
{
geovol *gvl;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GVL_draw_wire");
- }
-#endif
+ G_debug(3, "GVL_draw_wire");
gvl = gvl_get_vol(id);
@@ -310,47 +382,66 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Draw all volume sets
+*/
void GVL_alldraw_vol(void)
{
int id;
for (id = 0; id < Next_vol; id++) {
- GVL_draw_vol(Vol_ID[id]);
+ GVL_draw_vol(Vol_ID[id]);
}
return;
}
-/***********************************************************************/
+/*!
+ \brief Draw all volume sets in wire mode
+*/
void GVL_alldraw_wire(void)
{
int id;
for (id = 0; id < Next_vol; id++) {
- GVL_draw_wire(Vol_ID[id]);
+ GVL_draw_wire(Vol_ID[id]);
}
return;
}
-/***********************************************************************/
+/*!
+ \brief Set client data for volume set
+
+ \param id volume set id
+ \param clientd pointer to client data
+
+ \return 1 on success
+ \return -1 on error
+*/
int GVL_Set_ClientData(int id, void *clientd)
{
geovol *gvl;
-
+
gvl = gvl_get_vol(id);
-
+
if (gvl) {
- gvl->clientdata = clientd;
-
- return (1);
+ gvl->clientdata = clientd;
+
+ return (1);
}
-
+
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Get client data
+
+ \param id volume set id
+
+ \return pointer to client data
+ \return NULL on error
+*/
void *GVL_Get_ClientData(int id)
{
geovol *gvl;
@@ -358,23 +449,23 @@
gvl = gvl_get_vol(id);
if (gvl) {
- return (gvl->clientdata);
+ return (gvl->clientdata);
}
return (NULL);
}
-/***********************************************************************/
+/*!
+ \brief Set focus on map center
+
+ \param id volume set id
+*/
void GVL_set_focus_center_map(int id)
{
float center[3];
geovol *gvl;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_set_focus_center_map");
- }
-#endif
+ G_debug(3, "GS_set_focus_center_map");
gvl = gvl_get_vol(id);
@@ -385,22 +476,27 @@
GS_set_focus(center);
}
+
+ return;
}
/************************************************************************/
/* ISOSURFACES */
/************************************************************************/
-/***********************************************************************/
+/*!
+ \brief Get draw resolution for isosurface
+
+ \todo error handling
+
+ \param id volume set id
+ \param[out] xres,yres,zres x/y/z resolution value
+*/
void GVL_isosurf_get_drawres(int id, int *xres, int *yres, int *zres)
{
geovol *gvl;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_isosurf_get_drawres");
- }
-#endif
+ G_debug(3, "GVL_isosurf_get_drawres");
gvl = gvl_get_vol(id);
@@ -413,17 +509,21 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Set draw resolution of isosurface
+
+ \param id volume set id
+ \param xres,yres,zres x/y/z resolution value
+
+ \return -1 on error (invalid values/volume set id)
+ \return 0 on success
+*/
int GVL_isosurf_set_drawres(int id, int xres, int yres, int zres)
{
geovol *gvl;
int i;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_isosurf_set_drawres");
- }
-#endif
+ G_debug(3, "GVL_isosurf_set_drawres");
if (xres < 1 || yres < 1 || zres < 1) {
return (-1);
@@ -436,63 +536,80 @@
gvl->isosurf_y_mod = yres;
gvl->isosurf_z_mod = zres;
- for (i = 0; i < gvl->n_isosurfs; i++) {
- gvl_isosurf_set_att_changed(gvl->isosurf[i], ATT_TOPO);
- }
+ for (i = 0; i < gvl->n_isosurfs; i++) {
+ gvl_isosurf_set_att_changed(gvl->isosurf[i], ATT_TOPO);
+ }
+
+ return (0);
}
- return (0);
+ return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Get draw-mode of isosurface
+
+ \param id volume set id
+ \param[out] mode draw-mode
+
+ \return 1 on success
+ \return -1 on error
+*/
int GVL_isosurf_get_drawmode(int id, int *mode)
{
geovol *gvl;
-
+
gvl = gvl_get_vol(id);
-
+
if (gvl) {
- *mode = gvl->isosurf_draw_mode;
-
- return (1);
+ *mode = gvl->isosurf_draw_mode;
+
+ return (1);
}
-
+
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Set draw-mode of isosurface
+
+ \param id volume set id
+ \param mode draw-mode
+
+ \return 0 on success
+ \return -1 on error (invalid volume set id)
+*/
int GVL_isosurf_set_drawmode(int id, int mode)
{
geovol *gvl;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_isosurf_set_drawmode");
- }
-#endif
+ G_debug(3, "GVL_isosurf_set_drawmode");
gvl = gvl_get_vol(id);
if (gvl) {
- gvl->isosurf_draw_mode = mode;
-
- return (0);
+ gvl->isosurf_draw_mode = mode;
+
+ return (0);
}
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Add isosurface
+
+ \param id volume set id
+
+ \return -1 on error (invalid volume set id
+ \return 1 on success
+*/
int GVL_isosurf_add(int id)
{
geovol *gvl;
geovol_isosurf *isosurf;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_isosurf_add");
- }
-#endif
+ G_debug(3, "GVL_isosurf_add");
gvl = gvl_get_vol(id);
@@ -510,22 +627,26 @@
gvl->n_isosurfs++;
gvl->isosurf[gvl->n_isosurfs - 1] = (geovol_isosurf *) isosurf;
-
+
return (1);
}
-/***********************************************************************/
+/*!
+ \brief Delete isosurface
+
+ \param id volume set id
+ \param isosurf_id isosurface id
+
+ \return -1 on error
+ \return 1 on success
+*/
int GVL_isosurf_del(int id, int isosurf_id)
{
geovol *gvl;
geovol_isosurf *isosurf;
int i;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_isosurf_del");
- }
-#endif
+ G_debug(3, "GVL_isosurf_del");
isosurf = gvl_isosurf_get_isosurf(id, isosurf_id);
@@ -549,84 +670,101 @@
return (1);
}
-/***********************************************************************/
+/*!
+ \brief Move up isosurface in list
+
+ \param id volume set id
+ \param isosurf_id isosurface id
+
+ \return -1 on error
+ \return 1 on success
+*/
int GVL_isosurf_move_up(int id, int isosurf_id)
{
- geovol *gvl;
- geovol_isosurf *tmp;
+ geovol *gvl;
+ geovol_isosurf *tmp;
+
+ G_debug(3, "GVL_isosurf_move_up");
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_isosurf_move_up");
- }
-#endif
-
- gvl = gvl_get_vol(id);
-
- if (!gvl)
- return (-1);
-
- if (isosurf_id < 0 || isosurf_id > (gvl->n_isosurfs - 1))
- return (-1);
-
- if (isosurf_id == 0)
- return (1);
-
- tmp = gvl->isosurf[isosurf_id - 1];
- gvl->isosurf[isosurf_id - 1] = gvl->isosurf[isosurf_id];
- gvl->isosurf[isosurf_id] = tmp;
-
+ gvl = gvl_get_vol(id);
+
+ if (!gvl)
+ return (-1);
+
+ if (isosurf_id < 0 || isosurf_id > (gvl->n_isosurfs - 1))
+ return (-1);
+
+ if (isosurf_id == 0)
return (1);
+
+ tmp = gvl->isosurf[isosurf_id - 1];
+ gvl->isosurf[isosurf_id - 1] = gvl->isosurf[isosurf_id];
+ gvl->isosurf[isosurf_id] = tmp;
+
+ return (1);
}
-/***********************************************************************/
+/*!
+ \brief Move down isosurface in list
+
+ \param id volume set id
+ \param isosurf_id isosurface id
+
+ \return -1 on error
+ \return 1 on success
+*/
int GVL_isosurf_move_down(int id, int isosurf_id)
{
- geovol *gvl;
- geovol_isosurf *tmp;
+ geovol *gvl;
+ geovol_isosurf *tmp;
+
+ G_debug(3, "GVL_isosurf_move_up");
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_isosurf_move_up");
- }
-#endif
+ gvl = gvl_get_vol(id);
+
+ if (!gvl)
+ return (-1);
+
+ if (isosurf_id < 0 || isosurf_id > (gvl->n_isosurfs - 1))
+ return (-1);
+
+ if (isosurf_id == (gvl->n_isosurfs - 1))
+ return (1);
+
+ tmp = gvl->isosurf[isosurf_id + 1];
+ gvl->isosurf[isosurf_id + 1] = gvl->isosurf[isosurf_id];
+ gvl->isosurf[isosurf_id] = tmp;
+
+ return (1);
+}
- gvl = gvl_get_vol(id);
+/*!
+ \brief Get isosurface attributes
- if (!gvl)
- return (-1);
+ \param id volume set id
+ \param isosurf_id surface id
+ \param att attribute id
+ \param[out] set
+ \param[out] constant
+ \param[out] mapname
- if (isosurf_id < 0 || isosurf_id > (gvl->n_isosurfs - 1))
- return (-1);
-
- if (isosurf_id == (gvl->n_isosurfs - 1))
- return (1);
-
- tmp = gvl->isosurf[isosurf_id + 1];
- gvl->isosurf[isosurf_id + 1] = gvl->isosurf[isosurf_id];
- gvl->isosurf[isosurf_id] = tmp;
-
- return (1);
-}
-
-/***********************************************************************/
-int GVL_isosurf_get_att(int id, int isosurf_id, int att, int *set, float *constant, char *mapname)
+ \return -1 on error
+ \return 1 on success
+*/
+int GVL_isosurf_get_att(int id, int isosurf_id,
+ int att, int *set, float *constant, char *mapname)
{
int src;
geovol_isosurf *isosurf;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_isosurf_get_att");
- }
-#endif
+ G_debug(3, "GVL_isosurf_get_att");
isosurf = gvl_isosurf_get_isosurf(id, isosurf_id);
if (isosurf) {
if (-1 != (src = gvl_isosurf_get_att_src(isosurf, att))) {
*set = src;
-
+
if (src == CONST_ATT) {
*constant = isosurf->att[att].constant;
}
@@ -643,16 +781,21 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Unset isosurface attributes
+
+ \param id volume set id
+ \param isosurface_id isosurface id
+ \param att attribute id
+
+ \return ?
+ \return -1 on error
+*/
int GVL_isosurf_unset_att(int id, int isosurf_id, int att)
{
geovol_isosurf *isosurf;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_isosurf_unset_att");
- }
-#endif
+ G_debug(3, "GVL_isosurf_unset_att");
isosurf = gvl_isosurf_get_isosurf(id, isosurf_id);
@@ -663,16 +806,22 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Set constant isosurface attribute
+
+ \param id volume set id
+ \param isosurf_id isosurface id
+ \param att attribute id
+ \param constant constant value
+
+ \return ?
+ \return -1 on error
+*/
int GVL_isosurf_set_att_const(int id, int isosurf_id, int att, float constant)
{
geovol_isosurf *isosurf;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_isosurf_set_att_const");
- }
-#endif
+ G_debug(3, "GVL_isosurf_set_att_const");
isosurf = gvl_isosurf_get_isosurf(id, isosurf_id);
@@ -683,16 +832,22 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Set isosurface map attribute
+
+ \param id volume set id
+ \param isosurf_id isosurface id
+ \param att attribute id
+ \param filename map name
+
+ \return ?
+ \return -1 on error
+*/
int GVL_isosurf_set_att_map(int id, int isosurf_id, int att, char *filename)
{
geovol_isosurf *isosurf;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_isosurf_set_att_map");
- }
-#endif
+ G_debug(3, "GVL_isosurf_set_att_map");
isosurf = gvl_isosurf_get_isosurf(id, isosurf_id);
@@ -703,16 +858,21 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Get isosurface flags
+
+ \param id volume set id
+ \param isosurf_id isosurface id
+ \param[out] inout map name
+
+ \return 1 on success
+ \return -1 on error
+*/
int GVL_isosurf_get_flags(int id, int isosurf_id, int *inout)
{
geovol_isosurf *isosurf;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_isosurf_get_flags");
- }
-#endif
+ G_debug(3, "GVL_isosurf_get_flags");
isosurf = gvl_isosurf_get_isosurf(id, isosurf_id);
@@ -724,38 +884,46 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Set isosurface flags
+
+ \param id volume set id
+ \param isosurf_id isosurface id
+ \param inout map name
+
+ \return 1 on success
+ \return -1 on error
+*/
int GVL_isosurf_set_flags(int id, int isosurf_id, int inout)
{
geovol_isosurf *isosurf;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_isosurf_get_flags");
- }
-#endif
+ G_debug(3, "GVL_isosurf_get_flags");
isosurf = gvl_isosurf_get_isosurf(id, isosurf_id);
if (isosurf) {
isosurf->inout_mode = inout;
-
- return (1);
+
+ return (1);
}
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Get number of available isosurfaces
+
+ \param id volume set id
+
+ \return number of isosurfaces
+ \return -1 on error
+*/
int GVL_isosurf_num_isosurfs(int id)
{
geovol *gvl;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_isosurf_num_isosurfs");
- }
-#endif
+ G_debug(3, "GVL_isosurf_num_isosurfs");
gvl = gvl_get_vol(id);
@@ -766,17 +934,23 @@
return (-1);
}
-/***********************************************************************/
-/* mask attribute special: constant is set to indicate invert or no */
+/*!
+ \brief Set mask attribute mode
+
+ Mask attribute special: constant is set to indicate invert or no
+
+ \param id volume set id
+ \param isosurf_id isosurface id
+ \param mode attribute mode
+
+ \return mode id
+ \return -1 on error
+*/
int GVL_isosurf_set_maskmode(int id, int isosurf_id, int mode)
{
geovol_isosurf *isosurf;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_isosurf_set_att_const");
- }
-#endif
+ G_debug(3, "GVL_isosurf_set_att_const");
isosurf = gvl_isosurf_get_isosurf(id, isosurf_id);
@@ -789,7 +963,16 @@
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Get isosurface mask mode
+
+ \param id volume set id
+ \param isosurf_id isosurface id
+ \param mode attribute mode
+
+ \return 1 on success
+ \return -1 on error
+*/
int GVL_isosurf_get_maskmode(int id, int isosurf_id, int *mode)
{
geovol_isosurf *isosurf;
@@ -797,9 +980,9 @@
isosurf = gvl_isosurf_get_isosurf(id, isosurf_id);
if (isosurf) {
- *mode = isosurf->att[ATT_MASK].constant;
-
- return (1);
+ *mode = isosurf->att[ATT_MASK].constant;
+
+ return (1);
}
return (-1);
@@ -809,16 +992,17 @@
/* SLICES */
/************************************************************************/
-/***********************************************************************/
+/*!
+ \brief Get draw resolution of slice
+
+ \param id volume set id
+ \param[out] xres,yres,zres x/y/z resolution value
+*/
void GVL_slice_get_drawres(int id, int *xres, int *yres, int *zres)
{
geovol *gvl;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_slice_get_drawres");
- }
-#endif
+ G_debug(3, "GVL_slice_get_drawres");
gvl = gvl_get_vol(id);
@@ -831,17 +1015,21 @@
return;
}
-/***********************************************************************/
+/*!
+ \brief Set draw resolution of slice
+
+ \param id volume set id
+ \param xres,yres,zres x/y/z resolution value
+
+ \return 0 on success
+ \return -1 on error (invalid value or id)
+*/
int GVL_slice_set_drawres(int id, int xres, int yres, int zres)
{
geovol *gvl;
int i;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_slice_set_drawres");
- }
-#endif
+ G_debug(3, "GVL_slice_set_drawres");
if (xres < 1 || yres < 1 || zres < 1) {
return (-1);
@@ -854,15 +1042,25 @@
gvl->slice_y_mod = yres;
gvl->slice_z_mod = zres;
- for (i = 0; i < gvl->n_slices; i++) {
- gvl->slice[i]->changed = 1;
- }
+ for (i = 0; i < gvl->n_slices; i++) {
+ gvl->slice[i]->changed = 1;
+ }
+
+ return (0);
}
- return (0);
+ return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Get slice draw mode
+
+ \param id volume set id
+ \param[out] mode draw mode
+
+ \return 1 on success
+ \return -1 on error (invalid id)
+*/
int GVL_slice_get_drawmode(int id, int *mode)
{
geovol *gvl;
@@ -870,47 +1068,54 @@
gvl = gvl_get_vol(id);
if (gvl) {
- *mode = gvl->slice_draw_mode;
-
- return (1);
+ *mode = gvl->slice_draw_mode;
+
+ return (1);
}
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Set slice draw mode
+
+ \param id volume set id
+ \param mode draw mode
+
+ \return 0 on success
+ \return -1 on error (invalid id)
+*/
int GVL_slice_set_drawmode(int id, int mode)
{
geovol *gvl;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_slice_set_drawmode");
- }
-#endif
+ G_debug(3, "GVL_slice_set_drawmode");
gvl = gvl_get_vol(id);
if (gvl) {
- gvl->slice_draw_mode = mode;
-
- return (0);
+ gvl->slice_draw_mode = mode;
+
+ return (0);
}
-
+
return (-1);
}
-/***********************************************************************/
+/*!
+ \brief Add slice
+
+ \param id volume set id
+
+ \return -1 on error
+ \return 1 on success
+*/
int GVL_slice_add(int id)
{
geovol *gvl;
geovol_slice *slice;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_slice_add");
- }
-#endif
+ G_debug(3, "GVL_slice_add");
gvl = gvl_get_vol(id);
@@ -932,18 +1137,22 @@
return (1);
}
-/***********************************************************************/
+/*!
+ \brief Delete slice
+
+ \param id volume set id
+ \param slice_id slice id
+
+ \return -1 on error
+ \return 1 on success
+*/
int GVL_slice_del(int id, int slice_id)
{
geovol *gvl;
geovol_slice *slice;
int i;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_slice_del");
- }
-#endif
+ G_debug(3, "GVL_slice_del");
slice = gvl_slice_get_slice(id, slice_id);
@@ -967,76 +1176,87 @@
return (1);
}
-/***********************************************************************/
+/*!
+ \brief Move up slice
+
+ \param id volume set id
+ \param slice_id slice id
+
+ \return -1 on error
+ \return 1 on success
+*/
int GVL_slice_move_up(int id, int slice_id)
{
- geovol *gvl;
- geovol_slice *tmp;
+ geovol *gvl;
+ geovol_slice *tmp;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_slice_move_up");
- }
-#endif
+ G_debug(3, "GVL_slice_move_up");
- gvl = gvl_get_vol(id);
+ gvl = gvl_get_vol(id);
+
+ if (!gvl)
+ return (-1);
+
+ if (slice_id < 0 || slice_id > (gvl->n_slices - 1))
+ return (-1);
+
+ if (slice_id == 0)
+ return (1);
+
+ tmp = gvl->slice[slice_id - 1];
+ gvl->slice[slice_id - 1] = gvl->slice[slice_id];
+ gvl->slice[slice_id] = tmp;
+
+ return (1);
+}
- if (!gvl)
- return (-1);
+/*!
+ \brief Move down slice
- if (slice_id < 0 || slice_id > (gvl->n_slices - 1))
- return (-1);
+ \param id volume set id
+ \param slice_id slice id
- if (slice_id == 0)
- return (1);
+ \return -1 on error
+ \return 1 on success
+*/
+int GVL_slice_move_down(int id, int slice_id)
+{
+ geovol *gvl;
+ geovol_slice *tmp;
+
+ G_debug(3, "GVL_slice_move_up");
- tmp = gvl->slice[slice_id - 1];
- gvl->slice[slice_id - 1] = gvl->slice[slice_id];
- gvl->slice[slice_id] = tmp;
-
+ gvl = gvl_get_vol(id);
+
+ if (!gvl)
+ return (-1);
+
+ if (slice_id < 0 || slice_id > (gvl->n_slices - 1))
+ return (-1);
+
+ if (slice_id == (gvl->n_slices - 1))
return (1);
+
+ tmp = gvl->slice[slice_id + 1];
+ gvl->slice[slice_id + 1] = gvl->slice[slice_id];
+ gvl->slice[slice_id] = tmp;
+
+ return (1);
}
-/***********************************************************************/
-int GVL_slice_move_down(int id, int slice_id)
-{
- geovol *gvl;
- geovol_slice *tmp;
+/*!
+ \brief Get number or slices
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_slice_move_up");
- }
-#endif
+ \param id volume set id
- gvl = gvl_get_vol(id);
-
- if (!gvl)
- return (-1);
-
- if (slice_id < 0 || slice_id > (gvl->n_slices - 1))
- return (-1);
-
- if (slice_id == (gvl->n_slices - 1))
- return (1);
-
- tmp = gvl->slice[slice_id + 1];
- gvl->slice[slice_id + 1] = gvl->slice[slice_id];
- gvl->slice[slice_id] = tmp;
-
- return (1);
-}
-
-/***********************************************************************/
+ \return number of slices
+ \return -1 on error
+*/
int GVL_slice_num_slices(int id)
{
geovol *gvl;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_isosurf_num_isosurfs");
- }
-#endif
+ G_debug(3, "GVL_isosurf_num_isosurfs");
gvl = gvl_get_vol(id);
@@ -1047,108 +1267,137 @@
return (-1);
}
-/***********************************************************************/
-int GVL_slice_get_pos(int id, int slice_id, float *x1, float *x2, float *y1, float *y2, float *z1, float *z2, int *dir)
+/*!
+ \brief Get slice position
+
+ \param id volume set id
+ \param slice_id slice id
+ \param[out] x1,y1,z1 coordinates ?
+ \param[out] x2,y2,z2 coordinates ?
+ \param[out] dir direction
+
+ \return -1 on error
+ \return 1 on success
+*/
+int GVL_slice_get_pos(int id, int slice_id,
+ float *x1, float *x2, float *y1, float *y2, float *z1, float *z2, int *dir)
{
geovol *gvl;
- geovol_slice *slice;
- int cols, rows, depths;
+ geovol_slice *slice;
+ int cols, rows, depths;
- gvl = gvl_get_vol(id);
-
- if (!gvl)
- return (-1);
-
+ gvl = gvl_get_vol(id);
+
+ if (!gvl)
+ return (-1);
+
slice = gvl_slice_get_slice(id, slice_id);
-
- if (!slice)
- return (-1);
-
- if (slice->dir == X) {
+
+ if (!slice)
+ return (-1);
+
+ if (slice->dir == X) {
cols = gvl->rows;
- rows = gvl->depths;
- depths = gvl->cols;
- } else if (slice->dir == Y) {
- cols = gvl->cols;
- rows = gvl->depths;
- depths = gvl->rows;
- } else if (slice->dir == Z) {
- cols = gvl->cols;
- rows = gvl->rows;
- depths = gvl->depths;
- } else {
- return (-1);
- }
-
- *x1 = slice->x1 / (cols - 1);
- *x2 = slice->x2 / (cols - 1);
- *y1 = slice->y1 / (rows - 1);
- *y2 = slice->y2 / (rows - 1);
- *z1 = slice->z1 / (depths - 1);
- *z2 = slice->z2 / (depths - 1);
-
- *dir = slice->dir;
-
+ rows = gvl->depths;
+ depths = gvl->cols;
+ } else if (slice->dir == Y) {
+ cols = gvl->cols;
+ rows = gvl->depths;
+ depths = gvl->rows;
+ } else if (slice->dir == Z) {
+ cols = gvl->cols;
+ rows = gvl->rows;
+ depths = gvl->depths;
+ } else {
+ return (-1);
+ }
+
+ *x1 = slice->x1 / (cols - 1);
+ *x2 = slice->x2 / (cols - 1);
+ *y1 = slice->y1 / (rows - 1);
+ *y2 = slice->y2 / (rows - 1);
+ *z1 = slice->z1 / (depths - 1);
+ *z2 = slice->z2 / (depths - 1);
+
+ *dir = slice->dir;
+
return (1);
}
-/***********************************************************************/
-int GVL_slice_set_pos(int id, int slice_id, float x1, float x2, float y1, float y2, float z1, float z2, int dir)
-{
- geovol *gvl;
- geovol_slice *slice;
- int cols, rows, depths;
+/*!
+ \brief Get slice position
- gvl = gvl_get_vol(id);
+ \param id volume set id
+ \param slice_id slice id
+ \param x1,y1,z1 coordinates ?
+ \param x2,y2,z2 coordinates ?
+ \param dir direction
- if (!gvl)
- return (-1);
-
+ \return -1 on error
+ \return 1 on success
+*/
+int GVL_slice_set_pos(int id, int slice_id,
+ float x1, float x2, float y1, float y2, float z1, float z2, int dir)
+{
+ geovol *gvl;
+ geovol_slice *slice;
+ int cols, rows, depths;
+
+ gvl = gvl_get_vol(id);
+
+ if (!gvl)
+ return (-1);
+
slice = gvl_slice_get_slice(id, slice_id);
-
- if (!slice)
- return (-1);
-
- if (dir == X) {
+
+ if (!slice)
+ return (-1);
+
+ if (dir == X) {
cols = gvl->rows;
- rows = gvl->depths;
- depths = gvl->cols;
- } else if (dir == Y) {
- cols = gvl->cols;
- rows = gvl->depths;
- depths = gvl->rows;
- } else if (dir == Z) {
- cols = gvl->cols;
- rows = gvl->rows;
- depths = gvl->depths;
- } else {
- return (-1);
- }
+ rows = gvl->depths;
+ depths = gvl->cols;
+ } else if (dir == Y) {
+ cols = gvl->cols;
+ rows = gvl->depths;
+ depths = gvl->rows;
+ } else if (dir == Z) {
+ cols = gvl->cols;
+ rows = gvl->rows;
+ depths = gvl->depths;
+ } else {
+ return (-1);
+ }
+
+ slice->x1 = ((x1 < 0.) ? 0. : ((x1 > 1.) ? 1. : x1)) * (cols - 1);
+ slice->x2 = ((x2 < 0.) ? 0. : ((x2 > 1.) ? 1. : x2)) * (cols - 1);
+ slice->y1 = ((y1 < 0.) ? 0. : ((y1 > 1.) ? 1. : y1)) * (rows - 1);
+ slice->y2 = ((y2 < 0.) ? 0. : ((y2 > 1.) ? 1. : y2)) * (rows - 1);
+ slice->z1 = ((z1 < 0.) ? 0. : ((z1 > 1.) ? 1. : z1)) * (depths - 1);
+ slice->z2 = ((z2 < 0.) ? 0. : ((z2 > 1.) ? 1. : z2)) * (depths - 1);
+
+ slice->dir = dir;
+
+ slice->changed = 1;
+
+ return (1);
+}
- slice->x1 = ((x1 < 0.) ? 0. : ((x1 > 1.) ? 1. : x1)) * (cols - 1);
- slice->x2 = ((x2 < 0.) ? 0. : ((x2 > 1.) ? 1. : x2)) * (cols - 1);
- slice->y1 = ((y1 < 0.) ? 0. : ((y1 > 1.) ? 1. : y1)) * (rows - 1);
- slice->y2 = ((y2 < 0.) ? 0. : ((y2 > 1.) ? 1. : y2)) * (rows - 1);
- slice->z1 = ((z1 < 0.) ? 0. : ((z1 > 1.) ? 1. : z1)) * (depths - 1);
- slice->z2 = ((z2 < 0.) ? 0. : ((z2 > 1.) ? 1. : z2)) * (depths - 1);
+/*!
+ \brief Get slice trans ?
- slice->dir = dir;
+ \param id volume set id
+ \param slice_id slice id
+ \param[out] transp transp value
- slice->changed = 1;
-
- return (1);
-}
-
-/***********************************************************************/
+ \return -1 on error
+ \return 1 on success
+*/
int GVL_slice_get_transp(int id, int slice_id, int *transp)
{
geovol_slice *slice;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_get_transp");
- }
-#endif
+ G_debug(3, "GVL_get_transp");
slice = gvl_slice_get_slice(id, slice_id);
@@ -1160,16 +1409,21 @@
return (1);
}
-/***********************************************************************/
+/*!
+ \brief Set slice trans ?
+
+ \param id volume set id
+ \param slice_id slice id
+ \param transp transp value
+
+ \return -1 on error
+ \return 1 on success
+*/
int GVL_slice_set_transp(int id, int slice_id, int transp)
{
geovol_slice *slice;
-#ifdef TRACE_GVL_FUNCS
- {
- Gs_status("GVL_set_transp");
- }
-#endif
+ G_debug(3, "GVL_set_transp");
slice = gvl_slice_get_slice(id, slice_id);
Modified: grass/trunk/lib/ogsf/Gp3.c
===================================================================
--- grass/trunk/lib/ogsf/Gp3.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/Gp3.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,13 +1,20 @@
-/*
-* $Id$
+/*!
+ \file Gp3.c
+
+ \brief OGSF library - loading and manipulating point sets
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL, GMSL/University of Illinois (January 1994)
*/
-/* Gp.c
- Bill Brown, USACERL
- January 1994
- Uses GRASS routines!
-*/
-
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/site.h>
Modified: grass/trunk/lib/ogsf/Gs3.c
===================================================================
--- grass/trunk/lib/ogsf/Gs3.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/Gs3.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,12 +1,20 @@
-/*
-* $Id$
+/*!
+ \file Gs3.c
+
+ \brief OGSF library - loading and manipulating surfaces
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL, GMSL/University of Illinois (January 1993)
*/
-/* Gs.c
- Bill Brown, USACERL
- January 1993
-*/
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -56,20 +64,20 @@
typedef int FILEDESC;
-/*
-#define TRACE_FUNCS
-*/
-
#define NO_DATA_COL 0xffffff
-/************************************************************************/
-/* This should be a function variable that
- * may be replaced by a user's function.
- * Or else use G_set_error_routine.
+/*!
+ \brief Warning handling
+
+ This should be a function variable that
+ may be replaced by a user's function.
+ Or else use G_set_error_routine().
+
+ \param str message
*/
void Gs_warning(char *str)
{
- fprintf(stderr, "%s\n", str);
+ G_warning("%s", str);
return;
}
@@ -78,10 +86,10 @@
/* This should be a function variable that
* may be replaced by a user's function.
* Or else use G_set_error_routine.
-*/
+ */
void Gs_status(char *str)
{
- fprintf(stderr, "%s\n", str);
+ G_debug(3, "%s", str);
return;
}
Modified: grass/trunk/lib/ogsf/Gv3.c
===================================================================
--- grass/trunk/lib/ogsf/Gv3.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/Gv3.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,12 +1,20 @@
-/*
-* $Id$
+/*!
+ \file Gv3.c
+
+ \brief OGSF library - loading and manipulating vector sets
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL (December 1993)
*/
-/* Gv.c
- Bill Brown, USACERL
- December 1993
- Uses GRASS routines!
-*/
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/Vect.h>
Modified: grass/trunk/lib/ogsf/Gvl3.c
===================================================================
--- grass/trunk/lib/ogsf/Gvl3.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/Gvl3.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,7 +1,18 @@
-/* GVL3.c
- Volume access routines
- Tomas Paudits
- December 2003
+/*!
+ \file Gvl3.c
+
+ \brief OGSF library - loading and manipulating volumes
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Tomas Paudits (December 2003)
*/
#include <grass/gis.h>
Modified: grass/trunk/lib/ogsf/gk.c
===================================================================
--- grass/trunk/lib/ogsf/gk.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gk.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,5 +1,18 @@
-/*
-* $Id$
+/*!
+ \file gk.c
+
+ \brief OGSF library - setting and manipulating keyframes animation
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL, GMSL/University of Illinois
*/
#include <stdlib.h>
Modified: grass/trunk/lib/ogsf/gp.c
===================================================================
--- grass/trunk/lib/ogsf/gp.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gp.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,12 +1,20 @@
-/*
-* $Id$
+/*!
+ \file gp.c
+
+ \brief OGSF library - loading and manipulating point sets
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL, GMSL/University of Illinois (January 1994)
*/
-/* gp.c
- Bill Brown, USACERL
- January 1994
-*/
-
#include <stdlib.h>
#include <stdio.h>
Modified: grass/trunk/lib/ogsf/gpd.c
===================================================================
--- grass/trunk/lib/ogsf/gpd.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gpd.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,12 +1,20 @@
-/*
-* $Id$
+/*!
+ \file gpd.c
+
+ \brief OGSF library - loading and manipulating point sets
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL, GMSL/University of Illinois (December 1993)
*/
-/* gpd.c
- Bill Brown, USACERL
- December 1993
-*/
-
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
Modified: grass/trunk/lib/ogsf/gs.c
===================================================================
--- grass/trunk/lib/ogsf/gs.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gs.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,12 +1,20 @@
-/*
-* $Id$
+/*!
+ \file gs.c
+
+ \brief OGSF library - loading and manipulating surfaces (lower level functions)
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL, GMSL/University of Illinois (January 1993)
*/
-/* gs.c
- Bill Brown, USACERL
- January 1993
-*/
-
#include <stdlib.h>
#include <stdio.h>
@@ -16,17 +24,13 @@
#define FIRST_SURF_ID 110658
-/*
-#define TRACE_FUNCS
-*/
-
static geosurf *Surf_top;
static int Invertmask;
/***********************************************************************/
void gs_err(char *msg)
{
- fprintf(stderr, "%s\n", msg);
+ G_warning ("%s", msg);
return;
}
Modified: grass/trunk/lib/ogsf/gs_bm.c
===================================================================
--- grass/trunk/lib/ogsf/gs_bm.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gs_bm.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,12 +1,20 @@
-/*
-* $Id$
+/*!
+ \file gs_bm.c
+
+ \brief OGSF library - loading and manipulating surfaces
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL, GMSL/University of Illinois (September 1993)
*/
-/* gs.c
- Bill Brown, USACERL
- September 1993
-*/
-
#include <grass/gstypes.h>
#include "gsget.h"
#include <stdio.h>
Modified: grass/trunk/lib/ogsf/gs_norms.c
===================================================================
--- grass/trunk/lib/ogsf/gs_norms.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gs_norms.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,10 +1,18 @@
-/*
-* $Id$
-*/
+/*!
+ \file gs_norms.c
+
+ \brief OGSF library -
+
+ GRASS OpenGL gsurf OGSF Library
-/* gs_norms.c
- Bill Brown, USACERL
- functions for calculating normals
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL
*/
#include <grass/gstypes.h>
Modified: grass/trunk/lib/ogsf/gs_query.c
===================================================================
--- grass/trunk/lib/ogsf/gs_query.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gs_query.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,10 +1,18 @@
-/*
-* $Id$
-*/
+/*!
+ \file gs_query.c
+
+ \brief OGSF library -
+
+ GRASS OpenGL gsurf OGSF Library
-/* gs_query.c
- Bill Brown, USACERL
- January 1994
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL (January 1994)
*/
#include <math.h>
Modified: grass/trunk/lib/ogsf/gsd_cplane.c
===================================================================
--- grass/trunk/lib/ogsf/gsd_cplane.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gsd_cplane.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,12 +1,20 @@
-/*
-* $Id$
+/*!
+ \file gsd_cplane.c
+
+ \brief OGSF library - loading and manipulating surfaces
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL, GMSL/University of Illinois (January 1993)
*/
-/* gsd_cplane.c
- Bill Brown, USACERL
- January 1993
-*/
-
/* DEBUG */
#include <stdio.h>
Modified: grass/trunk/lib/ogsf/gsd_fonts.c
===================================================================
--- grass/trunk/lib/ogsf/gsd_fonts.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gsd_fonts.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,17 +1,22 @@
-/*
-****************************************************************************
-*
-* MODULE: GRASS ogsf library
-* AUTHOR(S): Bill Brown, USACERL
-* PURPOSE: This file needs to be re-written in OpenGL
-* COPYRIGHT: (C) 2000 by the GRASS Development Team
-*
-* This program is free software under the GNU General Public
-* License (>=v2). Read the file COPYING that comes with GRASS
-* for details.
-*
-*****************************************************************************/
+/*!
+ \file gsd_fonts.c
+
+ \brief OGSF library - loading and manipulating surfaces
+
+ GRASS OpenGL gsurf OGSF Library
+
+ \todo This file needs to be re-written in OpenGL
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL, GMSL/University of Illinois
+*/
+
#include <string.h>
#include <assert.h>
#include <grass/gstypes.h>
Modified: grass/trunk/lib/ogsf/gsd_fringe.c
===================================================================
--- grass/trunk/lib/ogsf/gsd_fringe.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gsd_fringe.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,4 +1,21 @@
+/*!
+ \file gsd_fonts.c
+
+ \brief OGSF library - loading and manipulating surfaces
+
+ GRASS OpenGL gsurf OGSF Library
+
+ \todo This file needs to be re-written in OpenGL
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL, GMSL/University of Illinois
+*/
#include <stdio.h>
Modified: grass/trunk/lib/ogsf/gsd_img_mpeg.c
===================================================================
--- grass/trunk/lib/ogsf/gsd_img_mpeg.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gsd_img_mpeg.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,3 +1,20 @@
+/*!
+ \file gsd_img_mpeg.c
+
+ \brief OGSF library - FFMPEG stuff
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL, GMSL/University of Illinois
+*/
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
Modified: grass/trunk/lib/ogsf/gsd_img_ppm.c
===================================================================
--- grass/trunk/lib/ogsf/gsd_img_ppm.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gsd_img_ppm.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,13 +1,28 @@
-/* - added little/big endian test Markus Neteler
- * -modified to PPM by Bob Covill <bcovill at tekmap.ns.ca>
- *
- * $Id$
- *
- * changed 10/99 Jaro
- * Created new function GS_write_ppm based
- * on RGB dump
- */
+/*!
+ \file gsd_img_ppm.c
+
+ \brief OGSF library - PPM stuff
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+ - added little/big endian test Markus Neteler
+ - modified to PPM by Bob Covill <bcovill at tekmap.ns.ca>
+ - changed 10/99 Jaro
+ - Created new function GS_write_ppm based on RGB dump
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL, GMSL/University of Illinois
+ Markus Neteler
+ Bob Covill
+ Jaro Hofierka
+*/
+
#include <stdlib.h>
#include <stdio.h>
Modified: grass/trunk/lib/ogsf/gsd_img_tif.c
===================================================================
--- grass/trunk/lib/ogsf/gsd_img_tif.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gsd_img_tif.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,11 +1,27 @@
-/*
- * $Id$
- *
- * endian added Markus
- * changed 10/99 Jaro
- * Created new function GS_write_tif based
- * on RGB dump
- */
+/*!
+ \file gsd_img_tif.c
+
+ \brief OGSF library - TIFF stuff
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ - added little/big endian test Markus Neteler
+ - modified to PPM by Bob Covill <bcovill at tekmap.ns.ca>
+ - changed 10/99 Jaro
+ - Created new function GS_write_tif based on RGB dump
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL, GMSL/University of Illinois
+ Markus Neteler
+ Jaro Hofierka
+*/
+
#include <grass/config.h>
#ifdef HAVE_TIFFIO_H
Modified: grass/trunk/lib/ogsf/gsd_label.c
===================================================================
--- grass/trunk/lib/ogsf/gsd_label.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gsd_label.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,20 +1,20 @@
-/*
-* $Id$
-*
-****************************************************************************
-*
-* MODULE: GRASS ogsf library
-* AUTHOR(S): Original author - Bill Brown - USA CERL 1991 - 1992
-* <new author name here>
-* PURPOSE: This file needs to be re-written in OpenGL
-* COPYRIGHT: (C) 2000 by the GRASS Development Team
-*
-* This program is free software under the GNU General Public
-* License (>=v2). Read the file COPYING that comes with GRASS
-* for details.
-*
-*****************************************************************************/
+/*!
+ \file gsd_label.c
+
+ \brief OGSF library - label management
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL (1991-1992)
+*/
+
#include <grass/gstypes.h>
#include "rgbpack.h"
#define MAX_LIST 20
Modified: grass/trunk/lib/ogsf/gsd_legend.c
===================================================================
--- grass/trunk/lib/ogsf/gsd_legend.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gsd_legend.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,6 +1,21 @@
-/*
- * Converted code from legend.c in SG3d
- * routines to set viewport, close viewport, and make legend
+/*!
+ \file gsd_legend.c
+
+ \brief OGSF library - legend creation
+
+ GRASS OpenGL gsurf OGSF Library
+
+ Converted code from legend.c in SG3d
+ routines to set viewport, close viewport, and make legend
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL
*/
#include <stdlib.h>
Modified: grass/trunk/lib/ogsf/gsd_objs.c
===================================================================
--- grass/trunk/lib/ogsf/gsd_objs.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gsd_objs.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,10 +1,18 @@
-/*
-* $Id$
-*/
+/*!
+ \file gsd_label.c
+
+ \brief OGSF library - objects management
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
-/* gsd.c
- Bill Brown, USACERL
- October 1993
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL (October 1993)
*/
#include <stdio.h>
Modified: grass/trunk/lib/ogsf/gsd_prim.c
===================================================================
--- grass/trunk/lib/ogsf/gsd_prim.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gsd_prim.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,10 +1,18 @@
-/*
- $Id$
+/*!
+ \file gsd_prim.c
+
+ \brief OGSF library - primitive drawing functions
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
- gsd_prim.c
- Bill Brown, USACERL
- January 1993
- Primitive drawing functions
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL (January 1993)
*/
/* DEBUG */
Modified: grass/trunk/lib/ogsf/gsd_surf.c
===================================================================
--- grass/trunk/lib/ogsf/gsd_surf.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gsd_surf.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,10 +1,18 @@
-/*
-* $Id$
-*/
+/*!
+ \file gsd_surf.c
+
+ \brief OGSF library - loading and manipulating surfaces
+
+ GRASS OpenGL gsurf OGSF Library
-/* gsd.c
- Bill Brown, USACERL
- October 1993
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL (October 1993)
*/
#include <stdlib.h>
Modified: grass/trunk/lib/ogsf/gsd_views.c
===================================================================
--- grass/trunk/lib/ogsf/gsd_views.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gsd_views.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,10 +1,18 @@
-/*
-* $Id$
-*/
+/*!
+ \file gsd_views.c
+
+ \brief OGSF library - manipulating views
+
+ GRASS OpenGL gsurf OGSF Library
-/* gsd_views.c
- Bill Brown, USACERL
- January 1993
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL (January 1993)
*/
/* DEBUG */
Modified: grass/trunk/lib/ogsf/gsd_wire.c
===================================================================
--- grass/trunk/lib/ogsf/gsd_wire.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gsd_wire.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,10 +1,18 @@
-/*
-* $Id$
-*/
+/*!
+ \file gsd_wire.c
+
+ \brief OGSF library -
+
+ GRASS OpenGL gsurf OGSF Library
-/* gsd.c
- Bill Brown, USACERL
- January 1993
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL (January 1993)
*/
#include <stdio.h>
Modified: grass/trunk/lib/ogsf/gsdiff.c
===================================================================
--- grass/trunk/lib/ogsf/gsdiff.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gsdiff.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,21 +1,29 @@
-/*
-* $Id$
-*/
+/*!
+ \file gsdiff.c
+
+ \brief OGSF library - loading and manipulating surfaces
+
+ GRASS OpenGL gsurf OGSF Library
+
+ Routines to set up automatic on-the-fly recalculation
+ of surface elevations, doing a "scaled difference" using another
+ surface for reference
+
+ Note that we're using a true difference here, between data set values,
+ no translations, etc.
+
+ \todo generalize this concept to allow transform functions which are
+ dependent on surfaces that are dependent on other surfaces, etc., as long
+ as the dependency doesn't loop back.
-/* gsdiff.c
- Bill Brown, USACERL
- November 1994
-routines to set up automatic on-the-fly recalculation
-of surface elevations, doing a "scaled difference" using another
-surface for reference
-
-Note that we're using a true difference here, between data set values,
-no translations, etc.
-
-TODO: generalize this concept to allow transform functions which are
-dependent on surfaces that are dependent on other surfaces, etc., as long
-as the dependency doesn't loop back.
-
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL, GMSL/University of Illinois (November 1994)
*/
#include <stdio.h>
Modified: grass/trunk/lib/ogsf/gsdrape.c
===================================================================
--- grass/trunk/lib/ogsf/gsdrape.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gsdrape.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,47 +1,51 @@
-/*
-* $Id$
-*/
+/*!
+ \file gsdrape.c
+
+ \brief OGSF library - functions to intersect line segments with edges of surface polygons
+
+ GRASS OpenGL gsurf OGSF Library
-/* drape.c
- * AUTHOR: Bill Brown, UI GMS Lab
- * functions to intersect line segments with edges of surface polygons
+ For efficiency, intersections are found without respect to which
+ specific triangle edge is intersected, but on a broader sense with
+ the horizontal, vertical, and diagonal seams in the grid, then
+ the intersections are ordered. If quadstrips are used for drawing
+ rather than tmesh, triangulation is not consistant; for diagonal
+ intersections, the proper diagonal to intersect would need to be
+ determined according to the algorithm used by qstrip (look at nearby
+ normals). It may be faster to go ahead and find the intersections
+ with the other diagonals using the same methods, then at sorting
+ time determine which diagonal array to look at for each quad.
+ It would also require a mechanism for throwing out unused intersections
+ with the diagonals during the ordering phase.
+ Do intersections in 2D, fill line structure with 3D pts (maybe calling
+ routine will cache for redrawing). Get Z value by using linear interp
+ between corners.
+
+ - check for easy cases:
+ - single point
+ - colinear with horizontal or vertical edges
+ - colinear with diagonal edges of triangles
+ - calculate three arrays of ordered intersections:
+ - with vertical edges
+ - with horizontal edges
+ - with diagonal edges and interpolate Z, using simple linear interpolation.
+ - eliminate duplicate intersections (need only compare one coord for each)
+ - build ordered set of points.
+
+ Return static pointer to 3D set of points. Max number of intersections
+ will be rows + cols + diags, so should allocate this number to initialize.
+ Let calling routine worry about copying points for caching.
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown UI GMS Lab
*/
-/*
-For efficiency, intersections are found without respect to which
-specific triangle edge is intersected, but on a broader sense with
-the horizontal, vertical, and diagonal seams in the grid, then
-the intersections are ordered. If quadstrips are used for drawing
-rather than tmesh, triangulation is not consistant; for diagonal
-intersections, the proper diagonal to intersect would need to be
-determined according to the algorithm used by qstrip (look at nearby
-normals). It may be faster to go ahead and find the intersections
-with the other diagonals using the same methods, then at sorting
-time determine which diagonal array to look at for each quad.
-It would also require a mechanism for throwing out unused intersections
-with the diagonals during the ordering phase.
-Do intersections in 2D, fill line structure with 3D pts (maybe calling
-routine will cache for redrawing). Get Z value by using linear interp
-between corners.
-
-1) check for easy cases:
- a) single point
- b) colinear with horizontal or vertical edges
- c) colinear with diagonal edges of triangles
-2) calculate three arrays of ordered intersections:
- a) with vertical edges
- b) with horizontal edges
- c) with diagonal edges
- and interpolate Z, using simple linear interpolation.
-3) eliminate duplicate intersections (need only compare one coord for each)
-4) build ordered set of points.
-
-Return static pointer to 3D set of points. Max number of intersections
-will be rows + cols + diags, so should allocate this number to initialize.
-Let calling routine worry about copying points for caching.
-
-*/
-
#include <stdio.h>
#include <stdlib.h>
Modified: grass/trunk/lib/ogsf/gsds.c
===================================================================
--- grass/trunk/lib/ogsf/gsds.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gsds.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,5 +1,55 @@
-/*
-* $Id$
+/*!
+ \file gsds.c
+
+ \brief OGSF library -
+
+ GRASS OpenGL gsurf OGSF Library
+
+ The idea here is to treat datasets as seperate objects, which SHOULD:
+ - allow easier reuse of data for different attributes.
+ - allow a mechanism for changing data and have changes reflected
+ in each attribute using that data.
+ - allow a mechanism to automatically update data when the data source
+ is changed.
+ - allow easier weaning from GRASS.
+ - allow easier use of shared memory between processes.
+
+ These structures are defined in gstypes.h:
+
+ <code>
+ typedef struct{
+ float *fb;
+ int *ib;
+ short *sb;
+ char *cb;
+ struct BM *bm;
+ } typbuff;
+ </code>
+
+ How about adding a transform func here, so GET_MAPATT would do an
+ on-the-fly transformation? Or even a transform func LIST!
+
+ <code>
+ typedef struct{
+ int data_id;
+ int dims[MAXDIMS];
+ int ndims;
+ int numbytes;
+ char unique_name[80];
+ typbuff databuff;
+ int changed;
+ int need_reload;
+ } dataset;
+ </code>
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown UI GMS Lab
*/
#include <stdlib.h>
@@ -8,44 +58,6 @@
#include <grass/gstypes.h>
-/* The idea here is to treat datasets as seperate objects, which SHOULD:
- * - allow easier reuse of data for different attributes.
- * - allow a mechanism for changing data and have changes reflected
- * in each attribute using that data.
- * - allow a mechanism to automatically update data when the data source
- * is changed.
- * - allow easier weaning from GRASS.
- * - allow easier use of shared memory between processes.
- *
- * These structures are defined in gstypes.h:
- * typedef struct{
- * float *fb;
- * int *ib;
- * short *sb;
- * char *cb;
- * struct BM *bm;
- * } typbuff;
- How about adding a transform func here, so GET_MAPATT would do an
- on-the-fly transformation? Or even a transform func LIST!
- *
- * typedef struct{
- * int data_id;
- * int dims[MAXDIMS];
- * int ndims;
- * int numbytes;
- * char unique_name[80];
- * typbuff databuff;
- * int changed;
- * int need_reload;
- * } dataset;
- *
- *
-*/
-
-/*
-#define TRACE_FUNCS
-*/
-
#define LUCKY 33
#define BLOC 20
#define MAX_DS 100
Modified: grass/trunk/lib/ogsf/gsget.c
===================================================================
--- grass/trunk/lib/ogsf/gsget.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gsget.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,5 +1,18 @@
-/*
-* $Id$
+/*!
+ \file gsd_get.c
+
+ \brief OGSF library -
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL (January 1993)
*/
#include <grass/gstypes.h>
Modified: grass/trunk/lib/ogsf/gsget.h
===================================================================
--- grass/trunk/lib/ogsf/gsget.h 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gsget.h 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,11 +1,3 @@
-/*
-* $Id$
-*/
-
-/***********
-* gsget.h
-***********/
-
#ifndef _GSGET_H
#define _GSGET_H
Modified: grass/trunk/lib/ogsf/gv.c
===================================================================
--- grass/trunk/lib/ogsf/gv.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gv.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,12 +1,20 @@
-/*
-* $Id$
+/*!
+ \file gv.c
+
+ \brief OGSF library - loading and manipulating vector sets
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL (November 1993)
*/
-/* gv.c
- Bill Brown, USACERL
- November 1993
-*/
-
#include <stdio.h>
#include <stdlib.h>
@@ -15,10 +23,6 @@
#define FIRST_VECT_ID 20656
-/*
-#define TRACE_FUNCS
-*/
-
static geovect *Vect_top = NULL;
/***********************************************************************/
Modified: grass/trunk/lib/ogsf/gv_quick.c
===================================================================
--- grass/trunk/lib/ogsf/gv_quick.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gv_quick.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,15 +1,21 @@
-/*
-* $Id$
-*/
+/*!
+ \file gv_quick.c
+
+ \brief OGSF library -
+
+ GRASS OpenGL gsurf OGSF Library
-/* gv_quick.c
- Bill Brown, USACERL
- December 1993
-*/
+ Trying some stuff to draw a quick version of a vector map, to represent
+ it when doing interactive translations.
-/*
-Trying some stuff to draw a quick version of a vector map, to represent
-it when doing interactive translations.
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown, USACERL (December 1993)
*/
#include <stdio.h>
Modified: grass/trunk/lib/ogsf/gvd.c
===================================================================
--- grass/trunk/lib/ogsf/gvd.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gvd.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,11 +1,19 @@
-/*
-* $Id$
+/*!
+ \file gvd.c
+
+ \brief OGSF library - loading and manipulating vector sets
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown USACERL (December 1993)
*/
-
-/* gvd.c
- Bill Brown, USACERL
- December 1993
-*/
#include <stdio.h>
#include <stdlib.h>
Modified: grass/trunk/lib/ogsf/gvl.c
===================================================================
--- grass/trunk/lib/ogsf/gvl.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gvl.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,13 +1,21 @@
-/*
-* $Id$
+/*!
+ \file gvl.c
+
+ \brief OGSF library - loading and manipulating volumes
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Bill Brown, UI-GMSL (May 1997)
+ Tomas Paudits (February 2004)
*/
-/* gvl.c
- volume access routines
- Bill Brown, UI-GMSL, May 1997
- Tomas Paudits, Februar 2004
-*/
-
#include <stdio.h>
#include <stdlib.h>
#include <grass/gstypes.h>
Modified: grass/trunk/lib/ogsf/gvl_calc.c
===================================================================
--- grass/trunk/lib/ogsf/gvl_calc.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gvl_calc.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,8 +1,20 @@
-/* gvl_isosurf_calc.c
- * Tomas Paudits
- * Februar 2004
- */
+/*!
+ \file gvl_calc.c
+
+ \brief OGSF library - loading and manipulating volumes
+
+ GRASS OpenGL gsurf OGSF Library
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Tomas Paudits (February 2004)
+*/
+
#include <stdio.h>
#include <math.h>
Modified: grass/trunk/lib/ogsf/gvl_calc2.c
===================================================================
--- grass/trunk/lib/ogsf/gvl_calc2.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gvl_calc2.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,9 +1,21 @@
-/*
-Based on implementation of MarchingCubes 33 Algorithm by
-Thomas Lewiner, thomas.lewiner at polytechnique.org, Math Dept, PUC-Rio
+/*!
+ \file gvl_calc2.c
+
+ \brief OGSF library - loading and manipulating volumes
+
+ GRASS OpenGL gsurf OGSF Library
-Implementation in ogsf library
-Tomas Paudits, 2004
+ Based on implementation of MarchingCubes 33 Algorithm by
+ Thomas Lewiner, thomas.lewiner at polytechnique.org, Math Dept, PUC-Rio
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Tomas Paudits, 2004
*/
#include <float.h>
Modified: grass/trunk/lib/ogsf/gvl_file.c
===================================================================
--- grass/trunk/lib/ogsf/gvl_file.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gvl_file.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,3 +1,18 @@
+/*!
+ \file gvl_file.c
+
+ \brief OGSF library - loading and manipulating volumes
+
+ GRASS OpenGL gsurf OGSF Library
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+*/
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
Modified: grass/trunk/lib/ogsf/gvld.c
===================================================================
--- grass/trunk/lib/ogsf/gvld.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/gvld.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,8 +1,20 @@
-/* gvld.c
- * Tomas Paudits
- * Februar 2004
- */
+/*!
+ \file gvld.c
+
+ \brief OGSF library - loading and manipulating volumes
+
+ GRASS OpenGL gsurf OGSF Library
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Tomas Paudits (February 2004)
+*/
+
#include <stdio.h>
#include <math.h>
Modified: grass/trunk/lib/ogsf/mc33_table.h
===================================================================
--- grass/trunk/lib/ogsf/mc33_table.h 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/mc33_table.h 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,14 +1,26 @@
-#ifndef _CELL_TABLE_H
-#define _CELL_TABLE_H
+/*!
+ \file m33_table.h
+
+ \brief OGSF library -
+
+ GRASS OpenGL gsurf OGSF Library
-/*
-LookUpTable for the MarchingCubes 33 Algorithm
-Thomas Lewiner, thomas.lewiner at polytechnique.org, Math Dept, PUC-Rio
+ LookUpTable for the MarchingCubes 33 Algorithm
+ Thomas Lewiner, thomas.lewiner at polytechnique.org, Math Dept, PUC-Rio
-Implementation in ogsf library
-Tomas Paudits, 2004
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Tomas Paudits, 2004
*/
+#ifndef _CELL_TABLE_H
+#define _CELL_TABLE_H
+
typedef struct
{
unsigned char nedges;
Modified: grass/trunk/lib/ogsf/ogsflib.dox
===================================================================
--- grass/trunk/lib/ogsf/ogsflib.dox 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/ogsflib.dox 2008-05-11 09:50:09 UTC (rev 31313)
@@ -2,11 +2,13 @@
<!-- doxygenized from "GRASS 5 Programmer's Manual"
by M. Neteler 2/2004
-->
-<title>GRASS openGL gsurf OGSF Library</title>
-\section ogsfintro OGSF Library for OpenGL programming (gsurf)
+by GRASS Development Team
+http://grass.osgeo.org
+\section ogsfintro OGSF Library for OpenGL programming (gsurf)
+
<P>
Author: Bill Brown GMSL/University of Illinois
@@ -21,12 +23,12 @@
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
+(%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
+%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
+Database-specific routines for interfacing with the \ref 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. It is used
@@ -35,40 +37,32 @@
<P>
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,
+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:
-<BR>
-<P>
+
GS_draw_surf(id)
-<BR>
-<P>
-where <I>id</I> is the handle number. To associate a vector set with
-a surface and then draw all surfaces with the vector set draped over
+
+where <I>id</I> is the handle number. To associate a %vector set with
+a surface and then draw all surfaces with the %vector set draped over
the one selected, the application would use the calls:
-<BR>
-<P>
+
GV_select_surf(vid, sid)
-<BR>
-<P>
+
GS_alldraw_surf()
-<BR>
-<P>
+
GV_draw_vect(vid)
-<BR>
-<P>
-where <I>vid</I> and <I>sid</I> are the handles for the vector set and
+
+where <I>vid</I> and <I>sid</I> are the handles for the %vector set and
surface. Similarly, to query or change attributes of the object, the
handle is used in conjunction with the new attribute, as in:
GV_set_vectmode(id, mem, color, width)
-
\subsection Naming_Conventions Naming Conventions
-<P>
The following naming conventions for function prefixes are used:
<UL>
@@ -79,15 +73,15 @@
</LI>
<LI><B>GSU_</B>
Utility functions for distance calculations, common 2D & 3D
- unit vector operations such as cross product or vector arithmetic.
+ unit %vector operations such as cross product or %vector arithmetic.
</LI>
<LI><B>GV_</B>
Functions which have to do with loading & manipulating
- vector sets.
+ %vector sets.
</LI>
<LI><B>GP_</B>
Functions which have to do with loading & manipulating
- point sets.
+ %point sets.
</LI>
<LI><B>GVL_</B>
Functions which have to do with loading & manipulating 3D
@@ -109,780 +103,438 @@
<UL>
<LI>public function prototypes
</LI>
-<LI>public include file gsurf.h
+<LI>public include file include/gsurf.h
</LI>
-<LI>public include file keyframe.h
+<LI>public include file include/keyframe.h
</LI>
<LI>public color packing utility macros rgbpack.h
</LI>
-<LI>private types and defines gstypes.h
+<LI>private types and defines include/gstypes.h
</LI>
<LI>private utilities gsget.h
</LI>
</UL>
-<P>
+\section Public_function_prototypes_for_gsurf_Library Public function prototypes
-\section Public_function_prototypes Public function prototypes
-
-\subsection Function_Prototypes_for_gsurf_Library Function Prototypes
- for gsurf Library
-
\subsection gs_init Initialization and positioning (GS)
Functions which have to do with loading & manipulating surfaces.
Also functions for library initialization, setting global variables,
viewer positioning, and lighting.
-<P>
-void *GS_Get_ClientData(int id)
+GS_Get_ClientData()
-<P>
-float GS_P2distance (float *from, float *to)
+GS_P2distance ()
-<P>
-GS_Set_ClientData(int id, void *clientd)
+GS_Set_ClientData()
-<P>
GS_alldraw_cplane_fences()
-<P>
GS_alldraw_surf()
-<P>
GS_alldraw_wire()
-<P>
GS_background_color()
-<P>
-int GS_check_cancel()
+GS_check_cancel()
-<P>
GS_clear(int col)
-<P>
GS_default_draw_color()
-<P>
GS_delete_surface(int id)
-<P>
-GS_distance (float *from, *to)
+GS_distance ()
-<P>
GS_done_draw()
-<P>
-int GS_draw_X(int id, float *pt) pt only has to have an X & Y value
- in true world coordinates
+GS_draw_X()
-<P>
-GS_draw_cplane(int num)
+GS_draw_cplane()
-<P>
-GS_draw_cplane_fence(int hs1, int hs2, int num)
+GS_draw_cplane_fence()
-<P>
GS_draw_lighting_model()
-<P>
-GS_draw_line_onsurf(int id, float x1, float y1, float x2, float y2)
+GS_draw_line_onsurf()
-<P>
GS_draw_surf(int id)
-<P>
GS_draw_wire(int id)
-<P>
-int GS_dv3norm(double dv1[3])
+GS_dv3norm()
-Changes dv1 so that it is a unit vector
+GS_geodistance()
-<P>
-double GS_geodistance(double *from, double *to, char
- *units) distance between 2 coordinates
+GS_get_SDscale()
-Returns distance between two geographic coordinates in current
-projection.
+GS_get_SDsurf()
-<P>
-Units is one of:
- "meters",
- "miles",
- "kilometers",
- "feet",
- "yards",
- "nmiles" (nautical miles),
- "rods",
- "inches",
- "centimeters",
- "millimeters",
- "micron",
- "nanometers",
- "cubits",
- "hands",
- "furlongs",
- "chains".
+GS_get_aspect()
-<P>
-Default is meters.
+GS_get_att()
-<P>
-GS_get_SDscale(float *scale)
+GS_get_cat_at_xy()
-<P>
-GS_get_SDsurf(int id)
+GS_get_dims()
-<P>
-double GS_get_aspect()
+GS_get_distance_alongsurf()
-<P>
-GS_get_att(int id, int att, int *set, float *constant, char *mapname)
+GS_get_drawmode()
-<P>
-GS_get_cat_at_xy(int id, int att, char *catstr, float x, float y)
+GS_get_drawres()
-<P>
-GS_get_dims(int id, int *rows, int *cols)
+GS_get_exag_guess()
-<P>
-int GS_get_distance_alongsurf(int hs, int use_exag, float x1, float
- y1, float x2, float y2, float *dist) Returns distance following terrain.
+GS_get_fencecolor()
-<P>
-GS_get_drawmode(int id, int mode)
+GS_get_focus()
-<P>
-GS_get_drawres(int id, int *xres, int *yres, int *xwire, int *ywire)
+GS_get_fov()
-<P>
-GS_get_exag_guess(int id, float *exag)
+GS_get_from()
-<P>
-int GS_get_fencecolor()
+GS_get_from_real()
-<P>
-GS_get_focus(float *realto)
+GS_get_longdim()
-<P>
-int GS_get_fov() Returns field of view, in 10ths of degrees.
+GS_get_maskmode()
-<P>
-GS_get_from(float *fr)
+GS_get_modelposition()
-<P>
-GS_get_from_real(float *fr)
+GS_get_nozero()
-<P>
-GS_get_longdim(float *dim)
+GS_get_region()
-<P>
-GS_get_maskmode(int id, int mode)
+GS_get_scale()
-<P>
-int GS_get_modelposition(float *siz, float pos[3])
+GS_get_selected_point_on_surface()
-Retrieves coordinates for lighting model position, at center of view,
-(nearclip * 2) from eye.
+GS_get_surf_list()
-<P>
-GS_get_nozero(int id, int att, int *mode)
+GS_get_to()
-<P>
-GS_get_region(float *n, float *s, float *w, float *e)
+GS_get_trans()
-<P>
-GS_get_scale(float *sx, float *sy, float *sz, int doexag)
+GS_get_twist()
-<P>
-int GS_get_selected_point_on_surface(int sx, int sy, int *id, float
- *x, float *y, float *z)
+GS_get_val_at_xy()
-Given screen coordinates sx & sy, find closest intersection of
-view ray with surfaces and return coordinates of intersection in x, y,
-z, and identifier of surface in id.
+GS_get_viewdir()
-<P>
-Returns 0 if no intersections found, otherwise number of intersections.
+GS_get_wire_color()
-<P>
-GS_get_surf_list(int *numsurfs)
+GS_get_zextents()
-<P>
-GS_get_to(float *to)
+GS_get_zrange()
-<P>
-GS_get_trans(int id, float *xtrans, float *ytrans, float *ztrans)
+GS_get_zrange_nz()
-<P>
-int GS_get_twist()
+GS_global_exag()
-<P>
-int GS_get_val_at_xy(int id, char *att, char *valstr, float x, float
- y) Prints "NULL" or the value (i.e., "921.5") to valstr.
+GS_has_transparency()
-<P>
-Colors are translated to rgb and returned as Rxxx Gxxx Bxxx
-
-<P>
-Usually call after GS_get_selected_point_on_surface
-
-<P>
-Returns -1 if point outside of window or masked, otherwise 1
-
-<P>
-GS_get_viewdir(float dir[3])
-
-<P>
-GS_get_wire_color(int id, int *colr)
-
-<P>
-int GS_get_zextents(int id, float *min, float *max, float
- *mid) Returns Z extents for a single surface.
-
-<P>
-int GS_get_zrange(float *min, float *max, int doexag) Returns Z
- extents for all loaded surfaces.
-
-<P>
-int GS_get_zrange_nz(float *min, float *max) Returns Z extents for
- all loaded surfaces, treating zeros as "no data".
-
-<P>
-float GS_global_exag()
-
-<P>
-int GS_has_transparency()
-
-<P>
GS_init_view()
-<P>
-GS_is_masked(int id, float *pt)
+GS_is_masked()
-<P>
GS_libinit()
-<P>
GS_lights_off()
-<P>
GS_lights_on()
-<P>
-GS_load_3dview(char *vname, int surfid)
+GS_load_3dview()
-<P>
-GS_load_att_map(int id, char *filename, int att)
+GS_load_att_map()
-<P>
-int GS_look_here(int sx, int sy) Reset center of view to screen
-coordinates sx, sy.
+GS_look_here()
-<P>
-Send screen coords sx & sy, lib traces through surfaces & sets
-new center to point of nearest intersection. If no intersection, uses
-line of sight with length of current view ray (eye to center) to set
-new center.
+GS_moveto()
-<P>
-GS_moveto(float *pt)
+GS_moveto_real()
-<P>
-GS_moveto_real(float *pt)
+GS_new_light()
-<P>
-int GS_new_light()
-
-<P>
GS_new_surface()
-<P>
-int GS_num_surfs()
+GS_num_surfs()
-<P>
GS_ready_draw()
-<P>
-GS_save_3dview(char *vname, int surfid)
+GS_save_3dview()
-<P>
-GS_set_SDscale(float scale)
+GS_set_SDscale()
-<P>
-GS_set_SDsurf(int id)
+GS_set_SDsurf()
-<P>
-GS_set_att_const(int id, int att, float constant)
+GS_set_att_const()
-<P>
-GS_set_att_defaults(float defs[MAX_ATTS], null_defs[MAX_ATTS])
+GS_set_att_defaults()
-<P>
-GS_set_cancel(int c)
+GS_set_cancel()
-<P>
-GS_set_cplane(int num)
+GS_set_cplane()
-<P>
-GS_set_cplane_rot(int num, float dx, float dy, float dz)
+GS_set_cplane_rot()
-<P>
-GS_set_cplane_trans(int num, float dx, float dy, float dz)
+GS_set_cplane_trans()
-<P>
-GS_set_cxl_func(void (*f) () )
+GS_set_cxl_func()
-<P>
-int GS_set_draw(int where) Sets which buffer to draw to.
+GS_set_draw()
-<P>
-where should be one of: GSD_BOTH, GSD_FRONT, GSD_BACK
+GS_set_drawmode()
-<P>
-GS_set_drawmode(int id, int mode)
+GS_set_drawres()
-<P>
-GS_set_drawres(int id, int xres, int yres, int xwire, int ywire)
+GS_set_exag()
-<P>
-GS_set_exag(int id, float exag)
+GS_set_fencecolor()
-<P>
-GS_set_fencecolor(int mode)
+GS_set_focus()
-<P>
-GS_set_focus(float *realto)
+GS_set_focus_center_map()
-<P>
-GS_set_focus_center_map(int id)
+GS_set_fov()
-<P>
-GS_set_fov(int fov)
+GS_set_global_exag()
-<P>
-GS_set_global_exag(float exag)
+GS_set_maskmode()
-<P>
-GS_set_maskmode(int id, int mode)
-
-<P>
GS_set_nofocus()
-<P>
-GS_set_nozero(int id, int att, int mode)
+GS_set_nozero()
-<P>
-GS_set_swap_func(void (*f) () )
+GS_set_swap_func()
-<P>
-GS_set_trans(int id, float xtrans, float ytrans, float ztrans)
+GS_set_trans()
-<P>
-int GS_set_twist(int t) t is tenths of degrees clockwise from 12:00.
+GS_set_twist()
-<P>
-GS_set_viewdir(float dir[3])
+GS_set_viewdir()
-<P>
-GS_set_viewport(int left, int right, int bottom, int top)
+GS_set_viewport()
-<P>
GS_set_wire_color(int id, int colr)
-<P>
GS_setall_drawmode(int mode)
-<P>
-GS_setall_drawres(int xres, int yres, int xwire, int ywire)
+GS_setall_drawres()
-<P>
-int GS_setlight_ambient(int num, float red, float green, float
- blue) Red, green, blue from 0.0 to 1.0
+GS_setlight_ambient()
-<P>
-int GS_setlight_color(int num, float red, float green, float
- blue) Red, green, blue from 0.0 to 1.0
+GS_setlight_color()
-<P>
-GS_setlight_position(int num, float xpos, float ypos, float zpos, int
-local)
+GS_setlight_position()
-<P>
-GS_surf_exists(int id)
+GS_surf_exists()
-<P>
-GS_switchlight(int num, int on)
+GS_switchlight()
-<P>
GS_transp_is_set()
-<P>
GS_unset_SDsurf()
-<P>
-GS_unset_att(int id, int att)
+GS_unset_att()
-<P>
-GS_unset_cplane(int num)
+GS_unset_cplane()
-<P>
-GS_update_curmask(int id)
+GS_update_curmask()
-<P>
-GS_update_normals(int id)
+GS_update_normals()
-<P>
-GS_v2dir(float v1[2], float v2[2], float v3[2])
+GS_v2dir()
-<P>
-GS_v3add(float v1[3], float v2[3])
+GS_v3add()
-<P>
-int GS_v3cross(float v1[3], float v2[3], float v3[3]) returns the
- cross product v3 = v1 cross v2
+GS_v3cross()
-<P>
-GS_v3dir(float v1[3], float v2[3], float v3[3)
+GS_v3dir()
-<P>
-GS_v3eq(float v1[3], float v2[3])
+GS_v3eq()
-<P>
-GS_v3mag(float v1[3], float *mag)
+GS_v3mag()
-<P>
-int GS_v3mult(float v1[3], float k) v1 *= k
+GS_v3mult()
-<P>
-int GS_v3norm(float v1[3]) Changes v1 so that it is a unit vector
+GS_v3norm()
-<P>
-int GS_v3normalize(float v1[3], float v2[3]) Changes v2 so that v1v2 is a
-unit vector
+GS_v3normalize()
-<P>
-int GS_v3sub(float v1[3], float v2[3]) v1 -= v2
+GS_v3sub()
-
\subsection gv_vect Loading and manipulation of vector maps (GV)
-Functions which have to do with loading & manipulating vector
+Functions which have to do with loading & manipulating %vector
sets.
-<P>
-void *GV_Get_ClientData(int id)
-<P>
-GV_Set_ClientData(int id, int clientd)
+GV_Get_ClientData()
-<P>
+GV_Set_ClientData()
+
GV_alldraw_vect()
-<P>
-GV_delete_vector(int id)
+GV_delete_vector()
-<P>
-GV_draw_fastvect(int vid)
+GV_draw_fastvect()
-<P>
-GV_draw_vect(int vid)
+GV_draw_vect()
-<P>
-GV_get_trans(int id, float *xtrans, float *ytrans, float *ztrans)
+GV_get_trans()
-<P>
-int *GV_get_vect_list(int *numvects) USER must free when no longer needed!
+GV_get_vect_list()
-<P>
-GV_get_vectmode(int id, int *mem, int *color, int *width)
+GV_get_vectmode()
-<P>
-GV_get_vectname(int id, char *filename)
+GV_get_vectname()
-<P>
-GV_load_vector(int id, char *filename)
+GV_load_vector()
-<P>
-int GV_new_vector()
+GV_new_vector()
-<P>
-int GV_num_vects()
+GV_num_vects()
-<P>
-int GV_select_surf(int hv, int hs) Select surface identified by hs
- to have vector identified by hv draped over it.
+GV_select_surf()
-<P>
-GV_set_trans(int id, float xtrans, float ytrans, float ztrans)
+GV_set_trans()
-<P>
-GV_set_vectmode(int id, int mem, int color, int width)
+GV_set_vectmode()
-<P>
-GV_surf_is_selected(int hv, int hs)
+GV_surf_is_selected()
-<P>
-GV_unselect_surf(int hv, int hs)
+GV_unselect_surf()
-<P>
-GV_vect_exists(int id)
+GV_vect_exists()
-
\subsection gp_points Loading and manipulation of point maps (GP)
-Functions which have to do with loading & manipulating point sets.
+Functions which have to do with loading & manipulating %point sets.
-<P>
-void *GP_Get_ClientData(int id)
+GP_Get_ClientData()
-<P>
-GP_Set_ClientData(int id, void *clientd)
+GP_Set_ClientData()
-<P>
GP_alldraw_site()
-<P>
-GP_attmode_color(int id, char *filename)
+GP_attmode_color()
-<P>
-GP_attmode_none(int id)
+GP_attmode_none()
-<P>
-GP_delete_site(int id)
+GP_delete_site()
-<P>
-GP_draw_site(int id)
+GP_draw_site()
-<P>
-int *GP_get_site_list(int *numsites) USER must free when no
- longer needed!
+GP_get_site_list()
-<P>
-GP_get_sitemode(int id, int *atmod, int *color, int *width, float *size,
-int *marker)
+GP_get_sitemode()
-<P>
-GP_get_sitename(int id, char *filename)
+GP_get_sitename()
-<P>
-GP_get_trans(int id, float *xtrans, float *ytrans, float *ztrans)
+GP_get_trans()
-<P>
-GP_get_zmode(int id, int *use_z)
+GP_get_zmode()
-<P>
-GP_load_site(int id, char *filename)
+GP_load_site()
-<P>
-int GP_new_site()
+GP_new_site()
-<P>
-int GP_num_sites()
+GP_num_sites()
-<P>
-GP_select_surf(int hp, int hs)
+GP_select_surf()
-<P>
-GP_set_sitemode(int id, int atmod, int color, int width, float size, int
-marker)
+GP_set_sitemode()
-<P>
-GP_set_trans(int id, float *xtrans, float *ytrans, float *ztrans)
+GP_set_trans()
-<P>
-GP_set_zmode(int id, int use_z)
+GP_set_zmode()
-<P>
-GP_site_exists(int id)
+GP_site_exists()
-<P>
-GP_surf_is_selected(int hp, int hs)
+GP_surf_is_selected()
-<P>
-GP_unselect_surf(int hp, int hs)
+GP_unselect_surf()
-
\subsection gk_keyframes Keyframe animation
Functions which have to do with setting & manipulating keyframes
for viewer position animation (fly-bys).
-<P>
-int GK_add_key(float pos, unsigned long fmask, int force_replace,
-float precis)
+GK_add_key()
-The pos value is the relative position in the animation for this
-particular keyframe - used to compare relative distance to neighboring
-keyframes, it can be any floating point value.
+GK_clear_keys()
-<P>
-The fmask value can be any of the following or'd together:
- KF_FROMX_MASK
- KF_FROMY_MASK
- KF_FROMZ_MASK
- KF_FROM_MASK (KF_FROMX_MASK | KF_FROMY_MASK | KF_FROMZ_MASK)
+GK_delete_key()
-<P>
-KF_DIRX_MASK
- KF_DIRY_MASK
- KF_DIRZ_MASK
- KF_DIR_MASK (KF_DIRX_MASK | KF_DIRY_MASK | KF_DIRZ_MASK)
+GK_do_framestep()
-<P>
-KF_FOV_MASK
- KF_TWIST_MASK
-<P>
-KF_ALL_MASK (KF_FROM_MASK | KF_DIR_MASK | KF_FOV_MASK | KF_TWIST_MASK)
+GK_move_key()
-<P>
-Other fields will be added later.
+GK_set_interpmode()
-<P>
-The value precis and the boolean force_replace are used to determine
-if a keyframe should be considered to be at the same position as a
-pre-existing keyframe. e.g., if anykey.pos - newkey.pos <= precis,
-GK_add_key() will fail unless force_replace is TRUE.
+GK_set_numsteps()
-<P>
-Returns 1 if key is added, otherwise -1.
+GK_set_tension()
+GK_show_path()
-<P>
-void GK_clear_keys() Deletes all keyframes, resets field masks.
- Doesn't change number of frames requested.
+GK_show_site()
-<P>
-int GK_delete_key(float pos, float precis, int justone)
+GK_show_vect()
-The values pos & precis are used to determine which keyframes to
-delete. Any keyframes with their position within precis of pos will
-be deleted if justone is zero. If justone is non-zero, only the first
-(lowest pos) keyframe in the range will be deleted.
+GK_showtension_start()
-<P>
-Returns number of keys deleted.
+GK_showtension_stop()
+GK_update_frames()
-<P>
-int GK_do_framestep(int step, int render)
+GK_update_tension()
-Moves the animation to frame number "step". Step should be a value
-between 1 and the number of frames. If render is non-zero, calls
-draw_all.
-
-<P>
-int GK_move_key(float oldpos, float precis, float newpos)
-
-Precis works as in other functions - to identify keyframe to move.
-Only the first keyframe in the precis range will be moved.
-
-<P>
-Returns number of keys moved (1 or 0) .
-
-
-<P>
-int GK_set_interpmode(int mode) Sets interpolation mode to
- KF_LINEAR or KF_SPLINE
-
-<P>
-void GK_set_numsteps(int newsteps) Sets the number of frames to be
- interpolated from keyframes.
-
-<P>
-int GK_set_tension(float tens) Sets value for tension when interpmode
-is KF_SPLINE. The value tens should be between 0.0 & 1.0.
-
-<P>
-void GK_show_path(int flag) Draws the current path.
-
-<P>
-GK_show_site(int flag)
-
-<P>
-GK_show_vect(int flag)
-
-<P>
-void GK_showtension_start()
-
-<P>
-void GK_showtension_stop() Use
-GK_showtension_start/GK_update_tension/GK_showtension_stop to
-initialize & stop multi-view display of path when changing
-tension.
-
-<P>
-void GK_update_frames() Recalculates path using the current number of
-frames requested. Call after changing number of frames or when
-Keyframes change.
-
-<P>
-void GK_update_tension()
-
\subsection gvl_volume Loading and manipulation of volume maps (GVL)
Functions which have to do with loading & manipulating 3D volumes.
-<P>
-void *GVL_Get_ClientData(int id)
+GVL_Get_ClientData()
-<P>
-GVL_Set_ClientData(int id, void *clientd)
+GVL_Set_ClientData()
-<P>
GVL_alldraw_vol()
-<P>
-GVL_delete_volume(int id)
+GVL_delete_volume()
-<P>
-GVL_draw_fastvol(int vid)
+GVL_draw_fastvol()
-<P>
-GVL_draw_vol(int vid)
+GVL_draw_vol()
-<P>
-GVL_get_trans(int id, float *xtrans, float *ytrans, float *ztrans)
+GVL_get_trans()
-<P>
-int *GVL_get_vol_list(int *numvols)
+GVL_get_vol_list()
-<P>
-GVL_get_volmode(int id, int *viztype)
+GVL_get_volmode()
-<P>
-GVL_get_volname(int id, char *filename)
+GVL_get_volname()
-<P>
-GVL_load_volume(int id, char *filename)
+GVL_load_volume()
-<P>
-int GVL_new_vol()
+GVL_new_vol()
-<P>
-int GVL_num_vol()
+GVL_num_vol()
-<P>
-GVL_set_trans(int id, float xtrans, float ytrans, float ztrans)
+GVL_set_trans()
-<P>
-GVL_set_volmode(int id, int viztype)
+GVL_set_volmode()
-<P>
-int GVL_vol_exists(int id)
+GVL_vol_exists()
-<P>
-
-
\subsection gsurf_h Public include file gsurf.h
-See lib/ogsf/gsurf.h
+See include/gsurf.h
\subsection keyframe_h Public include file keyframe.h
-See lib/ogsf/keyframe.h
+See include/keyframe.h
\subsection rgbpack_h Public color packing utility macros rgbpack.h
@@ -892,7 +544,7 @@
\subsection gstypes_h Private types and defines gstypes.h
-See lib/ogsf/gstypes.h
+See include/gstypes.h
\subsection gsget_h Private utilities gsget.h
Modified: grass/trunk/lib/ogsf/rgbpack.h
===================================================================
--- grass/trunk/lib/ogsf/rgbpack.h 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/rgbpack.h 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,7 +1,3 @@
-/*
-* $Id$
-*/
-
#ifndef _RGBPACK_H
#define _RGBPACK_H
Modified: grass/trunk/lib/ogsf/rowcol.h
===================================================================
--- grass/trunk/lib/ogsf/rowcol.h 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/rowcol.h 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,7 +1,3 @@
-/*
-* $Id$
-*/
-
#ifndef _ROWCOL_H
#define _ROWCOL_H
Modified: grass/trunk/lib/ogsf/trans.c
===================================================================
--- grass/trunk/lib/ogsf/trans.c 2008-05-11 09:41:11 UTC (rev 31312)
+++ grass/trunk/lib/ogsf/trans.c 2008-05-11 09:50:09 UTC (rev 31313)
@@ -1,35 +1,42 @@
-/* NOTE: This file should be REMOVED and any calls to the functions in this
-** file should be replaced with appropriate OpenGL calls.
-*/
+/*!
+ \file trans.c
+
+ \brief OGSF library -
+
+ GRASS OpenGL gsurf OGSF Library
-/*
-** Written by Dave Gerdes Jan 1990
-** Copyright Dave Gerdes 1990 All rights reserved
-** US Army Construction Engineering Research Lab
-**
-** Further authors: Justin Hickey, Bob Covill, Brad Douglas
-**
-** COPYRIGHT: (C) 1999, 2006 by the GRASS Development Team
-**
-** This program is free software under the GNU General Public
-** License (>=v2). Read the file COPYING that comes with GRASS
-** for details.
-**
-** Matrix Transformation library.
-**
-** P_pushmatrix ()
-** P_popmatrix ()
-** P_scale ()
-** P_rot ()
-** P_transform () transform array of vectors using current T matrix
-** This routine should be available in GL!
-**
-** Arguments are same as GL counterparts
-**
-** I threw this code together in January at the beginning of this
-** class. I was still learning about GL at the time.
-** There are many places where the code could be improved.
-**
+ NOTE: This file should be REMOVED and any calls to the functions in this
+ file should be replaced with appropriate OpenGL calls.
+
+ Matrix Transformation library.
+
+ P_pushmatrix ()
+
+ P_popmatrix ()
+
+ P_scale ()
+
+ P_rot ()
+
+ P_transform () transform array of vectors using current T matrix
+
+ This routine should be available in GL!
+
+ Arguments are same as GL counterparts
+
+ I threw this code together in January at the beginning of this
+ class. I was still learning about GL at the time.
+ There are many places where the code could be improved.
+
+ (C) 1999-2008 by the GRASS Development Team
+
+ This program is free software under the
+ GNU General Public License (>=v2).
+ Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Dave Gerdes Jan 1990 All rights reserved, US Army Construction Engineering Research Lab
+ Bill Brown USACERL (November 1993)
*/
#include <stdio.h>
More information about the grass-commit
mailing list