QGIS API Documentation  2.99.0-Master (716ff6c)
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 "qgspoint.h"
21 #include "qgis_gui.h"
22 
23 class QPainter;
24 
28 class GUI_EXPORT QgsVertexMarker : public QgsMapCanvasItem
29 {
30  public:
31 
33  enum IconType
34  {
39  ICON_CIRCLE
40  };
41 
42  QgsVertexMarker( QgsMapCanvas *mapCanvas );
43 
44  void setCenter( const QgsPoint &point );
45 
46  void setIconType( int iconType );
47 
48  void setIconSize( int iconSize );
49 
55  void setColor( const QColor &color );
56 
63  QColor color() const { return mColor; }
64 
72  void setFillColor( const QColor &color );
73 
81  QColor fillColor() const { return mFillColor; }
82 
83  void setPenWidth( int width );
84 
85  void paint( QPainter *p ) override;
86 
87  QRectF boundingRect() const override;
88 
89  virtual void updatePosition() override;
90 
91  private:
92 
94  int mIconType = ICON_X;
95 
97  int mIconSize = 10;
98 
100  QgsPoint mCenter;
101 
103  QColor mColor = QColor( 255, 0, 0 );
104 
106  int mPenWidth = 1;
107 
109  QColor mFillColor = QColor( 0, 0, 0, 0 );
110 
111 };
112 
113 #endif
An abstract class for items that can be placed on the map canvas.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:72
virtual QRectF boundingRect() const override
QColor color() const
Returns the stroke color for the marker.
QColor fillColor() const
Returns the fill color for the marker.
A class for marking vertices of features using e.g.
A class to represent a point.
Definition: qgspoint.h:37
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