QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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
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
21
22
23class QgsMapToolCaptureRubberBand;
24
25
26#define SIP_NO_FILE
27
29
35class GUI_EXPORT QgsMapToolCaptureRubberBand: public QgsGeometryRubberBand
36{
37 public:
39 QgsMapToolCaptureRubberBand( QgsMapCanvas *mapCanvas, Qgis::GeometryType geomType = Qgis::GeometryType::Line );
40
46 QgsCurve *curve() SIP_FACTORY;
47
52 bool curveIsComplete() const;
53
59 void reset( Qgis::GeometryType geomType = Qgis::GeometryType::Line, Qgis::WkbType stringType = Qgis::WkbType::LineString, const QgsPoint &firstPolygonPoint = QgsPoint() );
60
62 void setRubberBandGeometryType( Qgis::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 Qgis::WkbType stringType() const;
78
80 void setStringType( Qgis::WkbType 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
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
Definition: qgis.h:255
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition: qgis.h:182
@ LineString
LineString.
Abstract base class for all geometries.
Abstract base class for curved geometry type.
Definition: qgscurve.h:35
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:93
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:49
#define SIP_FACTORY
Definition: qgis_sip.h:76
QVector< QgsPoint > QgsPointSequence