GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
layertree.LayerTree Class Reference

Creates layer tree structure. More...

Inheritance diagram for layertree.LayerTree:
Collaboration diagram for layertree.LayerTree:

Public Member Functions

def __init__
 
def GetSelections
 
def GetMap
 Get map instace. More...
 
def GetMapDisplay
 Get associated MapFrame. More...
 
def OnIdle
 Only re-order and re-render a composite map image from GRASS during idle time instead of multiple times during layer changing. More...
 
def OnKeyUp
 Key pressed. More...
 
def OnLayerContextMenu
 Contextual menu for item/layer. More...
 
def OnTopology
 Rebuild topology of selected vector map. More...
 
def OnMetadata
 Print metadata of raster/vector map layer TODO: Dialog to modify metadata. More...
 
def OnSetCompRegFromRaster
 Set computational region from selected raster map (ignore NULLs) More...
 
def OnSetCompRegFromMap
 Set computational region from selected raster/vector map. More...
 
def OnProfile
 Plot profile of given raster map layer. More...
 
def OnRasterColorTable
 Set color table for raster map. More...
 
def OnVectorColorTable
 Set color table for vector map. More...
 
def OnHistogram
 Plot histogram for given raster map layer. More...
 
def OnUnivariateStats
 Univariate raster statistics. More...
 
def OnStartEditing
 Start editing vector map layer requested by the user. More...
 
def OnStopEditing
 Stop editing the current vector map layer. More...
 
def OnSetBgMap
 Set background vector map for editing sesstion. More...
 
def OnPopupProperties
 Popup properties dialog. More...
 
def OnPopupOpacityLevel
 Popup opacity level indicator. More...
 
def OnApplyLayerOpacity
 Handles EVT_APPLY_OPACITY event. More...
 
def ChangeLayerOpacity
 Change opacity value of layer. More...
 
def OnNvizProperties
 Nviz-related properties (raster/vector/volume) More...
 
def OnRenameLayer
 Rename layer. More...
 
def OnRenamed
 Layer renamed. More...
 
def AddLayer
 Add new item to the layer tree, create corresponding MapLayer instance. More...
 
def PropertiesDialog
 Launch the properties dialog. More...
 
def OnActivateLayer
 Double click on the layer item. More...
 
def OnDeleteLayer
 Remove selected layer item from the layer tree. More...
 
def OnLayerChecking
 Layer checkbox is being checked. More...
 
def OnLayerChecked
 Enable/disable data layer. More...
 
def OnCmdChanged
 Change command string. More...
 
def OnMotion
 Mouse is moving. More...
 
def OnChangingSel
 Selection is changing. More...
 
def OnChangeSel
 Selection changed. More...
 
def OnCollapseNode
 Collapse node. More...
 
def OnExpandNode
 Expand node. More...
 
def OnEndDrag
 
def OnDrop
 
def RecreateItem
 Recreate item (needed for OnEndDrag()) More...
 
def GetOptData
 Process layer data (when changes in propertiesdialog are applied) More...
 
def ReorderLayers
 Add commands from data associated with any valid layers (checked or not) to layer list in order to match layers in layer tree. More...
 
def ChangeLayer
 Change layer. More...
 
def OnCloseWindow
 
def FindItemByData
 Find item based on key and value (see PyData[0]) More...
 
def FindItemByIndex
 Find item by index (starting at 0) More...
 
def EnableItemType
 Enable/disable items in layer tree. More...
 

Data Fields

 displayIndex
 
 lmgr
 
 notebook
 
 auimgr
 
 treepg
 
 Map
 
 root
 
 groupnode
 
 optpage
 
 layer_selected
 
 saveitem
 
 first
 
 flag
 
 rerender
 
 reorder
 
 hitCheckbox
 
 forceCheck
 
 mapdisplay
 SetAutoLayout() causes that no vertical scrollbar is displayed when some layers are not visible in layer tree self.SetAutoLayout(True) More...
 
 folder_open
 
 folder
 
 rast_icon
 
 rast3d_icon
 
 rgb_icon
 
 his_icon
 
 shaded_icon
 
 rarrow_icon
 
 rnum_icon
 
 vect_icon
 
 theme_icon
 
 chart_icon
 
 grid_icon
 
 geodesic_icon
 
 rhumb_icon
 
 labels_icon
 
 cmd_icon
 
 popupID
 
 popupMenu
 
 profileFrame
 

