[GRASS-SVN] r31312 - grass/branches/develbranch_6/lib/ogsf
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun May 11 05:41:11 EDT 2008
Author: martinl
Date: 2008-05-11 05:41:11 -0400 (Sun, 11 May 2008)
New Revision: 31312
Modified:
grass/branches/develbranch_6/lib/ogsf/GS2.c
grass/branches/develbranch_6/lib/ogsf/GS_util.c
grass/branches/develbranch_6/lib/ogsf/GV2.c
grass/branches/develbranch_6/lib/ogsf/GVL2.c
grass/branches/develbranch_6/lib/ogsf/Gs3.c
grass/branches/develbranch_6/lib/ogsf/gs.c
grass/branches/develbranch_6/lib/ogsf/gsds.c
grass/branches/develbranch_6/lib/ogsf/gv.c
Log:
ogsf: Doxygenization in progress
TRACE_FUNC macro removed, use G_debug() instead of Gs_status()
Modified: grass/branches/develbranch_6/lib/ogsf/GS2.c
===================================================================
--- grass/branches/develbranch_6/lib/ogsf/GS2.c 2008-05-11 06:36:08 UTC (rev 31311)
+++ grass/branches/develbranch_6/lib/ogsf/GS2.c 2008-05-11 09:41:11 UTC (rev 31312)
@@ -50,10 +50,6 @@
#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().
@@ -165,11 +161,7 @@
{
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];
@@ -191,12 +183,9 @@
{
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);
}
@@ -224,11 +213,7 @@
{
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();
@@ -1160,7 +1145,7 @@
\param id surface id
\param att
- \param catstr
+ \param catstr cat string (must be allocated, dim?)
\param x,y real coordinates
\return -1 if no category info or point outside of window
@@ -1173,7 +1158,7 @@
typbuff *buff;
geosurf *gs;
- sprintf(catstr, "");
+ catstr[0] = '\0';
gs = gs_get_surf(id);
if (NULL == gs) {
@@ -1303,7 +1288,7 @@
typbuff *buff;
geosurf *gs;
- sprintf(valstr, "");
+ valstr = '\0';
gs = gs_get_surf(id);
if (NULL == gs) {
@@ -1556,11 +1541,7 @@
{
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);
@@ -1607,12 +1588,6 @@
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);
gs = gs_get_surf(id);
@@ -1882,11 +1857,7 @@
{
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) {
@@ -1921,11 +1892,7 @@
{
geosurf *gs;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_draw_wire");
- }
-#endif
+ G_debug(3, "GS_draw_wire");
gs = gs_get_surf(id);
@@ -1979,11 +1946,7 @@
{
geosurf *gs;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_set_exag");
- }
-#endif
+ G_debug(3, "GS_set_exag");
gs = gs_get_surf(id);
@@ -2006,11 +1969,7 @@
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 */
@@ -2031,11 +1990,7 @@
*/
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);
}
@@ -2052,11 +2007,7 @@
{
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);
@@ -2125,11 +2076,7 @@
{
geosurf *gs;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_set_drawmode");
- }
-#endif
+ G_debug(3, "GS_set_drawmode");
gs = gs_get_surf(id);
@@ -2177,11 +2124,7 @@
{
geosurf *gs;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_set_nozero");
- }
-#endif
+ G_debug(3, "GS_set_nozero");
gs = gs_get_surf(id);
@@ -2214,11 +2157,7 @@
{
geosurf *gs;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_set_nozero");
- }
-#endif
+ G_debug(3, "GS_set_nozero");
gs = gs_get_surf(id);
@@ -2275,11 +2214,7 @@
{
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);
@@ -2312,11 +2247,7 @@
{
geosurf *gs;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_get_drawres");
- }
-#endif
+ G_debug(3, "GS_get_drawres");
gs = gs_get_surf(id);
@@ -2340,11 +2271,7 @@
{
geosurf *gs;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_get_dims");
- }
-#endif
+ G_debug(3, "GS_get_dims");
gs = gs_get_surf(id);
@@ -2459,11 +2386,7 @@
{
geosurf *gs;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_set_trans");
- }
-#endif
+ G_debug(3, "GS_set_trans");
gs = gs_get_surf(id);
@@ -2486,11 +2409,7 @@
{
geosurf *gs;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_get_trans");
- }
-#endif
+ G_debug(3, "GS_get_trans");
gs = gs_get_surf(id);
@@ -2512,11 +2431,7 @@
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);
}
@@ -2568,11 +2483,7 @@
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);
@@ -2585,11 +2496,7 @@
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();
@@ -2608,11 +2515,8 @@
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);
@@ -2654,11 +2558,7 @@
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) {
@@ -2679,11 +2579,7 @@
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);
@@ -2717,13 +2613,8 @@
{
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);
/*
@@ -2771,11 +2662,7 @@
{
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);
@@ -2800,11 +2687,7 @@
float surf_min, surf_max;
float vol_min, vol_max;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_get_zrange");
- }
-#endif
+ G_debug(3, "GS_get_zrange");
ret_surf = gs_get_zrange(&surf_min, &surf_max);
ret_vol = gvl_get_zrange(&vol_min, &vol_max);
@@ -2835,13 +2718,8 @@
*/
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;
@@ -2909,13 +2787,8 @@
*/
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;
@@ -3006,13 +2879,8 @@
*/
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;
@@ -3025,13 +2893,8 @@
*/
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;
@@ -3046,13 +2909,8 @@
*/
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;
@@ -3414,11 +3272,7 @@
{
static int first = 1;
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_init_view");
- }
-#endif
+ G_debug(3, "GS_init_view");
if (first) {
first = 0;
@@ -3484,13 +3338,8 @@
*/
void GS_clear(int col)
{
+ G_debug(3, "GS_clear");
-#ifdef TRACE_GS_FUNCS
- {
- Gs_status("GS_clear");
- }
-#endif
-
col = col | 0xFF000000;
/* OGLXXX
@@ -3524,11 +3373,7 @@
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:
Modified: grass/branches/develbranch_6/lib/ogsf/GS_util.c
===================================================================
--- grass/branches/develbranch_6/lib/ogsf/GS_util.c 2008-05-11 06:36:08 UTC (rev 31311)
+++ grass/branches/develbranch_6/lib/ogsf/GS_util.c 2008-05-11 09:41:11 UTC (rev 31312)
@@ -129,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;
@@ -141,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;
@@ -152,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];
@@ -163,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];
@@ -174,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];
@@ -185,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;
@@ -197,9 +235,12 @@
}
/*!
- \brief Change v1 so that it is a unit vector
+ \brief Change v1 so that it is a unit vector (2D)
- \param v1 vector
+ \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)
{
@@ -218,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;
@@ -241,8 +288,8 @@
\param dv1 vector
- \return 0
- \return 1
+ \return 0 if magnitude of dv1 is zero
+ \return 1 if magnitude of dv1 > 0
*/
int GS_dv3norm(double *dv1)
{
@@ -266,9 +313,10 @@
\brief Change v2 so that v1v2 is a unit vector
\param v1 first vector
- \param v2 second vector
+ \param v2[in,out] second vector
- \return ADD
+ \return 0 if magnitude of dx is zero
+ \return 1 if magnitude of dx > 0
*/
int GS_v3normalize(float *v1, float *v2)
{
@@ -291,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;
@@ -315,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;
@@ -331,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]);
@@ -342,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]);
@@ -351,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)
{
@@ -364,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/branches/develbranch_6/lib/ogsf/GV2.c
===================================================================
--- grass/branches/develbranch_6/lib/ogsf/GV2.c 2008-05-11 06:36:08 UTC (rev 31311)
+++ grass/branches/develbranch_6/lib/ogsf/GV2.c 2008-05-11 09:41:11 UTC (rev 31312)
@@ -23,10 +23,6 @@
#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;
@@ -42,11 +38,7 @@
{
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);
@@ -71,11 +63,7 @@
{
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();
@@ -143,11 +131,7 @@
{
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);
@@ -297,11 +281,7 @@
{
geovect *gv;
-#ifdef TRACE_GV_FUNCS
- {
- Gs_status("GV_set_trans");
- }
-#endif
+ G_debug(3, "GV_set_trans");
gv = gv_get_vect(id);
Modified: grass/branches/develbranch_6/lib/ogsf/GVL2.c
===================================================================
--- grass/branches/develbranch_6/lib/ogsf/GVL2.c 2008-05-11 06:36:08 UTC (rev 31311)
+++ grass/branches/develbranch_6/lib/ogsf/GVL2.c 2008-05-11 09:41:11 UTC (rev 31312)
@@ -21,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();
@@ -47,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];
@@ -60,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();
@@ -118,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;
@@ -133,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;
@@ -302,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);
@@ -322,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;
@@ -370,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);
@@ -397,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);
@@ -425,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);
@@ -448,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);
@@ -522,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);
@@ -561,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;
}
@@ -655,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);
@@ -675,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);
@@ -695,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);
@@ -715,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);
@@ -736,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);
@@ -778,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);
@@ -801,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;
@@ -809,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);
@@ -821,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);
@@ -843,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);
@@ -866,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;
@@ -882,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);
@@ -944,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);
@@ -979,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);
@@ -1059,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);
@@ -1172,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/branches/develbranch_6/lib/ogsf/Gs3.c
===================================================================
--- grass/branches/develbranch_6/lib/ogsf/Gs3.c 2008-05-11 06:36:08 UTC (rev 31311)
+++ grass/branches/develbranch_6/lib/ogsf/Gs3.c 2008-05-11 09:41:11 UTC (rev 31312)
@@ -64,10 +64,6 @@
typedef int FILEDESC;
-/*
-#define TRACE_FUNCS
-*/
-
#define NO_DATA_COL 0xffffff
/*!
Modified: grass/branches/develbranch_6/lib/ogsf/gs.c
===================================================================
--- grass/branches/develbranch_6/lib/ogsf/gs.c 2008-05-11 06:36:08 UTC (rev 31311)
+++ grass/branches/develbranch_6/lib/ogsf/gs.c 2008-05-11 09:41:11 UTC (rev 31312)
@@ -24,10 +24,6 @@
#define FIRST_SURF_ID 110658
-/*
-#define TRACE_FUNCS
-*/
-
static geosurf *Surf_top;
static int Invertmask;
Modified: grass/branches/develbranch_6/lib/ogsf/gsds.c
===================================================================
--- grass/branches/develbranch_6/lib/ogsf/gsds.c 2008-05-11 06:36:08 UTC (rev 31311)
+++ grass/branches/develbranch_6/lib/ogsf/gsds.c 2008-05-11 09:41:11 UTC (rev 31312)
@@ -58,10 +58,6 @@
#include <grass/gstypes.h>
-/*
-#define TRACE_FUNCS
-*/
-
#define LUCKY 33
#define BLOC 20
#define MAX_DS 100
Modified: grass/branches/develbranch_6/lib/ogsf/gv.c
===================================================================
--- grass/branches/develbranch_6/lib/ogsf/gv.c 2008-05-11 06:36:08 UTC (rev 31311)
+++ grass/branches/develbranch_6/lib/ogsf/gv.c 2008-05-11 09:41:11 UTC (rev 31312)
@@ -23,10 +23,6 @@
#define FIRST_VECT_ID 20656
-/*
-#define TRACE_FUNCS
-*/
-
static geovect *Vect_top = NULL;
/***********************************************************************/
More information about the grass-commit
mailing list