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

Abstract map display window class. More...

Inheritance diagram for mapwindow.MapWindow:
Collaboration diagram for mapwindow.MapWindow:

Public Member Functions

def __init__
 
def RegisterMouseEventHandler
 Binds event handler. More...
 
def UnregisterMouseEventHandler
 Unbinds event handler a restores previous state. More...
 
def Pixel2Cell
 
def Cell2Pixel
 
def OnMotion
 Tracks mouse motion and update statusbar. More...
 
def GetLastEN
 Returns last coordinates of mouse cursor. More...
 
def GetLayerByName
 Get layer from layer tree by nam. More...
 
def GetSelectedLayer
 Get selected layer from layer tree. More...
 

Data Fields

 parent
 
 Map
 
 tree
 
 lmgr
 
 mouse
 
 lastEN
 

Detailed Description

Abstract map display window class.

Superclass for BufferedWindow class (2D display mode), and GLWindow (3D display mode).

Subclasses have to define

  • _bindMouseEvents method which binds MouseEvent handlers
  • Pixel2Cell
  • Cell2Pixel (if it is possible)

Definition at line 23 of file gui_core/mapwindow.py.

Constructor & Destructor Documentation

def mapwindow.MapWindow.__init__ (   self,
  parent,
  id = wx.ID_ANY,
  Map = None,
  tree = None,
  lmgr = None,
  kwargs 
)

Definition at line 36 of file gui_core/mapwindow.py.

Member Function Documentation

def mapwindow.MapWindow.Cell2Pixel (   self,
  east,
  north 
)
def mapwindow.MapWindow.GetLastEN (   self)

Returns last coordinates of mouse cursor.

See Also
OnMotion

Definition at line 162 of file gui_core/mapwindow.py.

References mapwindow.MapWindow.lastEN.

def mapwindow.MapWindow.GetLayerByName (   self,
  name,
  mapType,
  dataType = 'layer' 
)

Get layer from layer tree by nam.

Parameters
namelayer name
type'item' / 'layer' / 'nviz'
Returns
layer / map layer properties / nviz properties
None

Definition at line 169 of file gui_core/mapwindow.py.

References workspace.ProcessWorkspaceFile.tree, mapwindow.MapWindow.tree, menudata.MenuData.tree, mapdisplay.MapFrame.tree, and model.ProcessModelFile.tree.

def mapwindow.MapWindow.GetSelectedLayer (   self,
  type = 'layer',
  multi = False 
)

Get selected layer from layer tree.

Parameters
type'item' / 'layer' / 'nviz'
multireturn first selected layer or all
Returns
layer / map layer properties / nviz properties
None / [] on failure

Definition at line 196 of file gui_core/mapwindow.py.

References workspace.ProcessWorkspaceFile.tree, mapwindow.MapWindow.tree, menudata.MenuData.tree, mapdisplay.MapFrame.tree, and model.ProcessModelFile.tree.

Referenced by mapwindow.GLWindow.DoPaint(), mapwindow.GLWindow.LoadRaster3d(), mapwindow.GLWindow.LoadVector(), mapwindow.GLWindow.OnLeftUp(), mapwindow.BufferedWindow.OnLeftUp(), and mapwindow.BufferedWindow.ZoomToMap().

def mapwindow.MapWindow.OnMotion (   self,
  event 
)

Tracks mouse motion and update statusbar.

See Also
GetLastEN

Definition at line 140 of file gui_core/mapwindow.py.

References mapwindow.VDigitWindow._onMotion(), mapwindow.MapWindow.lastEN, and mapwindow.MapWindow.Pixel2Cell().

Referenced by mapwindow.GLWindow.StopTimer().

def mapwindow.MapWindow.RegisterMouseEventHandler (   self,
  event,
  handler,
  cursor = None 
)

Binds event handler.

Call event.Skip() in handler to allow default processing in MapWindow.

