QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
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 "qgis_gui.h"
22
#include "
qgscircularstring.h
"
23
#include "
qgscompoundcurve.h
"
24
#include "
qgscurvepolygon.h
"
25
#include "
qgslinestring.h
"
26
#include "
qgsmapcanvasitem.h
"
27
#include "
qgspoint.h
"
28
#include "
qgswkbtypes.h
"
29
30
#include <QBrush>
31
#include <QPen>
32
33
#ifdef SIP_RUN
34
//%ModuleHeaderCode
35
// For ConvertToSubClassCode.
36
#include <
qgsgeometryrubberband.h
>
37
//%End
38
#endif
39
40
class
QgsAbstractGeometry
;
41
class
QgsPoint
;
42
struct
QgsVertexId
;
43
48
class
GUI_EXPORT
QgsGeometryRubberBand
:
public
QgsMapCanvasItem
49
{
50
#ifdef SIP_RUN
51
SIP_CONVERT_TO_SUBCLASS_CODE
52
if
(
dynamic_cast<
QgsGeometryRubberBand
*
>
( sipCpp ) )
53
sipType = sipType_QgsGeometryRubberBand;
54
else
55
sipType =
nullptr
;
56
SIP_END
57
#endif
58
59
public
:
60
enum
IconType
61
{
62
66
ICON_NONE
,
67
71
ICON_CROSS
,
72
76
ICON_X
,
77
81
ICON_BOX
,
82
86
ICON_CIRCLE
,
87
91
ICON_FULL_BOX
92
};
93
97
QgsGeometryRubberBand
(
QgsMapCanvas
*mapCanvas,
Qgis::GeometryType
geomType =
Qgis::GeometryType::Line
);
98
~QgsGeometryRubberBand
()
override
;
99
101
virtual
void
setGeometry(
QgsAbstractGeometry
*geom
SIP_TRANSFER
);
103
const
QgsAbstractGeometry
*
geometry
() {
return
mGeometry.get(); }
105
void
moveVertex(
QgsVertexId
id
,
const
QgsPoint
&newPos );
107
void
setFillColor(
const
QColor &
c
);
109
void
setStrokeColor(
const
QColor &
c
);
111
void
setStrokeWidth(
int
width );
113
void
setLineStyle( Qt::PenStyle penStyle );
115
void
setBrushStyle( Qt::BrushStyle brushStyle );
117
void
setIconType
(
IconType
iconType ) { mIconType = iconType; }
119
void
setVertexDrawingEnabled(
bool
isVerticesDrawn );
120
void
updatePosition
()
override
;
121
122
protected
:
123
using
QgsMapCanvasItem::paint
;
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 = 5;
137
IconType mIconType = ICON_BOX;
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
Qgis::GeometryType
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
Definition
qgis.h:399
Qgis::GeometryType::Line
@ Line
Lines.
Definition
qgis.h:401
QgsAbstractGeometry
Abstract base class for all geometries.
Definition
qgsabstractgeometry.h:82
QgsGeometryRubberBand
A rubberband class for QgsAbstractGeometry (considering curved geometries).
Definition
qgsgeometryrubberband.h:49
QgsGeometryRubberBand::geometry
const QgsAbstractGeometry * geometry()
Returns a pointer to the geometry.
Definition
qgsgeometryrubberband.h:103
QgsGeometryRubberBand::QgsGeometryRubberBand
QgsGeometryRubberBand(QgsMapCanvas *mapCanvas, Qgis::GeometryType geomType=Qgis::GeometryType::Line)
Constructor for QgsGeometryRubberBand of the given geomType, shown in the specified mapCanvas.
Definition
qgsgeometryrubberband.cpp:28
QgsGeometryRubberBand::IconType
IconType
Definition
qgsgeometryrubberband.h:61
QgsGeometryRubberBand::ICON_X
@ ICON_X
A cross is used to highlight points (x).
Definition
qgsgeometryrubberband.h:76
QgsGeometryRubberBand::ICON_NONE
@ ICON_NONE
No icon is used.
Definition
qgsgeometryrubberband.h:66
QgsGeometryRubberBand::ICON_FULL_BOX
@ ICON_FULL_BOX
A full box is used to highlight points (■).
Definition
qgsgeometryrubberband.h:91
QgsGeometryRubberBand::ICON_CIRCLE
@ ICON_CIRCLE
A circle is used to highlight points (○).
Definition
qgsgeometryrubberband.h:86
QgsGeometryRubberBand::ICON_BOX
@ ICON_BOX
A box is used to highlight points (□).
Definition
qgsgeometryrubberband.h:81
QgsGeometryRubberBand::ICON_CROSS
@ ICON_CROSS
A cross is used to highlight points (+).
Definition
qgsgeometryrubberband.h:71
QgsGeometryRubberBand::setIconType
void setIconType(IconType iconType)
Sets vertex marker icon type.
Definition
qgsgeometryrubberband.h:117
QgsMapCanvasItem::paint
virtual void paint(QPainter *painter)=0
function to be implemented by derived classes
QgsMapCanvasItem::QgsMapCanvasItem
QgsMapCanvasItem(QgsMapCanvas *mapCanvas)
protected constructor: cannot be constructed directly
Definition
qgsmapcanvasitem.cpp:30
QgsMapCanvasItem::updatePosition
virtual void updatePosition()
called on changed extent or resize event to update position of the item
Definition
qgsmapcanvasitem.cpp:134
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition
qgsmapcanvas.h:96
QgsPoint
Point geometry type, with support for z-dimension and m-values.
Definition
qgspoint.h:53
QgsRectangle
A rectangle specified with double values.
Definition
qgsrectangle.h:47
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
SIP_CONVERT_TO_SUBCLASS_CODE
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition
qgis_sip.h:203
SIP_TRANSFER
#define SIP_TRANSFER
Definition
qgis_sip.h:35
SIP_END
#define SIP_END
Definition
qgis_sip.h:220
qgscircularstring.h
qgscompoundcurve.h
qgscurvepolygon.h
qgsgeometryrubberband.h
qgslinestring.h
qgsmapcanvasitem.h
qgspoint.h
qgswkbtypes.h
QgsVertexId
Utility class for identifying a unique vertex within a geometry.
Definition
qgsvertexid.h:35
Generated on
for QGIS API Documentation by
1.17.0