Skip to content

Commit 8ea5fe7

Browse files
committedOct 9, 2017
- mParentTool -> intialize to nullptr;
- =delete to explicit class; - move clean() to private; - remove unnecessary initializer;
1 parent d377970 commit 8ea5fe7

7 files changed

+17
-13
lines changed
 

‎src/app/qgsmaptooladdcircle.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class QgsMapToolAddCircle: public QgsMapToolCapture
5555
QgsCircle mCircle;
5656

5757
private:
58+
//! convenient method to clean members
5859
void clean();
5960
};
6061

‎src/app/qgsmaptooladdellipse.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
QgsMapToolAddEllipse::QgsMapToolAddEllipse( QgsMapToolCapture *parentTool, QgsMapCanvas *canvas, CaptureMode mode )
2727
: QgsMapToolCapture( canvas, QgisApp::instance()->cadDockWidget(), mode )
2828
, mParentTool( parentTool )
29-
, mEllipse( QgsEllipse() )
3029
{
3130
clean();
3231
}

‎src/app/qgsmaptooladdellipse.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class QgsGeometryRubberBand;
2424
class QgsMapToolAddEllipse: public QgsMapToolCapture
2525
{
2626
Q_OBJECT
27-
void clean();
2827
public:
2928
QgsMapToolAddEllipse( QgsMapToolCapture *parentTool, QgsMapCanvas *canvas, CaptureMode mode = CaptureLine );
3029
~QgsMapToolAddEllipse();
@@ -37,18 +36,22 @@ class QgsMapToolAddEllipse: public QgsMapToolCapture
3736
void activate() override;
3837

3938
protected:
40-
explicit QgsMapToolAddEllipse( QgsMapCanvas *canvas ); //forbidden
39+
explicit QgsMapToolAddEllipse( QgsMapCanvas *canvas ) = delete; //forbidden
4140

4241
/** The parent map tool, e.g. the add feature tool.
4342
* Completed ellipse will be added to this tool by calling its toLineString() method.
4443
* */
45-
QgsMapToolCapture *mParentTool;
44+
QgsMapToolCapture *mParentTool = nullptr;
4645
//! Ellipse points (in map coordinates)
4746
QgsPointSequence mPoints;
4847
//! The rubberband to show the ellipse currently working on
4948
QgsGeometryRubberBand *mTempRubberBand = nullptr;
5049
//! Ellipse
5150
QgsEllipse mEllipse;
51+
52+
private:
53+
//! convenient method to clean members
54+
void clean();
5255
};
5356

5457
#endif // QGSMAPTOOLADDELLIPSE_H

‎src/app/qgsmaptooladdrectangle.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
QgsMapToolAddRectangle::QgsMapToolAddRectangle( QgsMapToolCapture *parentTool, QgsMapCanvas *canvas, CaptureMode mode )
2828
: QgsMapToolCapture( canvas, QgisApp::instance()->cadDockWidget(), mode )
2929
, mParentTool( parentTool )
30-
, mRectangle( QgsRectangle() )
3130
{
3231
clean();
3332
}

‎src/app/qgsmaptooladdrectangle.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ class QgsMapToolAddRectangle: public QgsMapToolCapture
2626
{
2727
Q_OBJECT
2828

29-
//! convenient method to clean members
30-
void clean();
3129
public:
3230
QgsMapToolAddRectangle( QgsMapToolCapture *parentTool, QgsMapCanvas *canvas, CaptureMode mode = CaptureLine );
3331
~QgsMapToolAddRectangle();
@@ -40,12 +38,12 @@ class QgsMapToolAddRectangle: public QgsMapToolCapture
4038
void activate() override;
4139

4240
protected:
43-
explicit QgsMapToolAddRectangle( QgsMapCanvas *canvas ); //forbidden
41+
explicit QgsMapToolAddRectangle( QgsMapCanvas *canvas ) = delete; //forbidden
4442

4543
/** The parent map tool, e.g. the add feature tool.
4644
* Completed regular shape will be added to this tool by calling its addCurve() method.
4745
* */
48-
QgsMapToolCapture *mParentTool;
46+
QgsMapToolCapture *mParentTool = nullptr;
4947
//! Regular Shape points (in map coordinates)
5048
QgsPointSequence mPoints;
5149
//! The rubberband to show the rectangle currently working on
@@ -85,6 +83,8 @@ class QgsMapToolAddRectangle: public QgsMapToolCapture
8583
double mDistance2 = 0.0;
8684
//! Convenient member for the side where the second distance is drawn or when map is rotated.
8785
int mSide = 1;
86+
//! convenient method to clean members
87+
void clean();
8888
};
8989

9090
#endif // QGSMAPTOOLADDRECTANGLE_H

‎src/app/qgsmaptooladdregularpolygon.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
QgsMapToolAddRegularPolygon::QgsMapToolAddRegularPolygon( QgsMapToolCapture *parentTool, QgsMapCanvas *canvas, CaptureMode mode )
2727
: QgsMapToolCapture( canvas, QgisApp::instance()->cadDockWidget(), mode )
2828
, mParentTool( parentTool )
29-
, mRegularPolygon( QgsRegularPolygon() )
3029
{
3130
clean();
3231
}

‎src/app/qgsmaptooladdregularpolygon.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class QSpinBox;
2525
class QgsMapToolAddRegularPolygon: public QgsMapToolCapture
2626
{
2727
Q_OBJECT
28-
void clean();
2928

3029
public:
3130
QgsMapToolAddRegularPolygon( QgsMapToolCapture *parentTool, QgsMapCanvas *canvas, CaptureMode mode = CaptureLine );
@@ -39,7 +38,7 @@ class QgsMapToolAddRegularPolygon: public QgsMapToolCapture
3938
void activate() override;
4039

4140
protected:
42-
explicit QgsMapToolAddRegularPolygon( QgsMapCanvas *canvas ); //forbidden
41+
explicit QgsMapToolAddRegularPolygon( QgsMapCanvas *canvas ) = delete; //forbidden
4342

4443
std::unique_ptr<QSpinBox> mNumberSidesSpinBox;
4544
int mNumberSides;
@@ -52,13 +51,17 @@ class QgsMapToolAddRegularPolygon: public QgsMapToolCapture
5251
/** The parent map tool, e.g. the add feature tool.
5352
* Completed regular polygon will be added to this tool by calling its addCurve() method.
5453
* */
55-
QgsMapToolCapture *mParentTool;
54+
QgsMapToolCapture *mParentTool = nullptr;
5655
//! Regular Shape points (in map coordinates)
5756
QgsPointSequence mPoints;
5857
//! The rubberband to show the regular polygon currently working on
5958
QgsGeometryRubberBand *mTempRubberBand = nullptr;
6059
//! Regular shape as a regular polygon
6160
QgsRegularPolygon mRegularPolygon;
61+
62+
private:
63+
//! convenient method to clean members
64+
void clean();
6265
};
6366

6467
#endif // QGSMAPTOOLADDREGULARPOLYGON_H

0 commit comments

Comments
 (0)
Please sign in to comment.