1 # your class methods
2 def OnButton(self, event):
3  # current map display's map window
4  # expects LayerManager to be the parent
5  self.mapwin = self.parent.GetLayerTree().GetMapDisplay().GetWindow()
6  if self.mapwin.RegisterMouseEventHandler(wx.EVT_LEFT_DOWN, self.OnMouseAction,
7  wx.StockCursor(wx.CURSOR_CROSS)):
8 self.parent.GetLayerTree().GetMapDisplay().Raise()
9  else:
10 # handle that you cannot get coordinates
11 
12 def OnMouseAction(self, event):
13  # get real world coordinates of mouse click
14  coor = self.mapwin.Pixel2Cell(event.GetPositionTuple()[:])
15  self.text.SetLabel('Coor: ' + str(coor))
16  self.mapwin.UnregisterMouseEventHandler(wx.EVT_LEFT_DOWN)
17  event.Skip()
Parameters
eventone of mouse events
handlerfunction to handle event
cursorcursor which temporary overrides current cursor
Returns
True if successful
False if event cannot be bind

Definition at line 56 of file gui_core/mapwindow.py.

References mapwindow.MapWindow._overriddenCursor, and mapwindow.MapWindow.mouse.

def mapwindow.MapWindow.UnregisterMouseEventHandler (   self,
  event 
)

Unbinds event handler a restores previous state.

You should unbind to restore normal MapWindow behaviour. Note that this operation will unbind any other external (non-MapWindow) handlers.

Parameters
eventevent to unbind
Returns
True if successful
False if event cannot be unbind

Definition at line 105 of file gui_core/mapwindow.py.

References mapwindow.BufferedWindow._bindMouseEvents(), mapwindow.GLWindow._bindMouseEvents(), mapwindow.MapWindow._overriddenCursor, and mapwindow.MapWindow.mouse.

Field Documentation

mapwindow.MapWindow.lastEN
mapwindow.MapWindow.mouse

Definition at line 44 of file gui_core/mapwindow.py.

Referenced by frame.PsMapBufferedWindow.ComputeZoom(), mapwindow.GLWindow.DragItem(), mapwindow.GLWindow.FocusPanning(), mapwindow.GLWindow.HorizontalPanning(), mapwindow.BufferedWindow.MouseDraw(), frame.PsMapFrame.OnAddMap(), mapwindow.BufferedWindow.OnButtonDClick(), frame.PsMapBufferedWindow.OnButtonDClick(), mapwindow.GLWindow.OnDClick(), mapwindow.GLWindow.OnDragging(), mapwindow.BufferedWindow.OnDragging(), frame.PsMapBufferedWindow.OnDragging(), mapwindow.GLWindow.OnKeyDown(), mapwindow.GLWindow.OnKeyUp(), mapwindow.GLWindow.OnLeftDown(), mapwindow.BufferedWindow.OnLeftDown(), frame.PsMapBufferedWindow.OnLeftDown(), mapwindow.VDigitWindow.OnLeftDownAddLine(), mapwindow.VDigitWindow.OnLeftDownDisplayCA(), mapwindow.VDigitWindow.OnLeftDownEditLine(), mapwindow.VDigitWindow.OnLeftDownUndo(), mapwindow.GLWindow.OnLeftUp(), mapwindow.BufferedWindow.OnLeftUp(), frame.PsMapBufferedWindow.OnLeftUp(), mapwindow.VDigitWindow.OnLeftUpConnectLine(), mapwindow.VDigitWindow.OnLeftUpCopyLine(), mapwindow.VDigitWindow.OnLeftUpModifyLine(), mapwindow.VDigitWindow.OnLeftUpVarious(), mapwindow.BufferedWindow.OnMiddleDown(), frame.PsMapBufferedWindow.OnMiddleDown(), mapwindow.BufferedWindow.OnMiddleUp(), mapwindow.BufferedWindow.OnMouseMoving(), frame.PsMapBufferedWindow.OnMouseMoving(), frame.PsMapBufferedWindow.OnMouseWheel(), frame.PsMapFrame.OnPan(), frame.PsMapFrame.OnPointer(), mapwindow.BufferedWindow.OnRightDown(), mapwindow.BufferedWindow.OnRightUp(), mapwindow.GLWindow.OnTimerFly(), frame.PsMapFrame.OnZoomIn(), frame.PsMapFrame.OnZoomOut(), mapwindow.MapWindow.RegisterMouseEventHandler(), mapwindow.MapWindow.UnregisterMouseEventHandler(), and mapwindow.BufferedWindow.UpdateMap().


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