[GRASS-SVN] r42499 - in grass/branches/develbranch_6/gui: icons/grass2 wxpython/gui_modules wxpython/icons

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jun 7 12:55:26 EDT 2010


Author: martinl
Date: 2010-06-07 12:55:24 -0400 (Mon, 07 Jun 2010)
New Revision: 42499

Added:
   grass/branches/develbranch_6/gui/icons/grass2/zoom-extent.png
Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py
   grass/branches/develbranch_6/gui/wxpython/icons/grass2_icons.py
   grass/branches/develbranch_6/gui/wxpython/icons/grass_icons.py
   grass/branches/develbranch_6/gui/wxpython/icons/icon.py
   grass/branches/develbranch_6/gui/wxpython/icons/silk_icons.py
Log:
wxGUI: zoom to selected map available directly from map toolbar
(merge r42498 from trunk)


Copied: grass/branches/develbranch_6/gui/icons/grass2/zoom-extent.png (from rev 42498, grass/trunk/gui/icons/grass2/zoom-extent.png)
===================================================================
(Binary files differ)

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py	2010-06-07 16:41:46 UTC (rev 42498)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py	2010-06-07 16:55:24 UTC (rev 42499)
@@ -273,7 +273,7 @@
             
             if ltype in ('raster', 'vector', 'rgb'):
                 self.popupMenu.Append(self.popupID9, text=_("Zoom to selected map(s)"))
-                self.Bind(wx.EVT_MENU, self.mapdisplay.MapWindow.OnZoomToMap, id=self.popupID9)
+                self.Bind(wx.EVT_MENU, self.mapdisplay.OnZoomToMap, id=self.popupID9)
                 self.popupMenu.Append(self.popupID10, text=_("Set computational region from selected map(s)"))
                 self.Bind(wx.EVT_MENU, self.OnSetCompRegFromMap, id=self.popupID10)
             if numSelected > 1:
@@ -350,7 +350,7 @@
         #
         elif mltype and mltype == "raster":
             self.popupMenu.Append(self.popupID12, text=_("Zoom to selected map(s) (ignore NULLs)"))
-            self.Bind(wx.EVT_MENU, self.mapdisplay.MapWindow.OnZoomToRaster, id=self.popupID12)
+            self.Bind(wx.EVT_MENU, self.mapdisplay.OnZoomToRaster, id=self.popupID12)
             self.popupMenu.Append(self.popupID13, text=_("Set computational region from selected map(s) (ignore NULLs)"))
             self.Bind(wx.EVT_MENU, self.OnSetCompRegFromRaster, id=self.popupID13)
             self.popupMenu.AppendSeparator()

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2010-06-07 16:41:46 UTC (rev 42498)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2010-06-07 16:55:24 UTC (rev 42499)
@@ -1918,42 +1918,79 @@
         self.params[type] = params
         self.propwin[type] = propwin
 
+    def OnZoomToMap(self, event):
+        """!
+        Set display extents to match selected raster (including NULLs)
+        or vector map.
+        """
+        self.MapWindow.ZoomToMap()
+
+    def OnZoomToRaster(self, event):
+        """!
+        Set display extents to match selected raster map (ignore NULLs)
+        """
+        self.MapWindow.ZoomToMap(ignoreNulls = True)
+
+    def OnZoomToWind(self, event):
+        """!Set display geometry to match computational region
+        settings (set with g.region)
+        """
+        self.MapWindow.ZoomToWind()
+        
+    def OnZoomToDefault(self, event):
+        """!Set display geometry to match default region settings
+        """
+        self.MapWindow.ZoomToDefault()
+        
+    def OnZoomToSaved(self, event):
+        """!Set display geometry to match extents in
+        saved region file
+        """
+        self.MapWindow.ZoomToSaved()
+        
+    def OnDisplayToWind(self, event):
+        """!Set computational region (WIND file) to match display
+        extents
+        """
+        self.MapWindow.DisplayToWind()
+ 
+    def SaveDisplayRegion(self, event):
+        """!Save display extents to named region file.
+        """
+        self.MapWindow.SaveDisplayRegion()
+        
     def OnZoomMenu(self, event):
+        """!Popup Zoom menu
         """
