Created
April 4, 2012 20:53
-
-
Save jef-n/2305551 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/core/qgsdistancearea.cpp b/src/core/qgsdistancearea.cpp | |
index 269e0ae..bbcb5d5 100644 | |
@@ -808,14 +808,22 @@ QString QgsDistanceArea::textUnit( double value, int decimals, QGis::UnitType u, | |
case QGis::Feet: | |
if ( isArea ) | |
{ | |
- if ( keepBaseUnit || qAbs( value ) <= ( 528.0*528.0 ) ) | |
+ if ( keepBaseUnit || qAbs( value ) <= 0.5*43560.0 ) | |
{ | |
+ // < 0.5 acre show sq ft | |
unitLabel = QObject::tr( " sq ft" ); | |
} | |
+ else if ( qAbs( value ) <= 0.5*5280.0*5280.0 ) | |
+ { | |
+ // < 0.5 sq mile show acre | |
+ unitLabel = QObject::tr( " acre" ); | |
+ value /= 43560.0; | |
+ } | |
else | |
{ | |
+ // above 0.5 acre show sq mi | |
unitLabel = QObject::tr( " sq mile" ); | |
- value = value / ( 5280.0 * 5280.0 ); | |
+ value /= 5280.0 * 5280.0; | |
} | |
} | |
else |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Calculation wise it looks fine. I'm not really sure what most ends users expect other than to be able to toggle between acres/miles easily.