QGIS API Documentation  3.27.0-Master (0e23467727)
qgsmaptoolcapturerubberband.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmaptoolcapturerubberband.h - map tool for capturing points, lines, polygons
3  ---------------------
4  begin : January 2022
5  copyright : (C) Denis Rouzaud
6  email : [email protected]
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSMAPTOOLCAPTURERUBBERBAND_H
17 #define QGSMAPTOOLCAPTURERUBBERBAND_H
18 
19 
20 #include "qgsgeometryrubberband.h"
21 
22 
23 class QgsMapToolCaptureRubberBand;
24 
25 
26 #define SIP_NO_FILE
27 
29 
35 class GUI_EXPORT QgsMapToolCaptureRubberBand: public QgsGeometryRubberBand
36 {
37  public:
39  QgsMapToolCaptureRubberBand( QgsMapCanvas *mapCanvas, QgsWkbTypes::GeometryType geomType = QgsWkbTypes::LineGeometry );
40 
46  QgsCurve *curve() SIP_FACTORY;
47 
52  bool curveIsComplete() const;
53 
59  void reset( QgsWkbTypes::GeometryType geomType = QgsWkbTypes::LineGeometry, QgsWkbTypes::Type stringType = QgsWkbTypes::LineString, const QgsPoint &firstPolygonPoint = QgsPoint() );
60 
62  void setRubberBandGeometryType( QgsWkbTypes::GeometryType geomType );
63 
65  void addPoint( const QgsPoint &point, bool doUpdate = true );
66 
68  void movePoint( const QgsPoint &point );
69 
71  void movePoint( int index, const QgsPoint &point );
72 
74  int pointsCount();
75 
77  QgsWkbTypes::Type stringType() const;
78 
80  void setStringType( const QgsWkbTypes::Type &type );
81 
83  QgsPoint lastPoint() const;
84 
86  QgsPoint pointFromEnd( int posFromEnd ) const;
87 
89  void removeLastPoint();
90 
91  private:
93 
94  void setGeometry( QgsAbstractGeometry *geom ) override;
95  void updateCurve();
96 
97  QgsCurve *createLinearString();
98  QgsCurve *createCircularString();
99 
100  QgsPointSequence mPoints;
101  QgsPoint mFirstPolygonPoint;
102 };
103 
105 
106 #endif
Abstract base class for all geometries.
Abstract base class for curved geometry type.
Definition: qgscurve.h:36
A rubberband class for QgsAbstractGeometry (considering curved geometries).
virtual void setGeometry(QgsAbstractGeometry *geom)
Sets geometry (takes ownership). Geometry is expected to be in map coordinates.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:90
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:49
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Definition: qgswkbtypes.h:141
Type
The WKB type describes the number of dimensions a geometry has.
Definition: qgswkbtypes.h:70
#define SIP_FACTORY
Definition: qgis_sip.h:76
QVector< QgsPoint > QgsPointSequence