Browse Source

wxGUI: fix proj statusbar resolution
(merge from devbr6, https://trac.osgeo.org/grass/changeset/38154)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@38155 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 16 năm trước cách đây
mục cha
commit
c8b132f833
2 tập tin đã thay đổi với 24 bổ sung14 xóa
  1. 6 3
      gui/wxpython/gui_modules/mapdisp.py
  2. 18 11
      gui/wxpython/gui_modules/utils.py

+ 6 - 3
gui/wxpython/gui_modules/mapdisp.py

@@ -886,9 +886,10 @@ class MapFrame(wx.Frame):
                 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 @@ class MapFrame(wx.Frame):
                             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:

+ 18 - 11
gui/wxpython/gui_modules/utils.py

@@ -266,12 +266,13 @@ def GetVectorNumberOfLayers(vector):
     
     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 @@ def Deg2DMS(lon, lat, string = True):
         flon += 360.0
 
     # hemisphere
-    if flat < 0.0:
-        flat = abs(flat)
-        hlat = 'S'
-    else:
-        hlat = 'N'
+    if hemisphere:
+        if flat < 0.0:
+            flat = abs(flat)
+            hlat = 'S'
+        else:
+            hlat = 'N'
 
-    if flon < 0.0:
-        hlon = 'W'
-        flon = abs(flon)
+        if flon < 0.0:
+            hlon = 'W'
+            flon = abs(flon)
+        else:
+            hlon = 'E'
     else:
-        hlon = 'E'
-
+        flat = abs(flat)
+        flon = abs(flon)
+        hlon = ''
+        hlat = ''
+    
     slat = __ll_parts(flat)
     slon = __ll_parts(flon)