mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
- =delete to explicit class; - move clean() to private; - remove unnecessary initializer;
68 lines
2.5 KiB
C++
68 lines
2.5 KiB
C++
/***************************************************************************
|
|
qgsmaptooladdregularpolygon.h - map tool for adding regular polygon
|
|
---------------------
|
|
begin : July 2017
|
|
copyright : (C) 2017
|
|
email : lbartoletti at tuxfamily dot org
|
|
***************************************************************************
|
|
* *
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
* it under the terms of the GNU General Public License as published by *
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
* (at your option) any later version. *
|
|
* *
|
|
***************************************************************************/
|
|
|
|
#ifndef QGSMAPTOOLADDREGULARPOLYGON_H
|
|
#define QGSMAPTOOLADDREGULARPOLYGON_H
|
|
|
|
#include "qgsregularpolygon.h"
|
|
#include "qgsmaptoolcapture.h"
|
|
#include "qspinbox.h"
|
|
|
|
class QSpinBox;
|
|
|
|
class QgsMapToolAddRegularPolygon: public QgsMapToolCapture
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
QgsMapToolAddRegularPolygon( QgsMapToolCapture *parentTool, QgsMapCanvas *canvas, CaptureMode mode = CaptureLine );
|
|
~QgsMapToolAddRegularPolygon();
|
|
|
|
void keyPressEvent( QKeyEvent *e ) override;
|
|
void keyReleaseEvent( QKeyEvent *e ) override;
|
|
|
|
void deactivate() override;
|
|
|
|
void activate() override;
|
|
|
|
protected:
|
|
explicit QgsMapToolAddRegularPolygon( QgsMapCanvas *canvas ) = delete; //forbidden
|
|
|
|
std::unique_ptr<QSpinBox> mNumberSidesSpinBox;
|
|
int mNumberSides;
|
|
|
|
//! (re-)create the spin box to enter the number of sides
|
|
void createNumberSidesSpinBox();
|
|
//! delete the spin box to enter the number of sides, if it exists
|
|
void deleteNumberSidesSpinBox();
|
|
|
|
/** 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 = 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
|