QGIS API Documentation  3.4.15-Madeira (e83d02e274)
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 
23 class QPainter;
24 
25 #ifdef SIP_RUN
26 % ModuleHeaderCode
27 // For ConvertToSubClassCode.
28 #include <qgsvertexmarker.h>
29 % End
30 #endif
31 
36 class GUI_EXPORT QgsVertexMarker : public QgsMapCanvasItem
37 {
38 
39 #ifdef SIP_RUN
41  if ( dynamic_cast<QgsVertexMarker *>( sipCpp ) )
42  sipType = sipType_QgsVertexMarker;
43  else
44  sipType = nullptr;
45  SIP_END
46 #endif
47  public:
48 
50  enum IconType
51  {
58  };
59 
61 
62  void setCenter( const QgsPointXY &point );
63 
64  void setIconType( int iconType );
65 
66  void setIconSize( int iconSize );
67 
73  void setColor( const QColor &color );
74 
81  QColor color() const { return mColor; }
82 
90  void setFillColor( const QColor &color );
91 
99  QColor fillColor() const { return mFillColor; }
100 
101  void setPenWidth( int width );
102 
103  void paint( QPainter *p ) override;
104 
105  QRectF boundingRect() const override;
106 
107  void updatePosition() override;
108 
109  private:
110 
112  int mIconType = ICON_X;
113 
115  int mIconSize = 10;
116 
118  QgsPointXY mCenter;
119 
121  QColor mColor = QColor( 255, 0, 0 );
122 
124  int mPenWidth = 1;
125 
127  QColor mFillColor = QColor( 0, 0, 0, 0 );
128 
129 };
130 
131 #endif
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
A class to represent a 2D point.
Definition: qgspointxy.h:43
An abstract class for items that can be placed on the map canvas.
QColor color() const
Returns the stroke color for the marker.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:74
QRectF boundingRect() const override
#define SIP_END
Definition: qgis_sip.h:182
A class for marking vertices of features using e.g.
QColor fillColor() const
Returns the fill color for the marker.
virtual void paint(QPainter *painter)=0
function to be implemented by derived classes
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:165
virtual void updatePosition()
called on changed extent or resize event to update position of the item