-        Zoom menu
-        """
         point = wx.GetMousePosition()
         zoommenu = wx.Menu()
         # Add items to the menu
-        zoommap = wx.MenuItem(zoommenu, wx.ID_ANY, _('Zoom to selected map(s)'))
-        zoommenu.AppendItem(zoommap)
-        self.Bind(wx.EVT_MENU, self.MapWindow.OnZoomToMap, zoommap)
 
         zoomwind = wx.MenuItem(zoommenu, wx.ID_ANY, _('Zoom to computational region (set with g.region)'))
         zoommenu.AppendItem(zoomwind)
-        self.Bind(wx.EVT_MENU, self.MapWindow.ZoomToWind, zoomwind)
+        self.Bind(wx.EVT_MENU, self.OnZoomToWind, zoomwind)
 
         zoomdefault = wx.MenuItem(zoommenu, wx.ID_ANY, _('Zoom to default region'))
         zoommenu.AppendItem(zoomdefault)
-        self.Bind(wx.EVT_MENU, self.MapWindow.ZoomToDefault, zoomdefault)
+        self.Bind(wx.EVT_MENU, self.OnZoomToDefault, zoomdefault)
 
         zoomsaved = wx.MenuItem(zoommenu, wx.ID_ANY, _('Zoom to saved region'))
         zoommenu.AppendItem(zoomsaved)
-        self.Bind(wx.EVT_MENU, self.MapWindow.ZoomToSaved, zoomsaved)
+        self.Bind(wx.EVT_MENU, self.OnZoomToSaved, zoomsaved)
 
         savewind = wx.MenuItem(zoommenu, wx.ID_ANY, _('Set computational region from display'))
         zoommenu.AppendItem(savewind)
-        self.Bind(wx.EVT_MENU, self.MapWindow.DisplayToWind, savewind)
+        self.Bind(wx.EVT_MENU, self.OnDisplayToWind, savewind)
 
         savezoom = wx.MenuItem(zoommenu, wx.ID_ANY, _('Save display geometry to named region'))
         zoommenu.AppendItem(savezoom)
-        self.Bind(wx.EVT_MENU, self.MapWindow.SaveDisplayRegion, savezoom)
+        self.Bind(wx.EVT_MENU, self.SaveDisplayRegion, savezoom)
 
-        # Popup the menu.  If an item is selected then its handler
+        # Popup the menu. If an item is selected then its handler
         # will be called before PopupMenu returns.
         self.PopupMenu(zoommenu)
         zoommenu.Destroy()
-
+        
     def SetProperties(self, render=False, mode=0, showCompExtent=False,
                       constrainRes=False, projection=False):
         """!Set properies of map display window"""

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py	2010-06-07 16:41:46 UTC (rev 42498)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py	2010-06-07 16:55:24 UTC (rev 42499)
@@ -2627,18 +2627,6 @@
         """!Reset zoom history"""
         self.zoomhistory = list()
         
-    def OnZoomToMap(self, event):
-        """!
-        Set display extents to match selected raster (including NULLs)
-        or vector map.
-        """
-        self.ZoomToMap()
-
-    def OnZoomToRaster(self, event):
-        """!
-        Set display extents to match selected raster map (ignore NULLs)
-        """
-        self.ZoomToMap(ignoreNulls = True)
         
     def ZoomToMap(self, layers = None, ignoreNulls = False, render = True):
         """!
@@ -2687,10 +2675,9 @@
 
         self.parent.StatusbarUpdate()
         
-    def ZoomToWind(self, event):
-        """!
-        Set display geometry to match computational
-        region settings (set with g.region)
+    def ZoomToWind(self):
+        """!Set display geometry to match computational region
+        settings (set with g.region)
         """
         self.Map.region = self.Map.GetRegion()
         ### self.Map.SetRegion(windres=True)
@@ -2702,9 +2689,8 @@
 
         self.parent.StatusbarUpdate()
 
-    def ZoomToDefault(self, event):
-        """!
-        Set display geometry to match default region settings
+    def ZoomToDefault(self):
+        """!Set display geometry to match default region settings
         """
         self.Map.region = self.Map.GetRegion(default=True)
         self.Map.AdjustRegion() # aling region extent to the display
@@ -2716,10 +2702,9 @@
 
         self.parent.StatusbarUpdate()
         
-    def DisplayToWind(self, event):
-        """!
-        Set computational region (WIND file) to
-        match display extents
+    def DisplayToWind(self):
+        """!Set computational region (WIND file) to match display
+        extents
         """
         tmpreg = os.getenv("GRASS_REGION")
         if tmpreg:
@@ -2741,7 +2726,7 @@
         if tmpreg:
             os.environ["GRASS_REGION"] = tmpreg
 
-    def ZoomToSaved(self, event):
+    def ZoomToSaved(self):
         """!Set display geometry to match extents in
         saved region file
         """
@@ -2772,11 +2757,9 @@
         
         self.UpdateMap()
                 
-    def SaveDisplayRegion(self, event):
-        """!
-        Save display extents to named region file.
+    def SaveDisplayRegion(self):
+        """!Save display extents to named region file.
         """
-
         dlg = gdialogs.SavedRegion(parent = self,
                                    title = _("Save display extents to region file"),
                                    loadsave='save')

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py	2010-06-07 16:41:46 UTC (rev 42498)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py	2010-06-07 16:55:24 UTC (rev 42499)
@@ -213,6 +213,7 @@
         self.zoomout = wx.NewId()
         self.zoomback = wx.NewId()
         self.zoommenu = wx.NewId()
+        self.zoomextent = wx.NewId()
         self.analyze = wx.NewId()
         self.dec = wx.NewId()
         self.savefile = wx.NewId()
