QGIS API Documentation 3.99.0-Master (357b655ed83)
Loading...
Searching...
No Matches
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
20#include <memory>
21
23
24class QgsMapToolCaptureRubberBand;
25class QgsRubberBand;
26
27
28#define SIP_NO_FILE
29
31
37class GUI_EXPORT QgsMapToolCaptureRubberBand : public QgsGeometryRubberBand
38{
39 public:
41 QgsMapToolCaptureRubberBand( QgsMapCanvas *mapCanvas, Qgis::GeometryType geomType = Qgis::GeometryType::Line );
42
44 ~QgsMapToolCaptureRubberBand() override;
45
51 QgsCurve *curve() SIP_FACTORY;
52
57 bool curveIsComplete() const;
58
64 void reset( Qgis::GeometryType geomType = Qgis::GeometryType::Line, Qgis::WkbType stringType = Qgis::WkbType::LineString, const QgsPoint &firstPolygonPoint = QgsPoint() );
65
67 void setRubberBandGeometryType( Qgis::GeometryType geomType );
68
70 void addPoint( const QgsPoint &point, bool doUpdate = true );
71
73 void movePoint( const QgsPoint &point );
74
76 void movePoint( int index, const QgsPoint &point );
77
79 int pointsCount() const;
80
82 Qgis::WkbType stringType() const;
83
85 void setStringType( Qgis::WkbType type );
86
88 QgsPoint lastPoint() const;
89
91 QgsPoint pointFromEnd( int posFromEnd ) const;
92
94 void removeLastPoint();
95
101 double weight( int index ) const;
102
109 bool setWeight( int index, double weight );
110
115 const QVector<double> &weights() const { return mWeights; }
116
117 private:
119
120 void setGeometry( QgsAbstractGeometry *geom ) override;
121 void updateCurve();
122
123 QgsCurve *createLinearString();
124 QgsCurve *createCircularString();
125 QgsCurve *createNurbsCurve();
126
127 QgsPointSequence mPoints;
128 QVector<double> mWeights;
129 QgsPoint mFirstPolygonPoint;
130 std::unique_ptr<QgsRubberBand> mControlPolygonRubberBand;
131
132 void updateControlPolygon();
133};
134
136
137#endif
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
Definition qgis.h:365
@ Line
Lines.
Definition qgis.h:367
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:280
@ LineString
LineString.
Definition qgis.h:283
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.
Point geometry type, with support for z-dimension and m-values.
Definition qgspoint.h:53
Responsible for drawing transient features (e.g.
#define SIP_FACTORY
Definition qgis_sip.h:84
QVector< QgsPoint > QgsPointSequence