[GRASS-SVN] r57128 - in grass/trunk/gui/wxpython: gcp mapdisp
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jul 14 09:59:37 PDT 2013
Author: wenzeslaus
Date: 2013-07-14 09:59:37 -0700 (Sun, 14 Jul 2013)
New Revision: 57128
Modified:
grass/trunk/gui/wxpython/gcp/mapdisplay.py
grass/trunk/gui/wxpython/mapdisp/mapwindow.py
Log:
wxGUI/mapwindow: introducing mouseLeftUpPointer signal and removing gcp manager code
Modified: grass/trunk/gui/wxpython/gcp/mapdisplay.py
===================================================================
--- grass/trunk/gui/wxpython/gcp/mapdisplay.py 2013-07-14 16:56:43 UTC (rev 57127)
+++ grass/trunk/gui/wxpython/gcp/mapdisplay.py 2013-07-14 16:59:37 UTC (rev 57128)
@@ -125,12 +125,20 @@
self._setUpMapWindow(self.TgtMapWindow)
self.SrcMapWindow.SetCursor(self.cursors["cross"])
self.TgtMapWindow.SetCursor(self.cursors["cross"])
+ # used to switch current map (combo box in toolbar)
self.SrcMapWindow.mouseEntered.connect(
lambda:
self._setActiveMapWindow(self.SrcMapWindow))
self.TgtMapWindow.mouseEntered.connect(
lambda:
self._setActiveMapWindow(self.TgtMapWindow))
+ # used to add or edit GCP
+ self.SrcMapWindow.mouseLeftUpPointer.connect(
+ lambda x, y:
+ self._onMouseLeftUpPointer(self.SrcMapWindow, x, y))
+ self.TgtMapWindow.mouseLeftUpPointer.connect(
+ lambda x, y:
+ self._onMouseLeftUpPointer(self.TgtMapWindow, x, y))
#
# initialize region values
@@ -651,3 +659,13 @@
self.UpdateActive(mapWindow)
# needed for wingrass
self.SetFocus()
+
+ def _onMouseLeftUpPointer(self, mapWindow, x, y):
+ if mapWindow == self.SrcMapWindow:
+ coordtype = 'source'
+ else:
+ coordtype = 'target'
+
+ coord = (x, y)
+ self._layerManager.gcpmanagement.SetGCPData(coordtype, coord, self, confirm=True)
+ mapWindow.UpdateMap(render=False, renderVector=False)
Modified: grass/trunk/gui/wxpython/mapdisp/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/mapwindow.py 2013-07-14 16:56:43 UTC (rev 57127)
+++ grass/trunk/gui/wxpython/mapdisp/mapwindow.py 2013-07-14 16:59:37 UTC (rev 57128)
@@ -97,6 +97,12 @@
# Emitted when map enters the window
self.mouseEntered = Signal('BufferedWindow.mouseEntered')
+ # Emitted when left mouse button is released and mouse use is 'pointer'
+ # Parameters are x and y of the mouse click in map (cell) units
+ # new and experimental, if the concept would be used widely,
+ # it could replace register and unregister mechanism
+ # and partially maybe also internal mouse use dictionary
+ self.mouseLeftUpPointer = Signal('BufferedWindow.mouseLeftUpPointer')
# event bindings
self.Bind(wx.EVT_PAINT, self.OnPaint)
@@ -1192,22 +1198,8 @@
self.polycoords.append(self.Pixel2Cell(self.mouse['end']))
self.ClearLines(pdc = self.pdcTmp)
self.DrawLines(pdc = self.pdcTmp)
-
+
elif self.mouse["use"] == "pointer" and \
- not self.frame.IsStandalone() and \
- self.frame.GetLayerManager().gcpmanagement:
- # -> GCP manager
- if self.frame.GetToolbar('gcpdisp'):
- coord = self.Pixel2Cell(self.mouse['end'])
- if self.frame.MapWindow == self.frame.SrcMapWindow:
- coordtype = 'source'
- else:
- coordtype = 'target'
-
- self.frame.GetLayerManager().gcpmanagement.SetGCPData(coordtype, coord, self, confirm = True)
- self.UpdateMap(render = False, renderVector = False)
-
- elif self.mouse["use"] == "pointer" and \
hasattr(self, "digit"):
self._onLeftUp(event)
@@ -1223,7 +1215,10 @@
pass
self.dragid = None
self.currtxtid = None
-
+
+ coordinates = self.Pixel2Cell(self.mouse['end'])
+ self.mouseLeftUpPointer.emit(x=coordinates[0], y=coordinates[1])
+
elif self.mouse['use'] == 'legend':
self.frame.dialogs['legend'].resizeBtn.SetValue(False)
screenSize = self.GetClientSizeTuple()
More information about the grass-commit
mailing list