[GRASS-SVN] r54430 - grass/trunk/gui/wxpython/iclass
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Dec 27 12:41:13 PST 2012
Author: annakrat
Date: 2012-12-27 12:41:13 -0800 (Thu, 27 Dec 2012)
New Revision: 54430
Modified:
grass/trunk/gui/wxpython/iclass/frame.py
grass/trunk/gui/wxpython/iclass/toolbars.py
Log:
wxGUI/iclass: add RGB layer
Modified: grass/trunk/gui/wxpython/iclass/frame.py
===================================================================
--- grass/trunk/gui/wxpython/iclass/frame.py 2012-12-27 18:46:15 UTC (rev 54429)
+++ grass/trunk/gui/wxpython/iclass/frame.py 2012-12-27 20:41:13 UTC (rev 54430)
@@ -1124,6 +1124,23 @@
self.toolbar.choice.Insert(name, 0)
self.toolbar.choice.SetSelection(0)
+ def AddLayerRGB(self, cmd):
+ """!Adds RGB layer and update toolbar.
+
+ @param cmd d.rgb command as a list
+ """
+ name = []
+ for param in cmd:
+ if '=' in param:
+ name.append(param.split('=')[1])
+ name = ','.join(name)
+ self.map.AddLayer(type = 'rgb', command = cmd, l_active = True,
+ name = name, l_hidden = False, l_opacity = 1.0, l_render = True)
+ self.frame.Render(self.mapWindow)
+ self.layerName[name] = name
+ self.toolbar.choice.Insert(name, 0)
+ self.toolbar.choice.SetSelection(0)
+
def RemoveTemporaryLayer(self, name):
"""!Removes temporary layer (if exists) from Map and and updates toolbar.
@@ -1169,7 +1186,8 @@
def SelectLayer(self, name):
"""!Moves selected layer to top"""
- layers = self.map.GetListOfLayers(l_type = 'raster')
+ layers = self.map.GetListOfLayers(l_type = 'raster') + \
+ self.map.GetListOfLayers(l_type = 'rgb')
idx = None
for i, layer in enumerate(layers):
if self.layerName[name] == layer.GetName():
Modified: grass/trunk/gui/wxpython/iclass/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/iclass/toolbars.py 2012-12-27 18:46:15 UTC (rev 54429)
+++ grass/trunk/gui/wxpython/iclass/toolbars.py 2012-12-27 20:41:13 UTC (rev 54430)
@@ -23,6 +23,7 @@
from gui_core.toolbars import BaseToolbar, BaseIcons
from icons.icon import MetaIcon
from iclass.dialogs import IClassMapDialog
+from gui_core.forms import GUI
import grass.script as grass
@@ -43,6 +44,8 @@
label = _('Export training areas')),
'importAreas' : MetaIcon(img = 'layer-import',
label = _('Import training areas')),
+ 'addRgb' : MetaIcon(img = 'layer-rgb-add',
+ label = _('Add RGB map layer')),
}
class IClassMapToolbar(BaseToolbar):
@@ -250,10 +253,12 @@
"""!Toolbar data"""
return self._getToolbarData((("addRast", BaseIcons['addRast'],
self.OnAddRast),
- ("delRast", iClassIcons['delCmd'],
- self.OnDelRast),
- ("setOpacity", iClassIcons['opacity'],
- self.OnSetOpacity),
+ ('addRgb', iClassIcons['addRgb'],
+ self.OnAddRGB),
+ ("delRast", iClassIcons['delCmd'],
+ self.OnDelRast),
+ ("setOpacity", iClassIcons['opacity'],
+ self.OnSetOpacity),
))
def OnSelectLayer(self, event):
@@ -269,6 +274,14 @@
dlg.Destroy()
+ def OnAddRGB(self, event):
+ cmd = ['d.rgb']
+ GUI(parent = self.parent).ParseCommand(cmd, completed = (self.GetOptData, '', ''))
+
+ def GetOptData(self, dcmd, layer, params, propwin):
+ if dcmd:
+ self.mapManager.AddLayerRGB(cmd = dcmd)
+
def OnDelRast(self, event):
layer = self.choice.GetStringSelection()
idx = self.choice.GetSelection()
More information about the grass-commit
mailing list