Skip to content

Commit

Permalink
Use unique_ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti committed Sep 6, 2017
1 parent 37b6052 commit eee7577
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/app/qgsmaptoolcircle3points.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ void QgsMapToolCircle3Points::cadCanvasMoveEvent( QgsMapMouseEvent *e )
{
case 1:
{
QgsLineString *line = new QgsLineString();
std::unique_ptr<QgsLineString> line( new QgsLineString() );
line->addVertex( mPoints.at( 0 ) );
line->addVertex( mapPoint );
mTempRubberBand->setGeometry( line );
mTempRubberBand->setGeometry( line.release() );
}
break;
case 2:
Expand Down
5 changes: 3 additions & 2 deletions src/app/qgsmaptoolellipsecenter2points.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "qgsmapcanvas.h"
#include "qgspoint.h"
#include <QMouseEvent>
#include <memory>

QgsMapToolEllipseCenter2Points::QgsMapToolEllipseCenter2Points( QgsMapToolCapture *parentTool,
QgsMapCanvas *canvas, CaptureMode mode )
Expand Down Expand Up @@ -69,10 +70,10 @@ void QgsMapToolEllipseCenter2Points::cadCanvasMoveEvent( QgsMapMouseEvent *e )
{
case 1:
{
QgsLineString *line = new QgsLineString();
std::unique_ptr<QgsLineString> line( new QgsLineString() );
line->addVertex( mPoints.at( 0 ) );
line->addVertex( mapPoint );
mTempRubberBand->setGeometry( line );
mTempRubberBand->setGeometry( line.release() );
}
break;
case 2:
Expand Down
5 changes: 3 additions & 2 deletions src/app/qgsmaptoolellipsefoci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "qgsmapcanvas.h"
#include "qgspoint.h"
#include <QMouseEvent>
#include <memory>

QgsMapToolEllipseFoci::QgsMapToolEllipseFoci( QgsMapToolCapture *parentTool,
QgsMapCanvas *canvas, CaptureMode mode )
Expand Down Expand Up @@ -67,10 +68,10 @@ void QgsMapToolEllipseFoci::cadCanvasMoveEvent( QgsMapMouseEvent *e )
{
case 1:
{
QgsLineString *line = new QgsLineString();
std::unique_ptr<QgsLineString> line( new QgsLineString() );
line->addVertex( mPoints.at( 0 ) );
line->addVertex( mapPoint );
mTempRubberBand->setGeometry( line );
mTempRubberBand->setGeometry( line.release() );
}
break;
case 2:
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsmaptoolrectangle3points.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ void QgsMapToolRectangle3Points::cadCanvasMoveEvent( QgsMapMouseEvent *e )
{
case 1:
{
QgsLineString *line = new QgsLineString();
std::unique_ptr<QgsLineString> line( new QgsLineString() );
line->addVertex( mPoints.at( 0 ) );
line->addVertex( mapPoint );
mTempRubberBand->setGeometry( line );
mTempRubberBand->setGeometry( line.release() );
setAzimuth( mPoints.at( 0 ).azimuth( mapPoint ) );
setDistance1( mPoints.at( 0 ).distance( mapPoint ) );
}
Expand Down

0 comments on commit eee7577

Please sign in to comment.