Skip to content

Commit

Permalink
Fixed conversion of areas
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11342 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
homann committed Aug 11, 2009
1 parent 777b175 commit f0d400a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/app/qgsmeasuredialog.cpp
Expand Up @@ -90,9 +90,6 @@ void QgsMeasureDialog::mouseMove( QgsPoint &point )
QList<QgsPoint> tmpPoints = mTool->points();
tmpPoints.append( point );
double area = mTool->canvas()->mapRenderer()->distanceArea()->measurePolygon( tmpPoints );
QGis::UnitType myDisplayUnits;
// Ignore units
convertMeasurement( area, myDisplayUnits, true );
editTotal->setText( formatArea( area ) );
}
else if ( !mMeasureArea && mTool->points().size() > 0 )
Expand All @@ -115,9 +112,6 @@ void QgsMeasureDialog::addPoint( QgsPoint &point )
if ( mMeasureArea && numPoints > 2 )
{
double area = mTool->canvas()->mapRenderer()->distanceArea()->measurePolygon( mTool->points() );
QGis::UnitType myDisplayUnits;
// Ignore units
convertMeasurement( area, myDisplayUnits, true );
editTotal->setText( formatArea( area ) );
}
else if ( !mMeasureArea && numPoints > 1 )
Expand Down Expand Up @@ -246,6 +240,7 @@ void QgsMeasureDialog::convertMeasurement(double &measure, QGis::UnitType &u, bo
{
// Measuring on an ellipsoid returns meters
myUnits = QGis::Meters;
QgsDebugMsg( "We're measuring on an ellipsoid, returning meters" );
}

// Get the units for display
Expand All @@ -255,20 +250,24 @@ void QgsMeasureDialog::convertMeasurement(double &measure, QGis::UnitType &u, bo
// Only convert between meters and feet
if ( myUnits == QGis::Meters && myDisplayUnitsTxt == "feet" )
{
QgsDebugMsg( QString( "Converting %1 meters" ).arg( QString::number( measure ) ) );
measure /= 0.3048;
if ( isArea )
{
measure /= 0.3048;
}
QgsDebugMsg( QString( "to %1 feet" ).arg( QString::number( measure ) ) );
myUnits = QGis::Feet;
}
if ( myUnits == QGis::Feet && myDisplayUnitsTxt == "meters" )
{
measure *= 0.3048 * 0.3048;
QgsDebugMsg( QString( "Converting %1 feet" ).arg( QString::number( measure ) ) );
measure *= 0.3048;
if ( isArea )
{
measure *= 0.3048;
}
QgsDebugMsg( QString( "to %1 meters" ).arg( QString::number( measure ) ) );
myUnits = QGis::Meters;
}

Expand Down

0 comments on commit f0d400a

Please sign in to comment.