[GRASS-SVN] r35626 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jan 25 16:00:16 EST 2009
Author: martinl
Date: 2009-01-25 16:00:16 -0500 (Sun, 25 Jan 2009)
New Revision: 35626
Modified:
grass/trunk/gui/wxpython/gui_modules/globalvar.py
grass/trunk/gui/wxpython/gui_modules/mapdisp.py
Log:
Go to implemented
Modified: grass/trunk/gui/wxpython/gui_modules/globalvar.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/globalvar.py 2009-01-25 20:10:13 UTC (rev 35625)
+++ grass/trunk/gui/wxpython/gui_modules/globalvar.py 2009-01-25 21:00:16 UTC (rev 35626)
@@ -97,7 +97,8 @@
_("Show comp. extent"),
_("Display mode"),
_("Display geometry"),
- _("Map scale")]
+ _("Map scale"),
+ _("Go to")]
"""File name extension binaries/scripts"""
if subprocess.mswindows:
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2009-01-25 20:10:13 UTC (rev 35625)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2009-01-25 21:00:16 UTC (rev 35626)
@@ -194,6 +194,15 @@
size=(150, -1))
self.mapScale.Hide()
self.statusbar.Bind(wx.EVT_TEXT_ENTER, self.OnChangeMapScale, self.mapScale)
+
+ # go to
+ self.goTo = wx.TextCtrl(parent=self.statusbar, id=wx.ID_ANY,
+ value="", style=wx.TE_PROCESS_ENTER,
+ size=(200, -1))
+ self.goTo.Hide()
+ self.statusbar.Bind(wx.EVT_TEXT_ENTER, self.OnGoTo, self.goTo)
+
+
# on-render gauge
self.onRenderGauge = wx.Gauge(parent=self.statusbar, id=wx.ID_ANY,
range=0, style=wx.GA_HORIZONTAL)
@@ -734,12 +743,45 @@
self.MapWindow.UpdateMap()
self.mapScale.SetFocus()
+ def OnGoTo(self, event):
+ """
+ Go to position
+ """
+ try:
+ e, n = map(float, self.goTo.GetValue().split(','))
+ except ValueError:
+ region = self.Map.GetCurrentRegion()
+ self.goTo.SetValue("%.2f, %.2f" % (region['center_northing'],
+ region['center_easting']))
+ return
+
+ region = self.Map.GetCurrentRegion()
+ region['center_northing'] = n
+ region['center_easting'] = e
+ dn = (region['nsres'] * region['rows']) / 2.
+ region['n'] = region['center_northing'] + dn
+ region['s'] = region['center_northing'] - dn
+ de = (region['ewres'] * region['cols']) / 2.
+ region['e'] = region['center_easting'] + de
+ region['w'] = region['center_easting'] - de
+
+ self.Map.AdjustRegion()
+
+ # add to zoom history
+ self.MapWindow.ZoomHistory(region['n'], region['s'],
+ region['e'], region['w'])
+
+ # redraw a map
+ self.MapWindow.UpdateMap()
+ self.goTo.SetFocus()
+
def StatusbarUpdate(self):
"""Update statusbar content"""
self.showRegion.Hide()
self.compResolution.Hide()
self.mapScale.Hide()
+ self.goTo.Hide()
self.mapScaleValue = self.ppm = None
if self.toggleStatus.GetSelection() == 0: # Coordinates
@@ -831,6 +873,16 @@
# disable long help
self.StatusbarEnableLongHelp(False)
+ elif self.toggleStatus.GetSelection() == 7: # go to
+ self.statusbar.SetStatusText("")
+ region = self.Map.GetCurrentRegion()
+ self.goTo.SetValue("%.2f, %.2f" % (region['center_northing'],
+ region['center_easting']))
+ self.goTo.Show()
+
+ # disable long help
+ self.StatusbarEnableLongHelp(False)
+
else:
self.statusbar.SetStatusText("", 1)
More information about the grass-commit
mailing list