Detailed Description

Creates layer tree structure.

Definition at line 96 of file layertree.py.

Constructor & Destructor Documentation

def layertree.LayerTree.__init__ (   self,
  parent,
  id = wx.ID_ANY,
  style = wx.SUNKEN_BORDER,
  ctstyle = CT.TR_HAS_BUTTONS | CT.TR_HAS_VARIABLE_ROW_HEIGHT |                  CT.TR_HIDE_ROOT | CT.TR_ROW_LINES | CT.TR_FULL_ROW_HIGHLIGHT |                  CT.TR_MULTIPLE,
  kwargs 
)

Definition at line 103 of file layertree.py.

Member Function Documentation

def layertree.LayerTree.AddLayer (   self,
  ltype,
  lname = None,
  lchecked = None,
  lopacity = 1.0,
  lcmd = None,
  lgroup = None,
  lvdigit = None,
  lnviz = None,
  multiple = True 
)

Add new item to the layer tree, create corresponding MapLayer instance.

Launch property dialog if needed (raster, vector, etc.)

Parameters
ltypelayer type (raster, vector, 3d-raster, ...)
lnamelayer name
lcheckedif True layer is checked
lopacitylayer opacity level
lcmdcommand (given as a list)
lgroupindex of group item (-1 for root) or None
lvdigitvector digitizer settings (eg. geometry attributes)
lnvizlayer Nviz properties
multipleTrue to allow multiple map layers in layer tree

Definition at line 735 of file layertree.py.

References layertree.LayerTree._getLayerName(), layertree.LayerTree.chart_icon, layertree.LayerTree.cmd_icon, layertree.LayerTree.FindItemByIndex(), layertree.LayerTree.first, layertree.LayerTree.folder, layertree.LayerTree.forceCheck, layertree.LayerTree.geodesic_icon, utils.GetLayerNameFromCmd(), layertree.LayerTree.grid_icon, layertree.LayerTree.groupnode, layertree.LayerTree.his_icon, layertree.LayerTree.labels_icon, layertree.LayerTree.layer_selected, layertree.LayerTree.OnCmdChanged(), layertree.LayerTree.OnLayerContextMenu(), layertree.LayerTree.PropertiesDialog(), layertree.LayerTree.rarrow_icon, layertree.LayerTree.rast3d_icon, layertree.LayerTree.rast_icon, layertree.LayerTree.rgb_icon, layertree.LayerTree.rhumb_icon, layertree.LayerTree.rnum_icon, workspace.ProcessWorkspaceFile.root, layertree.LayerTree.root, widgets.ItemTree.root, model.ProcessModelFile.root, widgets.SetRange(), layertree.LayerTree.shaded_icon, layertree.LayerTree.theme_icon, and layertree.LayerTree.vect_icon.

Referenced by layertree.LayerTree.OnRenamed().

def layertree.LayerTree.ChangeLayer (   self,
  item 
)
def layertree.LayerTree.ChangeLayerOpacity (   self,
  layer,
  value 
)

Change opacity value of layer.

Parameters
layerlayer for which to change (item in layertree)
valueopacity value (float between 0 and 1)

Definition at line 684 of file layertree.py.

References layertree.LayerTree._getLayerName(), layertree.LayerTree.GetMapDisplay(), frame.GMFrame.GetMapDisplay(), and tools.UpdateSettings().

Referenced by layertree.LayerTree.OnApplyLayerOpacity(), and layertree.LayerTree.OnPopupOpacityLevel().

def layertree.LayerTree.EnableItemType (   self,
  type,
  enable = True 
)
def layertree.LayerTree.FindItemByData (   self,
  key,
  value 
)

Find item based on key and value (see PyData[0])

Returns
item instance
None not found

Definition at line 1602 of file layertree.py.

def layertree.LayerTree.FindItemByIndex (   self,
  index 
)

Find item by index (starting at 0)

Returns
item instance
None not found

