[GRASS-SVN] r61268 - in grass/branches/releasebranch_7_0/gui/wxpython: core mapwin

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 17 13:54:41 PDT 2014


Author: annakrat
Date: 2014-07-17 13:54:41 -0700 (Thu, 17 Jul 2014)
New Revision: 61268

Modified:
   grass/branches/releasebranch_7_0/gui/wxpython/core/units.py
   grass/branches/releasebranch_7_0/gui/wxpython/mapwin/analysis.py
Log:
wxGUI/measuring: don't report meters when units are not recognized like foot_uss (merge from trunk, r61132)

Modified: grass/branches/releasebranch_7_0/gui/wxpython/core/units.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/core/units.py	2014-07-17 20:42:22 UTC (rev 61267)
+++ grass/branches/releasebranch_7_0/gui/wxpython/core/units.py	2014-07-17 20:54:41 UTC (rev 61268)
@@ -144,12 +144,12 @@
         >>> formatDist(20.2546, 'degrees')
         (20.25, 'deg')
         >>> formatDist(82.146, 'unknown')
-        (82.15, 'meters')
+        (82.15, 'units')
 
         @endcode
 
-        Accepted map units are 'meters', 'metres', 'feet', 'degree'. Any
-        other units will be considered as meters (output 'meters').
+        Accepted map units are 'meters', 'metres', 'feet', 'degree'.
+        Returns 'units' instead of unrecognized units.
 
         @param distance map units
         @param mapunits map units
@@ -183,11 +183,11 @@
             # was: 'degree' in mapunits and not haveCtypes (for unknown reason)
             if distance < 1:
                 outunits = 'min'
-                divisor = (1/60.0)
+                divisor = (1 / 60.0)
             else:
                 outunits = 'deg'
         else:
-            outunits = 'meters'
+            return (distance, 'units')
 
         # format numbers in a nice way
         if (distance / divisor) >= 2500.0:

Modified: grass/branches/releasebranch_7_0/gui/wxpython/mapwin/analysis.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/mapwin/analysis.py	2014-07-17 20:42:22 UTC (rev 61267)
+++ grass/branches/releasebranch_7_0/gui/wxpython/mapwin/analysis.py	2014-07-17 20:54:41 UTC (rev 61268)
@@ -268,6 +268,8 @@
         self._totaldist += dist
         td, tdunits = units.formatDist(self._totaldist,
                                        mapunits)
+        if dunits == 'units' and mapunits:
+            dunits = tdunits = mapunits
 
         strdist = str(d)
         strtotdist = str(td)



More information about the grass-commit mailing list