[GRASS5] [GRASS] bug in surf panel in NVIZ

Stéphane Bidet stephane.bidet at tremplin-utc.net
Wed Nov 23 00:09:12 EST 2005


Hi,

I think there was a bug in NVIZ when adding a surface in the "surf" panel.

I'm working with grass-6.0.1 compiled from the source available on the
GRASS web site, and the data set "spearfish60".

The tests have been made on a debian system and a slackware system.

I first launch GRASS with the "elevation.dem" map available in the data
set.

After adding surface like "geology" from the "surf" panel, it seems that
when I press the "RESET" button on the main panel the value for the "exag"
and "height" are not the right one (exag=100 and height=96, the expected
values are exag=1 and height=10576.00)

After adding a constant surface, when I press the reset button I get the
following message:

   Error: floating-pont value too large to represent

   loating-point value too large to represent
   floating-point value too large to represent
   while executing
      "expr int($val * 1)"
      (procedure "Nv_floatscaleCallback" line 57)
   invoked from within
      "Nv_floatscaleCallback $E b 2 Nchange_exag $val"
      (procedure "do_reset" line 12)
   invoked from within
      "do_reset .top2.panelarea.panels.main.midf.pos \
         .top2.panelarea.panels.main.midf.height \
         .top2.panelarea.panels.main.midf.zexag \
         .top2.panelarea.panels.ma..."
   invoked from within
      ".top2.panelarea.panels.main.bframe.reset invoke"
      ("uplevel" body line 1)
   invoked from within
      "uplevel #0 [list $w invoke]"
      (procedure "tk::ButtonUp" line 22)
   invoked from within
      "tk::ButtonUp .top2.panelarea.panels.main.bframe.reset"
      (command bound to event)

I think that the bug resides in "exag.c" file (folder
visualization/nviz/src/ of the GRASS source tree), in the functions
"Nget_first_exag_cmd" and "Nget_height_cmd", they both use
"GS_get_exag_guess" function which can return a very high value if one of
the surface is one the one describes before ("constant" or "goelogy" in
the spearfish data set for example).

I've made a little change to this code and that seems to do the trick:
--- exag.c      2005-11-23 10:47:46.000000000 +1000
+++ exag.c.old  2005-11-23 10:48:33.000000000 +1000
@@ -67,7 +67,7 @@
     exag = 0.0;
     for (i = 0; i < nsurfs; i++) {
        if (GS_get_exag_guess(surf_list[0], &texag) > -1) {
-           if (texag && texag <= 10)
+           if (texag)
                exag = (texag > exag) ? texag : exag;
        }
     }
@@ -104,7 +104,7 @@
        exag = 0.0;
        for (i = 0; i < nsurfs; i++) {
            if (GS_get_exag_guess(surf_list[i], &texag) > -1)
-               if (texag && texag <= 10)
+               if (texag)
                    exag = texag > exag ? texag : exag;
        }
        if (exag == 0.0)

Another bug is when I try to load a state in NVIZ with several surfaces,
the surf panel is not updated correctly, if NVIZ is loaded with 3 surfaces
for example, I can only see one in the surface panel.

I've made a little change to the panel_surf.tcl file and that seems to
work fine:
--- panel_surf.tcl      2005-11-23 14:25:55.000000000 +1000
+++ panel_surf.tcl.old  2005-11-23 14:26:16.000000000 +1000
@@ -258,8 +258,6 @@

 # Load procedure for loading state of Nviz
 proc Nviz_surf_load { file_hook } {
-    Nviz_surf_reset
-
     # Read the number of surfaces saved in this state file
     gets $file_hook num_surfs


I've made several tests after these changes, and it seems to work fine.

Hope that helps.

Regards.

-- 
Stéphane Bidet <stephane.bidet at tremplin-utc.net>
VISLAB developer
http://www.vislab.uq.edu.au/




More information about the grass-dev mailing list