[GRASS-SVN] r47066 - grass/trunk/visualization/nviz2/cmd
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jul 8 12:29:19 EDT 2011
Author: annakrat
Date: 2011-07-08 09:29:19 -0700 (Fri, 08 Jul 2011)
New Revision: 47066
Modified:
grass/trunk/visualization/nviz2/cmd/volume.c
Log:
nviz_cmd: isosurface level is float; fixed setting of resolution and shading
Modified: grass/trunk/visualization/nviz2/cmd/volume.c
===================================================================
--- grass/trunk/visualization/nviz2/cmd/volume.c 2011-07-08 16:26:07 UTC (rev 47065)
+++ grass/trunk/visualization/nviz2/cmd/volume.c 2011-07-08 16:29:19 UTC (rev 47066)
@@ -76,7 +76,8 @@
int add_isosurfs(const struct GParams *params, nv_data *data)
{
int i;
- int num, level, nvols, *vol_list, id, nisosurfs;
+ float level;
+ int num, nvols, *vol_list, id, nisosurfs;
int ncolor_map, ncolor_const, ntransp_map, ntransp_const, nshine_map, nshine_const;
int res, draw_mode;
char **tokens;
@@ -90,7 +91,7 @@
G_fatal_error(_("Error tokenize '%s'"),
params->isosurf_level->answers[i]);
num = atoi(tokens[0]);
- level = atoi(tokens[1]);
+ level = atof(tokens[1]);
G_free_tokens(tokens);
if (num > nvols) {
@@ -112,31 +113,6 @@
nisosurfs-1, ATT_TOPO, id);
}
- /* set resolution */
- if (opt_get_num_answers(params->volume_res) != nvols)
- res = atof(params->volume_res->answers[0]);
- else
- res = atof(params->volume_res->answers[i]);
-
- GVL_isosurf_set_drawres(id, res, res, res);
-
- /* set shading */
- if (opt_get_num_answers(params->volume_shade) != nvols)
- style = params->volume_shade->answers[0];
- else
- style = params->volume_shade->answers[i];
-
- draw_mode = 0;
-
- if (strcmp(style, "flat") == 0) {
- draw_mode |= DM_FLAT;
- }
- else {
- draw_mode |= DM_GOURAUD;
- }
-
- GVL_isosurf_set_drawmode(id, draw_mode);
-
/* color */
ncolor_map = opt_get_num_answers(params->isosurf_color_map);
ncolor_const = opt_get_num_answers(params->isosurf_color_const);
@@ -156,7 +132,7 @@
}
else if (i-ncolor_map < ncolor_const &&
strcmp(params->isosurf_color_const->answers[i-ncolor_map], "")) {
-
+
if (GVL_isosurf_set_att_const(id, nisosurfs-1, ATT_COLOR,
Nviz_color_from_str(params->isosurf_color_const->answers[i-ncolor_map])) < 0)
G_fatal_error(_("Unable to set isosurface (%d) attribute (%d) of volume %d"),
@@ -205,5 +181,35 @@
}
}
+ /* set draw resolution and shading after isosurfaces are added*/
+ for (i = 0; i < nvols; i++) {
+
+ id = vol_list[i];
+ /* set resolution */
+ if (opt_get_num_answers(params->volume_res) != nvols)
+ res = atof(params->volume_res->answers[0]);
+ else
+ res = atof(params->volume_res->answers[i]);
+
+ GVL_isosurf_set_drawres(id, res, res, res);
+
+ /* set shading */
+ if (opt_get_num_answers(params->volume_shade) != nvols)
+ style = params->volume_shade->answers[0];
+ else
+ style = params->volume_shade->answers[i];
+
+ draw_mode = 0;
+
+ if (strcmp(style, "flat") == 0) {
+ draw_mode |= DM_FLAT;
+ }
+ else {
+ draw_mode |= DM_GOURAUD;
+ }
+
+ GVL_isosurf_set_drawmode(id, draw_mode);
+ }
+
return 1;
}
More information about the grass-commit
mailing list