[GRASS-SVN] r32617 - grass/trunk/lib/ogsf
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Aug 7 10:53:06 EDT 2008
Author: martinl
Date: 2008-08-07 10:53:05 -0400 (Thu, 07 Aug 2008)
New Revision: 32617
Modified:
grass/trunk/lib/ogsf/GS2.c
grass/trunk/lib/ogsf/GVL2.c
grass/trunk/lib/ogsf/gp.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/gsd_surf.c
grass/trunk/lib/ogsf/gsdrape.c
grass/trunk/lib/ogsf/gv.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_file.c
grass/trunk/lib/ogsf/gvld.c
Log:
ogsflib: minor fixes in debug messages / initialization of geosurf and geovol structures (merge from devbr6, r32613)
Modified: grass/trunk/lib/ogsf/GS2.c
===================================================================
--- grass/trunk/lib/ogsf/GS2.c 2008-08-07 14:51:07 UTC (rev 32616)
+++ grass/trunk/lib/ogsf/GS2.c 2008-08-07 14:53:05 UTC (rev 32617)
@@ -220,6 +220,8 @@
{
geosurf *ns;
+ G_debug(3, "GS_new_surface():");
+
if (Next_surf < MAX_SURFS) {
ns = gs_get_new_surface();
gs_init_surf(ns, wind.west + wind.ew_res / 2.,
@@ -233,7 +235,7 @@
Surf_ID[Next_surf] = ns->gsurf_id;
++Next_surf;
- G_debug(3, "GS_new_surface(): id=%d", ns->gsurf_id);
+ G_debug(3, " id=%d", ns->gsurf_id);
return (ns->gsurf_id);
}
@@ -1626,15 +1628,15 @@
G_warning("Raster map <%s> not found", filename);
return -1;
}
- filename = G_fully_qualified_name(filename, mapset);
-
+
/* Check to see if map is in Region */
G_get_cellhd(filename, mapset, &rast_head);
if (rast_head.north <= wind.south ||
rast_head.south >= wind.north ||
rast_head.east <= wind.west || rast_head.west >= wind.east) {
- G_fatal_error(_("Raster map <%s> is outside of current region. Load failed."),
- filename);
+
+ G_fatal_error(_("Raster map <%s@%s> is outside of current region. Load failed."),
+ filename, mapset);
}
while (!reuse && (0 < hdata)) {
@@ -1643,8 +1645,7 @@
if (0 < (hdata = gsds_findh(filename, &changed, &atty, begin))) {
- G_debug(3,
- "GS_load_att_map(): %s already has data handle %d.CF=%x",
+ G_debug(3, "GS_load_att_map(): %s already has data handle %d.CF=%x",
filename, hdata, changed);
/* handle found */
@@ -1684,8 +1685,7 @@
filename, hdata);
}
else {
- G_debug(3,
- "GS_load_att_map(): %s not loaded in correct form - loading now",
+ G_debug(3, "GS_load_att_map(): %s not loaded in correct form - loading now",
filename);
/* not loaded - need to get new dataset handle */
@@ -1700,7 +1700,6 @@
}
else {
atty = Gs_numtype(filename, &neg);
- filename = G_fully_qualified_name(filename, mapset);
}
#ifdef MAYBE_LATER
@@ -1724,8 +1723,7 @@
}
ret = Gs_loadmap_as_bitmap(&wind, filename, tbuff->bm);
- filename = G_fully_qualified_name(filename, mapset);
-
+
break;
case ATTY_CHAR:
if (0 > gs_malloc_att_buff(gs, att, ATTY_CHAR)) {
@@ -1734,7 +1732,6 @@
ret = Gs_loadmap_as_char(&wind, filename, tbuff->cb,
tbuff->nm, &has_null);
- filename = G_fully_qualified_name(filename, mapset);
break;
case ATTY_SHORT:
@@ -1744,8 +1741,6 @@
ret = Gs_loadmap_as_short(&wind, filename, tbuff->sb,
tbuff->nm, &has_null);
- filename = G_fully_qualified_name(filename, mapset);
-
break;
case ATTY_FLOAT:
if (0 > gs_malloc_att_buff(gs, att, ATTY_FLOAT)) {
@@ -1754,7 +1749,6 @@
ret = Gs_loadmap_as_float(&wind, filename, tbuff->fb,
tbuff->nm, &has_null);
- filename = G_fully_qualified_name(filename, mapset);
break;
case ATTY_INT:
@@ -1765,8 +1759,6 @@
ret = Gs_loadmap_as_int(&wind, filename, tbuff->ib,
tbuff->nm, &has_null);
- filename = G_fully_qualified_name(filename, mapset);
-
break;
} /* Done with switch */
@@ -1793,12 +1785,10 @@
Gs_pack_colors(filename, tbuff->ib, gs->rows, gs->cols);
gsds_set_changed(gs->att[att].hdata, CF_COLOR_PACKED);
gs->att[att].lookup = NULL;
- filename = G_fully_qualified_name(filename, mapset);
}
else {
gs_malloc_lookup(gs, att);
Gs_build_lookup(filename, gs->att[att].lookup);
- filename = G_fully_qualified_name(filename, mapset);
}
#else
@@ -1807,7 +1797,6 @@
/* might already exist if reusing */
gs_malloc_lookup(gs, att);
Gs_build_256lookup(filename, gs->att[att].lookup);
- filename = G_fully_qualified_name(filename, mapset);
}
}
else if (ATTY_FLOAT == atty) {
@@ -1821,7 +1810,6 @@
gsds_set_changed(gs->att[att].hdata, CF_COLOR_PACKED);
gsds_free_data_buff(gs->att[att].hdata, ATTY_FLOAT);
gs->att[att].lookup = NULL;
- filename = G_fully_qualified_name(filename, mapset);
}
}
else {
@@ -1829,7 +1817,6 @@
Gs_pack_colors(filename, tbuff->ib, gs->rows, gs->cols);
gsds_set_changed(gs->att[att].hdata, CF_COLOR_PACKED);
gs->att[att].lookup = NULL;
- filename = G_fully_qualified_name(filename, mapset);
}
}
#endif
Modified: grass/trunk/lib/ogsf/GVL2.c
===================================================================
--- grass/trunk/lib/ogsf/GVL2.c 2008-08-07 14:51:07 UTC (rev 32616)
+++ grass/trunk/lib/ogsf/GVL2.c 2008-08-07 14:53:05 UTC (rev 32617)
@@ -19,6 +19,7 @@
#include <grass/gis.h>
#include <grass/G3d.h>
#include <grass/gstypes.h>
+#include <grass/glocale.h>
#include "gsget.h"
static int Vol_ID[MAX_VOLS];
@@ -107,7 +108,7 @@
}
/*!
- \brief Add new volume set
+ \brief Create new volume set
\return volume set id
\return -1 on error
@@ -116,18 +117,21 @@
{
geovol *nvl;
- G_debug(3, "GVL_new_vol");
+ G_debug(3, "GVL_new_vol():");
if (Next_vol < MAX_VOLS) {
nvl = gvl_get_new_vol();
- gvl_init_vol(nvl, wind3.west, wind3.south, wind3.bottom,
+ gvl_init_vol(nvl, wind3.west + wind3.ew_res / 2.,
+ wind3.south + wind3.ns_res / 2., wind3.bottom,
wind3.rows, wind3.cols, wind3.depths,
wind3.ew_res, wind3.ns_res, wind3.tb_res);
Vol_ID[Next_vol] = nvl->gvol_id;
++Next_vol;
+ G_debug(3, " id=%d", nvl->gvol_id);
+
return (nvl->gvol_id);
}
@@ -135,7 +139,7 @@
}
/*!
- \brief Get number of available volume sets
+ \brief Get number of loaded volume sets
\return number of volume sets
*/
@@ -145,7 +149,7 @@
}
/*!
- \brief Get list volume sets
+ \brief Get list of loaded volume sets
Must be freed if not needed!
@@ -221,10 +225,10 @@
}
/*!
- \brief Load volume
+ \brief Load 3d raster map to volume set
\param id volume set id
- \param filename filename
+ \param filename 3d raster map name
\return -1 on error
\return 0 on success
@@ -234,10 +238,15 @@
geovol *gvl;
int handle;
+ G_debug(3, "GVL_load_vol(): id=%d, name=%s",
+ id, filename);
+
if (NULL == (gvl = gvl_get_vol(id))) {
return (-1);
}
+ G_message(_("Loading 3d raster map <%s>..."), filename);
+
if (0 > (handle = gvl_file_newh(filename, VOL_FTYPE_G3D)))
return (-1);
@@ -273,17 +282,15 @@
}
/*!
- \brief Get dimension
+ \brief Get volume dimensions
\param id volume set id
- \param[out] rows,cols,depths number of rows, cols, depth
+ \param[out] rows,cols,depths number of rows, cols, depths
*/
void GVL_get_dims(int id, int *rows, int *cols, int *depths)
{
geovol *gvl;
- G_debug(3, "GVL_get_dims");
-
gvl = gvl_get_vol(id);
if (gvl) {
@@ -292,6 +299,9 @@
*depths = gvl->depths;
}
+ G_debug(3, "GVL_get_dims() id=%d, rows=%d, cols=%d, depths=%d",
+ gvl->gvol_id, gvl->rows, gvl->cols, gvl->depths);
+
return;
}
@@ -511,7 +521,7 @@
}
/*!
- \brief Set draw resolution of isosurface
+ \brief Set isosurface draw resolution
\param id volume set id
\param xres,yres,zres x/y/z resolution value
@@ -524,7 +534,7 @@
geovol *gvl;
int i;
- G_debug(3, "GVL_isosurf_set_drawres");
+ G_debug(3, "GVL_isosurf_set_drawres(): id=%d", id);
if (xres < 1 || yres < 1 || zres < 1) {
return (-1);
@@ -548,7 +558,7 @@
}
/*!
- \brief Get draw-mode of isosurface
+ \brief Get isosurface draw mode
\param id volume set id
\param[out] mode draw-mode
@@ -572,10 +582,10 @@
}
/*!
- \brief Set draw-mode of isosurface
+ \brief Set isosurface draw mode
\param id volume set id
- \param mode draw-mode
+ \param mode draw mode
\return 0 on success
\return -1 on error (invalid volume set id)
@@ -584,7 +594,7 @@
{
geovol *gvl;
- G_debug(3, "GVL_isosurf_set_drawmode");
+ G_debug(3, "GVL_isosurf_set_drawmode(): id=%d mode=%d", id, mode);
gvl = gvl_get_vol(id);
@@ -1020,7 +1030,7 @@
}
/*!
- \brief Set draw resolution of slice
+ \brief Set slice draw resolution
\param id volume set id
\param xres,yres,zres x/y/z resolution value
@@ -1033,7 +1043,7 @@
geovol *gvl;
int i;
- G_debug(3, "GVL_slice_set_drawres");
+ G_debug(3, "GVL_slice_set_drawres(): id=%d", id);
if (xres < 1 || yres < 1 || zres < 1) {
return (-1);
@@ -1093,7 +1103,7 @@
{
geovol *gvl;
- G_debug(3, "GVL_slice_set_drawmode");
+ G_debug(3, "GVL_slice_set_drawmode(): id=%d, mode=%d", id, mode);
gvl = gvl_get_vol(id);
Modified: grass/trunk/lib/ogsf/gp.c
===================================================================
--- grass/trunk/lib/ogsf/gp.c 2008-08-07 14:51:07 UTC (rev 32616)
+++ grass/trunk/lib/ogsf/gp.c 2008-08-07 14:53:05 UTC (rev 32617)
@@ -37,7 +37,7 @@
{
geosite *gp;
- G_debug(4, "gp_get_site");
+ G_debug(5, "gp_get_site");
for (gp = Site_top; gp; gp = gp->next) {
if (gp->gsite_id == id) {
@@ -60,7 +60,7 @@
{
geosite *pp;
- G_debug(4, "gp_get_prev_site");
+ G_debug(5, "gp_get_prev_site");
for (pp = Site_top; pp; pp = pp->next) {
if (pp->gsite_id == id - 1) {
@@ -83,7 +83,7 @@
for (i = 0, gp = Site_top; gp; gp = gp->next, i++) ;
- G_debug(4, "gp_num_sites(): n=%d", i);
+ G_debug(5, "gp_num_sites(): n=%d", i);
return (i);
}
@@ -98,7 +98,7 @@
{
geosite *lp;
- G_debug(4, "gp_get_last_site");
+ G_debug(5, "gp_get_last_site");
if (!Site_top) {
return (NULL);
@@ -106,7 +106,7 @@
for (lp = Site_top; lp->next; lp = lp->next) ;
- G_debug(4, " last site id: %d", lp->gsite_id);
+ G_debug(5, " last site id: %d", lp->gsite_id);
return (lp);
}
@@ -121,7 +121,7 @@
{
geosite *np, *lp;
- G_debug(4, "gp_get_new_site");
+ G_debug(5, "gp_get_new_site");
np = (geosite *) G_malloc(sizeof(geosite)); /* G_fatal_error */
if (!np) {
@@ -185,7 +185,7 @@
int i;
float dim;
- G_debug(4, "gp_set_defaults");
+ G_debug(5, "gp_set_defaults");
if (!gp) {
return (-1);
@@ -249,7 +249,7 @@
*/
int gp_init_site(geosite * gp)
{
- G_debug(4, "gp_init_site");
+ G_debug(5, "gp_init_site");
if (!gp) {
return (-1);
@@ -267,7 +267,7 @@
{
geosite *fp;
- G_debug(4, "gp_delete_site");
+ G_debug(5, "gp_delete_site");
fp = gp_get_site(id);
@@ -291,7 +291,7 @@
geosite *gp;
int found = 0;
- G_debug(4, "gp_free_site");
+ G_debug(5, "gp_free_site");
if (Site_top) {
if (fp == Site_top) {
Modified: grass/trunk/lib/ogsf/gs.c
===================================================================
--- grass/trunk/lib/ogsf/gs.c 2008-08-07 14:51:07 UTC (rev 32616)
+++ grass/trunk/lib/ogsf/gs.c 2008-08-07 14:53:05 UTC (rev 32617)
@@ -63,11 +63,11 @@
{
geosurf *gs;
- G_debug(4, "gs_get_surf():");
+ G_debug(5, "gs_get_surf():");
for (gs = Surf_top; gs; gs = gs->next) {
if (gs->gsurf_id == id) {
- G_debug(4, " id=%d", id);
+ G_debug(5, " id=%d", id);
return (gs);
}
}
@@ -87,7 +87,7 @@
{
geosurf *ps;
- G_debug(4, "gs_get_prev_surface");
+ G_debug(5, "gs_get_prev_surface");
for (ps = Surf_top; ps; ps = ps->next) {
if (ps->gsurf_id == id - 1) {
@@ -114,7 +114,7 @@
gsurfs[i] = gs;
}
- G_debug(4, "gs_num_surfaces(): num=%d", i);
+ G_debug(5, "gs_num_surfaces(): num=%d", i);
return (i);
}
@@ -131,7 +131,7 @@
for (i = 0, gs = Surf_top; gs; gs = gs->next, i++) ;
- G_debug(4, "gs_num_surfaces(): num=%d", i);
+ G_debug(5, "gs_num_surfaces(): num=%d", i);
return (i);
}
@@ -179,7 +179,7 @@
for (ls = Surf_top; ls->next; ls = ls->next) ;
- G_debug(4, "gs_get_last_surface(): last surface id=%d", ls->gsurf_id);
+ G_debug(5, "gs_get_last_surface(): last surface id=%d", ls->gsurf_id);
return (ls);
}
@@ -210,7 +210,7 @@
ns->next = NULL;
- G_debug(4, "gs_get_new_surface(): id=%d", ns->gsurf_id);
+ G_debug(5, "gs_get_new_surface(): id=%d", ns->gsurf_id);
return (ns);
}
@@ -235,7 +235,7 @@
geosurf *ps;
int i;
- G_debug(4, "gs_init_surf() id=%d", gs->gsurf_id);
+ G_debug(5, "gs_init_surf() id=%d", gs->gsurf_id);
if (!gs) {
return (-1);
@@ -245,6 +245,12 @@
for (i = 0; i < MAX_ATTS; i++) {
gs->att[i].att_src = NOTSET_ATT;
gs->att[i].att_type = ATTY_INT;
+ gs->att[i].hdata = -1;
+ gs->att[i].user_func = NULL;
+ gs->att[i].constant = 0.;
+ gs->att[i].lookup = NULL;
+ gs->att[i].min_nz = gs->att[i].max_nz = gs->att[i].range_nz = 0;
+ gs->att[i].default_null = 0.;
}
/* default values */
@@ -264,6 +270,9 @@
gs->ymin = oy;
gs->ymax = oy + (rows - 1) * yres;
gs->yrange = gs->ymax - gs->ymin;
+ gs->zmin = gs->zmin_nz = gs->zminmasked = 0;
+ gs->zmax = gs->zmax_nz = 0;
+ gs->zrange = gs->zrange_nz = 0;
gs->wire_color = 0x00888888;
gs->x_trans = gs->y_trans = gs->z_trans = 0.0;
gs->nz_topo = gs->nz_color = 0;
@@ -272,6 +281,8 @@
gs->curmask = NULL;
gs->norms = NULL;
+ gs->draw_mode = DM_GOURAUD;
+
/* default z_exag value */
if (gs->gsurf_id == FIRST_SURF_ID) {
gs->z_exag = 1.0;
@@ -431,7 +442,7 @@
{
int i;
- G_debug(4, "gs_set_defaults(): id=%d", gs->gsurf_id);
+ G_debug(5, "gs_set_defaults(): id=%d", gs->gsurf_id);
for (i = 0; i < MAX_ATTS; i++) {
gs->att[i].constant = defs[i];
@@ -453,7 +464,7 @@
{
geosurf *fs;
- G_debug(4, "gs_delete_surf");
+ G_debug(5, "gs_delete_surf");
fs = gs_get_surf(id);
@@ -478,7 +489,7 @@
geosurf *gs;
int found = 0;
- G_debug(4, "gs_free_surf");
+ G_debug(5, "gs_free_surf");
if (Surf_top) {
if (fs == Surf_top) {
@@ -549,7 +560,7 @@
int i, j, same;
int old_datah;
- G_debug(4, "gs_free_unshared_buffs");
+ G_debug(5, "gs_free_unshared_buffs");
/* for each attribute
if !same, free buff
@@ -588,7 +599,7 @@
geosurf *gs;
int ref, j;
- G_debug(4, "gs_num_datah_reused");
+ G_debug(5, "gs_num_datah_reused");
/* for each attribute
if same, ++reference
@@ -618,7 +629,7 @@
*/
int gs_get_att_type(geosurf * gs, int desc)
{
- G_debug(4, "gs_get_att_type");
+ G_debug(5, "gs_get_att_type");
if (!LEGAL_ATT(desc)) {
return (-1);
@@ -644,7 +655,7 @@
*/
int gs_get_att_src(geosurf * gs, int desc)
{
- G_debug(4, "gs_get_att_src(): id=%d desc=%d", gs->gsurf_id, desc);
+ G_debug(5, "gs_get_att_src(): id=%d desc=%d", gs->gsurf_id, desc);
if (!LEGAL_ATT(desc)) {
return (-1);
@@ -672,7 +683,7 @@
typbuff *tb;
geosurf *gsref;
- G_debug(4, "gs_get_att_typbuff(): id=%d desc=%d to_write=%d",
+ G_debug(5, "gs_get_att_typbuff(): id=%d desc=%d to_write=%d",
gs->gsurf_id, desc, to_write);
if (gs) {
@@ -708,7 +719,7 @@
{
int hdata, dims[2], ndims;
- G_debug(4, "gs_malloc_att_buff");
+ G_debug(5, "gs_malloc_att_buff");
if (gs) {
if (0 < (hdata = gs->att[desc].hdata)) {
@@ -737,7 +748,7 @@
{
int size;
- G_debug(4, "gs_malloc_lookup");
+ G_debug(5, "gs_malloc_lookup");
if (gs) {
if (gs->att[desc].lookup) {
@@ -793,7 +804,7 @@
int gs_set_att_type(geosurf * gs, int desc, int type)
{
- G_debug(4, "gs_set_att_type(): desc=%d, type=%d", desc, type);
+ G_debug(5, "gs_set_att_type(): desc=%d, type=%d", desc, type);
if (gs && LEGAL_TYPE(type)) {
gs->att[desc].att_type = type;
@@ -816,14 +827,14 @@
*/
int gs_set_att_src(geosurf * gs, int desc, int src)
{
- G_debug(4, "gs_set_att_src(): id=%d desc=%d src=%d",
+ G_debug(5, "gs_set_att_src(): id=%d desc=%d src=%d",
gs->gsurf_id, desc, src);
/* check if old source was MAP_ATT, free buff */
if (MAP_ATT == gs_get_att_src(gs, desc)) {
if (1 == gs_num_datah_reused(gs->att[desc].hdata)) {
/* only reference */
- G_debug(4, "gs_set_att_src(): replacing existing map");
+ G_debug(5, "gs_set_att_src(): replacing existing map");
gsds_free_datah(gs->att[desc].hdata);
}
@@ -860,7 +871,7 @@
*/
int gs_set_att_const(geosurf * gs, int desc, float constant)
{
- G_debug(4, "gs_set_att_const(): id=%d, desc=%d, const=%f",
+ G_debug(5, "gs_set_att_const(): id=%d, desc=%d, const=%f",
gs->gsurf_id, desc, constant);
if (gs) {
Modified: grass/trunk/lib/ogsf/gs_bm.c
===================================================================
--- grass/trunk/lib/ogsf/gs_bm.c 2008-08-07 14:51:07 UTC (rev 32616)
+++ grass/trunk/lib/ogsf/gs_bm.c 2008-08-07 14:53:05 UTC (rev 32617)
@@ -236,7 +236,7 @@
int row, col, offset, destroy_ok = 1;
gsurf_att *coloratt;
- G_debug(4, "gs_update_curmask(): id=%d", surf->gsurf_id);
+ G_debug(5, "gs_update_curmask(): id=%d", surf->gsurf_id);
if (surf->mask_needupdate) {
surf->mask_needupdate = 0;
@@ -304,24 +304,24 @@
}
if (b_topo) {
- G_debug(4, "gs_update_curmask(): update topo mask");
+ G_debug(5, "gs_update_curmask(): update topo mask");
gsbm_or_masks(surf->curmask, b_topo);
BM_destroy(b_topo);
}
if (b_color) {
- G_debug(4, "gs_update_curmask(): update color mask");
+ G_debug(5, "gs_update_curmask(): update color mask");
gsbm_or_masks(surf->curmask, b_color);
BM_destroy(b_color);
}
if (t_topo->nm) {
- G_debug(4, "gs_update_curmask(): update elev null mask");
+ G_debug(5, "gs_update_curmask(): update elev null mask");
gsbm_or_masks(surf->curmask, t_topo->nm);
}
if (b_mask) {
- G_debug(4, "gs_update_curmask(): update mask mask");
+ G_debug(5, "gs_update_curmask(): update mask mask");
if (t_mask->bm) {
if (surf->att[ATT_MASK].constant) {
Modified: grass/trunk/lib/ogsf/gs_norms.c
===================================================================
--- grass/trunk/lib/ogsf/gs_norms.c 2008-08-07 14:51:07 UTC (rev 32616)
+++ grass/trunk/lib/ogsf/gs_norms.c 2008-08-07 14:53:05 UTC (rev 32617)
@@ -142,7 +142,7 @@
init_vars(gs);
- G_debug(4, "gs_calc_normals(): id=%d", gs->gsurf_id);
+ G_debug(5, "gs_calc_normals(): id=%d", gs->gsurf_id);
/* first row - just use single cell */
/* first col - use bottom & right neighbors */
@@ -159,7 +159,7 @@
/* now use four neighboring points for rows 1 - (n-1) */
for (row = 1; row < ycnt; row++) {
if (!(row % 100))
- G_debug(4, "gs_calc_normals(): row=%d", row);
+ G_debug(5, "gs_calc_normals(): row=%d", row);
/* turn off left neighbor for first col */
calc_norm(gs, row * ymod, 0, ~NLFT);
Modified: grass/trunk/lib/ogsf/gsd_surf.c
===================================================================
--- grass/trunk/lib/ogsf/gsd_surf.c 2008-08-07 14:51:07 UTC (rev 32616)
+++ grass/trunk/lib/ogsf/gsd_surf.c 2008-08-07 14:53:05 UTC (rev 32617)
@@ -82,7 +82,7 @@
{
int desc, ret;
- G_debug(4, "gsd_surf(): id=%d", surf->gsurf_id);
+ G_debug(5, "gsd_surf(): id=%d", surf->gsurf_id);
desc = ATT_TOPO;
@@ -706,8 +706,8 @@
show_colormode();
#ifdef CALC_AREA
- G_debug(4, " Surface Area: %.12lf", asurf);
- G_debug(4, " Exaggerated Surface Area: %.12lf", axsurf);
+ G_debug(5, " Surface Area: %.12lf", asurf);
+ G_debug(5, " Exaggerated Surface Area: %.12lf", axsurf);
#endif
return (0);
@@ -747,7 +747,7 @@
unsigned int ktrans = 255;
- G_debug(4, "gsd_surf_const(): id=%d", surf->gsurf_id);
+ G_debug(5, "gsd_surf_const(): id=%d", surf->gsurf_id);
if (GS_check_cancel()) {
return (-1);
@@ -1513,7 +1513,7 @@
&tx, &ty)) {
/* crossing going up */
- G_debug(4,
+ G_debug(5,
"crossing going up at surf %d no. %d",
n, i);
@@ -1550,7 +1550,7 @@
[Z], &tx, &ty)) {
/* crossing going down */
- G_debug(4,
+ G_debug(5,
"crossing going down at surf %d no. %d",
n, i);
@@ -1599,7 +1599,7 @@
lower = 1;
}
#endif
- G_debug(4,
+ G_debug(5,
"lower crossing at surf %d no. %d between surfs %d & %d",
n, i, bn, bnl);
@@ -1629,16 +1629,16 @@
#ifdef CPDEBUG
{
if (!upper && !lower) {
- G_debug(4,
+ G_debug(5,
"Crossing NOT found or masked:");
- G_debug(4,
+ G_debug(5,
" current surf: %d [ %.2f %.2f %.2f -> %.2f %.2f %f",
n, points[n][i - 1][X],
points[n][i - 1][Y],
points[n][i - 1][Z],
points[n][i][X], points[n][i][Y],
points[n][i][Z]);
- G_debug(4,
+ G_debug(5,
" below surf: %d [ %.2f %.2f %.2f -> %.2f %.2f %f\n",
bn, points[bn][i - 1][X],
points[bn][i - 1][Y],
@@ -1646,7 +1646,7 @@
points[bn][i][X],
points[bn][i][Y],
points[bn][i][Z]);
- G_debug(4,
+ G_debug(5, gs
" last below surf: %d [ %.2f %.2f %.2f -> %.2f %.2f %f\n",
bnl, points[bnl][i - 1][X],
points[bnl][i - 1][Y],
Modified: grass/trunk/lib/ogsf/gsdrape.c
===================================================================
--- grass/trunk/lib/ogsf/gsdrape.c 2008-08-07 14:51:07 UTC (rev 32616)
+++ grass/trunk/lib/ogsf/gsdrape.c 2008-08-07 14:53:05 UTC (rev 32617)
@@ -164,7 +164,7 @@
*num = order_intersects(gs, f, l, vi, hi, di);
/* fills in return values, eliminates dupes (corners) */
- G_debug(4, "_gsdrape_get_segments vi=%d, hi=%d, di=%d, num=%d",
+ G_debug(5, "_gsdrape_get_segments vi=%d, hi=%d, di=%d, num=%d",
vi, hi, di, *num);
return (I3d);
@@ -837,10 +837,10 @@
}
if (i == cv + ch + cd) {
- G_debug(4, "order_intersects(): stuck on %d", cnum);
- G_debug(4, "order_intersects(): cv = %d, ch = %d, cd = %d", cv,
+ G_debug(5, "order_intersects(): stuck on %d", cnum);
+ G_debug(5, "order_intersects(): cv = %d, ch = %d, cd = %d", cv,
ch, cd);
- G_debug(4, "order_intersects(): dv = %f, dh = %f, dd = %f", dv,
+ G_debug(5, "order_intersects(): dv = %f, dh = %f, dd = %f", dv,
dh, dd);
break;
Modified: grass/trunk/lib/ogsf/gv.c
===================================================================
--- grass/trunk/lib/ogsf/gv.c 2008-08-07 14:51:07 UTC (rev 32616)
+++ grass/trunk/lib/ogsf/gv.c 2008-08-07 14:53:05 UTC (rev 32617)
@@ -38,7 +38,7 @@
{
geovect *gv;
- G_debug(4, "gv_get_vect() id=%d", id);
+ G_debug(5, "gv_get_vect() id=%d", id);
for (gv = Vect_top; gv; gv = gv->next) {
if (gv->gvect_id == id) {
@@ -61,7 +61,7 @@
{
geovect *pv;
- G_debug(4, "gv_get_prev_vect(): id=%d", id);
+ G_debug(5, "gv_get_prev_vect(): id=%d", id);
for (pv = Vect_top; pv; pv = pv->next) {
if (pv->gvect_id == id - 1) {
@@ -84,7 +84,7 @@
for (i = 0, gv = Vect_top; gv; gv = gv->next, i++) ;
- G_debug(4, "gv_num_vects(): num=%d", i);
+ G_debug(5, "gv_num_vects(): num=%d", i);
return (i);
}
@@ -105,7 +105,7 @@
for (lv = Vect_top; lv->next; lv = lv->next) ;
- G_debug(4, "gv_get_last_vect(): id=%d", lv->gvect_id);
+ G_debug(5, "gv_get_last_vect(): id=%d", lv->gvect_id);
return (lv);
}
@@ -137,7 +137,7 @@
nv->next = NULL;
- G_debug(4, "gv_get_new_vect() id=%d", nv->gvect_id);
+ G_debug(5, "gv_get_new_vect() id=%d", nv->gvect_id);
return (nv);
}
@@ -181,7 +181,7 @@
{
int i;
- G_debug(4, "gv_set_defaults() id=%d", gv->gvect_id);
+ G_debug(5, "gv_set_defaults() id=%d", gv->gvect_id);
if (!gv) {
return (-1);
@@ -217,7 +217,7 @@
return (-1);
}
- G_debug(4, "gv_init_vect() id=%d", gv->gvect_id);
+ G_debug(5, "gv_init_vect() id=%d", gv->gvect_id);
return (0);
}
@@ -231,7 +231,7 @@
{
geovect *fv;
- G_debug(4, "gv_delete_vect(): id=%d", id);
+ G_debug(5, "gv_delete_vect(): id=%d", id);
fv = gv_get_vect(id);
@@ -281,7 +281,7 @@
}
if (found) {
- G_debug(4, "gv_free_vect(): id=%d", fv->gvect_id);
+ G_debug(5, "gv_free_vect(): id=%d", fv->gvect_id);
gv_free_vectmem(fv);
G_free(fv);
fv = NULL;
Modified: grass/trunk/lib/ogsf/gvd.c
===================================================================
--- grass/trunk/lib/ogsf/gvd.c 2008-08-07 14:51:07 UTC (rev 32616)
+++ grass/trunk/lib/ogsf/gvd.c 2008-08-07 14:53:05 UTC (rev 32617)
@@ -89,7 +89,7 @@
int npts, src, check;
geoline *gln;
- G_debug(4, "gvd_vect(): id=%d", gv->gvect_id);
+ G_debug(5, "gvd_vect(): id=%d", gv->gvect_id);
if (GS_check_cancel()) {
return (0);
@@ -139,7 +139,7 @@
}
for (; gln; gln = gln->next) {
- G_debug(4, "gvd_vect(): type = %d dims = %d", gln->type, gln->dims);
+ G_debug(5, "gvd_vect(): type = %d dims = %d", gln->type, gln->dims);
if (!(++check % CHK_FREQ)) {
if (GS_check_cancel()) {
@@ -152,7 +152,7 @@
if (gln->type == OGSF_LINE) { /* line */
if (gln->dims == 2) { /* 2d line */
- G_debug(4, "gvd_vect(): 2D vector line");
+ G_debug(5, "gvd_vect(): 2D vector line");
for (k = 0; k < gln->npts - 1; k++) {
bgn[X] = gln->p2[k][X] + gv->x_trans - gs->ox;
bgn[Y] = gln->p2[k][Y] + gv->y_trans - gs->oy;
@@ -202,7 +202,7 @@
}
else { /* 3D line */
- G_debug(4, "gvd_vect(): 3D vector line");
+ G_debug(5, "gvd_vect(): 3D vector line");
points = (Point3 *) malloc(sizeof(Point3));
gsd_color_func(gv->color);
@@ -222,7 +222,7 @@
}
else if (gln->type == OGSF_POLYGON) { /* polygon */
if (gln->dims == 3) { /* 3D polygon */
- G_debug(4, "gvd_vect(): draw 3D polygon");
+ G_debug(5, "gvd_vect(): draw 3D polygon");
/* We want at least 3 points */
if (gln->npts >= 3) {
Modified: grass/trunk/lib/ogsf/gvl.c
===================================================================
--- grass/trunk/lib/ogsf/gvl.c 2008-08-07 14:51:07 UTC (rev 32616)
+++ grass/trunk/lib/ogsf/gvl.c 2008-08-07 14:53:05 UTC (rev 32617)
@@ -29,7 +29,7 @@
static geovol *Vol_top = NULL;
/*!
- \brief Get volume
+ \brief Get volume set structure
\param id volume set id
@@ -40,10 +40,11 @@
{
geovol *gvl;
- G_debug(3, "gvl_get_vol");
+ G_debug(5, "gvl_get_vol():");
for (gvl = Vol_top; gvl; gvl = gvl->next) {
if (gvl->gvol_id == id) {
+ G_debug(5, " id=%d", id);
return (gvl);
}
}
@@ -63,7 +64,7 @@
{
geovol *pv;
- G_debug(3, "gvl_get_prev_vol");
+ G_debug(5, "gvl_get_prev_vol");
for (pv = Vol_top; pv; pv = pv->next) {
if (pv->gvol_id == id - 1) {
@@ -86,7 +87,7 @@
geovol *gvl;
int i;
- G_debug(3, "gvl_getall_vols");
+ G_debug(5, "gvl_getall_vols");
for (i = 0, gvl = Vol_top; gvl; gvl = gvl->next, i++) {
gvols[i] = gvl;
@@ -96,7 +97,7 @@
}
/*!
- \brief Get number of registrated volume sets
+ \brief Get number of loaded volume sets
\return number of volumes
*/
@@ -105,15 +106,15 @@
geovol *gvl;
int i;
- G_debug(3, "gvl_num_vols");
-
for (i = 0, gvl = Vol_top; gvl; gvl = gvl->next, i++) ;
+ G_debug(5, "gvl_num_vols(): num=%d", i);
+
return (i);
}
/*!
- \brief Get last volume
+ \brief Get last volume set from the list
\return pointer to geovol struct
\return NULL on failure
@@ -122,7 +123,7 @@
{
geovol *lvl;
- G_debug(3, "gvl_get_last_vol");
+ G_debug(5, "gvl_get_last_vol");
if (!Vol_top) {
return (NULL);
@@ -130,7 +131,7 @@
for (lvl = Vol_top; lvl->next; lvl = lvl->next) ;
- G_debug(3, " last vol id: %d", lvl->gvol_id);
+ G_debug(5, " last vol id: %d", lvl->gvol_id);
return (lvl);
}
@@ -138,14 +139,14 @@
/*!
\brief Allocate new volume set and add it to the list
- \return pointer to new geovol struct
+ \return pointer to geovol struct
\return NULL on failure
*/
geovol *gvl_get_new_vol(void)
{
geovol *nvl, *lvl;
- G_debug(3, "gvl_get_new_vol");
+ G_debug(5, "gvl_get_new_vol()");
nvl = (geovol *) G_malloc(sizeof(geovol)); /* G_fatal_error */
if (!nvl) {
@@ -163,11 +164,13 @@
nvl->next = NULL;
+ G_debug(5, " id=%d", nvl->gvol_id);
+
return (nvl);
}
/*!
- \brief Initialize volume
+ \brief Initialize geovol structure
\param gvl pointer to geovol struct
\param ox,oy,oz
@@ -182,7 +185,7 @@
int rows, int cols, int depths, double xres, double yres,
double zres)
{
- G_debug(3, "gvl_init_vol");
+ G_debug(5, "gvl_init_vol() id=%d", gvl->gvol_id);
if (!gvl) {
return (-1);
@@ -199,26 +202,30 @@
gvl->zres = zres;
gvl->xmin = ox;
- gvl->xmax = ox + cols * xres;
+ gvl->xmax = ox + (cols - 1) * xres;
gvl->xrange = gvl->xmax - gvl->xmin;
gvl->ymin = oy;
- gvl->ymax = oy + rows * yres;
+ gvl->ymax = oy + (rows - 1) * yres;
gvl->yrange = gvl->ymax - gvl->ymin;
gvl->zmin = oz;
- gvl->zmax = oz + depths * zres;
+ gvl->zmax = oz + (depths - 1) * zres;
gvl->zrange = gvl->zmax - gvl->zmin;
gvl->x_trans = gvl->y_trans = gvl->z_trans = 0.0;
gvl->n_isosurfs = 0;
+ G_zero(gvl->isosurf, sizeof(geovol_isosurf *) * MAX_ISOSURFS);
gvl->isosurf_x_mod = 1;
gvl->isosurf_y_mod = 1;
gvl->isosurf_z_mod = 1;
+ gvl->isosurf_draw_mode = DM_GOURAUD;
gvl->n_slices = 0;
+ G_zero(gvl->slice, sizeof(geovol_slice *) * MAX_SLICES);
gvl->slice_x_mod = 1;
gvl->slice_y_mod = 1;
gvl->slice_z_mod = 1;
+ gvl->slice_draw_mode = DM_GOURAUD;
gvl->hfile = -1;
gvl->clientdata = NULL;
@@ -235,7 +242,7 @@
{
geovol *fvl;
- G_debug(3, "gvl_delete_vol");
+ G_debug(5, "gvl_delete_vol");
fvl = gvl_get_vol(id);
@@ -259,7 +266,7 @@
geovol *gvl;
int found = 0;
- G_debug(3, "gvl_free_vol");
+ G_debug(5, "gvl_free_vol");
if (Vol_top) {
if (fvl == Vol_top) {
@@ -318,15 +325,15 @@
*/
void print_vol_fields(geovol * gvl)
{
- G_debug(4, "ID: %d", gvl->gvol_id);
- G_debug(4, "cols: %d rows: %d depths: %d", gvl->cols, gvl->rows,
+ G_debug(5, "ID: %d", gvl->gvol_id);
+ G_debug(5, "cols: %d rows: %d depths: %d", gvl->cols, gvl->rows,
gvl->depths);
- G_debug(4, "ox: %lf oy: %lf oz: %lf", gvl->ox, gvl->oy, gvl->oz);
- G_debug(4, "xres: %lf yres: %lf zres: %lf", gvl->xres, gvl->yres,
+ G_debug(5, "ox: %lf oy: %lf oz: %lf", gvl->ox, gvl->oy, gvl->oz);
+ G_debug(5, "xres: %lf yres: %lf zres: %lf", gvl->xres, gvl->yres,
gvl->zres);
- G_debug(4, "xmin: %f ymin: %f zmin: %f", gvl->xmin, gvl->ymin, gvl->zmin);
- G_debug(4, "xmax: %f ymax: %f zmax: %f", gvl->xmax, gvl->ymax, gvl->zmax);
- G_debug(4, "x_trans: %f y_trans: %f z_trans: %f", gvl->x_trans,
+ G_debug(5, "xmin: %f ymin: %f zmin: %f", gvl->xmin, gvl->ymin, gvl->zmin);
+ G_debug(5, "xmax: %f ymax: %f zmax: %f", gvl->xmax, gvl->ymax, gvl->zmax);
+ G_debug(5, "x_trans: %f y_trans: %f z_trans: %f", gvl->x_trans,
gvl->y_trans, gvl->z_trans);
return;
@@ -511,7 +518,7 @@
{
int i;
- G_debug(3, "gvl_isosurf_init");
+ G_debug(5, "gvl_isosurf_init");
if (!isosurf)
return (-1);
@@ -541,7 +548,7 @@
{
int i;
- G_debug(3, "gvl_isosurf_freemem");
+ G_debug(5, "gvl_isosurf_freemem");
if (!isosurf)
return (-1);
@@ -591,7 +598,7 @@
*/
int gvl_isosurf_get_att_src(geovol_isosurf * isosurf, int desc)
{
- G_debug(3, "isosurf_get_att_src");
+ G_debug(5, "isosurf_get_att_src");
if (!LEGAL_ATT(desc)) {
return (-1);
@@ -616,7 +623,7 @@
*/
int gvl_isosurf_set_att_src(geovol_isosurf * isosurf, int desc, int src)
{
- G_debug(3, "gvl_isosurf_set_att_src");
+ G_debug(5, "gvl_isosurf_set_att_src");
/* check if old source was MAP_ATT, deattach volfile */
if (MAP_ATT == gvl_isosurf_get_att_src(isosurf, desc)) {
@@ -650,7 +657,7 @@
int gvl_isosurf_set_att_const(geovol_isosurf * isosurf, int desc,
float constant)
{
- G_debug(3, "gvl_isosurf_set_att_const");
+ G_debug(5, "gvl_isosurf_set_att_const");
if (isosurf) {
isosurf->att[desc].constant = constant;
@@ -678,7 +685,7 @@
{
int hfile;
- G_debug(3, "gvl_isosurf_set_att_map(): att_map: %s", filename);
+ G_debug(5, "gvl_isosurf_set_att_map(): att_map: %s", filename);
if (isosurf) {
if (0 > (hfile = gvl_file_newh(filename, VOL_FTYPE_G3D)))
@@ -710,7 +717,7 @@
{
int i;
- G_debug(3, "gvl_isosurf_set_att_changed");
+ G_debug(5, "gvl_isosurf_set_att_changed");
if (isosurf && LEGAL_ATT(desc)) {
isosurf->att[desc].changed = 1;
@@ -741,7 +748,7 @@
*/
int gvl_slice_init(geovol_slice * slice)
{
- G_debug(3, "gvl_slice_init");
+ G_debug(5, "gvl_slice_init");
if (!slice)
return (-1);
@@ -767,7 +774,7 @@
*/
int gvl_slice_freemem(geovol_slice * slice)
{
- G_debug(3, "gvl_slice_freemem");
+ G_debug(5, "gvl_slice_freemem");
if (!slice)
return (-1);
Modified: grass/trunk/lib/ogsf/gvl_calc.c
===================================================================
--- grass/trunk/lib/ogsf/gvl_calc.c 2008-08-07 14:51:07 UTC (rev 32616)
+++ grass/trunk/lib/ogsf/gvl_calc.c 2008-08-07 14:53:05 UTC (rev 32617)
@@ -1008,17 +1008,19 @@
}
/*!
- \brief Calculate slices
+ \brief Calculate slices for given volume set
\param gvol pointer to geovol struct
\return 1
*/
-int gvl_slices_calc(geovol * gvol)
+int gvl_slices_calc(geovol *gvol)
{
int i;
void *colors;
+ G_debug(5, "gvl_slices_calc(): id=%d", gvol->gvol_id);
+
/* set current resolution */
ResX = gvol->slice_x_mod;
ResY = gvol->slice_y_mod;
Modified: grass/trunk/lib/ogsf/gvl_file.c
===================================================================
--- grass/trunk/lib/ogsf/gvl_file.c 2008-08-07 14:51:07 UTC (rev 32616)
+++ grass/trunk/lib/ogsf/gvl_file.c 2008-08-07 14:53:05 UTC (rev 32617)
@@ -219,7 +219,7 @@
}
/*!
- \brief Open volume file
+ \brief Open 3d raster file
\param name file name
\param file_type file type
@@ -367,7 +367,7 @@
int i, j, found = -1;
geovol_file *fvf;
- G_debug(3, "gvl_file_free_datah");
+ G_debug(5, "gvl_file_free_datah(): id=%d", id);
for (i = 0; i < Numfiles; i++) {
if (Data[i]->data_id == id) {
@@ -406,7 +406,7 @@
/******************************************************************/
/*!
- \brief Open g3d file
+ \brief Open 3d raster file
\param filename file name
\param type data type
@@ -440,7 +440,7 @@
/* load range into range structure of map */
if (!G3d_range_load(map)) {
- G_warning("Unable to read range of 3D raster map <%s>", filename);
+ G_warning(_("Unable to read range of 3D raster map <%s>"), filename);
return (NULL);
}
@@ -1109,7 +1109,7 @@
\brief Set read mode
\param vf pointer to geovol_file struct
- \param mode
+ \param mode read mode
\return -1 on failure
\return 1 on success
Modified: grass/trunk/lib/ogsf/gvld.c
===================================================================
--- grass/trunk/lib/ogsf/gvld.c 2008-08-07 14:51:07 UTC (rev 32616)
+++ grass/trunk/lib/ogsf/gvld.c 2008-08-07 14:53:05 UTC (rev 32617)
@@ -27,22 +27,22 @@
#define READ() gvl_read_char(pos[i]++, gvl->isosurf[i]->data)
/*!
- \brief ADD
+ \brief Draw volume set (slices and isosurfaces)
\param gvl pointer to geovol struct
\return -1 on failure
\return 1 on success
*/
-int gvld_vol(geovol * gvl)
+int gvld_vol(geovol *gvl)
{
- G_debug(3, "gvld_vol");
+ G_debug(5, "gvld_vol(): id=%d", gvl->gvol_id);
/* SLICES */
/* calculate slices data, if slices changed */
if (0 > gvl_slices_calc(gvl))
return (-1);
- /* draw isosurfaces */
+ /* draw slices */
if (0 > gvld_slices(gvl))
return (-1);
@@ -67,7 +67,7 @@
*/
int gvld_wire_vol(geovol * gvl)
{
- G_debug(3, "gvld_vol");
+ G_debug(5, "gvld_vol");
gvld_wind3_box(gvl);
@@ -133,9 +133,9 @@
nz = G_malloc(n_i * sizeof(int));
e_dl = G_malloc(n_i * sizeof(int));
- G_debug(3, "gvld_isosurf():");
+ G_debug(5, "gvld_isosurf():");
for (i = 0; i < gvl->n_isosurfs; i++) {
- G_debug(4, " start : gvl: %s isosurf : %d\n",
+ G_debug(5, " start : gvl: %s isosurf : %d\n",
gvl_file_get_name(gvl->hfile), i);
}
@@ -239,14 +239,14 @@
nz[i] = 0;
}
- G_debug(3, " intialize OK");
+ G_debug(5, " intialize OK");
for (z = 0; z < depths - 1; z++) {
zc = z * zres;
if (GS_check_cancel()) {
for (i = 0; i < gvl->n_isosurfs; i++) {
- G_debug(4, " break : isosurf : %d datalength : %d B\n",
+ G_debug(5, " break : isosurf : %d datalength : %d B\n",
i, pos[i]);
}
@@ -388,7 +388,7 @@
}
for (i = 0; i < gvl->n_isosurfs; i++) {
- G_debug(4, " end : isosurf : %d datalength : %d B\n", i, pos[i]);
+ G_debug(5, " end : isosurf : %d datalength : %d B\n", i, pos[i]);
}
gsd_set_material(1, 1, 0., 0., 0x0);
@@ -434,7 +434,7 @@
GLint viewport[4];
GLint window[4];
- G_debug(3, "gvld_slices");
+ G_debug(5, "gvld_slices");
/* shade */
gsd_shademodel(gvl->slice_draw_mode & DM_GOURAUD);
@@ -668,7 +668,7 @@
geovol_slice *slice;
- G_debug(3, "gvld_wire_slices");
+ G_debug(5, "gvld_wire_slices");
gsd_pushmatrix();
@@ -767,7 +767,7 @@
{
float pt[3];
- G_debug(3, "gvld_wind3_box");
+ G_debug(5, "gvld_wind3_box");
gsd_pushmatrix();
More information about the grass-commit
mailing list