1
0
mirror of https://github.com/qgis/QGIS.git synced 2025-03-28 00:04:04 -04:00

- mParentTool -> intialize to nullptr;

- =delete to explicit class;
- move clean() to private;
- remove unnecessary initializer;
This commit is contained in:
lbartoletti 2017-10-09 12:05:19 +02:00
parent d377970db4
commit 8ea5fe7d05
7 changed files with 17 additions and 13 deletions

@ -55,6 +55,7 @@ class QgsMapToolAddCircle: public QgsMapToolCapture
QgsCircle mCircle;
private:
//! convenient method to clean members
void clean();
};

@ -26,7 +26,6 @@
QgsMapToolAddEllipse::QgsMapToolAddEllipse( QgsMapToolCapture *parentTool, QgsMapCanvas *canvas, CaptureMode mode )
: QgsMapToolCapture( canvas, QgisApp::instance()->cadDockWidget(), mode )
, mParentTool( parentTool )
, mEllipse( QgsEllipse() )
{
clean();
}

@ -24,7 +24,6 @@ class QgsGeometryRubberBand;
class QgsMapToolAddEllipse: public QgsMapToolCapture
{
Q_OBJECT
void clean();
public:
QgsMapToolAddEllipse( QgsMapToolCapture *parentTool, QgsMapCanvas *canvas, CaptureMode mode = CaptureLine );
~QgsMapToolAddEllipse();
@ -37,18 +36,22 @@ class QgsMapToolAddEllipse: public QgsMapToolCapture
void activate() override;
protected:
explicit QgsMapToolAddEllipse( QgsMapCanvas *canvas ); //forbidden
explicit QgsMapToolAddEllipse( QgsMapCanvas *canvas ) = delete; //forbidden
/** The parent map tool, e.g. the add feature tool.
* Completed ellipse will be added to this tool by calling its toLineString() method.
* */
QgsMapToolCapture *mParentTool;
QgsMapToolCapture *mParentTool = nullptr;
//! Ellipse points (in map coordinates)
QgsPointSequence mPoints;
//! The rubberband to show the ellipse currently working on
QgsGeometryRubberBand *mTempRubberBand = nullptr;
//! Ellipse
QgsEllipse mEllipse;
private:
//! convenient method to clean members
void clean();
};
#endif // QGSMAPTOOLADDELLIPSE_H

@ -27,7 +27,6 @@
QgsMapToolAddRectangle::QgsMapToolAddRectangle( QgsMapToolCapture *parentTool, QgsMapCanvas *canvas, CaptureMode mode )
: QgsMapToolCapture( canvas, QgisApp::instance()->cadDockWidget(), mode )
, mParentTool( parentTool )
, mRectangle( QgsRectangle() )
{
clean();
}

@ -26,8 +26,6 @@ class QgsMapToolAddRectangle: public QgsMapToolCapture
{
Q_OBJECT
//! convenient method to clean members
void clean();
public:
QgsMapToolAddRectangle( QgsMapToolCapture *parentTool, QgsMapCanvas *canvas, CaptureMode mode = CaptureLine );
~QgsMapToolAddRectangle();
@ -40,12 +38,12 @@ class QgsMapToolAddRectangle: public QgsMapToolCapture
void activate() override;
protected:
explicit QgsMapToolAddRectangle( QgsMapCanvas *canvas ); //forbidden
explicit QgsMapToolAddRectangle( QgsMapCanvas *canvas ) = delete; //forbidden
/** The parent map tool, e.g. the add feature tool.
* Completed regular shape will be added to this tool by calling its addCurve() method.
* */
QgsMapToolCapture *mParentTool;
QgsMapToolCapture *mParentTool = nullptr;
//! Regular Shape points (in map coordinates)
QgsPointSequence mPoints;
//! The rubberband to show the rectangle currently working on
@ -85,6 +83,8 @@ class QgsMapToolAddRectangle: public QgsMapToolCapture
double mDistance2 = 0.0;
//! Convenient member for the side where the second distance is drawn or when map is rotated.
int mSide = 1;
//! convenient method to clean members
void clean();
};
#endif // QGSMAPTOOLADDRECTANGLE_H

@ -26,7 +26,6 @@
QgsMapToolAddRegularPolygon::QgsMapToolAddRegularPolygon( QgsMapToolCapture *parentTool, QgsMapCanvas *canvas, CaptureMode mode )
: QgsMapToolCapture( canvas, QgisApp::instance()->cadDockWidget(), mode )
, mParentTool( parentTool )
, mRegularPolygon( QgsRegularPolygon() )
{
clean();
}

@ -25,7 +25,6 @@ class QSpinBox;
class QgsMapToolAddRegularPolygon: public QgsMapToolCapture
{
Q_OBJECT
void clean();
public:
QgsMapToolAddRegularPolygon( QgsMapToolCapture *parentTool, QgsMapCanvas *canvas, CaptureMode mode = CaptureLine );
@ -39,7 +38,7 @@ class QgsMapToolAddRegularPolygon: public QgsMapToolCapture
void activate() override;
protected:
explicit QgsMapToolAddRegularPolygon( QgsMapCanvas *canvas ); //forbidden
explicit QgsMapToolAddRegularPolygon( QgsMapCanvas *canvas ) = delete; //forbidden
std::unique_ptr<QSpinBox> mNumberSidesSpinBox;
int mNumberSides;
@ -52,13 +51,17 @@ class QgsMapToolAddRegularPolygon: public QgsMapToolCapture
/** The parent map tool, e.g. the add feature tool.
* Completed regular polygon will be added to this tool by calling its addCurve() method.
* */
QgsMapToolCapture *mParentTool;
QgsMapToolCapture *mParentTool = nullptr;
//! Regular Shape points (in map coordinates)
QgsPointSequence mPoints;
//! The rubberband to show the regular polygon currently working on
QgsGeometryRubberBand *mTempRubberBand = nullptr;
//! Regular shape as a regular polygon
QgsRegularPolygon mRegularPolygon;
private:
//! convenient method to clean members
void clean();
};
#endif // QGSMAPTOOLADDREGULARPOLYGON_H