15#ifndef QGSRUBBERBAND_H
16#define QGSRUBBERBAND_H
29#include <QSvgRenderer>
85 QPointer< QgsRubberBand > mRubberBand;
109 sipType = sipType_QgsRubberBand;
142 void setColor( const QColor &color );
159 void setStrokeColor(
const QColor &color );
171 void setSecondaryStrokeColor(
const QColor &color );
182 void setWidth(
double width );
187 int width()
const {
return mPen.width(); }
202 void setSvgIcon(
const QString &path, QPoint drawOffset );
213 void setIconSize(
double iconSize );
223 void setLineStyle( Qt::PenStyle penStyle );
228 void setBrushStyle( Qt::BrushStyle brushStyle );
253 void clearPreviewItems();
264 void addPoint(
const QgsPointXY &p,
bool doUpdate =
true,
int geometryIndex = 0,
int ringIndex = 0 );
273 void closePoints(
bool doUpdate =
true,
int geometryIndex = 0,
int ringIndex = 0 );
282 void removePoint(
int index = 0,
bool doUpdate =
true,
int geometryIndex = 0,
int ringIndex = 0 );
287 void removeLastPoint(
int geometryIndex = 0,
bool doUpdate =
true,
int ringIndex = 0 );
293 void movePoint(
const QgsPointXY &p,
int geometryIndex = 0,
int ringIndex = 0 );
299 void movePoint(
int index,
const QgsPointXY &p,
int geometryIndex = 0,
int ringIndex = 0 );
306 int partSize(
int geometryIndex )
const;
333 void setToCanvasRectangle( QRect rect );
375 void setTranslationOffset(
double dx,
double dy );
387 int numberOfVertices()
const;
398 const QgsPointXY *getPoint(
int i,
int j = 0,
int ringIndex = 0 )
const;
406 void updatePosition()
override;
446 QRectF boundingRect()
const override;
455 void paint( QPainter *p )
override;
462 void drawShape( QPainter *p,
const QVector<QPointF> &pts );
469 void drawShape( QPainter *p,
const QVector<QPolygonF> &rings );
480 double mIconSize = 5;
485 std::unique_ptr<QSvgRenderer> mSvgRenderer;
488 std::unique_ptr<QgsSymbol> mSymbol;
493 QVector<QVector<QVector<QgsPointXY>>> mPoints;
495 double mTranslationOffsetX = 0.0;
496 double mTranslationOffsetY = 0.0;
498 std::vector<std::unique_ptr<QgsRubberBandPreviewItem>> mPreviewItems;
Provides global constants and enumerations for use throughout the application.
QFlags< RubberBandComponent > RubberBandComponents
Rubber band components.
RubberBandIconType
Rubber band icon type.
@ Circle
A circle is used to highlight points (○).
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
@ Symbol
Base symbol component.
@ PreviewItems
Preview overlayer items.
Represents a coordinate reference system (CRS).
A geometry is the spatial representation of a feature.
virtual void paint(QPainter *painter)=0
function to be implemented by derived classes
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.
Contains information about the context of a rendering operation.
Abstract interface for rendering custom preview overlays attached to a QgsRubberBand.
QgsRubberBandPreviewItem(QgsRubberBand *rubberBand)
Constructor for a QgsRubberBandPreviewItem, attached to the specified rubberBand.
virtual void render(QgsRenderContext &context)=0
Renders the custom preview overlay using the specified render context.
virtual ~QgsRubberBandPreviewItem()=default
QgsRubberBand * rubberBand()
Returns the rubber band associated with the item.
virtual QRectF boundingRect() const
Returns the bounding rect required for drawing the preview item.
Responsible for drawing transient features (e.g.
void setIconSize(double iconSize)
Sets the size of the point icons.
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.
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.
QColor secondaryStrokeColor() const
Returns the current secondary stroke color.
Qgis::RubberBandIconType icon() const
Returns the current icon type to highlight point geometries.
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)