瀏覽代碼

wxGUI: enabling automatic selection of map from layer tree for histogramming

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@48404 15284696-431f-4ddb-bdfa-cd5b030d7da7
Michael Barton 13 年之前
父節點
當前提交
c984ff7e93
共有 3 個文件被更改,包括 16 次插入19 次删除
  1. 3 10
      gui/wxpython/gui_modules/histogram2.py
  2. 12 8
      gui/wxpython/gui_modules/mapdisp.py
  3. 1 1
      gui/wxpython/gui_modules/preferences.py

+ 3 - 10
gui/wxpython/gui_modules/histogram2.py

@@ -617,17 +617,10 @@ class HistFrame(wx.Frame):
 
     def OnCloseWindow(self, event):
         """
-        Close profile window and clean up
+        Close histogram window and clean up
         """
-        self.mapwin.ClearLines()
-        self.mapwin.mouse['begin'] = self.mapwin.mouse['end'] = (0.0, 0.0)
-        self.mapwin.mouse['use'] = 'pointer'
-        self.mapwin.mouse['box'] = 'point'
-        self.mapwin.polycoords = []
-        self.mapwin.SetCursor(self.Parent.cursors["default"])
-
-        self.mapwin.UpdateMap(render=False, renderVector=False)
 
+        self.mapwin.SetCursor(self.Parent.cursors["default"])
         self.Destroy()
 
 class SetRasterDialog(wx.Dialog):
@@ -1385,4 +1378,4 @@ class OptDialog(wx.Dialog):
     def OnCancel(self, event):
         """!Button 'Cancel' pressed"""
         self.Close()
-        
+        

+ 12 - 8
gui/wxpython/gui_modules/mapdisp.py

@@ -1705,16 +1705,20 @@ class MapFrame(wx.Frame):
         return (outdist, outunits)
     
     def Histogram(self, event):
-        """!Init histogram display canvas and tools
+        """!Init PyPlot histogram display canvas and tools
         """
-        self.histogram = histogram.HistFrame(self,
-                                             id = wx.ID_ANY, size = globalvar.HIST_WINDOW_SIZE,
-                                             style = wx.DEFAULT_FRAME_STYLE)
+        raster = []
+        if self.tree.layer_selected and \
+                self.tree.GetPyData(self.tree.layer_selected)[0]['type'] == 'raster':
+            raster.append(self.tree.GetPyData(self.tree.layer_selected)[0]['maplayer'].name)
 
-        #show new display
-        self.histogram.Show()
-        self.histogram.Refresh()
-        self.histogram.Update()
+        self.histogram2 = histogram2.HistFrame(self,
+                                            id = wx.ID_ANY, pos = wx.DefaultPosition, size = (700,300),
+                                            style = wx.DEFAULT_FRAME_STYLE, rasterList = raster)
+        self.histogram2.Show()
+        # Open raster select dialog to make sure that a raster (and the desired raster)
+        # is selected to be histogrammed
+        self.histogram2.OnSelectRaster(None)
 
     def Histogram2(self, event):
         """!Init histogram display canvas and tools

+ 1 - 1
gui/wxpython/gui_modules/preferences.py

@@ -447,7 +447,7 @@ class Settings:
                 },
              'histogram': {
                 'raster' : {
-                    'pcolor'        : (0, 0, 0, 255), # line color
+                    'pcolor'        : (0, 0, 255, 255), # line color
                     'pwidth'        : 1, # line width
                     'pstyle'        : 'solid', # line pen style
                     'datatype'      : 'cell', # raster type