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

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Aug 30 17:03:52 EDT 2011


Author: martinl
Date: 2011-08-30 14:03:51 -0700 (Tue, 30 Aug 2011)
New Revision: 47990

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py
Log:
wxGUI: minor changes in AlignExtentFromDisplay
       (merge r47989 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py	2011-08-30 21:01:25 UTC (rev 47989)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py	2011-08-30 21:03:51 UTC (rev 47990)
@@ -515,8 +515,9 @@
         nwres = ewres = 0.0
         
         # 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'])
         s = float(self.region['s'])
@@ -528,15 +529,16 @@
         new['cols'] = math.fabs(round((e-w)/ewres))
         
         # 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['e'] = new['w'] + (new['cols'] * ewres)
         
         return new
 
     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
         if self.region["ewres"] > self.region["nsres"]:
             res = self.region["ewres"]
@@ -557,10 +559,8 @@
         
         # LL locations
         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 ChangeMapSize(self, (width, height)):
         """!Change size of rendered map.



More information about the grass-commit mailing list