[GRASS-SVN] r46919 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jul 1 09:43:25 EDT 2011


Author: annakrat
Date: 2011-07-01 06:43:25 -0700 (Fri, 01 Jul 2011)
New Revision: 46919

Modified:
   grass/trunk/gui/wxpython/gui_modules/gselect.py
   grass/trunk/gui/wxpython/gui_modules/layertree.py
   grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
   grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
Log:
wxNviz: minor changes in (un)loading maps

Modified: grass/trunk/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gselect.py	2011-07-01 13:30:39 UTC (rev 46918)
+++ grass/trunk/gui/wxpython/gui_modules/gselect.py	2011-07-01 13:43:25 UTC (rev 46919)
@@ -266,6 +266,7 @@
                        'raster files':'rast',
                        'grid3':'rast3d',
                        'rast3d':'rast3d',
+                       '3d-raster':'rast3d',
                        'raster3D':'rast3d',
                        'raster3D files':'rast3d',
                        'vector':'vect',

Modified: grass/trunk/gui/wxpython/gui_modules/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/layertree.py	2011-07-01 13:30:39 UTC (rev 46918)
+++ grass/trunk/gui/wxpython/gui_modules/layertree.py	2011-07-01 13:43:25 UTC (rev 46919)
@@ -1068,6 +1068,22 @@
         # update progress bar range (mapwindow statusbar)
         self.mapdisplay.statusbarWin['progress'].SetRange(len(self.Map.GetListOfLayers(l_active = True)))
 
+        #
+        # nviz
+        #
+        if self.mapdisplay.toolbars['nviz'] and \
+                self.GetPyData(item) is not None:
+            # nviz - load/unload data layer
+            mapLayer = self.GetPyData(item)[0]['maplayer']
+            self.mapdisplay.SetStatusText(_("Please wait, updating data..."), 0)
+            if mapLayer.type == 'raster':
+                self.mapdisplay.MapWindow.UnloadRaster(item)
+            elif mapLayer.type == '3d-raster':
+                self.mapdisplay.MapWindow.UnloadRaster3d(item)
+            elif mapLayer.type == 'vector':
+                self.mapdisplay.MapWindow.UnloadVector(item)
+            self.mapdisplay.SetStatusText("", 0)
+            
         event.Skip()
 
     def OnLayerChecked(self, event):

Modified: grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py	2011-07-01 13:30:39 UTC (rev 46918)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py	2011-07-01 13:43:25 UTC (rev 46919)
@@ -975,7 +975,10 @@
         data = event.data
         
         if 'surface' in data:
-            id = data['surface']['object']['id']
+            try:
+                id = data['surface']['object']['id']
+            except KeyError:
+                pass
             self.UpdateSurfaceProperties(id, data['surface'])
             # -> initialized
             data['surface']['object']['init'] = True

Modified: grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_tools.py	2011-07-01 13:30:39 UTC (rev 46918)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_tools.py	2011-07-01 13:43:25 UTC (rev 46919)
@@ -168,7 +168,7 @@
         
     def SetInitialMaps(self):
         """!Set initial raster and vector map"""
-        for l_type in ('raster', 'vector'):
+        for l_type in ('raster', 'vector', '3d-raster'):
             selectedLayer = self.mapWindow.GetSelectedLayer()
             layers = self.mapWindow.Map.GetListOfLayers(l_type = l_type, l_active = True)
             if selectedLayer in layers:
@@ -177,13 +177,15 @@
                 try:
                     selection = layers[0].GetName()
                 except:
-                    return
+                    continue
             if l_type == 'raster':
                 self.FindWindowById(self.win['surface']['map']).SetValue(selection)
                 self.FindWindowById(self.win['fringe']['map']).SetValue(selection)
             elif l_type == 'vector':
                 self.FindWindowById(self.win['vector']['map']).SetValue(selection)
-    
+            elif l_type == '3d-raster':
+                self.FindWindowById(self.win['volume']['map']).SetValue(selection)
+                
     def UpdateState(self, **kwargs):
         if 'view' in kwargs:
             self.mapWindow.view = kwargs['view']
@@ -1250,7 +1252,7 @@
         box = wx.StaticBox (parent = panel, id = wx.ID_ANY,
                             label = " %s " % (_("3D raster map")))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
-        rmaps = gselect.Select(parent = panel, type = 'raster3D',
+        rmaps = gselect.Select(parent = panel, type = '3d-raster',
                                onPopup = self.GselectOnPopup)
         rmaps.GetChildren()[0].Bind(wx.EVT_TEXT, self.OnSetRaster3D)
         self.win['volume']['map'] = rmaps.GetId()



More information about the grass-commit mailing list