[GRASS-SVN] r38155 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 2 04:20:56 EDT 2009


Author: martinl
Date: 2009-07-02 04:20:55 -0400 (Thu, 02 Jul 2009)
New Revision: 38155

Modified:
   grass/trunk/gui/wxpython/gui_modules/mapdisp.py
   grass/trunk/gui/wxpython/gui_modules/utils.py
Log:
wxGUI: fix proj statusbar resolution
       (merge from devbr6, r38154)


Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2009-07-02 08:19:26 UTC (rev 38154)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2009-07-02 08:20:55 UTC (rev 38155)
@@ -886,9 +886,10 @@
                 proj, coord2 = utils.ReprojectCoordinates(coord = (region["e"], region["n"]),
                                                           projOut = projOut, flags = 'd')
                 if sel == 2:
-                    proj, coord3 = utils.ReprojectCoordinates(coord = (region["ewres"], region["nsres"]),
+                    proj, coord3 = utils.ReprojectCoordinates(coord = (0.0, 0.0),
                                                               projOut = projOut, flags = 'd')
-                
+                    proj, coord4 = utils.ReprojectCoordinates(coord = (region["ewres"], region["nsres"]),
+                                                              projOut = projOut, flags = 'd')
                 if coord1 and coord2:
                     if proj in ('ll', 'latlong', 'longlat'):
                         w, s = utils.Deg2DMS(coord1[0], coord1[1], string = False)
@@ -897,7 +898,9 @@
                             self.statusbar.SetStatusText("%s - %s, %s - %s" %
                                                          (w, e, s, n), 0)
                         else:
-                            ewres, nsres = utils.Deg2DMS(coord3[0], coord3[1], string = False)
+                            ewres, nsres = utils.Deg2DMS(abs(coord3[0]) - abs(coord4[0]),
+                                                         abs(coord3[1]) - abs(coord4[1]),
+                                                         string = False, hemisphere = False)
                             self.statusbar.SetStatusText("%s - %s, %s - %s (%s, %s)" %
                                                          (w, e, s, n, ewres, nsres), 0)
                     else:

Modified: grass/trunk/gui/wxpython/gui_modules/utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/utils.py	2009-07-02 08:19:26 UTC (rev 38154)
+++ grass/trunk/gui/wxpython/gui_modules/utils.py	2009-07-02 08:20:55 UTC (rev 38155)
@@ -266,12 +266,13 @@
     
     return layers
 
-def Deg2DMS(lon, lat, string = True):
+def Deg2DMS(lon, lat, string = True, hemisphere = True):
     """!Convert deg value to dms string
 
     @param lon longitude (x)
     @param lat latitude (y)
     @param string True to return string otherwise tuple
+    @param hemisphere print hemisphere
     
     @return DMS string or tuple of values
     @return empty string on error
@@ -292,18 +293,24 @@
         flon += 360.0
 
     # hemisphere
-    if flat < 0.0:
+    if hemisphere:
+        if flat < 0.0:
+            flat = abs(flat)
+            hlat = 'S'
+        else:
+            hlat = 'N'
+
+        if flon < 0.0:
+            hlon = 'W'
+            flon = abs(flon)
+        else:
+            hlon = 'E'
+    else:
         flat = abs(flat)
-        hlat = 'S'
-    else:
-        hlat = 'N'
-
-    if flon < 0.0:
-        hlon = 'W'
         flon = abs(flon)
-    else:
-        hlon = 'E'
-
+        hlon = ''
+        hlat = ''
+    
     slat = __ll_parts(flat)
     slon = __ll_parts(flon)
 



More information about the grass-commit mailing list