Definition at line 1611 of file layertree.py.

References workspace.ProcessWorkspaceFile.root, layertree.LayerTree.root, widgets.ItemTree.root, and model.ProcessModelFile.root.

Referenced by layertree.LayerTree.AddLayer().

def layertree.LayerTree.GetMap (   self)
def layertree.LayerTree.GetMapDisplay (   self)

Get associated MapFrame.

Definition at line 281 of file layertree.py.

References layertree.LayerTree.mapdisplay, and manager.AttributeManager.mapdisplay.

Referenced by layertree.LayerTree.ChangeLayerOpacity().

def layertree.LayerTree.GetOptData (   self,
  dcmd,
  layer,
  params,
  propwin 
)

Process layer data (when changes in propertiesdialog are applied)

Definition at line 1464 of file layertree.py.

References layertree.LayerTree._getLayerName(), render.Map.ChangeLayer(), layertree.LayerTree.ChangeLayer(), and utils.GetLayerNameFromCmd().

Referenced by histogram.HistogramFrame.OnOptions(), and layertree.LayerTree.PropertiesDialog().

def layertree.LayerTree.GetSelections (   self)
Returns a list of selected items.

This method is copied from customtreecontrol and overriden because
with some version wx (?) multiple selection doesn't work. 
Probably it is caused by another GetSelections method in treemixin.DragAndDrop?

Definition at line 261 of file layertree.py.

Referenced by ogc_services.LayersList.GetSelectedLayers(), and layertree.LayerTree.OnSetCompRegFromMap().

def layertree.LayerTree.OnActivateLayer (   self,
  event 
)

Double click on the layer item.

Launch property dialog, or expand/collapse group of items, etc.

Definition at line 1044 of file layertree.py.

References goutput.PyStc.Expand(), layertree.LayerTree.layer_selected, and layertree.LayerTree.PropertiesDialog().

def layertree.LayerTree.OnApplyLayerOpacity (   self,
  event 
)

Handles EVT_APPLY_OPACITY event.

Definition at line 680 of file layertree.py.

References layertree.LayerTree.ChangeLayerOpacity(), and layertree.LayerTree.layer_selected.

Referenced by layertree.LayerTree.OnPopupOpacityLevel().

def layertree.LayerTree.OnChangeSel (   self,
  event 
)

Selection changed.

Definition at line 1230 of file layertree.py.

References layertree.LayerTree._setGradient(), and layertree.LayerTree.layer_selected.

def layertree.LayerTree.OnChangingSel (   self,
  event 
)

Selection is changing.

If the user is clicking on checkbox, selection change is vetoed.

Definition at line 1222 of file layertree.py.

References layertree.LayerTree.hitCheckbox.

def layertree.LayerTree.OnCloseWindow (   self,
  event 
)

Definition at line 1598 of file layertree.py.

def layertree.LayerTree.OnCmdChanged (   self,
  event 
)

Change command string.

Definition at line 1190 of file layertree.py.

References render.Map.ChangeLayer(), and layertree.LayerTree.ChangeLayer().

Referenced by layertree.LayerTree.AddLayer(), and layertree.LayerTree.RecreateItem().

def layertree.LayerTree.OnCollapseNode (   self,
  event 
)

Collapse node.

Definition at line 1301 of file layertree.py.

References layertree.LayerTree.folder, and layertree.LayerTree.layer_selected.

def layertree.LayerTree.OnDeleteLayer (   self,
  event 
)
def layertree.LayerTree.OnDrop (   self,
  dropTarget,
  dragItem 
)
def layertree.LayerTree.OnEndDrag (   self,
  event 
)
def layertree.LayerTree.OnExpandNode (   self,
  event 
)

Expand node.

Definition at line 1307 of file layertree.py.

References layertree.LayerTree.folder_open, and layertree.LayerTree.layer_selected.

def layertree.LayerTree.OnHistogram (   self,
  event 
)

Plot histogram for given raster map layer.

Definition at line 586 of file layertree.py.

References layertree.LayerTree.layer_selected.

def layertree.LayerTree.OnIdle (   self,
  event 
)

Only re-order and re-render a composite map image from GRASS during idle time instead of multiple times during layer changing.

