[GRASS-SVN] r52034 - grass/branches/develbranch_6/gui/wxpython/dbmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jun 11 05:16:22 PDT 2012


Author: annakrat
Date: 2012-06-11 05:16:22 -0700 (Mon, 11 Jun 2012)
New Revision: 52034

Modified:
   grass/branches/develbranch_6/gui/wxpython/dbmgr/manager.py
Log:
wxGUI/dbmgr: add some padding when zooming to feature (needed especially for points) (merge from trunk, r52033)

Modified: grass/branches/develbranch_6/gui/wxpython/dbmgr/manager.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/dbmgr/manager.py	2012-06-11 12:03:47 UTC (rev 52033)
+++ grass/branches/develbranch_6/gui/wxpython/dbmgr/manager.py	2012-06-11 12:16:22 UTC (rev 52034)
@@ -1252,7 +1252,7 @@
         tlist = self.FindWindowById(self.layerPage[self.layer]['data'])
         cats = map(int, tlist.GetSelectedItems())
 
-        digitToolbar = self.mapdisplay.toolbars['vdigit']
+        digitToolbar = self.mapdisplay.GetToolbar('vdigit')
         if digitToolbar and digitToolbar.GetLayer() and \
                 digitToolbar.GetLayer().GetName() == self.vectorName:
             display = self.mapdisplay.GetMapWindow().GetDisplay()
@@ -1297,10 +1297,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