[GRASS-SVN] r42632 - in grass/branches/develbranch_6:
gui/wxpython/gui_modules lib/nviz visualization/nviz2/cmd
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Jun 22 12:53:58 EDT 2010
Author: martinl
Date: 2010-06-22 16:53:58 +0000 (Tue, 22 Jun 2010)
New Revision: 42632
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/wxnviz.py
grass/branches/develbranch_6/lib/nviz/change_view.c
grass/branches/develbranch_6/lib/nviz/exag.c
grass/branches/develbranch_6/lib/nviz/lights.c
grass/branches/develbranch_6/visualization/nviz2/cmd/main.c
Log:
wxGUI/nviz: temp fix (problem with ctypes)
(merge r42631 from trunk)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py 2010-06-22 16:51:49 UTC (rev 42631)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py 2010-06-22 16:53:58 UTC (rev 42632)
@@ -120,6 +120,7 @@
#
self.view = copy.deepcopy(UserSettings.Get(group = 'nviz', key = 'view')) # copy
self.iview = UserSettings.Get(group = 'nviz', key = 'view', internal = True)
+
self.nvizDefault = NvizDefault()
self.light = copy.deepcopy(UserSettings.Get(group = 'nviz', key = 'light')) # copy
@@ -759,6 +760,7 @@
self.iview['height']['value'], \
self.iview['height']['min'], \
self.iview['height']['max'] = self._display.SetViewDefault()
+
self.view['z-exag']['min'] = 0
self.view['z-exag']['max'] = self.view['z-exag']['value'] * 10
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py 2010-06-22 16:51:49 UTC (rev 42631)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py 2010-06-22 16:53:58 UTC (rev 42632)
@@ -1145,8 +1145,8 @@
gridSizer.Add(item = wx.StaticText(panel, id = wx.ID_ANY, label = _("Color:")),
pos = (0, 0), flag = wx.ALIGN_CENTER_VERTICAL)
color = csel.ColourSelect(panel, id = wx.ID_ANY,
- colour = UserSettings.Get(group = 'nviz', key = 'settings',
- subkey = ['light', 'color']),
+ colour = UserSettings.Get(group = 'nviz', key = 'light',
+ subkey = 'color'),
size = globalvar.DIALOG_COLOR_SIZE)
color.Bind(csel.EVT_COLOURSELECT, self.OnLightColor)
gridSizer.Add(item = color, pos = (0, 2))
@@ -2273,7 +2273,7 @@
zmin = self.mapWindow.view['z-exag']['min']
zmax = self.mapWindow.view['z-exag']['max']
zval = self.mapWindow.view['z-exag']['value']
- print hmin, hmax, hval
+
for control in ('spin', 'slider'):
self.FindWindowById(self.win['view']['height'][control]).SetRange(hmin,
hmax)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/wxnviz.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/wxnviz.py 2010-06-22 16:51:49 UTC (rev 42631)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/wxnviz.py 2010-06-22 16:53:58 UTC (rev 42632)
@@ -92,9 +92,12 @@
hmax = c_float()
Nviz_get_exag_height(byref(hdef), byref(hmin), byref(hmax))
- Debug.msg(3, "Nviz::SetViewDefault(): hdef=%f, hmin=%f, hmax=%f",
+ Debug.msg(1, "Nviz::SetViewDefault(): hdef=%f, hmin=%f, hmax=%f",
hdef.value, hmin.value, hmax.value)
+ hdef.value = 805
+ hmin.value = -2944.302979
+ hmax.value = 4555.696777
return (z_exag, hdef.value, hmin.value, hmax.value)
def SetView(self, x, y, height, persp, twist):
@@ -104,10 +107,10 @@
@param persp perpective
@param twist
"""
- Nviz_set_viewpoint_height(self.data, height)
- Nviz_set_viewpoint_position(self.data, x, y)
- Nviz_set_viewpoint_twist(self.data, twist)
- Nviz_set_viewpoint_persp(self.data, persp)
+ Nviz_set_viewpoint_height(height)
+ Nviz_set_viewpoint_position(x, y)
+ Nviz_set_viewpoint_twist(twist)
+ Nviz_set_viewpoint_persp(persp)
Debug.msg(3, "Nviz::SetView(): x=%f, y=%f, height=%f, persp=%f, twist=%f",
x, y, height, persp, twist)
@@ -162,7 +165,7 @@
# initialize view, lights
Nviz_init_view(self.data)
-
+
# clear window
GS_clear(self.data.bgcolor)
Modified: grass/branches/develbranch_6/lib/nviz/change_view.c
===================================================================
--- grass/branches/develbranch_6/lib/nviz/change_view.c 2010-06-22 16:51:49 UTC (rev 42631)
+++ grass/branches/develbranch_6/lib/nviz/change_view.c 2010-06-22 16:53:58 UTC (rev 42632)
@@ -36,6 +36,7 @@
ret = 0;
}
+ G_debug(1, "Nviz_resize_window(): width = %d height = %d", width, height);
GS_set_viewport(0, width, 0, height);
/* GS_clear(0x0000FF); causes red flash - debug only */
@@ -105,7 +106,7 @@
xpos, 1.0 - ypos);
}
- G_debug(3, "Nviz_set_viewpoint_position(): x = %f y = %f", x_pos, y_pos);
+ G_debug(1, "Nviz_set_viewpoint_position(): x = %f y = %f", x_pos, y_pos);
GS_get_from(from);
tempx = xpos * RANGE - RANGE_OFFSET;
@@ -136,6 +137,8 @@
{
float from[3];
+ G_debug(1, "Nviz_set_viewpoint_height(): value = %f", height);
+
GS_get_from_real(from);
if (height != from[Z]) {
@@ -166,6 +169,8 @@
{
int fov;
+ G_debug(1, "Nviz_set_viewpoint_persp(): value = %d", persp);
+
fov = (int)(10 * persp);
GS_set_fov(fov);
@@ -184,6 +189,7 @@
*/
int Nviz_set_viewpoint_twist(int twist)
{
+ G_debug(1, "Nviz_set_viewpoint_twist(): value = %d", twist);
GS_set_twist(10 * twist);
/* Nviz_draw_quick(data); */
@@ -203,6 +209,7 @@
{
double temp;
+ G_debug(1, "Nviz_change_exag(): value = %f", exag);
temp = GS_global_exag();
if (exag != temp) {
Modified: grass/branches/develbranch_6/lib/nviz/exag.c
===================================================================
--- grass/branches/develbranch_6/lib/nviz/exag.c 2010-06-22 16:51:49 UTC (rev 42631)
+++ grass/branches/develbranch_6/lib/nviz/exag.c 2010-06-22 16:53:58 UTC (rev 42632)
@@ -60,6 +60,9 @@
if (max)
*max = fmax;
+ G_debug(1, "Nviz_get_exag_height(): value = %f min = %f max = %f",
+ *val, min ? *min : 0.0 , max ? *max : 0.0);
+
return 1;
}
@@ -91,5 +94,6 @@
if (nsurfs > 0)
G_free(surf_list);
+ G_debug(1, "Nviz_get_exag(): value = %f", exag);
return exag;
}
Modified: grass/branches/develbranch_6/lib/nviz/lights.c
===================================================================
--- grass/branches/develbranch_6/lib/nviz/lights.c 2010-06-22 16:51:49 UTC (rev 42631)
+++ grass/branches/develbranch_6/lib/nviz/lights.c 2010-06-22 16:53:58 UTC (rev 42632)
@@ -35,7 +35,7 @@
ypos = (ypos < 0) ? 0 : (ypos > 1.0) ? 1.0 : ypos;
if (x < 0.0 || x > 1.0 || y < 0.0 || y > 1.0) {
- G_debug(0, "Invalid light position coordinates (%f,%f), using %f,%f",
+ G_debug(1, "Invalid light position coordinates (%f,%f), using %f,%f",
x, y, xpos, 1.0 - ypos);
}
*/
@@ -46,7 +46,7 @@
data->light[num].z = z;
data->light[num].w = w;
- G_debug(0, "Nviz_set_light_position(): num = %d x = %f y = %f z = %f w = %f",
+ G_debug(1, "Nviz_set_light_position(): num = %d x = %f y = %f z = %f w = %f",
num + 1, x, y, z, w);
GS_setlight_position(num + 1, x, y, z, w);
@@ -71,7 +71,7 @@
g = data->light[num].g * data->light[num].brt;
b = data->light[num].b * data->light[num].brt;
- G_debug(0, "Nviz_set_light_bright(): num = %d value = %f r = %f g = %f b = %f",
+ G_debug(1, "Nviz_set_light_bright(): num = %d value = %f r = %f g = %f b = %f",
num + 1, value, r, g, b);
GS_setlight_color(num + 1, r, g, b);
@@ -99,7 +99,7 @@
g = data->light[num].g * data->light[num].brt;
b = data->light[num].b * data->light[num].brt;
- G_debug(0, "Nviz_set_light_color(): num = %d r = %d/%f g = %d/%f b = %d/%f",
+ G_debug(1, "Nviz_set_light_color(): num = %d r = %d/%f g = %d/%f b = %d/%f",
num + 1, red, r, green, g, blue, b);
GS_setlight_color(num + 1, r, g, b);
@@ -120,7 +120,7 @@
data->light[num].ag = value;
data->light[num].ab = value;
- G_debug(0, "Nviz_set_light_ambient(): num = %d value = %f",
+ G_debug(1, "Nviz_set_light_ambient(): num = %d value = %f",
num + 1, value);
GS_setlight_ambient(num + 1, value, value, value);
Modified: grass/branches/develbranch_6/visualization/nviz2/cmd/main.c
===================================================================
--- grass/branches/develbranch_6/visualization/nviz2/cmd/main.c 2010-06-22 16:51:49 UTC (rev 42631)
+++ grass/branches/develbranch_6/visualization/nviz2/cmd/main.c 2010-06-22 16:53:58 UTC (rev 42632)
@@ -87,21 +87,6 @@
/* init view, lights */
Nviz_init_view(&data);
- /* set lights */
- Nviz_set_light_position(&data, 1,
- atof(params->light_pos->answers[0]),
- atof(params->light_pos->answers[1]),
- atof(params->light_pos->answers[2]),
- 0.0);
- Nviz_set_light_bright(&data, 1,
- atoi(params->light_bright->answer) / 100.0);
- if(G_str_to_color(params->light_color->answer, &red, &grn, &blu) != 1) {
- red = grn = blu = 255;
- }
- Nviz_set_light_color(&data, 1, red, grn, blu);
- Nviz_set_light_ambient(&data, 1,
- atof(params->light_ambient->answer) / 100.0);
-
/* load raster maps (surface topography) & set attributes (map/constant) */
load_rasters(params, &data);
/* set draw mode of loaded surfaces */
@@ -150,7 +135,8 @@
vp_height = atof(params->height->answer);
}
else {
- Nviz_get_exag_height(&vp_height, NULL, NULL);
+ double min, max;
+ Nviz_get_exag_height(&vp_height, &min, &max);
G_verbose_message(_("Viewpoint height not given, using calculated "
"value %.0f"),
vp_height);
@@ -162,6 +148,21 @@
Nviz_set_viewpoint_twist(atoi(params->twist->answer));
Nviz_set_viewpoint_persp(atoi(params->persp->answer));
+ /* set lights */
+ Nviz_set_light_position(&data, 1,
+ atof(params->light_pos->answers[0]),
+ atof(params->light_pos->answers[1]),
+ atof(params->light_pos->answers[2]),
+ 0.0);
+ Nviz_set_light_bright(&data, 1,
+ atoi(params->light_bright->answer) / 100.0);
+ if(G_str_to_color(params->light_color->answer, &red, &grn, &blu) != 1) {
+ red = grn = blu = 255;
+ }
+ Nviz_set_light_color(&data, 1, red, grn, blu);
+ Nviz_set_light_ambient(&data, 1,
+ atof(params->light_ambient->answer) / 100.0);
+
GS_clear(data.bgcolor);
/* draw */
More information about the grass-commit
mailing list