[GRASS-SVN] r61132 - in grass/trunk/gui/wxpython: core mapwin
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jul 2 19:50:34 PDT 2014
Author: annakrat
Date: 2014-07-02 19:50:34 -0700 (Wed, 02 Jul 2014)
New Revision: 61132
Modified:
grass/trunk/gui/wxpython/core/units.py
grass/trunk/gui/wxpython/mapwin/analysis.py
Log:
wxGUI/measuring: don't report meters when units are not recognized like foot_uss
Modified: grass/trunk/gui/wxpython/core/units.py
===================================================================
--- grass/trunk/gui/wxpython/core/units.py 2014-07-02 21:35:47 UTC (rev 61131)
+++ grass/trunk/gui/wxpython/core/units.py 2014-07-03 02:50:34 UTC (rev 61132)
@@ -142,10 +142,10 @@
>>> formatDist(20.2546, 'degrees')
(20.25, 'deg')
>>> formatDist(82.146, 'unknown')
- (82.15, 'meters')
+ (82.15, 'units')
- 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
@@ -179,11 +179,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/trunk/gui/wxpython/mapwin/analysis.py
===================================================================
--- grass/trunk/gui/wxpython/mapwin/analysis.py 2014-07-02 21:35:47 UTC (rev 61131)
+++ grass/trunk/gui/wxpython/mapwin/analysis.py 2014-07-03 02:50:34 UTC (rev 61132)
@@ -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