[GRASS-SVN] r31863 - grass-addons/visualization/nviz2/wxpython/nviz
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jun 27 17:31:44 EDT 2008
Author: martinl
Date: 2008-06-27 17:31:43 -0400 (Fri, 27 Jun 2008)
New Revision: 31863
Added:
grass-addons/visualization/nviz2/wxpython/nviz/surface.cpp
Modified:
grass-addons/visualization/nviz2/wxpython/nviz/change_view.cpp
grass-addons/visualization/nviz2/wxpython/nviz/draw.cpp
grass-addons/visualization/nviz2/wxpython/nviz/init.cpp
grass-addons/visualization/nviz2/wxpython/nviz/lights.cpp
grass-addons/visualization/nviz2/wxpython/nviz/load.cpp
grass-addons/visualization/nviz2/wxpython/nviz/nviz.h
Log:
nviz2: wxGUI-related fixes
some debug messages added to nviz Python extension
surface attributes: setting color attr functional (only map)
Modified: grass-addons/visualization/nviz2/wxpython/nviz/change_view.cpp
===================================================================
--- grass-addons/visualization/nviz2/wxpython/nviz/change_view.cpp 2008-06-27 16:50:35 UTC (rev 31862)
+++ grass-addons/visualization/nviz2/wxpython/nviz/change_view.cpp 2008-06-27 21:31:43 UTC (rev 31863)
@@ -29,7 +29,14 @@
*/
int Nviz::ResizeWindow(int width, int height)
{
- return Nviz_resize_window(width, height);
+ int ret;
+
+ ret = Nviz_resize_window(width, height);
+
+ G_debug(1, "Nviz::ResizeWindow(): width=%d height=%d",
+ width, height);
+
+ return ret;
}
/*!
@@ -50,6 +57,8 @@
SetView(VIEW_DEFAULT_POS_X, VIEW_DEFAULT_POS_Y,
vp_height, VIEW_DEFAULT_PERSP, VIEW_DEFAULT_TWIST);
+ G_debug(1, "Nviz::SetViewDefault()");
+
return vp_height;
}
@@ -75,6 +84,9 @@
Nviz_set_viewpoint_persp(data,
persp);
+ G_debug(1, "Nviz::SetView(): x=%f, y=%f, height=%f, persp=%f, twist=%f",
+ x, y, height, persp, twist);
+
return 1;
}
@@ -87,5 +99,11 @@
*/
int Nviz::SetZExag(float z_exag)
{
- return Nviz_change_exag(data, z_exag);
+ int ret;
+
+ ret = Nviz_change_exag(data, z_exag);
+
+ G_debug(1, "Nviz::SetZExag(): z_exag=%f", z_exag);
+
+ return ret;
}
Modified: grass-addons/visualization/nviz2/wxpython/nviz/draw.cpp
===================================================================
--- grass-addons/visualization/nviz2/wxpython/nviz/draw.cpp 2008-06-27 16:50:35 UTC (rev 31862)
+++ grass-addons/visualization/nviz2/wxpython/nviz/draw.cpp 2008-06-27 21:31:43 UTC (rev 31863)
@@ -35,6 +35,8 @@
else
Nviz_draw_quick(data);
+ G_debug(1, "Nviz::Draw(): quick=%d", quick);
+
return;
}
@@ -45,5 +47,7 @@
{
GS_clear(data->bgcolor);
+ G_debug(1, "Nviz::EraseMap()");
+
return;
}
Modified: grass-addons/visualization/nviz2/wxpython/nviz/init.cpp
===================================================================
--- grass-addons/visualization/nviz2/wxpython/nviz/init.cpp 2008-06-27 16:50:35 UTC (rev 31862)
+++ grass-addons/visualization/nviz2/wxpython/nviz/init.cpp 2008-06-27 21:31:43 UTC (rev 31863)
@@ -37,6 +37,8 @@
/* GLCanvas */
glCanvas = NULL;
+
+ G_debug(1, "Nviz::Nviz()");
}
/*!
@@ -61,6 +63,8 @@
glCanvas = (wxGLCanvas *) display;
// glCanvas->SetCurrent();
+ G_debug(1, "Nviz::SetDisplay()");
+
return 1;
}
@@ -83,6 +87,8 @@
/* clear window */
GS_clear(data->bgcolor);
+ G_debug(1, "Nviz::InitView()");
+
return;
}
Modified: grass-addons/visualization/nviz2/wxpython/nviz/lights.cpp
===================================================================
--- grass-addons/visualization/nviz2/wxpython/nviz/lights.cpp 2008-06-27 16:50:35 UTC (rev 31862)
+++ grass-addons/visualization/nviz2/wxpython/nviz/lights.cpp 2008-06-27 21:31:43 UTC (rev 31863)
@@ -43,5 +43,7 @@
Nviz_set_light_ambient(data, 1,
0.3, 0.3, 0.3);
+ G_debug(1, "Nviz::SetLightsDefault()");
+
return;
}
Modified: grass-addons/visualization/nviz2/wxpython/nviz/load.cpp
===================================================================
--- grass-addons/visualization/nviz2/wxpython/nviz/load.cpp 2008-06-27 16:50:35 UTC (rev 31862)
+++ grass-addons/visualization/nviz2/wxpython/nviz/load.cpp 2008-06-27 21:31:43 UTC (rev 31863)
@@ -29,8 +29,8 @@
\param color_name raster map for color (NULL for color_value)
\param color_value color string (named color or RGB triptet)
- \return 1 on success
- \return 0 on failure
+ \return object id
+ \return -1 on failure
*/
int Nviz::LoadRaster(const char* name, const char *color_name, const char *color_value)
{
@@ -41,7 +41,7 @@
if (mapset == NULL) {
G_warning(_("Raster map <%s> not found"),
name);
- return 0;
+ return -1;
}
/* topography */
@@ -55,7 +55,7 @@
G_warning(_("Raster map <%s> not found"),
color_name);
GS_delete_surface(id);
- return 0;
+ return -1;
}
Nviz_set_attr(id, MAP_OBJ_SURF, ATT_COLOR, MAP_ATT,
@@ -81,5 +81,7 @@
/* focus on loaded data */
Nviz_set_focus_map(MAP_OBJ_UNDEFINED, -1);
- return 1;
+ G_debug(1, "Nviz::LoadRaster(): name=%s", name);
+
+ return id;
}
Modified: grass-addons/visualization/nviz2/wxpython/nviz/nviz.h
===================================================================
--- grass-addons/visualization/nviz2/wxpython/nviz/nviz.h 2008-06-27 16:50:35 UTC (rev 31862)
+++ grass-addons/visualization/nviz2/wxpython/nviz/nviz.h 2008-06-27 21:31:43 UTC (rev 31863)
@@ -45,34 +45,28 @@
/* change_view.cpp */
int ResizeWindow(int, int);
-
- /* set */
- /* init.cpp */
- int SetDisplay(void *);
- void Reset();
-
- /* lights */
- /* lights.cpp */
- void SetLightsDefault();
-
- /* viewport */
- /* change_view.cpp */
float SetViewDefault();
int SetView(float, float,
float, float, float);
int SetZExag(float);
/* init.cpp */
+ int SetDisplay(void *);
void InitView();
+ void Reset();
- /* load data */
+ /* lights.cpp */
+ void SetLightsDefault();
+
/* load.cpp */
int LoadRaster(const char*, const char *, const char *);
- /* draw */
/* draw.cpp */
void Draw(bool);
void EraseMap();
+
+ /* surface.cpp */
+ void SetSurfaceColor(int, bool, const char *);
};
#endif /* __NVIZ_H__ */
Added: grass-addons/visualization/nviz2/wxpython/nviz/surface.cpp
===================================================================
--- grass-addons/visualization/nviz2/wxpython/nviz/surface.cpp (rev 0)
+++ grass-addons/visualization/nviz2/wxpython/nviz/surface.cpp 2008-06-27 21:31:43 UTC (rev 31863)
@@ -0,0 +1,40 @@
+/**
+ \file map_obj.cpp
+
+ \brief Experimental C++ wxWidgets Nviz prototype -- map object management
+
+ Used by wxGUI Nviz extension.
+
+ Copyright: (C) by the GRASS Development Team
+
+ This program is free software under the GNU General Public
+ License (>=v2). Read the file COPYING that comes with GRASS
+ for details.
+
+ \author Martin Landa <landa.martin gmail.com> (Google SoC 2008)
+
+ \date 2008
+*/
+
+#include "nviz.h"
+
+void Nviz::SetSurfaceColor(int id, bool map, const char *value)
+{
+ if (map) {
+ Nviz_set_attr(id, MAP_OBJ_SURF, ATT_COLOR, MAP_ATT,
+ value, -1.0,
+ data);
+ }
+ else {
+ float val;
+ val = atof(value);
+ Nviz_set_attr(id, MAP_OBJ_SURF, ATT_COLOR, CONST_ATT,
+ NULL, val,
+ data);
+ }
+
+ G_debug(1, "Nviz::SetSurfaceColor(): id=%d, map=%d, value=%s",
+ id, map, value);
+
+ return;
+}
More information about the grass-commit
mailing list