15#ifndef QGSRUBBERBAND_H
16#define QGSRUBBERBAND_H
28#include <QSvgRenderer>
64 sipType = sipType_QgsRubberBand;
148 void setColor(
const QColor &color );
165 void setStrokeColor(
const QColor &color );
177 void setSecondaryStrokeColor(
const QColor &color );
188 void setWidth(
double width );
193 int width()
const {
return mPen.width(); }
199 void setIcon( IconType icon );
208 void setSvgIcon(
const QString &path, QPoint drawOffset );
219 void setIconSize(
double iconSize );
229 void setLineStyle( Qt::PenStyle penStyle );
234 void setBrushStyle( Qt::BrushStyle brushStyle );
252 void addPoint(
const QgsPointXY &p,
bool doUpdate =
true,
int geometryIndex = 0,
int ringIndex = 0 );
261 void closePoints(
bool doUpdate =
true,
int geometryIndex = 0,
int ringIndex = 0 );
270 void removePoint(
int index = 0,
bool doUpdate =
true,
int geometryIndex = 0,
int ringIndex = 0 );
275 void removeLastPoint(
int geometryIndex = 0,
bool doUpdate =
true,
int ringIndex = 0 );
281 void movePoint(
const QgsPointXY &p,
int geometryIndex = 0,
int ringIndex = 0 );
287 void movePoint(
int index,
const QgsPointXY &p,
int geometryIndex = 0,
int ringIndex = 0 );
294 int partSize(
int geometryIndex )
const;
321 void setToCanvasRectangle( QRect rect );
363 void setTranslationOffset(
double dx,
double dy );
375 int numberOfVertices()
const;
386 const QgsPointXY *getPoint(
int i,
int j = 0,
int ringIndex = 0 )
const;
394 void updatePosition()
override;
424 void paint( QPainter *p )
override;
431 void drawShape( QPainter *p,
const QVector<QPointF> &pts );
438 void drawShape( QPainter *p,
const QVector<QPolygonF> &rings );
449 double mIconSize = 5;
452 IconType mIconType = ICON_CIRCLE;
453 std::unique_ptr<QSvgRenderer> mSvgRenderer;
456 std::unique_ptr<QgsSymbol> mSymbol;
461 QVector<QVector<QVector<QgsPointXY>>> mPoints;
463 double mTranslationOffsetX = 0.0;
464 double mTranslationOffsetY = 0.0;
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
Represents a coordinate reference system (CRS).
A geometry is the spatial representation of a feature.
QgsMapCanvasItem(QgsMapCanvas *mapCanvas)
protected constructor: cannot be constructed directly
Map canvas is a class for displaying all GIS data types on a canvas.
Base class for all map layer types.
Responsible for drawing transient features (e.g.
void setIconSize(double iconSize)
Sets the size of the point icons.
~QgsRubberBand() override
QgsRubberBand(QgsMapCanvas *mapCanvas, Qgis::GeometryType geometryType=Qgis::GeometryType::Line)
Creates a new RubberBand.
double iconSize() const
Returns the current icon size of the point icons.
QColor fillColor() const
Returns the current fill color.
IconType icon() const
Returns the current icon type to highlight point geometries.
void setWidth(double width)
Sets the width of the line.
void setSecondaryStrokeColor(const QColor &color)
Sets a secondary stroke color for the rubberband which will be drawn under the main stroke color.
@ ICON_X
A cross is used to highlight points (x).
@ ICON_FULL_DIAMOND
A diamond is used to highlight points (◆).
@ ICON_FULL_BOX
A full box is used to highlight points (■).
@ ICON_NONE
No icon is used.
@ ICON_CROSS
A cross is used to highlight points (+).
@ ICON_SVG
An svg image is used to highlight points.
@ ICON_CIRCLE
A circle is used to highlight points (○).
@ ICON_DIAMOND
A diamond is used to highlight points (◇).
@ ICON_BOX
A box is used to highlight points (□).
QColor secondaryStrokeColor() const
Returns the current secondary stroke color.
void setColor(const QColor &color)
Sets the color for the rubberband.
void setStrokeColor(const QColor &color)
Sets the stroke color for the rubberband.
QColor secondaryStrokeColor
int width() const
Returns the current width of the line or stroke width for polygon.
QColor strokeColor() const
Returns the current stroke color.
void setFillColor(const QColor &color)
Sets the fill color for the rubberband.
Abstract base class for all rendered symbols.
Represents a vector layer which manages a vector based dataset.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)