Skip to content

Commit

Permalink
Fix last segment length in measure dialog is incorrect after
Browse files Browse the repository at this point in the history
completing measurement with right mouse click
  • Loading branch information
nyalldawson committed Oct 5, 2016
1 parent 03bff50 commit bad1372
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/app/qgsmeasuredialog.cpp
Expand Up @@ -213,16 +213,24 @@ void QgsMeasureDialog::removeLastPoint()
//remove final row
delete mTable->takeTopLevelItem( mTable->topLevelItemCount() - 1 );

QgsPoint p1( mTool->points().last() );
double d = mDa.measureLine( p1, mLastMousePoint );

mTotal = mDa.measureLine( mTool->points() );
editTotal->setText( formatDistance( mTotal + d ) );

d = convertLength( d, mDistanceUnits );
if ( !mTool->done() )
{
// need to add the distance for the temporary mouse cursor point
QgsPoint p1( mTool->points().last() );
double d = mDa.measureLine( p1, mLastMousePoint );

QTreeWidgetItem *item = mTable->topLevelItem( mTable->topLevelItemCount() - 1 );
item->setText( 0, QLocale::system().toString( d, 'f', mDecimalPlaces ) );
d = convertLength( d, mDistanceUnits );

QTreeWidgetItem *item = mTable->topLevelItem( mTable->topLevelItemCount() - 1 );
item->setText( 0, QLocale::system().toString( d, 'f', mDecimalPlaces ) );
editTotal->setText( formatDistance( mTotal + d ) );
}
else
{
editTotal->setText( formatDistance( mTotal ) );
}
}
}

Expand Down

1 comment on commit bad1372

@3nids
Copy link
Member

@3nids 3nids commented on bad1372 Oct 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh! I tried once to change the behavior of the map tool so that the right-click finishes without adding point (to be coherent with add line/polygon) but I end up on this issue... I will resurrect this, thanks!

Please sign in to comment.