2 @package lmgr.layertree
4 @brief Utility classes for map layer management.
9 (C) 2007-2013 by the GRASS Development Team
11 This program is free software under the GNU General Public License
12 (>=v2). Read the file COPYING that comes with GRASS for details.
14 @author Michael Barton (Arizona State University)
15 @author Jachym Cepicky (Mendel University of Agriculture)
16 @author Martin Landa <landa.martin gmail.com>
21 import wx.lib.agw.customtreectrl
as CT
23 import wx.lib.customtreectrl
as CT
24 import wx.lib.buttons
as buttons
28 from wx.lib.mixins
import treemixin
33 from core
import globalvar
35 from gui_core.forms
import GUI
45 from icons.icon
import MetaIcon
46 from modules.colorrules
import RasterColorTable
51 'rastImport' : MetaIcon(img =
'layer-import',
52 label = _(
'Import raster data')),
53 'rastLink' : MetaIcon(img =
'layer-import',
54 label = _(
'Link external raster data')),
55 'rastOut' : MetaIcon(img =
'layer-export',
56 label = _(
'Set raster output format')),
57 'vectImport' : MetaIcon(img =
'layer-import',
58 label = _(
'Import vector data')),
59 'vectLink' : MetaIcon(img =
'layer-import',
60 label = _(
'Link external vector data')),
61 'vectOut' : MetaIcon(img =
'layer-export',
62 label = _(
'Set vector output format')),
63 'addCmd' : MetaIcon(img =
'layer-command-add',
64 label = _(
'Add command layer')),
65 'quit' : MetaIcon(img =
'quit',
67 'addRgb' : MetaIcon(img =
'layer-rgb-add',
68 label = _(
'Add RGB map layer')),
69 'addHis' : MetaIcon(img =
'layer-his-add',
70 label = _(
'Add HIS map layer')),
71 'addShaded' : MetaIcon(img =
'layer-shaded-relief-add',
72 label = _(
'Add shaded relief map layer')),
73 'addRArrow' : MetaIcon(img =
'layer-aspect-arrow-add',
74 label = _(
'Add raster flow arrows')),
75 'addRNum' : MetaIcon(img =
'layer-cell-cats-add',
76 label = _(
'Add raster cell numbers')),
77 'addThematic': MetaIcon(img =
'layer-vector-thematic-add',
78 label = _(
'Add thematic area (choropleth) map layer')),
79 'addChart' : MetaIcon(img =
'layer-vector-chart-add',
80 label = _(
'Add thematic chart layer')),
81 'addGrid' : MetaIcon(img =
'layer-grid-add',
82 label = _(
'Add grid layer')),
83 'addGeodesic': MetaIcon(img =
'shortest-distance',
84 label = _(
'Add geodesic line layer')),
85 'addRhumb' : MetaIcon(img =
'shortest-distance',
86 label = _(
'Add rhumbline layer')),
87 'addLabels' : MetaIcon(img =
'layer-label-add',
88 label = _(
'Add labels')),
89 'addRast3d' : MetaIcon(img =
'layer-raster3d-add',
90 label = _(
'Add 3D raster map layer'),
91 desc = _(
'Note that 3D raster data are rendered only in 3D view mode')),
92 'layerOptions' : MetaIcon(img =
'options',
93 label = _(
'Set options')),
96 class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
97 """!Creates layer tree structure
100 id = wx.ID_ANY, style = wx.SUNKEN_BORDER,
101 ctstyle = CT.TR_HAS_BUTTONS | CT.TR_HAS_VARIABLE_ROW_HEIGHT |
102 CT.TR_HIDE_ROOT | CT.TR_ROW_LINES | CT.TR_FULL_ROW_HIGHLIGHT |
103 CT.TR_MULTIPLE, **kwargs):
105 if 'style' in kwargs:
106 ctstyle |= kwargs[
'style']
113 del kwargs[
'notebook']
116 showMapDisplay = kwargs[
'showMapDisplay']
117 del kwargs[
'showMapDisplay']
133 ctstyle |= CT.TR_ALIGN_WINDOWS
134 except AttributeError:
138 super(LayerTree, self).
__init__(parent, id, agwStyle = ctstyle, **kwargs)
140 super(LayerTree, self).
__init__(parent, id, style = ctstyle, **kwargs)
141 self.SetName(
"LayerTree")
146 self.SetGradientStyle(1)
147 self.EnableSelectionGradient(
True)
153 id = wx.ID_ANY, pos = pos,
154 size = globalvar.MAP_WINDOW_SIZE,
155 style = wx.DEFAULT_FRAME_STYLE,
156 tree = self, notebook = self.
notebook,
161 self.mapdisplay.SetTitle(_(
"GRASS GIS %(version)s Map Display: %(id)d - Location: %(loc)s") % \
162 {
'version' : grass.version()[
'version'],
164 'loc' : grass.gisenv()[
"LOCATION_NAME"] })
167 if showMapDisplay
is True:
168 self.mapdisplay.Show()
169 self.mapdisplay.Refresh()
170 self.mapdisplay.Update()
172 self.
root = self.AddRoot(_(
"Map Layers"))
173 self.SetPyData(self.
root, (
None,
None))
176 il = wx.ImageList(16, 16, mask =
False)
178 trart = wx.ArtProvider.GetBitmap(wx.ART_FOLDER_OPEN, wx.ART_OTHER, (16, 16))
180 trart = wx.ArtProvider.GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, (16, 16))
184 trgif = BaseIcons[
"addRast"].GetBitmap(bmpsize)
187 trgif = LMIcons[
"addRast3d"].GetBitmap(bmpsize)
190 trgif = LMIcons[
"addRgb"].GetBitmap(bmpsize)
193 trgif = LMIcons[
"addHis"].GetBitmap(bmpsize)
196 trgif = LMIcons[
"addShaded"].GetBitmap(bmpsize)
199 trgif = LMIcons[
"addRArrow"].GetBitmap(bmpsize)
202 trgif = LMIcons[
"addRNum"].GetBitmap(bmpsize)
205 trgif = BaseIcons[
"addVect"].GetBitmap(bmpsize)
208 trgif = LMIcons[
"addThematic"].GetBitmap(bmpsize)
211 trgif = LMIcons[
"addChart"].GetBitmap(bmpsize)
214 trgif = LMIcons[
"addGrid"].GetBitmap(bmpsize)
217 trgif = LMIcons[
"addGeodesic"].GetBitmap(bmpsize)
220 trgif = LMIcons[
"addRhumb"].GetBitmap(bmpsize)
223 trgif = LMIcons[
"addLabels"].GetBitmap(bmpsize)
226 trgif = LMIcons[
"addCmd"].GetBitmap(bmpsize)
229 self.AssignImageList(il)
231 self.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.
OnExpandNode)
234 self.Bind(wx.EVT_TREE_SEL_CHANGED, self.
OnChangeSel)
240 self.Bind(wx.EVT_TREE_END_DRAG, self.
OnEndDrag)
241 self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.
OnRenamed)
242 self.Bind(wx.EVT_KEY_UP, self.
OnKeyUp)
243 self.Bind(wx.EVT_IDLE, self.
OnIdle)
244 self.Bind(wx.EVT_MOTION, self.
OnMotion)
246 def _setGradient(self, iType = None):
247 """!Set gradient for items
249 @param iType bgmap, vdigit or None
252 self.SetFirstGradientColour(wx.Colour(0, 100, 0))
253 self.SetSecondGradientColour(wx.Colour(0, 150, 0))
254 elif iType ==
'vdigit':
255 self.SetFirstGradientColour(wx.Colour(100, 0, 0))
256 self.SetSecondGradientColour(wx.Colour(150, 0, 0))
258 self.SetFirstGradientColour(wx.Colour(100, 100, 100))
259 self.SetSecondGradientColour(wx.Colour(150, 150, 150))
262 """Returns a list of selected items.
264 This method is copied from customtreecontrol and overriden because
265 with some version wx (?) multiple selection doesn't work.
266 Probably it is caused by another GetSelections method in treemixin.DragAndDrop?
269 idRoot = self.GetRootItem()
271 array = self.FillArray(idRoot, array)
278 """!Get map instace"""
282 """!Get associated MapFrame"""
286 """!Only re-order and re-render a composite map image from GRASS during
287 idle time instead of multiple times during layer changing.
290 if self.mapdisplay.GetToolbar(
'vdigit'):
294 if self.mapdisplay.IsAutoRendered():
295 self.mapdisplay.MapWindow2D.UpdateMap(render =
True, renderVector = vector)
296 if self.lmgr.IsPaneShown(
'toolbarNviz'):
297 self.mapdisplay.MapWindow3D.UpdateMap(render =
True)
305 key = event.GetKeyCode()
307 if key == wx.WXK_DELETE
and self.
lmgr and \
308 not self.GetEditControl():
309 self.lmgr.OnDeleteLayer(
None)
314 """!Contextual menu for item/layer"""
322 Debug.msg (4,
"LayerTree.OnContextMenu: layertype=%s" % \
325 if not hasattr (self,
"popupID"):
327 for key
in (
'remove',
'rename',
'opacity',
'nviz',
'zoom',
328 'region',
'export',
'attr',
'edit0',
'edit1',
329 'bgmap',
'topo',
'meta',
'null',
'zoom1',
'region1',
330 'color',
'hist',
'univar',
'prof',
'properties'):
337 self.popupMenu.Append(self.
popupID[
'remove'], text = _(
"Remove"))
338 self.Bind(wx.EVT_MENU, self.lmgr.OnDeleteLayer, id = self.
popupID[
'remove'])
340 if ltype !=
"command":
341 self.popupMenu.Append(self.
popupID[
'rename'], text = _(
"Rename"))
344 self.popupMenu.Enable(self.
popupID[
'rename'],
False)
347 if ltype
not in (
"group",
"command"):
348 self.popupMenu.AppendSeparator()
349 self.popupMenu.Append(self.
popupID[
'opacity'], text = _(
"Change opacity level"))
351 self.popupMenu.Append(self.
popupID[
'properties'], text = _(
"Properties"))
355 self.popupMenu.Enable(self.
popupID[
'opacity'],
False)
356 self.popupMenu.Enable(self.
popupID[
'properties'],
False)
358 if ltype
in (
'raster',
'vector',
'3d-raster')
and self.lmgr.IsPaneShown(
'toolbarNviz'):
359 self.popupMenu.Append(self.
popupID[
'nviz'], _(
"3D view properties"))
362 if ltype
in (
'raster',
'vector',
'rgb'):
363 self.popupMenu.Append(self.
popupID[
'zoom'], text = _(
"Zoom to selected map(s)"))
364 self.Bind(wx.EVT_MENU, self.mapdisplay.OnZoomToMap, id = self.
popupID[
'zoom'])
365 self.popupMenu.Append(self.
popupID[
'region'], text = _(
"Set computational region from selected map(s)"))
375 if mltype
and mltype ==
"vector":
376 self.popupMenu.AppendSeparator()
377 self.popupMenu.Append(self.
popupID[
'export'], text = _(
"Export"))
378 self.Bind(wx.EVT_MENU,
lambda x: self.lmgr.OnMenuCmd(cmd = [
'v.out.ogr',
379 'input=%s' % mapLayer.GetName()]),
382 self.popupMenu.AppendSeparator()
384 self.popupMenu.Append(self.
popupID[
'color'], _(
"Set color table"))
387 self.popupMenu.Append(self.
popupID[
'attr'], text = _(
"Show attribute data"))
388 self.Bind(wx.EVT_MENU, self.lmgr.OnShowAttributeTable, id = self.
popupID[
'attr'])
390 self.popupMenu.Append(self.
popupID[
'edit0'], text = _(
"Start editing"))
391 self.popupMenu.Append(self.
popupID[
'edit1'], text = _(
"Stop editing"))
392 self.popupMenu.Enable(self.
popupID[
'edit1'],
False)
398 digitToolbar = self.mapdisplay.GetToolbar(
'vdigit')
401 self.popupMenu.Append(self.
popupID[
'bgmap'],
402 text = _(
"Use as background vector map for digitizer"),
403 kind = wx.ITEM_CHECK)
405 if UserSettings.Get(group =
'vdigit', key =
'bgmap', subkey =
'value',
406 internal =
True) == layer.GetName():
407 self.popupMenu.Check(self.
popupID[
'bgmap'],
True)
409 self.popupMenu.Append(self.
popupID[
'topo'], text = _(
"Rebuild topology"))
412 if layer.GetMapset() != grass.gisenv()[
'MAPSET']:
414 self.popupMenu.Enable (self.
popupID[
'edit0'],
False)
415 self.popupMenu.Enable (self.
popupID[
'edit1'],
False)
416 self.popupMenu.Enable (self.
popupID[
'topo'],
False)
417 elif digitToolbar
and digitToolbar.GetLayer():
419 vdigitLayer = digitToolbar.GetLayer()
420 if vdigitLayer
is layer:
421 self.popupMenu.Enable(self.
popupID[
'edit0'],
False)
422 self.popupMenu.Enable(self.
popupID[
'edit1'],
True)
423 self.popupMenu.Enable(self.
popupID[
'remove'],
False)
424 self.popupMenu.Enable(self.
popupID[
'bgmap'],
False)
425 self.popupMenu.Enable(self.
popupID[
'topo'],
False)
427 self.popupMenu.Enable(self.
popupID[
'edit0'],
False)
428 self.popupMenu.Enable(self.
popupID[
'edit1'],
False)
429 self.popupMenu.Enable(self.
popupID[
'bgmap'],
True)
431 self.popupMenu.Append(self.
popupID[
'meta'], _(
"Metadata"))
434 self.popupMenu.Enable(self.
popupID[
'attr'],
False)
435 self.popupMenu.Enable(self.
popupID[
'edit0'],
False)
436 self.popupMenu.Enable(self.
popupID[
'edit1'],
False)
437 self.popupMenu.Enable(self.
popupID[
'meta'],
False)
438 self.popupMenu.Enable(self.
popupID[
'bgmap'],
False)
439 self.popupMenu.Enable(self.
popupID[
'topo'],
False)
440 self.popupMenu.Enable(self.
popupID[
'export'],
False)
443 elif mltype
and mltype ==
"raster":
444 self.popupMenu.Append(self.
popupID[
'zoom1'], text = _(
"Zoom to selected map(s) (ignore NULLs)"))
445 self.Bind(wx.EVT_MENU, self.mapdisplay.OnZoomToRaster, id = self.
popupID[
'zoom1'])
446 self.popupMenu.Append(self.
popupID[
'region1'], text = _(
"Set computational region from selected map(s) (ignore NULLs)"))
449 self.popupMenu.AppendSeparator()
450 self.popupMenu.Append(self.
popupID[
'export'], text = _(
"Export"))
451 self.Bind(wx.EVT_MENU,
lambda x: self.lmgr.OnMenuCmd(cmd = [
'r.out.gdal',
452 'input=%s' % mapLayer.GetName()]),
455 self.popupMenu.AppendSeparator()
456 self.popupMenu.Append(self.
popupID[
'color'], _(
"Set color table"))
458 self.popupMenu.Append(self.
popupID[
'hist'], _(
"Histogram"))
460 self.popupMenu.Append(self.
popupID[
'univar'], _(
"Univariate raster statistics"))
462 self.popupMenu.Append(self.
popupID[
'prof'], _(
"Profile"))
464 self.popupMenu.Append(self.
popupID[
'meta'], _(
"Metadata"))
468 self.popupMenu.Enable(self.
popupID[
'zoom1'],
False)
469 self.popupMenu.Enable(self.
popupID[
'region1'],
False)
470 self.popupMenu.Enable(self.
popupID[
'color'],
False)
471 self.popupMenu.Enable(self.
popupID[
'hist'],
False)
472 self.popupMenu.Enable(self.
popupID[
'univar'],
False)
473 self.popupMenu.Enable(self.
popupID[
'prof'],
False)
474 self.popupMenu.Enable(self.
popupID[
'meta'],
False)
475 self.popupMenu.Enable(self.
popupID[
'export'],
False)
476 if self.lmgr.IsPaneShown(
'toolbarNviz'):
477 self.popupMenu.Enable(self.
popupID[
'nviz'],
False)
480 self.popupMenu.Destroy()
483 """!Rebuild topology of selected vector map"""
486 'map=%s' % mapLayer.GetName()]
487 self.lmgr.goutput.RunCmd(cmd, switchPage =
True)
490 """!Print metadata of raster/vector map layer
491 TODO: Dialog to modify metadata
496 if mltype ==
'raster':
498 elif mltype ==
'vector':
500 cmd.append(
'map=%s' % mapLayer.GetName())
503 self.lmgr.goutput.RunCmd(cmd, switchPage =
True)
506 """!Set computational region from selected raster map (ignore NULLs)"""
511 'zoom=%s' % mapLayer.GetName()]
514 self.lmgr.goutput.RunCmd(cmd)
517 """!Set computational region from selected raster/vector map
523 mapLayer = self.GetPyData(layer)[0][
'maplayer']
524 mltype = self.GetPyData(layer)[0][
'type']
526 if mltype ==
'raster':
527 rast.append(mapLayer.GetName())
528 elif mltype ==
'vector':
529 vect.append(mapLayer.GetName())
530 elif mltype ==
'3d-raster':
531 rast3d.append(mapLayer.GetName())
532 elif mltype ==
'rgb':
533 for rname
in mapLayer.GetName().splitlines():
538 cmd.append(
'rast=%s' %
','.join(rast))
540 cmd.append(
'vect=%s' %
','.join(vect))
542 cmd.append(
'rast3d=%s' %
','.join(rast3d))
547 self.lmgr.goutput.RunCmd(cmd, compReg =
False)
550 """!Plot profile of given raster map layer"""
552 if not mapLayer.GetName():
553 wx.MessageBox(parent = self,
554 message = _(
"Unable to create profile of "
556 caption = _(
"Error"), style = wx.OK | wx.ICON_ERROR | wx.CENTRE)
559 if not hasattr (self,
"profileFrame"):
562 if hasattr (self.
mapdisplay,
"profile")
and self.mapdisplay.profile:
567 id = wx.ID_ANY, pos = wx.DefaultPosition, size = (700,300),
568 style = wx.DEFAULT_FRAME_STYLE, rasterList = [mapLayer.GetName()])
570 self.profileFrame.Show()
573 """!Set color table for raster map"""
574 name = self.GetPyData(self.
layer_selected)[0][
'maplayer'].GetName()
575 ctable = RasterColorTable(self, layerTree = self)
578 ctable.CentreOnScreen()
581 """!Set color table for vector map"""
582 name = self.GetPyData(self.
layer_selected)[0][
'maplayer'].GetName()
583 GUI(parent = self, centreOnParent =
False).ParseCommand([
'v.colors',
587 """!Plot histogram for given raster map layer
590 if not mapLayer.GetName():
591 GError(parent = self,
592 message = _(
"Unable to display histogram of "
593 "raster map. No map name defined."))
596 win = HistogramFrame(parent = self)
600 win.SetHistLayer(mapLayer.GetName())
601 win.HistWindow.UpdateHist()
606 """!Univariate raster statistics"""
607 name = self.GetPyData(self.
layer_selected)[0][
'maplayer'].GetName()
608 self.lmgr.goutput.RunCmd([
'r.univar',
'map=%s' % name], switchPage =
True)
611 """!Start editing vector map layer requested by the user
619 if not self.mapdisplay.GetToolbar(
'vdigit'):
620 self.mapdisplay.AddToolbar(
'vdigit')
622 if not self.mapdisplay.toolbars[
'vdigit']:
625 self.mapdisplay.toolbars[
'vdigit'].StartEditing(maplayer)
631 """!Stop editing the current vector map layer
635 self.mapdisplay.toolbars[
'vdigit'].OnExit()
637 self.lmgr.toolbars[
'tools'].Enable(
'vdigit', enable =
True)
643 """!Set background vector map for editing sesstion"""
644 digit = self.mapdisplay.GetWindow().digit
645 if event.IsChecked():
646 mapName = self.GetPyData(self.
layer_selected)[0][
'maplayer'].GetName()
647 UserSettings.Set(group =
'vdigit', key =
'bgmap', subkey =
'value',
648 value = str(mapName), internal =
True)
649 digit.OpenBackgroundMap(mapName)
652 UserSettings.Set(group =
'vdigit', key =
'bgmap', subkey =
'value',
653 value =
'', internal =
True)
654 digit.CloseBackgroundMap()
660 """!Popup properties dialog"""
664 """!Popup opacity level indicator"""
669 current_opacity = maplayer.GetOpacity()
671 dlg = SetOpacityDialog(self, opacity = current_opacity,
672 title = _(
"Set opacity of <%s>") % maplayer.GetName())
676 if dlg.ShowModal() == wx.ID_OK:
681 """!Handles EVT_APPLY_OPACITY event."""
685 """!Change opacity value of layer
686 @param layer layer for which to change (item in layertree)
687 @param value opacity value (float between 0 and 1)
689 maplayer = self.GetPyData(layer)[0][
'maplayer']
690 self.Map.ChangeOpacity(maplayer, value)
691 maplayer.SetOpacity(value)
692 self.SetItemText(layer,
697 self.
GetMapDisplay().GetToolbar(
'vdigit').GetLayer() == maplayer:
698 alpha = int(value * 255)
705 self.
GetMapDisplay().GetWindow().UpdateMap(render =
False, renderVector = renderVector)
708 """!Nviz-related properties (raster/vector/volume)
712 self.lmgr.notebook.SetSelectionByName(
'nviz')
714 if ltype ==
'raster':
715 self.lmgr.nviz.SetPage(
'surface')
716 elif ltype ==
'vector':
717 self.lmgr.nviz.SetPage(
'vector')
718 elif ltype ==
'3d-raster':
719 self.lmgr.nviz.SetPage(
'volume')
724 self.GetEditControl().SetSelection(-1, -1)
729 self.GetPyData(item)[0][
'label'] = event.GetLabel()
734 def AddLayer(self, ltype, lname = None, lchecked = None,
735 lopacity = 1.0, lcmd =
None, lgroup =
None, lvdigit =
None, lnviz =
None, multiple =
True):
736 """!Add new item to the layer tree, create corresponding MapLayer instance.
737 Launch property dialog if needed (raster, vector, etc.)
739 @param ltype layer type (raster, vector, 3d-raster, ...)
740 @param lname layer name
741 @param lchecked if True layer is checked
742 @param lopacity layer opacity level
743 @param lcmd command (given as a list)
744 @param lgroup index of group item (-1 for root) or None
745 @param lvdigit vector digitizer settings (eg. geometry attributes)
746 @param lnviz layer Nviz properties
747 @param multiple True to allow multiple map layers in layer tree
749 if lname
and not multiple:
751 item = self.GetFirstVisibleItem()
752 while item
and item.IsOk():
753 if self.GetPyData(item)[0][
'type'] ==
'vector':
754 name = self.GetPyData(item)[0][
'maplayer'].GetName()
757 item = self.GetNextVisible(item)
766 Debug.msg (3,
"LayerTree().AddLayer(): ltype=%s" % (ltype))
768 if ltype ==
'command':
770 ctrl = wx.TextCtrl(self, id = wx.ID_ANY, value =
'',
771 pos = wx.DefaultPosition, size = (self.GetSize()[0]-100,25),
773 style = wx.TE_PROCESS_ENTER | wx.TE_DONTWRAP)
776 elif ltype ==
'group':
779 grouptext = _(
'Layer group:') + str(self.
groupnode)
782 btnbmp = LMIcons[
"layerOptions"].GetBitmap((16,16))
783 ctrl = buttons.GenBitmapButton(self, id = wx.ID_ANY, bitmap = btnbmp, size = (24,24))
784 ctrl.SetToolTipString(_(
"Click to edit layer settings"))
792 text =
'', ct_type = 1, wnd = ctrl)
797 layer = self.AppendItem(parentId = self.
root,
798 text =
'', ct_type = 1, wnd = ctrl)
804 layer = self.AppendItem(parentId = parent,
805 text =
'', ct_type = 1, wnd = ctrl)
809 layer = self.InsertItem(parentId = parent,
811 text =
'', ct_type = 1, wnd = ctrl)
813 layer = self.PrependItem(parent = self.
root, text =
'', ct_type = 1, wnd = ctrl)
817 if lchecked
is not None:
823 self.CheckItem(layer, checked = checked)
826 label = _(
'(double click to set properties)') +
' ' * 15
827 if ltype ==
'raster':
829 self.SetItemText(layer,
'%s %s' % (_(
'raster'), label))
830 elif ltype ==
'3d-raster':
832 self.SetItemText(layer,
'%s %s' % (_(
'3D raster'), label))
834 self.SetItemImage(layer, self.
rgb_icon)
835 self.SetItemText(layer,
'%s %s' % (_(
'RGB'), label))
837 self.SetItemImage(layer, self.
his_icon)
838 self.SetItemText(layer,
'%s %s' % (_(
'HIS'), label))
839 elif ltype ==
'shaded':
841 self.SetItemText(layer,
'%s %s' % (_(
'shaded relief'), label))
842 elif ltype ==
'rastnum':
844 self.SetItemText(layer,
'%s %s' % (_(
'raster cell numbers'), label))
845 elif ltype ==
'rastarrow':
847 self.SetItemText(layer,
'%s %s' % (_(
'raster flow arrows'), label))
848 elif ltype ==
'vector':
850 self.SetItemText(layer,
'%s %s' % (_(
'vector'), label))
851 elif ltype ==
'thememap':
853 self.SetItemText(layer,
'%s %s' % (_(
'thematic map'), label))
854 elif ltype ==
'themechart':
856 self.SetItemText(layer,
'%s %s' % (_(
'thematic charts'), label))
857 elif ltype ==
'grid':
859 self.SetItemText(layer,
'%s %s' % (_(
'grid'), label))
860 elif ltype ==
'geodesic':
862 self.SetItemText(layer,
'%s %s' % (_(
'geodesic line'), label))
863 elif ltype ==
'rhumb':
865 self.SetItemText(layer,
'%s %s' % (_(
'rhumbline'), label))
866 elif ltype ==
'labels':
868 self.SetItemText(layer,
'%s %s' % (_(
'vector labels'), label))
869 elif ltype ==
'command':
870 self.SetItemImage(layer, self.
cmd_icon)
871 elif ltype ==
'group':
872 self.SetItemImage(layer, self.
folder)
873 self.SetItemText(layer, grouptext)
878 if lcmd
and len(lcmd) > 1:
884 if ltype ==
'command' and lname:
885 for c
in lname.split(
';'):
886 cmd.append(c.split(
' '))
892 ctrlId = ctrl.GetId()
897 self.SetPyData(layer, ({
'cmd' : cmd,
908 prevItem = self.GetFirstChild(self.
root)[0]
911 while prevItem
and prevItem.IsOk()
and prevItem != layer:
912 if self.GetPyData(prevItem)[0][
'maplayer']:
913 prevMapLayer = self.GetPyData(prevItem)[0][
'maplayer']
915 prevItem = self.GetNextSibling(prevItem)
918 pos = self.Map.GetLayerIndex(prevMapLayer)
922 maplayer = self.Map.AddLayer(pos = pos,
923 type = ltype, command = self.GetPyData(layer)[0][
'cmd'], name = name,
924 l_active = checked, l_hidden =
False,
925 l_opacity = lopacity, l_render = render)
926 self.GetPyData(layer)[0][
'maplayer'] = maplayer
933 self.SetPyData(layer, ({
'cmd' :
None,
942 self.SelectItem(layer, select =
True)
948 self.SetItemText(layer, lname)
949 elif ltype ==
'command':
956 self.mapdisplay.GetProgressBar().
SetRange(len(self.Map.GetListOfLayers(l_active =
True)))
961 """!Launch the properties dialog"""
962 if 'propwin' in self.GetPyData(layer)[0]
and \
963 self.GetPyData(layer)[0][
'propwin']
is not None:
965 win = self.GetPyData(layer)[0][
'propwin']
974 params = self.GetPyData(layer)[1]
975 ltype = self.GetPyData(layer)[0][
'type']
977 Debug.msg (3,
"LayerTree.PropertiesDialog(): ltype=%s" % \
981 if self.GetPyData(layer)[0][
'cmd']:
982 module = GUI(parent = self, show = show, centreOnParent =
False)
983 module.ParseCommand(self.GetPyData(layer)[0][
'cmd'],
986 self.GetPyData(layer)[0][
'cmd'] = module.GetCmd()
987 elif ltype ==
'raster':
989 if UserSettings.Get(group=
'cmd', key=
'rasterOverlay', subkey=
'enabled'):
992 elif ltype ==
'3d-raster':
993 cmd = [
'd.rast3d.py']
997 if UserSettings.Get(group=
'cmd', key=
'rasterOverlay', subkey=
'enabled'):
1000 elif ltype ==
'his':
1003 elif ltype ==
'shaded':
1004 cmd = [
'd.shadedmap']
1006 elif ltype ==
'rastarrow':
1007 cmd = [
'd.rast.arrow']
1009 elif ltype ==
'rastnum':
1010 cmd = [
'd.rast.num']
1012 elif ltype ==
'vector':
1014 for ftype
in [
'point',
'line',
'boundary',
'centroid',
'area',
'face']:
1015 if UserSettings.Get(group =
'cmd', key =
'showType', subkey = [ftype,
'enabled']):
1018 cmd = [
'd.vect',
'type=%s' %
','.join(types)]
1020 elif ltype ==
'thememap':
1023 cmd = [
'd.vect.thematic',
'-s']
1025 elif ltype ==
'themechart':
1026 cmd = [
'd.vect.chart']
1028 elif ltype ==
'grid':
1031 elif ltype ==
'geodesic':
1032 cmd = [
'd.geodesic']
1034 elif ltype ==
'rhumb':
1035 cmd = [
'd.rhumbline']
1037 elif ltype ==
'labels':
1041 GUI(parent = self, centreOnParent =
False).ParseCommand(cmd,
1045 """!Double click on the layer item.
1046 Launch property dialog, or expand/collapse group of items, etc.
1048 self.lmgr.WorkspaceChanged()
1049 layer = event.GetItem()
1054 if self.GetPyData(layer)[0][
'type'] ==
'group':
1055 if self.IsExpanded(layer):
1056 self.Collapse(layer)
1061 """!Remove selected layer item from the layer tree"""
1062 self.lmgr.WorkspaceChanged()
1063 item = event.GetItem()
1066 item.properties.Close(
True)
1070 if item != self.
root:
1071 Debug.msg (3,
"LayerTree.OnDeleteLayer(): name=%s" % \
1072 (self.GetItemText(item)))
1081 if self.GetPyData(item)[0][
'type'] !=
'group':
1082 self.Map.DeleteLayer( self.GetPyData(item)[0][
'maplayer'])
1090 if self.mapdisplay.GetToolbar(
'vdigit'):
1091 self.mapdisplay.toolbars[
'vdigit'].UpdateListOfLayers (updateTool =
True)
1094 self.mapdisplay.GetProgressBar().
SetRange(len(self.Map.GetListOfLayers(l_active =
True)))
1099 if self.lmgr.IsPaneShown(
'toolbarNviz')
and \
1100 self.GetPyData(item)
is not None:
1102 mapLayer = self.GetPyData(item)[0][
'maplayer']
1103 self.mapdisplay.SetStatusText(_(
"Please wait, updating data..."), 0)
1104 if mapLayer.type ==
'raster':
1105 self.mapdisplay.MapWindow.UnloadRaster(item)
1106 elif mapLayer.type ==
'3d-raster':
1107 self.mapdisplay.MapWindow.UnloadRaster3d(item)
1108 elif mapLayer.type ==
'vector':
1109 self.mapdisplay.MapWindow.UnloadVector(item)
1110 self.mapdisplay.SetStatusText(
"", 0)
1115 """!Layer checkbox is being checked.
1117 Continue only if mouse is above checkbox or layer was checked programatically.
1126 """!Enable/disable data layer"""
1127 self.lmgr.WorkspaceChanged()
1129 item = event.GetItem()
1130 checked = item.IsChecked()
1132 digitToolbar = self.mapdisplay.GetToolbar(
'vdigit')
1135 if self.GetPyData(item)[0][
'type'] ==
'group':
1136 child, cookie = self.GetFirstChild(item)
1139 self.CheckItem(child, checked)
1140 mapLayer = self.GetPyData(child)[0][
'maplayer']
1141 if not digitToolbar
or \
1142 (digitToolbar
and digitToolbar.GetLayer() != mapLayer):
1144 self.Map.ChangeLayerActive(mapLayer, checked)
1145 child = self.GetNextSibling(child)
1147 mapLayer = self.GetPyData(item)[0][
'maplayer']
1148 if not digitToolbar
or \
1149 (digitToolbar
and digitToolbar.GetLayer() != mapLayer):
1151 self.Map.ChangeLayerActive(mapLayer, checked)
1154 self.mapdisplay.GetProgressBar().
SetRange(len(self.Map.GetListOfLayers(l_active =
True)))
1157 if self.lmgr.IsPaneShown(
'toolbarNviz')
and \
1158 self.GetPyData(item)
is not None:
1160 mapLayer = self.GetPyData(item)[0][
'maplayer']
1162 self.mapdisplay.SetStatusText(_(
"Please wait, updating data..."), 0)
1165 if mapLayer.type ==
'raster':
1166 self.mapdisplay.MapWindow.LoadRaster(item)
1167 elif mapLayer.type ==
'3d-raster':
1168 self.mapdisplay.MapWindow.LoadRaster3d(item)
1169 elif mapLayer.type ==
'vector':
1170 vInfo = gvector.vector_info_topo(mapLayer.GetName())
1171 if (vInfo[
'points'] + vInfo[
'centroids']) > 0:
1172 self.mapdisplay.MapWindow.LoadVector(item, points =
True)
1173 if (vInfo[
'lines'] + vInfo[
'boundaries']) > 0:
1174 self.mapdisplay.MapWindow.LoadVector(item, points =
False)
1177 if mapLayer.type ==
'raster':
1178 self.mapdisplay.MapWindow.UnloadRaster(item)
1179 elif mapLayer.type ==
'3d-raster':
1180 self.mapdisplay.MapWindow.UnloadRaster3d(item)
1181 elif mapLayer.type ==
'vector':
1182 self.mapdisplay.MapWindow.UnloadVector(item)
1184 self.mapdisplay.SetStatusText(
"", 0)
1191 """!Change command string"""
1192 ctrl = event.GetEventObject().GetId()
1193 cmd = event.GetString()
1196 layer = self.GetFirstVisibleItem()
1197 while layer
and layer.IsOk():
1198 if self.GetPyData(layer)[0][
'ctrl'] == ctrl:
1200 layer = self.GetNextVisible(layer)
1208 """!Mouse is moving.
1210 Detects if mouse points at checkbox.
1212 thisItem, flags = self.HitTest(event.GetPosition())
1216 if (flags & CT.TREE_HITTEST_ONITEMCHECKICON)
and not (flags & CT.TREE_HITTEST_ONITEMLABEL):
1223 """!Selection is changing.
1225 If the user is clicking on checkbox, selection change is vetoed.
1231 """!Selection changed"""
1232 layer = event.GetItem()
1233 digitToolbar = self.mapdisplay.GetToolbar(
'vdigit')
1235 mapLayer = self.GetPyData(layer)[0][
'maplayer']
1236 bgmap = UserSettings.Get(group =
'vdigit', key =
'bgmap', subkey =
'value',
1239 if digitToolbar.GetLayer() == mapLayer:
1241 elif bgmap == mapLayer.GetName():
1251 if self.IsSelected(oldlayer):
1252 self.SetItemWindowEnabled(oldlayer,
True)
1254 self.SetItemWindowEnabled(oldlayer,
False)
1256 if self.IsSelected(layer):
1257 self.SetItemWindowEnabled(layer,
True)
1259 self.SetItemWindowEnabled(layer,
False)
1264 self.RefreshLine(oldlayer)
1265 self.RefreshLine(layer)
1270 if self.GetPyData(layer)
and self.GetPyData(layer)[0][
'maplayer']:
1271 cmd = self.GetPyData(layer)[0][
'maplayer'].GetCmd(string =
True)
1273 self.lmgr.SetStatusText(cmd)
1276 if self.GetPyData(layer)
and self.GetPyData(layer)[0][
'cmd']
and \
1277 UserSettings.Get(group =
'display', key =
'autoZooming', subkey =
'enabled'):
1278 mapLayer = self.GetPyData(layer)[0][
'maplayer']
1279 if mapLayer.GetType()
in (
'raster',
'vector'):
1280 render = self.mapdisplay.IsAutoRendered()
1281 self.mapdisplay.MapWindow.ZoomToMap(layers = [mapLayer,],
1285 if self.lmgr.IsPaneShown(
'toolbarNviz')
and \
1287 if self.layer_selected.IsChecked():
1291 if type ==
'raster':
1292 self.lmgr.nviz.UpdatePage(
'surface')
1293 self.lmgr.nviz.SetPage(
'surface')
1294 elif type ==
'vector':
1295 self.lmgr.nviz.UpdatePage(
'vector')
1296 self.lmgr.nviz.SetPage(
'vector')
1297 elif type ==
'3d-raster':
1298 self.lmgr.nviz.UpdatePage(
'volume')
1299 self.lmgr.nviz.SetPage(
'volume')
1316 dropTarget = event.GetItem()
1317 self.
flag = self.HitTest(event.GetPoint())[1]
1318 if self.IsValidDropTarget(dropTarget):
1320 if dropTarget !=
None:
1321 self.SelectItem(dropTarget)
1322 self.
OnDrop(dropTarget, self._dragItem)
1323 elif dropTarget ==
None:
1324 self.
OnDrop(dropTarget, self._dragItem)
1333 Debug.msg (4,
"LayerTree.OnDrop(): layer=%s" % \
1334 (self.GetItemText(dragItem)))
1340 if self.GetPyData(newItem)[0][
'type'] ==
'group':
1341 (child, cookie) = self.GetFirstChild(dragItem)
1346 child = self.GetNextChild(old, cookie)[0]
1351 except AttributeError:
1359 self.SelectItem(newItem)
1362 """!Recreate item (needed for OnEndDrag())
1364 Debug.msg (4,
"LayerTree.RecreateItem(): layer=%s" % \
1365 self.GetItemText(dragItem))
1368 checked = self.IsItemChecked(dragItem)
1369 image = self.GetItemImage(dragItem, 0)
1370 text = self.GetItemText(dragItem)
1371 if self.GetPyData(dragItem)[0][
'ctrl']:
1373 btnbmp = LMIcons[
"layerOptions"].GetBitmap((16,16))
1374 newctrl = buttons.GenBitmapButton(self, id = wx.ID_ANY, bitmap = btnbmp, size = (24, 24))
1375 newctrl.SetToolTipString(_(
"Click to edit layer settings"))
1377 data = self.GetPyData(dragItem)
1379 elif self.GetPyData(dragItem)[0][
'type'] ==
'command':
1382 newctrl = wx.TextCtrl(self, id = wx.ID_ANY, value =
'',
1383 pos = wx.DefaultPosition, size = (250,25),
1384 style = wx.TE_MULTILINE|wx.TE_WORDWRAP)
1386 newctrl.SetValue(self.GetPyData(dragItem)[0][
'maplayer'].GetCmd(string =
True))
1391 data = self.GetPyData(dragItem)
1393 elif self.GetPyData(dragItem)[0][
'type'] ==
'group':
1399 if dropTarget !=
None and dropTarget != self.GetRootItem():
1405 afteritem = dropTarget
1408 if self.GetPyData(afteritem)[0][
'type'] ==
'group':
1409 newItem = self.PrependItem(afteritem, text = text, \
1410 ct_type = 1, wnd = newctrl, image = image, \
1412 self.Expand(afteritem)
1415 newparent = self.GetItemParent(afteritem)
1416 newItem = self.InsertItem(newparent, self.GetPrevSibling(afteritem), \
1417 text = text, ct_type = 1, wnd = newctrl, \
1418 image = image, data = data)
1421 if self.
flag & wx.TREE_HITTEST_ABOVE:
1422 newItem = self.PrependItem(self.
root, text = text, \
1423 ct_type = 1, wnd = newctrl, image = image, \
1425 elif (self.
flag & wx.TREE_HITTEST_BELOW)
or (self.
flag & wx.TREE_HITTEST_NOWHERE) \
1426 or (self.
flag & wx.TREE_HITTEST_TOLEFT)
or (self.
flag & wx.TREE_HITTEST_TORIGHT):
1427 newItem = self.AppendItem(self.
root, text = text, \
1428 ct_type = 1, wnd = newctrl, image = image, \
1432 self.SetPyData(newItem, self.GetPyData(dragItem))
1434 self.GetPyData(newItem)[0][
'ctrl'] = newctrl.GetId()
1436 self.GetPyData(newItem)[0][
'ctrl'] =
None
1439 self.CheckItem(newItem, checked = checked)
1443 def _getLayerName(self, item, lname = ''):
1444 """!Get layer name string
1446 @param lname optional layer name
1448 mapLayer = self.GetPyData(item)[0][
'maplayer']
1450 lname = self.GetPyData(item)[0][
'label']
1451 opacity = int(mapLayer.GetOpacity(float =
True) * 100)
1453 dcmd = self.GetPyData(item)[0][
'cmd']
1455 fullyQualified =
True)
1460 return lname +
' (%s %d' % (_(
'opacity:'), opacity) +
'%)'
1465 """!Process layer data (when changes in propertiesdialog are applied)"""
1468 self.GetPyData(layer)[0][
'cmd'] = dcmd
1471 mapLayer = self.GetPyData(layer)[0][
'maplayer']
1472 self.SetItemText(layer, mapName)
1474 if not mapText
or not found:
1476 GWarning(parent = self,
1477 message = _(
"Map <%s> not found.") % mapName)
1482 self.SetPyData(layer, (self.GetPyData(layer)[0], params))
1483 self.GetPyData(layer)[0][
'propwin'] = propwin
1489 if dcmd
and UserSettings.Get(group =
'display', key =
'autoZooming', subkey =
'enabled'):
1490 mapLayer = self.GetPyData(layer)[0][
'maplayer']
1491 if mapLayer.GetType()
in (
'raster',
'vector'):
1492 render = UserSettings.Get(group =
'display', key =
'autoRendering', subkey =
'enabled')
1493 self.mapdisplay.MapWindow.ZoomToMap(layers = [mapLayer,],
1497 if self.lmgr.IsPaneShown(
'toolbarNviz')
and dcmd:
1498 mapLayer = self.GetPyData(layer)[0][
'maplayer']
1499 mapWin = self.mapdisplay.MapWindow
1500 if len(mapLayer.GetCmd()) > 0:
1502 if mapLayer.type ==
'raster':
1503 if mapWin.IsLoaded(layer):
1504 mapWin.UnloadRaster(layer)
1506 mapWin.LoadRaster(layer)
1508 elif mapLayer.type ==
'3d-raster':
1509 if mapWin.IsLoaded(layer):
1510 mapWin.UnloadRaster3d(layer)
1512 mapWin.LoadRaster3d(layer)
1514 elif mapLayer.type ==
'vector':
1515 if mapWin.IsLoaded(layer):
1516 mapWin.UnloadVector(layer)
1518 mapWin.LoadVector(layer)
1521 nlayers = len(mapWin.Map.GetListOfLayers(l_type = (
'raster',
'3d-raster',
'vector'),
1527 """!Add commands from data associated with any valid layers
1528 (checked or not) to layer list in order to match layers in
1534 vislayer = self.GetFirstVisibleItem()
1536 if not vislayer
or self.GetPyData(vislayer)
is None:
1541 for item
in range(self.GetCount()):
1542 itemList += self.GetItemText(vislayer) +
','
1543 if self.GetPyData(vislayer)[0][
'type'] !=
'group':
1544 treelayers.append(self.GetPyData(vislayer)[0][
'maplayer'])
1546 if not self.GetNextVisible(vislayer):
1549 vislayer = self.GetNextVisible(vislayer)
1551 Debug.msg (4,
"LayerTree.ReorderLayers(): items=%s" % \
1555 treelayers.reverse()
1556 self.Map.ReorderLayers(treelayers)
1561 type = self.GetPyData(item)[0][
'type']
1564 if type ==
'command':
1565 win = self.FindWindowById(self.GetPyData(item)[0][
'ctrl'])
1566 if win.GetValue() !=
None:
1567 cmd = win.GetValue().
split(
';')
1570 cmdlist.append(c.split(
' '))
1572 chk = self.IsItemChecked(item)
1573 hidden =
not self.IsVisible(item)
1574 elif type !=
'group':
1575 if self.GetPyData(item)[0]
is not None:
1576 cmdlist = self.GetPyData(item)[0][
'cmd']
1577 opac = self.GetPyData(item)[0][
'maplayer'].GetOpacity(float =
True)
1578 chk = self.IsItemChecked(item)
1579 hidden =
not self.IsVisible(item)
1583 layerName = self.GetItemText(item)
1585 maplayer = self.Map.ChangeLayer(layer = self.GetPyData(item)[0][
'maplayer'], type = type,
1586 command = cmdlist, name = layerName,
1587 l_active = chk, l_hidden = hidden, l_opacity = opac, l_render =
False)
1589 self.GetPyData(item)[0][
'maplayer'] = maplayer
1592 if self.mapdisplay.GetToolbar(
'vdigit'):
1593 self.mapdisplay.GetToolbar(
'vdigit').UpdateListOfLayers(updateTool =
True)
1603 """!Find item based on key and value (see PyData[0])
1605 @return item instance
1606 @return None not found
1608 item = self.GetFirstChild(self.root)[0]
1609 return self.__FindSubItemByData(item, key, value)
1612 """!Find item by index (starting at 0)
1614 @return item instance
1615 @return None not found
1617 item = self.GetFirstChild(self.
root)[0]
1619 while item
and item.IsOk():
1623 item = self.GetNextVisible(item)
1629 """!Enable/disable items in layer tree"""
1630 item = self.GetFirstChild(self.
root)[0]
1631 while item
and item.IsOk():
1632 mapLayer = self.GetPyData(item)[0][
'maplayer']
1633 if mapLayer
and type == mapLayer.type:
1634 self.EnableItem(item, enable)
1636 item = self.GetNextSibling(item)
1638 def __FindSubItemByData(self, item, key, value):
1639 """!Support method for FindItemByValue"""
1640 while item
and item.IsOk():
1642 itemValue = self.GetPyData(item)[0][key]
1646 if value == itemValue:
1648 if self.GetPyData(item)[0][
'type'] ==
'group':
1649 subItem = self.GetFirstChild(item)[0]
1653 item = self.GetNextSibling(item)
def OnRenamed
Layer renamed.
def FindItemByIndex
Find item by index (starting at 0)
def OnChangingSel
Selection is changing.
def _setGradient
Set gradient for items.
def OnSetCompRegFromRaster
Set computational region from selected raster map (ignore NULLs)
def OnMetadata
Print metadata of raster/vector map layer TODO: Dialog to modify metadata.
def OnActivateLayer
Double click on the layer item.
def OnIdle
Only re-order and re-render a composite map image from GRASS during idle time instead of multiple tim...
def OnLayerChecking
Layer checkbox is being checked.
def GetMapDisplay
Get associated MapFrame.
def __FindSubItemByData
Support method for FindItemByValue.
def FindItemByData
Find item based on key and value (see PyData[0])
Creates layer tree structure.
Map display with toolbar for various display management functions, and additional toolbars (vector di...
mapdisplay
SetAutoLayout() causes that no vertical scrollbar is displayed when some layers are not visible in la...
def OnMotion
Mouse is moving.
def RecreateItem
Recreate item (needed for OnEndDrag())
def GetOptData
Process layer data (when changes in propertiesdialog are applied)
def ChangeLayerOpacity
Change opacity value of layer.
Various dialogs used in wxGUI.
Rendering map layers and overlays into map composition image.
def split
Platform spefic shlex.split.
def OnCollapseNode
Collapse node.
def OnRasterColorTable
Set color table for raster map.
def OnCmdChanged
Change command string.
def OnNvizProperties
Nviz-related properties (raster/vector/volume)
def OnPopupOpacityLevel
Popup opacity level indicator.
def ChangeLayer
Change layer.
def GetLayerNameFromCmd
Get map name from GRASS command.
Plotting histogram based on d.histogram.
def ReorderLayers
Add commands from data associated with any valid layers (checked or not) to layer list in order to ma...
def OnChangeSel
Selection changed.
def OnProfile
Plot profile of given raster map layer.
def OnExpandNode
Expand node.
def OnSetCompRegFromMap
Set computational region from selected raster/vector map.
def OnStartEditing
Start editing vector map layer requested by the user.
def OnApplyLayerOpacity
Handles EVT_APPLY_OPACITY event.
def AddLayer
Add new item to the layer tree, create corresponding MapLayer instance.
Misc utilities for wxGUI.
def OnLayerChecked
Enable/disable data layer.
def OnRenameLayer
Rename layer.
def OnDeleteLayer
Remove selected layer item from the layer tree.
def OnSetBgMap
Set background vector map for editing sesstion.
def GetMap
Get map instace.
def PropertiesDialog
Launch the properties dialog.
def OnLayerContextMenu
Contextual menu for item/layer.
def OnPopupProperties
Popup properties dialog.
def _getLayerName
Get layer name string.
def OnVectorColorTable
Set color table for vector map.
def OnTopology
Rebuild topology of selected vector map.
def OnStopEditing
Stop editing the current vector map layer.
def EnableItemType
Enable/disable items in layer tree.
def OnUnivariateStats
Univariate raster statistics.
def OnHistogram
Plot histogram for given raster map layer.