QGIS API Documentation  3.24.2-Tisler (13c1a02865)
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 QgsMapToolCaptureRubberBand: public QgsGeometryRubberBand
36 {
37  public:
39  QgsMapToolCaptureRubberBand( QgsMapCanvas *mapCanvas, QgsWkbTypes::GeometryType geomType = QgsWkbTypes::LineGeometry );
40 
42  QgsCurve *curve();
43 
48  bool curveIsComplete() const;
49 
55  void reset( QgsWkbTypes::GeometryType geomType = QgsWkbTypes::LineGeometry, QgsWkbTypes::Type stringType = QgsWkbTypes::LineString, const QgsPoint &firstPolygonPoint = QgsPoint() );
56 
58  void setRubberBandGeometryType( QgsWkbTypes::GeometryType geomType );
59 
61  void addPoint( const QgsPoint &point, bool doUpdate = true );
62 
64  void movePoint( const QgsPoint &point );
65 
67  void movePoint( int index, const QgsPoint &point );
68 
70  int pointsCount();
71 
73  QgsWkbTypes::Type stringType() const;
74 
76  void setStringType( const QgsWkbTypes::Type &type );
77 
79  QgsPoint lastPoint() const;
80 
82  QgsPoint pointFromEnd( int posFromEnd ) const;
83 
85  void removeLastPoint();
86 
87  private:
89 
90  void setGeometry( QgsAbstractGeometry *geom ) override;
91  void updateCurve();
92 
93  QgsCurve *createLinearString();
94  QgsCurve *createCircularString();
95 
96  QgsPointSequence mPoints;
97  QgsPoint mFirstPolygonPoint;
98 };
99 
101 
102 #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
QVector< QgsPoint > QgsPointSequence