[GRASS-SVN] r47378 - in grass/trunk: gui/wxpython/gui_modules include lib/raster

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Aug 3 11:39:38 EDT 2011


Author: annakrat
Date: 2011-08-03 08:39:38 -0700 (Wed, 03 Aug 2011)
New Revision: 47378

Modified:
   grass/trunk/gui/wxpython/gui_modules/mapdisp.py
   grass/trunk/gui/wxpython/gui_modules/wxnviz.py
   grass/trunk/include/rasterdefs.h
   grass/trunk/lib/raster/set_window.c
Log:
wxNviz: attempt to fix updating region when switching back to 3D view

Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2011-08-03 15:09:11 UTC (rev 47377)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2011-08-03 15:39:38 UTC (rev 47378)
@@ -397,13 +397,16 @@
             self.MapWindow3D.UpdateView(None)
         else:
             self.MapWindow = self.MapWindow3D
+            os.environ['GRASS_REGION'] = self.Map.SetRegion(windres = True)
             self.MapWindow3D.GetDisplay().Init()
+            del os.environ['GRASS_REGION']
+            
             self.MapWindow3D.UpdateOverlays()
             # add Nviz notebookpage
             self._layerManager.AddNviz()
             for page in ('view', 'light', 'fringe', 'constant', 'cplane'):
                 self._layerManager.nviz.UpdatePage(page)
-        
+
         # switch from MapWindow to MapWindowGL
         # add nviz toolbar
         self._mgr.DetachPane(self.MapWindow2D)
@@ -500,8 +503,6 @@
             # switch from MapWindowGL to MapWindow
             self._mgr.DetachPane(self.MapWindow3D)
             self.MapWindow3D.Hide()
-            #self.MapWindow3D.Destroy()
-            #self.MapWindow3D = None
             self.MapWindow2D.Show()
             self._mgr.AddPane(self.MapWindow2D, wx.aui.AuiPaneInfo().CentrePane().
                               Dockable(False).BestSize((-1,-1)).
@@ -1792,20 +1793,18 @@
             # delete object if it has no text or is not active
             if text == '' or active == False:
                 try:
-                    self.MapWindow2D.pdc.ClearId(id)
-                    self.MapWindow2D.pdc.RemoveId(id)
+                    self.MapWindow.pdc.ClearId(id)
+                    self.MapWindow.pdc.RemoveId(id)
                     del self.MapWindow.textdict[id]
-                    if self.MapWindow3D:
-                        self.MapWindow3D.UpdateOverlays()
                 except:
                     pass
                 return
 
-            self.MapWindow2D.pdc.ClearId(id)
-            self.MapWindow2D.pdc.SetId(id)
-            self.MapWindow2D.textdict[id] = self.dialogs['text'].GetValues()
-            if self.MapWindow3D:
-                self.MapWindow3D.textdict[id] = self.dialogs['text'].GetValues()
+            self.MapWindow.pdc.ClearId(id)
+            self.MapWindow.pdc.SetId(id)
+            self.MapWindow.textdict[id] = self.dialogs['text'].GetValues()
+##            if self.MapWindow3D:
+##                self.MapWindow3D.textdict[id] = self.dialogs['text'].GetValues()
                 
             
             self.MapWindow2D.UpdateMap(render = False, renderVector = False)

Modified: grass/trunk/gui/wxpython/gui_modules/wxnviz.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxnviz.py	2011-08-03 15:09:11 UTC (rev 47377)
+++ grass/trunk/gui/wxpython/gui_modules/wxnviz.py	2011-08-03 15:39:38 UTC (rev 47378)
@@ -30,6 +30,7 @@
 from grass.lib.g3d   import *
 from grass.lib.ogsf  import *
 from grass.lib.nviz  import *
+from grass.lib.raster import *
 
 from debug import Debug
 
@@ -96,9 +97,11 @@
     def Init(self):
         """!Initialize window"""
         G_unset_window()
+        Rast_unset_window()
+        Rast__init_window()
         GS_libinit()
         GVL_libinit()
-        
+    
     def ResizeWindow(self, width, height):
         """!GL canvas resized
         

Modified: grass/trunk/include/rasterdefs.h
===================================================================
--- grass/trunk/include/rasterdefs.h	2011-08-03 15:09:11 UTC (rev 47377)
+++ grass/trunk/include/rasterdefs.h	2011-08-03 15:39:38 UTC (rev 47378)
@@ -551,6 +551,7 @@
 /* set_window.c */
 void Rast__init_window(void);
 void Rast_set_window(struct Cell_head *);
+void Rast_unset_window(void);
 void Rast_set_output_window(struct Cell_head *);
 void Rast_set_input_window(struct Cell_head *);
 

Modified: grass/trunk/lib/raster/set_window.c
===================================================================
--- grass/trunk/lib/raster/set_window.c	2011-08-03 15:09:11 UTC (rev 47377)
+++ grass/trunk/lib/raster/set_window.c	2011-08-03 15:39:38 UTC (rev 47378)
@@ -57,7 +57,15 @@
 
     update_window_mappings();
 }
+/*!
+  \brief Unset current window
+*/
+void Rast_unset_window(void)
+{
+    G_debug(4, "Rast_unset_window()");
 
+    R__.window_set = 0;
+}
 /*!
  * \brief Establishes 'window' as the current working window for output.
  * 



More information about the grass-commit mailing list