Browse Source

wxGUI/mapdisp: improving handling of zoom history

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@57079 15284696-431f-4ddb-bdfa-cd5b030d7da7
Vaclav Petras 11 years ago
parent
commit
e88c2efdf9
1 changed files with 22 additions and 0 deletions
  1. 22 0
      gui/wxpython/mapdisp/mapwindow.py

+ 22 - 0
gui/wxpython/mapdisp/mapwindow.py

@@ -1524,6 +1524,8 @@ class BufferedWindow(MapWindow, wx.Window):
         Emits zoomChanged signal.
         Emits zoomChanged signal.
         Emits zoomHistoryUnavailable signal when stack is empty.
         Emits zoomHistoryUnavailable signal when stack is empty.
         """
         """
+        Debug.msg(4, "BufferedWindow.ZoomBack(): hist)=%s" % self.zoomhistory)
+
         zoom = list()
         zoom = list()
         
         
         if len(self.zoomhistory) > 1:
         if len(self.zoomhistory) > 1:
@@ -1579,6 +1581,26 @@ class BufferedWindow(MapWindow, wx.Window):
         
         
         return removed
         return removed
 
 
+    def InitZoomHistory(self):
+        """Initializes zoom history.
+
+        @todo First item is handled in some special way. Improve the
+        documentation or fix the code.
+
+        It does not emits any signals.
+
+        This method can be possibly removed when the history will solve the
+        fist item in different way or when GCP manager (and possibly others)
+        will handle Map variable in the way that it will be prepared for
+        MapWindow/BufferedWindow and thus usable to initialize history.
+        """
+        self.zoomhistory.append((self.Map.region['n'],
+                                 self.Map.region['s'],
+                                 self.Map.region['e'],
+                                 self.Map.region['w']))
+        Debug.msg(4, "BufferedWindow.InitZoomHistory(): hist=%s" %
+                  (self.zoomhistory))
+
     def ResetZoomHistory(self):
     def ResetZoomHistory(self):
         """!Reset zoom history"""
         """!Reset zoom history"""
         self.zoomhistory = list()
         self.zoomhistory = list()