|
@@ -45,8 +45,6 @@ import disp_print
|
|
|
import gcmd
|
|
|
import dbm
|
|
|
import dbm_dialogs
|
|
|
-import histogram
|
|
|
-import histogram2
|
|
|
import profile
|
|
|
import globalvar
|
|
|
import utils
|
|
@@ -56,7 +54,8 @@ from icon import Icons
|
|
|
from preferences import globalSettings as UserSettings
|
|
|
|
|
|
from mapdisp_window import BufferedWindow
|
|
|
-
|
|
|
+from histogram import HistFrame
|
|
|
+from histogram2 import HistFrame as HistFramePyPlot
|
|
|
from grass.script import core as grass
|
|
|
|
|
|
# for standalone app
|
|
@@ -1544,12 +1543,12 @@ class MapFrame(wx.Frame):
|
|
|
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)
|
|
|
+ self.Bind(wx.EVT_MENU, self.OnHistogramPyPlot, histogram2)
|
|
|
|
|
|
histogram = wx.MenuItem(toolsmenu, wx.ID_ANY, icons["histogram"].GetLabel())
|
|
|
histogram.SetBitmap(icons["histogram"].GetBitmap(self.iconsize))
|
|
|
toolsmenu.AppendItem(histogram)
|
|
|
- self.Bind(wx.EVT_MENU, self.Histogram, histogram)
|
|
|
+ self.Bind(wx.EVT_MENU, self.OnHistogram, histogram)
|
|
|
|
|
|
# Popup the menu. If an item is selected then its handler
|
|
|
# will be called before PopupMenu returns.
|
|
@@ -1704,33 +1703,35 @@ class MapFrame(wx.Frame):
|
|
|
|
|
|
return (outdist, outunits)
|
|
|
|
|
|
- def Histogram(self, event):
|
|
|
+ def OnHistogramPyPlot(self, event):
|
|
|
"""!Init PyPlot histogram display canvas and tools
|
|
|
"""
|
|
|
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)
|
|
|
-
|
|
|
- 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):
|
|
|
+ for layer in self.tree.GetSelections():
|
|
|
+ if self.tree.GetPyData(layer)[0]['maplayer'].GetType() != 'raster':
|
|
|
+ continue
|
|
|
+ raster.append(self.tree.GetPyData(layer)[0]['maplayer'].GetName())
|
|
|
+ print raster
|
|
|
+ self.histogramPyPlot = HistFramePyPlot(parent = self, id = wx.ID_ANY, size = globalvar.HIST_WINDOW_SIZE,
|
|
|
+ style = wx.DEFAULT_FRAME_STYLE, rasterList = raster)
|
|
|
+ self.histogramPyPlot.Show()
|
|
|
+ # Open raster select dialog to make sure that a raster (and
|
|
|
+ # the desired raster) is selected to be histogrammed
|
|
|
+ if not raster:
|
|
|
+ self.histogramPyPlot.OnSelectRaster(None)
|
|
|
+ else:
|
|
|
+ self.histogramPyPlot.OnCreateHist(None)
|
|
|
+
|
|
|
+ def OnHistogram(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()
|
|
|
-
|
|
|
+ self.histogram = HistFrame(parent = self, id = wx.ID_ANY, size = globalvar.HIST_WINDOW_SIZE,
|
|
|
+ style = wx.DEFAULT_FRAME_STYLE)
|
|
|
+
|
|
|
+ # show new display
|
|
|
+ self.histogram.Show()
|
|
|
+ self.histogram.Refresh()
|
|
|
+
|
|
|
def OnDecoration(self, event):
|
|
|
"""!Decorations overlay menu
|
|
|
"""
|