[GRASS-SVN] r34385 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Nov 19 04:18:25 EST 2008


Author: martinl
Date: 2008-11-19 04:18:25 -0500 (Wed, 19 Nov 2008)
New Revision: 34385

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/georect.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py
Log:
georect: fix 'Zoom to map'


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/georect.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/georect.py	2008-11-19 09:13:43 UTC (rev 34384)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/georect.py	2008-11-19 09:18:25 UTC (rev 34385)
@@ -163,6 +163,7 @@
                 cmdlist = ['d.vect', 'map=%s' % xy_map]
 
             self.Map.AddLayer(type=rendertype, command=cmdlist, l_active=True,
+                              name=utils.GetLayerNameFromCmd(cmdlist),
                               l_hidden=False, l_opacity=1.0, l_render=False)
 
             #

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2008-11-19 09:13:43 UTC (rev 34384)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2008-11-19 09:18:25 UTC (rev 34385)
@@ -2272,14 +2272,15 @@
         """
         self.ZoomToMap(zoom=True)
         
-    def ZoomToMap(self, zoom=False):
+    def ZoomToMap(self, layer=None, zoom=False):
         """
         Set display extents to match selected raster
         or vector map.
         """
         zoomreg = {}
 
-        layer = self.GetSelectedLayer()
+        if not layer:
+            layer = self.GetSelectedLayer()
         
         if layer is None:
             return

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py	2008-11-19 09:13:43 UTC (rev 34384)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py	2008-11-19 09:18:25 UTC (rev 34385)
@@ -294,7 +294,7 @@
         self.zoomin = wx.NewId()
         self.zoomout = wx.NewId()
         self.zoomback = wx.NewId()
-        self.zoommenu = wx.NewId()
+        self.zoomtomap = wx.NewId()
 
         # tool, label, bitmap, kind, shortHelp, longHelp, handler
         return (
@@ -323,12 +323,20 @@
             (self.zoomback, "zoom_back", Icons["zoom_back"].GetBitmap(),
              wx.ITEM_NORMAL, Icons["zoom_back"].GetLabel(), Icons["zoom_back"].GetDesc(),
              self.mapdisplay.OnZoomBack),
-            (self.zoommenu, "zoommenu", Icons["zoommenu"].GetBitmap(),
-             wx.ITEM_NORMAL, Icons["zoommenu"].GetLabel(), Icons["zoommenu"].GetDesc(),
-             self.mapdisplay.OnZoomMenu),
+            (self.zoomtomap, "zoomtomap", Icons["zoommenu"].GetBitmap(),
+             wx.ITEM_NORMAL, _("Zoom to map"), _("Zoom to displayed map"),
+             self.OnZoomMap),
             ("", "", "", "", "", "", ""),
             )
 
+    def OnZoomMap(self, event):
+        """Zoom to selected map"""
+        layer = self.mapcontent.GetListOfLayers()[0]
+
+        self.mapdisplay.MapWindow.ZoomToMap(layer=layer)
+
+        event.Skip()
+        
 class GCPToolbar(AbstractToolbar):
     """
     Toolbar for managing ground control points during georectification



More information about the grass-commit mailing list