QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 <QBrush>
23 #include <QPen>
24 
25 
27 class QgsPointV2;
28 struct QgsVertexId;
29 
32 class GUI_EXPORT QgsGeometryRubberBand: public QgsMapCanvasItem
33 {
34  public:
35  enum IconType
36  {
60  ICON_FULL_BOX
61  };
62 
65 
67  void setGeometry( QgsAbstractGeometryV2* geom );
69  const QgsAbstractGeometryV2* geometry() { return mGeometry; }
71  void moveVertex( QgsVertexId id, const QgsPointV2& newPos );
73  void setFillColor( const QColor& c );
75  void setOutlineColor( const QColor& c );
77  void setOutlineWidth( int width );
79  void setLineStyle( Qt::PenStyle penStyle );
81  void setBrushStyle( Qt::BrushStyle brushStyle );
83  void setIconType( IconType iconType ) { mIconType = iconType; }
84 
85  protected:
86  virtual void paint( QPainter* painter ) override;
87 
88  private:
89  QgsAbstractGeometryV2* mGeometry;
90  QBrush mBrush;
91  QPen mPen;
92  int mIconSize;
93  IconType mIconType;
94  QGis::GeometryType mGeometryType;
95 
96  void drawVertex( QPainter* p, double x, double y );
97  QgsRectangle rubberBandRectangle() const;
98 };
99 
100 #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:35
const QgsAbstractGeometryV2 * geometry()
Returns a pointer to the geometry.
GeometryType
Definition: qgis.h:115
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.
Abstract base class for all geometries.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:109
Utility class for identifying a unique vertex within a geometry.
Point geometry type, with support for z-dimension and m-values.
Definition: qgspointv2.h:34
virtual void paint(QPainter *painter)=0
function to be implemented by derived classes
A rubberband class for QgsAbstractGeometryV2 (considering curved geometries)
A cross is used to highlight points (x)