QGIS API Documentation 3.39.0-Master (be2050b798e)
Loading...
Searching...
No Matches
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#include "qgscompoundcurve.h"
28#include "qgscurvepolygon.h"
29#include "qgscircularstring.h"
30#include "qgslinestring.h"
31#include "qgspoint.h"
32
33#ifdef SIP_RUN
34% ModuleHeaderCode
35// For ConvertToSubClassCode.
37% End
38#endif
39
41class QgsPoint;
42struct QgsVertexId;
43
49{
50
51#ifdef SIP_RUN
53 if ( dynamic_cast<QgsGeometryRubberBand *>( sipCpp ) )
54 sipType = sipType_QgsGeometryRubberBand;
55 else
56 sipType = nullptr;
58#endif
59
60 public:
62 {
63
68
73
78
83
88
92 ICON_FULL_BOX
93 };
94
99 ~QgsGeometryRubberBand() override;
100
102 virtual void setGeometry( QgsAbstractGeometry *geom SIP_TRANSFER );
104 const QgsAbstractGeometry *geometry() { return mGeometry.get(); }
106 void moveVertex( QgsVertexId id, const QgsPoint &newPos );
108 void setFillColor( const QColor &c );
110 void setStrokeColor( const QColor &c );
112 void setStrokeWidth( int width );
114 void setLineStyle( Qt::PenStyle penStyle );
116 void setBrushStyle( Qt::BrushStyle brushStyle );
118 void setIconType( IconType iconType ) { mIconType = iconType; }
120 void setVertexDrawingEnabled( bool isVerticesDrawn );
121 void updatePosition() override;
122
123 protected:
124 void paint( QPainter *painter ) override;
125
127 Qgis::GeometryType geometryType() const;
128
130 void setGeometryType( Qgis::GeometryType geometryType );
131
132 private:
133 std::unique_ptr<QgsAbstractGeometry> mGeometry = nullptr;
134 QBrush mBrush;
135 QPen mPen;
136 int mIconSize;
137 IconType mIconType;
138 Qgis::GeometryType mGeometryType;
139 bool mDrawVertices = true;
140
141 void drawVertex( QPainter *p, double x, double y );
142 QgsRectangle rubberBandRectangle() const;
143};
144
145
146#endif // QGSGEOMETRYRUBBERBAND_H
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
Definition qgis.h:274
Abstract base class for all geometries.
A rubberband class for QgsAbstractGeometry (considering curved geometries).
const QgsAbstractGeometry * geometry()
Returns a pointer to the geometry.
@ ICON_X
A cross is used to highlight points (x)
@ ICON_CIRCLE
A circle is used to highlight points (○)
@ ICON_BOX
A box is used to highlight points (□)
@ ICON_CROSS
A cross is used to highlight points (+)
void setIconType(IconType iconType)
Sets vertex marker icon type.
An abstract class for items that can be placed on the map canvas.
virtual void paint(QPainter *painter)=0
function to be implemented by derived classes
virtual void updatePosition()
called on changed extent or resize event to update position of the item
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:49
A rectangle specified with double values.
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
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:191
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_END
Definition qgis_sip.h:208
Utility class for identifying a unique vertex within a geometry.
Definition qgsvertexid.h:30