QGIS API Documentation  2.12.0-Lyon
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 
31 class GUI_EXPORT QgsGeometryRubberBand: public QgsMapCanvasItem
32 {
33  public:
34  enum IconType
35  {
59  ICON_FULL_BOX
60  };
61 
64 
66  void setGeometry( QgsAbstractGeometryV2* geom );
68  const QgsAbstractGeometryV2* geometry() { return mGeometry; }
70  void moveVertex( const QgsVertexId& id, const QgsPointV2& newPos );
72  void setFillColor( const QColor& c );
74  void setOutlineColor( const QColor& c );
76  void setOutlineWidth( int width );
78  void setLineStyle( Qt::PenStyle penStyle );
80  void setBrushStyle( Qt::BrushStyle brushStyle );
82  void setIconType( IconType iconType ) { mIconType = iconType; }
83 
84  protected:
85  virtual void paint( QPainter* painter ) override;
86 
87  private:
88  QgsAbstractGeometryV2* mGeometry;
89  QBrush mBrush;
90  QPen mPen;
91  int mIconSize;
92  IconType mIconType;
93  QGis::GeometryType mGeometryType;
94 
95  void drawVertex( QPainter* p, double x, double y );
96  QgsRectangle rubberBandRectangle() const;
97 };
98 
99 #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.
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.
GeometryType
Definition: qgis.h:104
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:107
Utility class for identifying a unique vertex within a geometry.
Point geometry type.
Definition: qgspointv2.h:29
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)