[GRASS-SVN] r35952 - in grass/branches/develbranch_6/gui/wxpython:
gui_modules nviz
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Feb 19 12:28:07 EST 2009
Author: martinl
Date: 2009-02-19 12:28:06 -0500 (Thu, 19 Feb 2009)
New Revision: 35952
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py
grass/branches/develbranch_6/gui/wxpython/nviz/change_view.cpp
grass/branches/develbranch_6/gui/wxpython/nviz/init.cpp
grass/branches/develbranch_6/gui/wxpython/nviz/nviz.h
Log:
wxGUI/nviz: cleaning
(merge from trunk, r35950)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py 2009-02-19 17:27:41 UTC (rev 35951)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py 2009-02-19 17:28:06 UTC (rev 35952)
@@ -379,22 +379,20 @@
#
self.MapWindow.EraseMap()
- busy = wx.BusyInfo(message=_("Please wait, loading data..."),
- parent=self)
- wx.Yield()
-
+ self.statusbar.SetStatusText(_("Please wait, loading data..."), 0)
+
#
# create GL window & NVIZ toolbar
#
if not self.MapWindow3D:
self.MapWindow3D = nviz.GLWindow(self, id=wx.ID_ANY,
Map=self.Map, tree=self.tree, gismgr=self.gismanager)
+ # -> show after paint
self.nvizToolWin = nviz.NvizToolWindow(self, id=wx.ID_ANY,
mapWindow=self.MapWindow3D)
self.MapWindow3D.OnPaint(None) # -> LoadData
-
- busy.Destroy()
-
+ self.MapWindow3D.Show()
+
self.nvizToolWin.Show()
#
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py 2009-02-19 17:27:41 UTC (rev 35951)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py 2009-02-19 17:28:06 UTC (rev 35952)
@@ -3,12 +3,12 @@
@brief Nviz extension for wxGUI
-This module adds to Map Display 2.5/3D visualization mode.
+This module implements 3D visualization mode of map display.
List of classes:
- GLWindow
-(C) 2008 by the GRASS Development Team
+(C) 2008-2009 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
@@ -76,9 +76,7 @@
glcanvas.GLCanvas.__init__(self, parent, id)
MapWindow.__init__(self, parent, id, pos, size, style,
Map, tree, gismgr)
-
-
- self.parent = parent # MapFrame
+ self.Hide()
self.init = False
self.initView = False
@@ -110,15 +108,10 @@
logmsg)
self.nvizThread.start()
time.sleep(.1)
- self.nvizClass = self.nvizThread.nvizClass
+ self.nvizClass = self.nvizThread.nvizClass
# GRASS_REGION needed only for initialization
del os.environ['GRASS_REGION']
-
- #
- # set current display
- #
- self.nvizClass.SetDisplay(self)
#
# default values
@@ -923,7 +916,7 @@
self.UnloadRaster3d(item)
elif type == 'vector':
self.UnloadVector(item)
-
+
self.init = False
def OnZoomToMap(self, event):
Modified: grass/branches/develbranch_6/gui/wxpython/nviz/change_view.cpp
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/nviz/change_view.cpp 2009-02-19 17:27:41 UTC (rev 35951)
+++ grass/branches/develbranch_6/gui/wxpython/nviz/change_view.cpp 2009-02-19 17:28:06 UTC (rev 35952)
@@ -21,7 +21,7 @@
\param height window height
\return 1 on success
- \return 0 on failure (window resized by dafault to 20x20 px)
+ \return 0 on failure (window resized by default to 20x20 px)
*/
int Nviz::ResizeWindow(int width, int height)
{
Modified: grass/branches/develbranch_6/gui/wxpython/nviz/init.cpp
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/nviz/init.cpp 2009-02-19 17:27:41 UTC (rev 35951)
+++ grass/branches/develbranch_6/gui/wxpython/nviz/init.cpp 2009-02-19 17:28:06 UTC (rev 35952)
@@ -35,8 +35,7 @@
logStream = log;
G_set_error_routine(&print_error);
- // TODO
- // G_set_percent_routine(&print_percent);
+ G_set_percent_routine(&print_percent);
GS_libinit();
GVL_libinit();
@@ -44,10 +43,7 @@
GS_set_swap_func(swap_gl);
data = (nv_data*) G_malloc(sizeof (nv_data));
-
- /* GLCanvas */
- glCanvas = NULL;
-
+
G_debug(1, "Nviz::Nviz()");
}
@@ -57,33 +53,15 @@
Nviz::~Nviz()
{
G_unset_error_routine();
- // TODO
- // G_unset_percent_routine();
+ G_unset_percent_routine();
G_free((void *) data);
data = NULL;
- glCanvas = NULL;
-
+
logStream = NULL;
}
-/*!
- \brief Associate display with render window
-
- \return 1 on success
- \return 0 on failure
-*/
-int Nviz::SetDisplay(void *display)
-{
- glCanvas = (wxGLCanvas *) display;
- // glCanvas->SetCurrent();
-
- G_debug(1, "Nviz::SetDisplay()");
-
- return 1;
-}
-
void Nviz::InitView()
{
/* initialize nviz data */
@@ -125,18 +103,6 @@
return;
}
-int print_error(const char *msg, const int type)
-{
- if (logStream) {
- print_sentence(logStream, type, msg);
- }
- else {
- fprintf(stderr, "Nviz: %s\n", msg);
- }
-
- return 0;
-}
-
/*
\brief Print one message, prefix inserted before each new line
@@ -148,60 +114,92 @@
const char *start;
char* sentence;
- switch ( type ) {
- case MSG:
- sprintf (prefix, "GRASS_INFO_MESSAGE(%d,%d): Nviz: ", getpid(), message_id);
- break;
- case WARN:
- sprintf (prefix, "GRASS_INFO_WARNING(%d,%d): Nviz: ", getpid(), message_id);
- break;
- case ERR:
- sprintf (prefix, "GRASS_INFO_ERROR(%d,%d): Nviz: ", getpid(), message_id);
- break;
+ switch (type) {
+ case MSG:
+ sprintf (prefix, "GRASS_INFO_MESSAGE(%d,%d): Nviz: ", getpid(), message_id);
+ break;
+ case WARN:
+ sprintf (prefix, "GRASS_INFO_WARNING(%d,%d): Nviz: ", getpid(), message_id);
+ break;
+ case ERR:
+ sprintf (prefix, "GRASS_INFO_ERROR(%d,%d): Nviz: ", getpid(), message_id);
+ break;
}
start = msg;
-
+
PyFile_WriteString("\n", pyFd);
- while ( *start != '\0' ) {
+ while (*start != '\0') {
const char *next = start;
-
+
PyFile_WriteString(prefix, pyFd);
-
+
while ( *next != '\0' ) {
next++;
-
+
if ( *next == '\n' ) {
next++;
break;
}
}
-
- sentence = (char *) G_malloc ((next - start + 1) * sizeof (char));
+
+ sentence = (char *) G_malloc((next - start + 1) * sizeof (char));
strncpy(sentence, start, next - start + 1);
sentence[next-start] = '\0';
-
+
PyFile_WriteString(sentence, pyFd);
G_free((void *)sentence);
-
+
PyFile_WriteString("\n", pyFd);
start = next;
}
-
+
PyFile_WriteString("\n", pyFd);
sprintf(prefix, "GRASS_INFO_END(%d,%d)\n", getpid(), message_id);
PyFile_WriteString(prefix, pyFd);
-
+
message_id++;
}
+/*!
+ \brief Print error/warning/message
+
+ \param msg message buffer
+ \param type message type
+
+ \return 0
+*/
+int print_error(const char *msg, const int type)
+{
+ if (logStream) {
+ print_sentence(logStream, type, msg);
+ }
+ else {
+ fprintf(stderr, "Nviz: %s\n", msg);
+ }
+
+ return 0;
+}
+
+/*!
+ \brief Print percentage information
+
+ \param x value
+
+ \return 0
+*/
int print_percent(int x)
{
char msg[256];
- sprintf(msg, "GRASS_INFO_PERCENT: %d\n", x);
- PyFile_WriteString(msg, logStream);
-
+ if (logStream) {
+ sprintf(msg, "GRASS_INFO_PERCENT: %d\n", x);
+ PyFile_WriteString(msg, logStream);
+ }
+ else {
+ fprintf(stderr, "GRASS_INFO_PERCENT: %d\n", x);
+ }
+
return 0;
}
Modified: grass/branches/develbranch_6/gui/wxpython/nviz/nviz.h
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/nviz/nviz.h 2009-02-19 17:27:41 UTC (rev 35951)
+++ grass/branches/develbranch_6/gui/wxpython/nviz/nviz.h 2009-02-19 17:28:06 UTC (rev 35952)
@@ -30,8 +30,7 @@
{
private:
nv_data *data;
- wxGLCanvas *glCanvas;
-
+
/* surface.cpp */
int SetSurfaceAttr(int, int, bool, const char *);
int UnsetSurfaceAttr(int, int);
@@ -55,7 +54,6 @@
int SetZExag(float);
/* init.cpp */
- int SetDisplay(void *);
void InitView();
void SetBgColor(const char *);
More information about the grass-commit
mailing list