66 pen.setWidth( mPenWidth );
68 QBrush brush( mFillColor );
73 void QgsVertexMarker::updatePath()
75 mPath = QPainterPath();
77 const qreal s = ( mIconSize - 1 ) / 2.0;
85 mPath.moveTo( QPointF( -s, 0 ) );
86 mPath.lineTo( QPointF( s, 0 ) );
87 mPath.moveTo( QPointF( 0, -s ) );
88 mPath.lineTo( QPointF( 0, s ) );
92 mPath.moveTo( QPointF( -s, -s ) );
93 mPath.lineTo( QPointF( s, s ) );
94 mPath.moveTo( QPointF( -s, s ) );
95 mPath.lineTo( QPointF( s, -s ) );
99 mPath.addRect( QRectF( -s, -s, s * 2, s * 2 ) );
103 mPath.addEllipse( QPointF( 0, 0 ), s, s );
107 mPath.moveTo( QPointF( -s, -s ) );
108 mPath.lineTo( QPointF( s, -s ) );
109 mPath.lineTo( QPointF( -s, s ) );
110 mPath.lineTo( QPointF( s, s ) );
111 mPath.lineTo( QPointF( -s, -s ) );
115 mPath.moveTo( QPointF( -s, s ) );
116 mPath.lineTo( QPointF( s, s ) );
117 mPath.lineTo( QPointF( 0, -s ) );
118 mPath.lineTo( QPointF( -s, s ) );
122 mPath.moveTo( QPointF( 0, -s ) );
123 mPath.lineTo( QPointF( -s, 0 ) );
124 mPath.lineTo( QPointF( 0, s ) );
125 mPath.lineTo( QPointF( s, 0 ) );
126 mPath.lineTo( QPointF( 0, -s ) );
130 mPath.moveTo( QPointF( -s, -s ) );
131 mPath.lineTo( QPointF( s, -s ) );
132 mPath.lineTo( QPointF( 0, s ) );
133 mPath.lineTo( QPointF( -s, -s ) );
140 qreal s = qreal( mIconSize + mPenWidth ) / 2.0;
141 return QRectF( -s, -s, 2.0 * s, 2.0 * s );
An abstract class for items that can be placed on the map canvas.
QPointF toCanvasCoordinates(const QgsPointXY &point) const
transformation from map coordinates to screen coordinates
Map canvas is a class for displaying all GIS data types on a canvas.
A class to represent a 2D point.
QColor color() const
Returns the stroke color for the marker.
void setFillColor(const QColor &color)
Sets the fill color for the marker.
void setPenWidth(int width)
@ 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.
void setIconSize(int iconSize)
void setCenter(const QgsPointXY &point)
Sets the center point of the marker, in map coordinates.
QRectF boundingRect() const override
void setIconType(int iconType)
void setColor(const QColor &color)
Sets the stroke color for the marker.
void updatePosition() override
called on changed extent or resize event to update position of the item
void paint(QPainter *p) override
function to be implemented by derived classes
QgsVertexMarker(QgsMapCanvas *mapCanvas)
QSize iconSize(bool dockableToolbar)
Returns the user-preferred size of a window's toolbar icons.