Sfoglia il codice sorgente

wxNviz: fixed small bugs in volume page gui

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@47030 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 14 anni fa
parent
commit
d6f09d6010
1 ha cambiato i file con 37 aggiunte e 8 eliminazioni
  1. 37 8
      gui/wxpython/gui_modules/nviz_tools.py

+ 37 - 8
gui/wxpython/gui_modules/nviz_tools.py

@@ -2388,7 +2388,7 @@ class NvizToolWindow(FN.FlatNotebook):
                 else:
                 else:
                     value = self.FindWindowById(self.win[nvizType][attrb]['const']).GetValue()
                     value = self.FindWindowById(self.win[nvizType][attrb]['const']).GetValue()
                     
                     
-            useMap = False
+                useMap = False
         else:
         else:
             useMap = None
             useMap = None
             value = self.FindWindowById(self.win[nvizType][attrb]['const']).GetValue()
             value = self.FindWindowById(self.win[nvizType][attrb]['const']).GetValue()
@@ -2410,7 +2410,7 @@ class NvizToolWindow(FN.FlatNotebook):
                     if attrb == 'topo':
                     if attrb == 'topo':
                         list = self.FindWindowById(self.win['volume']['isosurfs'])
                         list = self.FindWindowById(self.win['volume']['isosurfs'])
                         sel = list.GetSelection()
                         sel = list.GetSelection()
-                        list.SetString(sel, "%s %s" % (_("Level"), str(value)))
+                        list.SetString(sel, "%s %.1f" % (_("Level"), value))
                         list.Check(sel)
                         list.Check(sel)
             
             
             # update properties
             # update properties
@@ -2896,6 +2896,9 @@ class NvizToolWindow(FN.FlatNotebook):
         
         
     def OnVolumeIsosurfMap(self, event):
     def OnVolumeIsosurfMap(self, event):
         """!Set surface attribute"""
         """!Set surface attribute"""
+        if self.vetoGSelectEvt:
+            self.vetoGSelectEvt = False
+            return
         self.SetMapObjAttrb(nvizType = 'volume', winId = event.GetId())
         self.SetMapObjAttrb(nvizType = 'volume', winId = event.GetId())
         
         
     def OnVolumeIsosurfCheck(self, event):
     def OnVolumeIsosurfCheck(self, event):
@@ -2909,7 +2912,17 @@ class NvizToolWindow(FN.FlatNotebook):
         isosurfId = event.GetSelection()
         isosurfId = event.GetSelection()
         
         
         if list.IsChecked(index):
         if list.IsChecked(index):
-            self._display.SetIsosurfaceTransp(id, isosurfId, False, "0")
+            if 'transp' in data['isosurface'][isosurfId] and\
+                data['isosurface'][isosurfId]['transp']['map'] is not None:
+                if data['isosurface'][isosurfId]['transp']['map']:
+                    map = True
+                    value = data['isosurface'][isosurfId]['transp']['value']
+                elif data['isosurface'][isosurfId]['transp']['map'] is not None:
+                    map = False
+                    value = data['isosurface'][isosurfId]['transp']['value']
+                self._display.SetIsosurfaceTransp(id, isosurfId, map, value)
+            else:
+                self._display.SetIsosurfaceTransp(id, isosurfId, False, "0")
         else:
         else:
             # disable -> make transparent
             # disable -> make transparent
             self._display.SetIsosurfaceTransp(id, isosurfId, False, "255")
             self._display.SetIsosurfaceTransp(id, isosurfId, False, "255")
@@ -2972,6 +2985,7 @@ class NvizToolWindow(FN.FlatNotebook):
                 isosurfData[attrb] = {}
                 isosurfData[attrb] = {}
                 win = self.FindWindowById(self.win['volume'][attrb]['const'])
                 win = self.FindWindowById(self.win['volume'][attrb]['const'])
                 isosurfData[attrb]['value'] = win.GetValue()
                 isosurfData[attrb]['value'] = win.GetValue()
