QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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 #ifdef SIP_RUN
28 % ModuleHeaderCode
29 // For ConvertToSubClassCode.
30 #include <qgsgeometryrubberband.h>
31 % End
32 #endif
33 
35 class QgsPoint;
36 struct QgsVertexId;
37 
41 class GUI_EXPORT QgsGeometryRubberBand: public QgsMapCanvasItem
42 {
43 
44 #ifdef SIP_RUN
46  if ( dynamic_cast<QgsGeometryRubberBand *>( sipCpp ) )
47  sipType = sipType_QgsGeometryRubberBand;
48  else
49  sipType = nullptr;
50  SIP_END
51 #endif
52 
53  public:
54  enum IconType
55  {
56 
61 
66 
71 
76 
81 
85  ICON_FULL_BOX
86  };
87 
89  ~QgsGeometryRubberBand() override;
90 
92  void setGeometry( QgsAbstractGeometry *geom SIP_TRANSFER );
94  const QgsAbstractGeometry *geometry() { return mGeometry; }
96  void moveVertex( QgsVertexId id, const QgsPoint &newPos );
98  void setFillColor( const QColor &c );
100  void setStrokeColor( const QColor &c );
102  void setStrokeWidth( int width );
104  void setLineStyle( Qt::PenStyle penStyle );
106  void setBrushStyle( Qt::BrushStyle brushStyle );
108  void setIconType( IconType iconType ) { mIconType = iconType; }
109 
110  protected:
111  void paint( QPainter *painter ) override;
112 
113  private:
114  QgsAbstractGeometry *mGeometry = nullptr;
115  QBrush mBrush;
116  QPen mPen;
117  int mIconSize;
118  IconType mIconType;
119  QgsWkbTypes::GeometryType mGeometryType;
120 
121  void drawVertex( QPainter *p, double x, double y );
122  QgsRectangle rubberBandRectangle() const;
123 };
124 
125 #endif // QGSGEOMETRYRUBBERBAND_H
QgsPoint
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:37
QgsGeometryRubberBand::ICON_CROSS
@ ICON_CROSS
A cross is used to highlight points (+)
Definition: qgsgeometryrubberband.h:65
qgsgeometryrubberband.h
QgsMapCanvas
Definition: qgsmapcanvas.h:83
QgsGeometryRubberBand::ICON_CIRCLE
@ ICON_CIRCLE
A circle is used to highlight points (○)
Definition: qgsgeometryrubberband.h:80
QgsGeometryRubberBand::geometry
const QgsAbstractGeometry * geometry()
Returns a pointer to the geometry.
Definition: qgsgeometryrubberband.h:94
QgsRectangle
Definition: qgsrectangle.h:41
QgsGeometryRubberBand::ICON_BOX
@ ICON_BOX
A box is used to highlight points (□)
Definition: qgsgeometryrubberband.h:75
SIP_CONVERT_TO_SUBCLASS_CODE
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:172
QgsMapCanvasItem::paint
virtual void paint(QPainter *painter)=0
function to be implemented by derived classes
qgsmapcanvasitem.h
QgsMapCanvasItem
Definition: qgsmapcanvasitem.h:33
SIP_TRANSFER
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QgsGeometryRubberBand::setIconType
void setIconType(IconType iconType)
Sets vertex marker icon type.
Definition: qgsgeometryrubberband.h:108
QgsAbstractGeometry
Abstract base class for all geometries.
Definition: qgsabstractgeometry.h:71
QgsGeometryRubberBand
Definition: qgsgeometryrubberband.h:41
QgsWkbTypes::LineGeometry
@ LineGeometry
Definition: qgswkbtypes.h:142
QgsWkbTypes::GeometryType
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Definition: qgswkbtypes.h:139
c
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
Definition: porting_processing.dox:1
QgsVertexId
Utility class for identifying a unique vertex within a geometry.
Definition: qgsabstractgeometry.h:1033
QgsGeometryRubberBand::ICON_NONE
@ ICON_NONE
No icon is used.
Definition: qgsgeometryrubberband.h:60
qgswkbtypes.h
SIP_END
#define SIP_END
Definition: qgis_sip.h:189
QgsGeometryRubberBand::ICON_X
@ ICON_X
A cross is used to highlight points (x)
Definition: qgsgeometryrubberband.h:70
QgsGeometryRubberBand::IconType
IconType
Definition: qgsgeometryrubberband.h:54