فهرست منبع

wxNviz: minor changes in (un)loading maps

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@46919 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 14 سال پیش
والد
کامیت
a9bec5923c

+ 1 - 0
gui/wxpython/gui_modules/gselect.py

@@ -266,6 +266,7 @@ class TreeCtrlComboPopup(wx.combo.ComboPopup):
                        'raster files':'rast',
                        'grid3':'rast3d',
                        'rast3d':'rast3d',
+                       '3d-raster':'rast3d',
                        'raster3D':'rast3d',
                        'raster3D files':'rast3d',
                        'vector':'vect',

+ 16 - 0
gui/wxpython/gui_modules/layertree.py

@@ -1068,6 +1068,22 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
         # 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):

+ 4 - 1
gui/wxpython/gui_modules/nviz_mapdisp.py

@@ -975,7 +975,10 @@ class GLWindow(MapWindow, glcanvas.GLCanvas):
         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

+ 6 - 4
gui/wxpython/gui_modules/nviz_tools.py

@@ -168,7 +168,7 @@ class NvizToolWindow(FN.FlatNotebook):
         
     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 @@ class NvizToolWindow(FN.FlatNotebook):
                 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 @@ class NvizToolWindow(FN.FlatNotebook):
         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()