Definition at line 285 of file layertree.py.

References layertree.LayerTree.rerender.

def layertree.LayerTree.OnKeyUp (   self,
  event 
)

Key pressed.

Definition at line 303 of file layertree.py.

References mapwindow.MapWindow.lmgr, layertree.LayerTree.lmgr, and workspace.WriteWorkspaceFile.lmgr.

def layertree.LayerTree.OnLayerChecked (   self,
  event 
)
def layertree.LayerTree.OnLayerChecking (   self,
  event 
)

Layer checkbox is being checked.

Continue only if mouse is above checkbox or layer was checked programatically.

Definition at line 1114 of file layertree.py.

References layertree.LayerTree.forceCheck, and layertree.LayerTree.hitCheckbox.

def layertree.LayerTree.OnLayerContextMenu (   self,
  event 
)

Contextual menu for item/layer.

Definition at line 313 of file layertree.py.

References layertree.LayerTree.layer_selected.

Referenced by layertree.LayerTree.AddLayer(), and layertree.LayerTree.RecreateItem().

def layertree.LayerTree.OnMetadata (   self,
  event 
)

Print metadata of raster/vector map layer TODO: Dialog to modify metadata.

Definition at line 489 of file layertree.py.

References layertree.LayerTree.layer_selected.

def layertree.LayerTree.OnMotion (   self,
  event 
)

Mouse is moving.

Detects if mouse points at checkbox.

Definition at line 1207 of file layertree.py.

References layertree.LayerTree.hitCheckbox, and wxnviz.Texture.HitTest().

def layertree.LayerTree.OnNvizProperties (   self,
  event 
)

Nviz-related properties (raster/vector/volume)

Todo:
vector/volume

Definition at line 707 of file layertree.py.

References layertree.LayerTree.layer_selected.

def layertree.LayerTree.OnPopupOpacityLevel (   self,
  event 
)
def layertree.LayerTree.OnPopupProperties (   self,
  event 
)

Popup properties dialog.

Definition at line 659 of file layertree.py.

References layertree.LayerTree.layer_selected, and layertree.LayerTree.PropertiesDialog().

def layertree.LayerTree.OnProfile (   self,
  event 
)

Plot profile of given raster map layer.

Definition at line 549 of file layertree.py.

References layertree.LayerTree.layer_selected.

def layertree.LayerTree.OnRasterColorTable (   self,
  event 
)

Set color table for raster map.

Definition at line 572 of file layertree.py.

References layertree.LayerTree.layer_selected.

def layertree.LayerTree.OnRenamed (   self,
  event 
)
def layertree.LayerTree.OnRenameLayer (   self,
  event 
)

Rename layer.

Definition at line 721 of file layertree.py.

References layertree.LayerTree.layer_selected.

def layertree.LayerTree.OnSetBgMap (   self,
  event 
)

Set background vector map for editing sesstion.

Definition at line 642 of file layertree.py.

References layertree.LayerTree._setGradient(), and layertree.LayerTree.layer_selected.

def layertree.LayerTree.OnSetCompRegFromMap (   self,
  event 
)

Set computational region from selected raster/vector map.

Definition at line 516 of file layertree.py.

References layertree.LayerTree.GetSelections().

def layertree.LayerTree.OnSetCompRegFromRaster (   self,
  event 
)

Set computational region from selected raster map (ignore NULLs)

Definition at line 505 of file layertree.py.

References layertree.LayerTree.layer_selected.

def layertree.LayerTree.OnStartEditing (   self,
  event 
)

Start editing vector map layer requested by the user.

Definition at line 610 of file layertree.py.

References layertree.LayerTree._setGradient(), and layertree.LayerTree.layer_selected.

def layertree.LayerTree.OnStopEditing (   self,
  event 
)
def layertree.LayerTree.OnTopology (   self,
  event 
)

Rebuild topology of selected vector map.

Definition at line 482 of file layertree.py.

References layertree.LayerTree.layer_selected.

def layertree.LayerTree.OnUnivariateStats (   self,
  event 
)

Univariate raster statistics.

Definition at line 605 of file layertree.py.

