Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
show acres after sq ft and before sq mile
  • Loading branch information
jef-n committed Apr 4, 2012
1 parent 4a9e8cc commit 25988d6
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/core/qgsdistancearea.cpp
Expand Up @@ -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 )
Expand All @@ -775,7 +775,7 @@ QString QgsDistanceArea::textUnit( double value, int decimals, QGis::UnitType u,
}
else
{
unitLabel = QObject::tr( " m2" );
unitLabel = QObject::trUtf8( " " );
}
}
else
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down

0 comments on commit 25988d6

Please sign in to comment.