QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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
QgsCurve
Abstract base class for curved geometry type.
Definition: qgscurve.h:35
QgsPoint
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:48
qgsgeometryrubberband.h
QgsWkbTypes::LineString
@ LineString
Definition: qgswkbtypes.h:73
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:89
QgsWkbTypes::Type
Type
The WKB type describes the number of dimensions a geometry has.
Definition: qgswkbtypes.h:69
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsGeometryRubberBand::setGeometry
virtual void setGeometry(QgsAbstractGeometry *geom)
Sets geometry (takes ownership). Geometry is expected to be in map coordinates.
Definition: qgsgeometryrubberband.cpp:120
QgsAbstractGeometry
Abstract base class for all geometries.
Definition: qgsabstractgeometry.h:79
QgsGeometryRubberBand
A rubberband class for QgsAbstractGeometry (considering curved geometries).
Definition: qgsgeometryrubberband.h:48
QgsWkbTypes::LineGeometry
@ LineGeometry
Definition: qgswkbtypes.h:143
QgsWkbTypes::GeometryType
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Definition: qgswkbtypes.h:140
QgsPointSequence
QVector< QgsPoint > QgsPointSequence
Definition: qgsabstractgeometry.h:52