Browse Source

wxGUI: minor changes in AlignExtentFromDisplay

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@47989 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 years ago
parent
commit
d74033a1ab
2 changed files with 10 additions and 10 deletions
  1. 9 9
      gui/wxpython/gui_modules/render.py
  2. 1 1
      gui/wxpython/gui_modules/workspace.py

+ 9 - 9
gui/wxpython/gui_modules/render.py

@@ -499,8 +499,9 @@ class Map(object):
         nwres = ewres = 0.0
         nwres = ewres = 0.0
         
         
         # Get current values for region and display
         # Get current values for region and display
-        nsres = self.GetRegion()['nsres']
-        ewres = self.GetRegion()['ewres']
+        reg = self.GetRegion()
+        nsres = reg['nsres']
+        ewres = reg['ewres']
         
         
         n = float(self.region['n'])
         n = float(self.region['n'])
         s = float(self.region['s'])
         s = float(self.region['s'])
@@ -512,15 +513,16 @@ class Map(object):
         new['cols'] = math.fabs(round((e-w)/ewres))
         new['cols'] = math.fabs(round((e-w)/ewres))
         
         
         # Calculate new extents
         # Calculate new extents
-        new['s'] = nsres * round(s/nsres)
-        new['w'] = ewres * round(w/ewres)
+        new['s'] = nsres * round(s / nsres)
+        new['w'] = ewres * round(w / ewres)
         new['n'] = new['s'] + (new['rows'] * nsres)
         new['n'] = new['s'] + (new['rows'] * nsres)
         new['e'] = new['w'] + (new['cols'] * ewres)
         new['e'] = new['w'] + (new['cols'] * ewres)
         
         
         return new
         return new
 
 
     def AlignExtentFromDisplay(self):
     def AlignExtentFromDisplay(self):
-        """!Align region extent based on display size from center point"""
+        """!Align region extent based on display size from center
+        point"""
         # calculate new bounding box based on center of display
         # calculate new bounding box based on center of display
         if self.region["ewres"] > self.region["nsres"]:
         if self.region["ewres"] > self.region["nsres"]:
             res = self.region["ewres"]
             res = self.region["ewres"]
@@ -541,10 +543,8 @@ class Map(object):
         
         
         # LL locations
         # LL locations
         if self.projinfo['proj'] == 'll':
         if self.projinfo['proj'] == 'll':
-            if self.region['n'] > 90.0:
-                self.region['n'] = 90.0
-            if self.region['s'] < -90.0:
-                self.region['s'] = -90.0
+            self.region['n'] = min(self.region['n'], 90.0)
+            self.region['s'] = max(self.region['s'], -90.0)
         
         
     def _writeEnvFile(self, data):
     def _writeEnvFile(self, data):
         """!Write display-related variable to the file (used for
         """!Write display-related variable to the file (used for

+ 1 - 1
gui/wxpython/gui_modules/workspace.py

@@ -930,7 +930,7 @@ class WriteWorkspaceFile(object):
                                               region['e'],
                                               region['e'],
                                               region['n'],
                                               region['n'],
                                               viewmode
                                               viewmode
-                                                    ))
+                                              ))
             # projection statusbar info
             # projection statusbar info
             if mapTree.mapdisplay.statusbarWin['projection'].IsChecked() and \
             if mapTree.mapdisplay.statusbarWin['projection'].IsChecked() and \
                     UserSettings.Get(group='display', key='projection', subkey='proj4'):
                     UserSettings.Get(group='display', key='projection', subkey='proj4'):