Skip to content

Commit

Permalink
Use references when iterating on point. Also more expressive variable…
Browse files Browse the repository at this point in the history
… name.
  • Loading branch information
obrix authored and Hugo Mercier committed Feb 20, 2020
1 parent 912441b commit 9c05614
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/app/qgsmaptooladdrectangle.cpp
Expand Up @@ -94,19 +94,19 @@ void QgsMapToolAddRectangle::deactivate( )

mParentTool->clearCurve( );
// keep z value from the first snapped point
std::unique_ptr<QgsLineString> ls( mRectangle.toLineString() );
for ( const QgsPoint point : qgis::as_const( mPoints ) )
std::unique_ptr<QgsLineString> lineString( mRectangle.toLineString() );
for ( const QgsPoint &point : qgis::as_const( mPoints ) )
{
if ( QgsWkbTypes::hasZ( point.wkbType() ) &&
point.z() != defaultZValue() )
{
ls->dropZValue();
ls->addZValue( point.z() );
lineString->dropZValue();
lineString->addZValue( point.z() );
break;
}
}

mParentTool->addCurve( ls.release() );
mParentTool->addCurve( lineString.release() );
clean();

QgsMapToolCapture::deactivate();
Expand Down

0 comments on commit 9c05614

Please sign in to comment.