[GRASS-SVN] r52033 - grass/trunk/gui/wxpython/dbmgr
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jun 11 05:03:47 PDT 2012
Author: annakrat
Date: 2012-06-11 05:03:47 -0700 (Mon, 11 Jun 2012)
New Revision: 52033
Modified:
grass/trunk/gui/wxpython/dbmgr/manager.py
Log:
wxGUI/dbmgr: add some padding when zooming to feature (needed especially for points)
Modified: grass/trunk/gui/wxpython/dbmgr/manager.py
===================================================================
--- grass/trunk/gui/wxpython/dbmgr/manager.py 2012-06-11 11:37:00 UTC (rev 52032)
+++ grass/trunk/gui/wxpython/dbmgr/manager.py 2012-06-11 12:03:47 UTC (rev 52033)
@@ -1299,10 +1299,19 @@
for line in select.splitlines():
key, value = line.split('=')
region[key.strip()] = float(value.strip())
-
- self.mapdisplay.Map.GetRegion(n = region['n'], s = region['s'],
- w = region['w'], e = region['e'],
- update = True)
+
+ nsdist = ewdist = 0
+ renderer = self.mapdisplay.GetMap()
+ nsdist = 10 * ((renderer.GetCurrentRegion()['n'] - renderer.GetCurrentRegion()['s']) /
+ renderer.height)
+ ewdist = 10 * ((renderer.GetCurrentRegion()['e'] - renderer.GetCurrentRegion()['w']) /
+ renderer.width)
+ north = region['n'] + nsdist
+ south = region['s'] - nsdist
+ west = region['w'] - ewdist
+ east = region['e'] + ewdist
+ renderer.GetRegion(n = north, s = south, w = west, e = east, update = True)
+ self.mapdisplay.GetMapWindow().ZoomHistory(n = north, s = south, w = west, e = east)
if zoom:
self.mapdisplay.Map.AdjustRegion() # adjust resolution
More information about the grass-commit
mailing list