References layertree.LayerTree.layer_selected.

def layertree.LayerTree.OnVectorColorTable (   self,
  event 
)

Set color table for vector map.

Definition at line 580 of file layertree.py.

References layertree.LayerTree.layer_selected.

def layertree.LayerTree.PropertiesDialog (   self,
  layer,
  show = True 
)
def layertree.LayerTree.ReorderLayers (   self)

Add commands from data associated with any valid layers (checked or not) to layer list in order to match layers in layer tree.

Definition at line 1526 of file layertree.py.

References tools.range, and layertree.LayerTree.reorder.

Field Documentation

layertree.LayerTree.auimgr

Definition at line 114 of file layertree.py.

layertree.LayerTree.chart_icon

Definition at line 212 of file layertree.py.

Referenced by layertree.LayerTree.AddLayer().

layertree.LayerTree.cmd_icon

Definition at line 227 of file layertree.py.

Referenced by layertree.LayerTree.AddLayer().

layertree.LayerTree.displayIndex

Definition at line 108 of file layertree.py.

layertree.LayerTree.first
layertree.LayerTree.folder
layertree.LayerTree.folder_open

Definition at line 179 of file layertree.py.

Referenced by layertree.LayerTree.OnExpandNode().

layertree.LayerTree.geodesic_icon

Definition at line 218 of file layertree.py.

Referenced by layertree.LayerTree.AddLayer().

layertree.LayerTree.grid_icon

Definition at line 215 of file layertree.py.

Referenced by layertree.LayerTree.AddLayer().

layertree.LayerTree.groupnode

Definition at line 121 of file layertree.py.

Referenced by layertree.LayerTree.AddLayer().

layertree.LayerTree.his_icon

Definition at line 194 of file layertree.py.

Referenced by layertree.LayerTree.AddLayer().

layertree.LayerTree.hitCheckbox
layertree.LayerTree.labels_icon

Definition at line 224 of file layertree.py.

Referenced by layertree.LayerTree.AddLayer().

layertree.LayerTree.lmgr
layertree.LayerTree.mapdisplay

SetAutoLayout() causes that no vertical scrollbar is displayed when some layers are not visible in layer tree self.SetAutoLayout(True)

Definition at line 152 of file layertree.py.

Referenced by layertree.LayerTree.GetMapDisplay().

layertree.LayerTree.notebook

Definition at line 112 of file layertree.py.

layertree.LayerTree.optpage

Definition at line 122 of file layertree.py.

layertree.LayerTree.popupID

Definition at line 326 of file layertree.py.

layertree.LayerTree.popupMenu

Definition at line 333 of file layertree.py.

layertree.LayerTree.profileFrame

Definition at line 560 of file layertree.py.

layertree.LayerTree.rarrow_icon

Definition at line 200 of file layertree.py.

Referenced by layertree.LayerTree.AddLayer().

layertree.LayerTree.rast3d_icon

Definition at line 188 of file layertree.py.

Referenced by layertree.LayerTree.AddLayer().

layertree.LayerTree.rast_icon

Definition at line 185 of file layertree.py.

Referenced by layertree.LayerTree.AddLayer().

layertree.LayerTree.rgb_icon

Definition at line 191 of file layertree.py.

Referenced by layertree.LayerTree.AddLayer().

layertree.LayerTree.rhumb_icon

Definition at line 221 of file layertree.py.

Referenced by layertree.LayerTree.AddLayer().

layertree.LayerTree.rnum_icon

Definition at line 203 of file layertree.py.

Referenced by layertree.LayerTree.AddLayer().

layertree.LayerTree.saveitem

Definition at line 124 of file layertree.py.

layertree.LayerTree.shaded_icon

Definition at line 197 of file layertree.py.

Referenced by layertree.LayerTree.AddLayer().

layertree.LayerTree.theme_icon

Definition at line 209 of file layertree.py.

Referenced by layertree.LayerTree.AddLayer().

layertree.LayerTree.treepg

Definition at line 118 of file layertree.py.

layertree.LayerTree.vect_icon

Definition at line 206 of file layertree.py.

Referenced by layertree.LayerTree.AddLayer().


The documentation for this class was generated from the following file: