Skip to content
Permalink
Browse files

Use unique_ptr

  • Loading branch information
lbartoletti committed Sep 6, 2017
1 parent 37b6052 commit eee75771224a905e8eca6be0919742a46ebd9bdd
@@ -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:
@@ -19,6 +19,7 @@
#include "qgsmapcanvas.h"
#include "qgspoint.h"
#include <QMouseEvent>
#include <memory>

QgsMapToolEllipseCenter2Points::QgsMapToolEllipseCenter2Points( QgsMapToolCapture *parentTool,
QgsMapCanvas *canvas, CaptureMode mode )
@@ -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:
@@ -19,6 +19,7 @@
#include "qgsmapcanvas.h"
#include "qgspoint.h"
#include <QMouseEvent>
#include <memory>

QgsMapToolEllipseFoci::QgsMapToolEllipseFoci( QgsMapToolCapture *parentTool,
QgsMapCanvas *canvas, CaptureMode mode )
@@ -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:
@@ -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 ) );
}

0 comments on commit eee7577

Please sign in to comment.
You can’t perform that action at this time.