Skip to content
Permalink
Browse files

unique ptr improvements

  • Loading branch information
nyalldawson committed Jan 19, 2018
1 parent 884ccc8 commit 96d1ea57a82e343c3cc3b2a08e8fe7bd45796bc9
Showing with 5 additions and 8 deletions.
  1. +4 −7 src/app/qgsmaptoolselectradius.cpp
  2. +1 −1 src/app/qgsmaptoolselectradius.h
@@ -104,15 +104,14 @@ void QgsDistanceWidget::distanceSpinBoxValueChanged( double distance )

QgsMapToolSelectRadius::QgsMapToolSelectRadius( QgsMapCanvas *canvas )
: QgsMapTool( canvas )
, mSnapIndicator( new QgsSnapIndicator( canvas ) )
, mSnapIndicator( qgis::make_unique< QgsSnapIndicator >( canvas ) )
{
mCursor = Qt::ArrowCursor;
}

QgsMapToolSelectRadius::~QgsMapToolSelectRadius()
{
deleteRotationWidget();
deleteRubberband();
}

void QgsMapToolSelectRadius::canvasMoveEvent( QgsMapMouseEvent *e )
@@ -125,7 +124,7 @@ void QgsMapToolSelectRadius::canvasMoveEvent( QgsMapMouseEvent *e )

if ( !mRubberBand )
{
mRubberBand = new QgsRubberBand( mCanvas, QgsWkbTypes::PolygonGeometry );
mRubberBand = qgis::make_unique< QgsRubberBand >( mCanvas, QgsWkbTypes::PolygonGeometry );
mRubberBand->setFillColor( mFillColor );
mRubberBand->setStrokeColor( mStrokeColor );
}
@@ -157,7 +156,7 @@ void QgsMapToolSelectRadius::canvasReleaseEvent( QgsMapMouseEvent *e )
{
if ( !mRubberBand )
{
mRubberBand = new QgsRubberBand( mCanvas, QgsWkbTypes::PolygonGeometry );
mRubberBand = qgis::make_unique< QgsRubberBand >( mCanvas, QgsWkbTypes::PolygonGeometry );
mRubberBand->setFillColor( mFillColor );
mRubberBand->setStrokeColor( mStrokeColor );
}
@@ -242,11 +241,9 @@ void QgsMapToolSelectRadius::cancel()

void QgsMapToolSelectRadius::deleteRubberband()
{
delete mRubberBand;
mRubberBand = nullptr;
mRubberBand.reset();
}


void QgsMapToolSelectRadius::createRotationWidget()
{
if ( !mCanvas )
@@ -104,7 +104,7 @@ class APP_EXPORT QgsMapToolSelectRadius : public QgsMapTool
void createRotationWidget();

//! used for storing all of the maps point for the polygon
QgsRubberBand *mRubberBand = nullptr;
std::unique_ptr< QgsRubberBand > mRubberBand;
std::unique_ptr<QgsSnapIndicator> mSnapIndicator;

//! Center point for the radius

0 comments on commit 96d1ea5

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