Skip to content
Permalink
Browse files
show acres after sq ft and before sq mile
  • Loading branch information
jef-n committed Apr 4, 2012
1 parent 4a9e8cc commit 25988d67b188fc5a05eaa3d49abad7d2495aab4e
Showing with 14 additions and 6 deletions.
  1. +14 −6 src/core/qgsdistancearea.cpp
@@ -761,11 +761,11 @@ QString QgsDistanceArea::textUnit( double value, int decimals, QGis::UnitType u,
{
if ( keepBaseUnit )
{
unitLabel = QObject::tr( " m2" );
unitLabel = QObject::trUtf8( " " );
}
else if ( qAbs( value ) > 1000000.0 )
{
unitLabel = QObject::tr( " km2" );
unitLabel = QObject::trUtf8( " km²" );
value = value / 1000000.0;
}
else if ( qAbs( value ) > 10000.0 )
@@ -775,7 +775,7 @@ QString QgsDistanceArea::textUnit( double value, int decimals, QGis::UnitType u,
}
else
{
unitLabel = QObject::tr( " m2" );
unitLabel = QObject::trUtf8( " " );
}
}
else
@@ -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( " acres" );
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
@@ -834,7 +842,7 @@ QString QgsDistanceArea::textUnit( double value, int decimals, QGis::UnitType u,
else
{
unitLabel = QObject::tr( " mile" );
value = value / 5280.0;
value /= 5280.0;
}
}
break;

0 comments on commit 25988d6

Please sign in to comment.