QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
qgsvertexmarker.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsvertexmarker.h - canvas item which shows a simple vertex marker
3 ---------------------
4 begin : February 2006
5 copyright : (C) 2006 by Martin Dobias
6 email : wonder.sk at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSVERTEXMARKER_H
17#define QGSVERTEXMARKER_H
18
19#include "qgsmapcanvasitem.h"
20#include "qgspointxy.h"
21#include "qgis_gui.h"
22
23class QPainter;
24
25#ifdef SIP_RUN
26//%ModuleHeaderCode
27// For ConvertToSubClassCode.
28#include <qgsvertexmarker.h>
29//%End
30#endif
31
36class GUI_EXPORT QgsVertexMarker : public QgsMapCanvasItem
37{
38#ifdef SIP_RUN
40 if ( dynamic_cast<QgsVertexMarker *>( sipCpp ) )
41 sipType = sipType_QgsVertexMarker;
42 else
43 sipType = nullptr;
45#endif
46 public:
60
62
68 void setCenter( const QgsPointXY &point );
69
76 QgsPointXY center() const { return mCenter; }
77
78 void setIconType( int iconType );
79
80 void setIconSize( int iconSize );
81
87 void setColor( const QColor &color );
88
94 QColor color() const { return mColor; }
95
102 void setFillColor( const QColor &color );
103
110 QColor fillColor() const { return mFillColor; }
111
112 void setPenWidth( int width );
113
114 void paint( QPainter *p ) override;
115
116 QRectF boundingRect() const override;
117
118 void updatePosition() override;
119
120 private:
121 void updatePath();
122
124 int mIconType = ICON_X;
125
126 QPainterPath mPath;
127
129 int mIconSize = 10;
130
132 QgsPointXY mCenter;
133
135 QColor mColor = QColor( 255, 0, 0 );
136
138 int mPenWidth = 1;
139
141 QColor mFillColor = QColor( 0, 0, 0, 0 );
142};
143
144#endif
An abstract class for items that can be placed on the map canvas.
QRectF boundingRect() const override
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.
A class to represent a 2D point.
Definition qgspointxy.h:60
A class for marking vertices of features using e.g.
QColor color() const
Returns the stroke color for the marker.
@ ICON_TRIANGLE
Added in QGIS 3.12.
@ ICON_DOUBLE_TRIANGLE
Added in QGIS 3.0.
@ ICON_INVERTED_TRIANGLE
Added in QGIS 3.20.
@ ICON_RHOMBUS
Added in QGIS 3.12.
QgsPointXY center() const
Returns the center point of the marker, in map coordinates.
QColor fillColor() const
Returns the fill color for the marker.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:191
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_END
Definition qgis_sip.h:208