@@ -245,6 +246,9 @@
             (self.zoomout, "zoom_out", Icons["zoom_out"].GetBitmap(),
              wx.ITEM_CHECK, Icons["zoom_out"].GetLabel(), Icons["zoom_out"].GetDesc(),
              self.parent.OnZoomOut),
+            (self.zoomextent, "zoom_extent", Icons["zoom_extent"].GetBitmap(),
+             wx.ITEM_NORMAL, Icons["zoom_extent"].GetLabel(), Icons["zoom_extent"].GetDesc(),
+             self.parent.OnZoomToMap),
             (self.zoomback, "zoom_back", Icons["zoom_back"].GetBitmap(),
              wx.ITEM_NORMAL, Icons["zoom_back"].GetLabel(), Icons["zoom_back"].GetDesc(),
              self.parent.OnZoomBack),

Modified: grass/branches/develbranch_6/gui/wxpython/icons/grass2_icons.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/icons/grass2_icons.py	2010-06-07 16:41:46 UTC (rev 42498)
+++ grass/branches/develbranch_6/gui/wxpython/icons/grass2_icons.py	2010-06-07 16:55:24 UTC (rev 42499)
@@ -22,10 +22,11 @@
     "printmap"   : 'print.png',
     "pan"        : 'pan.png', 
     # zoom (mapdisplay)
-    "zoom_in"    : 'zoom-in.png',
-    "zoom_out"   : 'zoom-out.png',
-    "zoom_back"  : 'zoom-last.png',
-    "zoommenu"   : 'zoom-more.png',
+    "zoom_in"     : 'zoom-in.png',
+    "zoom_out"    : 'zoom-out.png',
+    "zoom_back"   : 'zoom-last.png',
+    "zoommenu"    : 'zoom-more.png',
+    "zoom_extent" : 'zoom-extent.png',
     # analyze raster (mapdisplay)
     "analyze"    : 'layer-raster-analyze.png',
     "measure"    : 'measure-length.png',

Modified: grass/branches/develbranch_6/gui/wxpython/icons/grass_icons.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/icons/grass_icons.py	2010-06-07 16:41:46 UTC (rev 42498)
+++ grass/branches/develbranch_6/gui/wxpython/icons/grass_icons.py	2010-06-07 16:55:24 UTC (rev 42499)
@@ -23,6 +23,7 @@
     "query"      : 'gui-query.gif',
     "zoom_back"  : 'gui-zoom_back.gif',
     "zoommenu"   : 'gui-mapzoom.gif',
+    "zoom_extent" : wx.ART_ERROR, # FIXME
     "savefile"   : 'file-save.gif',
     "printmap"   : 'file-print.gif',
     "overlay"    : 'gui-overlay.gif',

Modified: grass/branches/develbranch_6/gui/wxpython/icons/icon.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/icons/icon.py	2010-06-07 16:41:46 UTC (rev 42498)
+++ grass/branches/develbranch_6/gui/wxpython/icons/icon.py	2010-06-07 16:55:24 UTC (rev 42499)
@@ -164,6 +164,8 @@
     "zoommenu"   : MetaIcon (img=Icons["zoommenu"],
                              label=_("Zoom options"),
                              desc=_("Display zoom management")),
+    "zoom_extent" : MetaIcon (img=Icons["zoom_extent"],
+                             label=_("Zoom to selected map layer(s)")),
     "overlay"    : MetaIcon (img=Icons["overlay"],
                              label=_("Add map elements"),
                              desc=_("Overlay elements like scale and legend onto map")),

Modified: grass/branches/develbranch_6/gui/wxpython/icons/silk_icons.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/icons/silk_icons.py	2010-06-07 16:41:46 UTC (rev 42498)
+++ grass/branches/develbranch_6/gui/wxpython/icons/silk_icons.py	2010-06-07 16:55:24 UTC (rev 42499)
@@ -29,6 +29,7 @@
     "zoom_out"   : 'zoom_out.png',
     "zoom_back"  : 'zoom_back.png',
     "zoommenu"   : 'zoom.png',
+    "zoom_extent" : wx.ART_ERROR, # FIXME
     # analyze raster (mapdisplay)
     "analyze"    : 'application_lightning.png',
     "measure"    : 'sum.png',


Property changes on: grass/branches/develbranch_6/gui/wxpython/icons/silk_icons.py
___________________________________________________________________
Modified: svn:mergeinfo
   - /grass/branches/releasebranch_6_4/gui/wxpython/icons/silk_icons.py:42375
/grass/trunk/gui/wxpython/icons/silk_icons.py:41584,41586-41587,41590-41592,41594,41596,41598,41600,41806,41884,41888,42350,42372,42377
   + /grass/branches/releasebranch_6_4/gui/wxpython/icons/silk_icons.py:42375
/grass/trunk/gui/wxpython/icons/silk_icons.py:41584,41586-41587,41590-41592,41594,41596,41598,41600,41806,41884,41888,42350,42372,42377,42498



More information about the grass-commit mailing list