+                isosurfData[attrb]['map'] = None
             else:
             else:
                 uwin = self.FindWindowById(self.win['volume'][attrb]['use'])
                 uwin = self.FindWindowById(self.win['volume'][attrb]['use'])
                 sel = uwin.GetSelection()
                 sel = uwin.GetSelection()
@@ -3003,6 +3017,7 @@ class NvizToolWindow(FN.FlatNotebook):
         
         
         # update buttons
         # update buttons
         self.UpdateIsosurfButtons(list)
         self.UpdateIsosurfButtons(list)
+        self.UpdateVolumeIsosurfPage(layer, isosurfData)
         
         
         if self.mapDisplay.statusbarWin['render'].IsChecked():
         if self.mapDisplay.statusbarWin['render'].IsChecked():
             self.mapWindow.Refresh(False)
             self.mapWindow.Refresh(False)
@@ -3600,13 +3615,14 @@ class NvizToolWindow(FN.FlatNotebook):
             # check required first
             # check required first
             if attrb == 'color':
             if attrb == 'color':
                 if layer and layer.type == '3d-raster':
                 if layer and layer.type == '3d-raster':
+                    self.vetoGSelectEvt = True
                     self.FindWindowById(self.win['volume'][attrb]['map']).SetValue(layer.name)
                     self.FindWindowById(self.win['volume'][attrb]['map']).SetValue(layer.name)
                 else:
                 else:
                     self.FindWindowById(self.win['volume'][attrb]['map']).SetValue('')
                     self.FindWindowById(self.win['volume'][attrb]['map']).SetValue('')
                 self.SetMapObjUseMap(nvizType = 'volume',
                 self.SetMapObjUseMap(nvizType = 'volume',
                                      attrb = attrb, map = True) # -> map
                                      attrb = attrb, map = True) # -> map
-                continue
-            
+                #continue
+                
             # skip empty attributes
             # skip empty attributes
             if attrb not in data:
             if attrb not in data:
                 self.SetMapObjUseMap(nvizType = 'volume',
                 self.SetMapObjUseMap(nvizType = 'volume',
@@ -3622,15 +3638,28 @@ class NvizToolWindow(FN.FlatNotebook):
                     self.FindWindowById(self.win['volume'][attrb]['const']).SetColour(color)
                     self.FindWindowById(self.win['volume'][attrb]['const']).SetColour(color)
             else:
             else:
                 if data[attrb]['map']:
                 if data[attrb]['map']:
+                    self.vetoGSelectEvt = True
                     win = self.FindWindowById(self.win['volume'][attrb]['map'])
                     win = self.FindWindowById(self.win['volume'][attrb]['map'])
                     win.SetValue(value)
                     win.SetValue(value)
                 else:
                 else:
-                    win = self.FindWindowById(self.win['volume'][attrb]['const'])
-                    win.SetValue(float(value))
-            
+                    if value:
+                        win = self.FindWindowById(self.win['volume'][attrb]['const'])
+                        win.SetValue(float(value))
+                    
             self.SetMapObjUseMap(nvizType = 'volume',
             self.SetMapObjUseMap(nvizType = 'volume',
                                  attrb = attrb, map = data[attrb]['map'])
                                  attrb = attrb, map = data[attrb]['map'])
             
             
+            ret = gcmd.RunCommand('r3.info', read = True, flags = 'r', map = layer.name)
+            if ret:
+                range = []
+                for value in ret.strip('\n').split('\n'):
+                    range.append(value.split('=')[1])
+                topo = self.FindWindowById(self.win['volume']['topo']['const'])
+                if fs:
+                    topo.SetRange(min_val = float(range[0]), max_val = float(range[1]))
+                else:
+                    topo.SetRange(minVal = int(range[0]), maxVal = int(range[1]))
+            
     def SetPage(self, name):
     def SetPage(self, name):
         """!Get named page"""
         """!Get named page"""
         if name == 'view':
         if name == 'view':