QGIS API Documentation  3.6.0-Noosa (5873452)
qgsgeometryrubberband.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsgeometryrubberband.h
3  -----------------------
4  begin : December 2014
5  copyright : (C) 2014 by Marco Hugentobler
6  email : marco at sourcepole dot ch
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSGEOMETRYRUBBERBAND_H
19 #define QGSGEOMETRYRUBBERBAND_H
20 
21 #include "qgsmapcanvasitem.h"
22 #include "qgswkbtypes.h"
23 #include <QBrush>
24 #include <QPen>
25 #include "qgis_gui.h"
26 
27 
29 class QgsPoint;
30 struct QgsVertexId;
31 
35 class GUI_EXPORT QgsGeometryRubberBand: public QgsMapCanvasItem
36 {
37  public:
38  enum IconType
39  {
40 
45 
50 
55 
60 
65 
69  ICON_FULL_BOX
70  };
71 
73  ~QgsGeometryRubberBand() override;
74 
76  void setGeometry( QgsAbstractGeometry *geom SIP_TRANSFER );
78  const QgsAbstractGeometry *geometry() { return mGeometry; }
80  void moveVertex( QgsVertexId id, const QgsPoint &newPos );
82  void setFillColor( const QColor &c );
84  void setStrokeColor( const QColor &c );
86  void setStrokeWidth( int width );
88  void setLineStyle( Qt::PenStyle penStyle );
90  void setBrushStyle( Qt::BrushStyle brushStyle );
92  void setIconType( IconType iconType ) { mIconType = iconType; }
93 
94  protected:
95  void paint( QPainter *painter ) override;
96 
97  private:
98  QgsAbstractGeometry *mGeometry = nullptr;
99  QBrush mBrush;
100  QPen mPen;
101  int mIconSize;
102  IconType mIconType;
103  QgsWkbTypes::GeometryType mGeometryType;
104 
105  void drawVertex( QPainter *p, double x, double y );
106  QgsRectangle rubberBandRectangle() const;
107 };
108 
109 #endif // QGSGEOMETRYRUBBERBAND_H
A circle is used to highlight points (○)
void setIconType(IconType iconType)
Sets vertex marker icon type.
A rectangle specified with double values.
Definition: qgsrectangle.h:41
A cross is used to highlight points (+)
A box is used to highlight points (□)
An abstract class for items that can be placed on the map canvas.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:73
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
Utility class for identifying a unique vertex within a geometry.
#define SIP_TRANSFER
Definition: qgis_sip.h:36
Abstract base class for all geometries.
const QgsAbstractGeometry * geometry()
Returns a pointer to the geometry.
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:37
virtual void paint(QPainter *painter)=0
function to be implemented by derived classes
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Definition: qgswkbtypes.h:138
A rubberband class for QgsAbstractGeometry (considering curved geometries)
A cross is used to highlight points (x)