Forráskód Böngészése

wxGUI: new histogramming tool based on PyPlot. Histograms single maps and imagery groups, with control over line colors and styles, axes and other plot features.

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@48403 15284696-431f-4ddb-bdfa-cd5b030d7da7
Michael Barton 13 éve
szülő
commit
25bfe96d8c

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1388 - 0
gui/wxpython/gui_modules/histogram2.py


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

@@ -46,6 +46,7 @@ import gcmd
 import dbm
 import dbm_dialogs
 import histogram
+import histogram2
 import profile
 import globalvar
 import utils
@@ -1540,6 +1541,11 @@ class MapFrame(wx.Frame):
         toolsmenu.AppendItem(profile)
         self.Bind(wx.EVT_MENU, self.Profile, profile)
 
+        histogram2 = wx.MenuItem(toolsmenu, wx.ID_ANY, _("Create histogram with PyPlot"))
+        histogram2.SetBitmap(icons["histogram"].GetBitmap(self.iconsize))
+        toolsmenu.AppendItem(histogram2)
+        self.Bind(wx.EVT_MENU, self.Histogram2, histogram2)
+
         histogram = wx.MenuItem(toolsmenu, wx.ID_ANY, icons["histogram"].GetLabel())
         histogram.SetBitmap(icons["histogram"].GetBitmap(self.iconsize))
         toolsmenu.AppendItem(histogram)
@@ -1710,6 +1716,16 @@ class MapFrame(wx.Frame):
         self.histogram.Refresh()
         self.histogram.Update()
 
+    def Histogram2(self, event):
+        """!Init histogram display canvas and tools
+        """
+        self.histogram2 = histogram2.HistFrame(self,
+                                             id = wx.ID_ANY, size = globalvar.HIST_WINDOW_SIZE,
+                                             style = wx.DEFAULT_FRAME_STYLE)
+
+        #show new display
+        self.histogram2.Show()
+        self.histogram2.Refresh()
 
     def OnDecoration(self, event):
         """!Decorations overlay menu

+ 32 - 0
gui/wxpython/gui_modules/preferences.py

@@ -445,6 +445,38 @@ class Settings:
                     'enabled' : True
                     },
                 },
+             'histogram': {
+                'raster' : {
+                    'pcolor'        : (0, 0, 0, 255), # line color
+                    'pwidth'        : 1, # line width
+                    'pstyle'        : 'solid', # line pen style
+                    'datatype'      : 'cell', # raster type
+                    },
+                'font' : {
+                    'titleSize'     : 12,
+                    'axisSize'      : 11,
+                    'legendSize'    : 10,
+                    },
+                'grid' : {
+                    'color'         : (200, 200, 200, 255),
+                    'enabled'       : True,
+                    },
+                'x-axis' : {
+                    'type'          : 'auto', # axis format
+                    'min'           : 0, # axis min for custom axis range
+                    'max'           : 0, # axis max for custom axis range
+                    'log'           : False,
+                    },
+                'y-axis' : {
+                    'type'          : 'auto', # axis format
+                    'min'           : 0, # axis min for custom axis range
+                    'max'           : 0, # axis max for custom axis range
+                    'log'           : False,
+                    },
+                'legend' : {
+                    'enabled'       : True
+                    },
+                },
             'gcpman' : {
                 'rms' : {
                     'highestonly' : True,

+ 39 - 0
gui/wxpython/gui_modules/toolbars.py

@@ -1416,6 +1416,45 @@ class HistogramToolbar(AbstractToolbar):
                                       self.parent.OnQuit))
                                     )
 
+class Histogram2Toolbar(AbstractToolbar):
+    """!Toolbar for histogramming raster map
+    """ 
+    def __init__(self, parent):
+        AbstractToolbar.__init__(self, parent)
+        
+        self.InitToolbar(self._toolbarData())
+        
+        # realize the toolbar
+        self.Realize()
+        
+    def _toolbarData(self):
+        """!Toolbar data"""
+        icons = Icons['profile']
+        return self._getToolbarData((('addraster', Icons['layerManager']["addRast"],
+                                      self.parent.OnSelectRaster),
+                                     (None, ),
+                                     ('draw', icons["draw"],
+                                      self.parent.OnCreateHist),
+                                     ('erase', Icons['displayWindow']["erase"],
+                                      self.parent.OnErase),
+                                     ('drag', Icons['displayWindow']['pan'],
+                                      self.parent.OnDrag),
+                                     ('zoom', Icons['displayWindow']['zoomIn'],
+                                      self.parent.OnZoom),
+                                     ('unzoom', Icons['displayWindow']['zoomBack'],
+                                      self.parent.OnRedraw),
+                                     (None, ),
+                                     ('image', Icons['displayWindow']["saveFile"],
+                                      self.parent.SaveToFile),
+                                     ('print', Icons['displayWindow']["print"],
+                                      self.parent.PrintMenu),
+                                     (None, ),
+                                     ('settings', icons["options"],
+                                      self.parent.HistOptionsMenu),
+                                     ('quit', icons["quit"],
+                                      self.parent.OnQuit),
+                                     ))
+
 class LMWorkspaceToolbar(AbstractToolbar):
     """!Layer Manager `workspace` toolbar
     """