15#ifndef QGSRUBBERBAND_H
16#define QGSRUBBERBAND_H
29#include <QSvgRenderer>
75 QPointer< QgsRubberBand > mRubberBand;
99 sipType = sipType_QgsRubberBand;
132 void setColor( const QColor &color );
149 void setStrokeColor(
const QColor &color );
161 void setSecondaryStrokeColor(
const QColor &color );
172 void setWidth(
double width );
177 int width()
const {
return mPen.width(); }
192 void setSvgIcon(
const QString &path, QPoint drawOffset );
203 void setIconSize(
double iconSize );
213 void setLineStyle( Qt::PenStyle penStyle );
218 void setBrushStyle( Qt::BrushStyle brushStyle );
243 void clearPreviewItems();
254 void addPoint(
const QgsPointXY &p,
bool doUpdate =
true,
int geometryIndex = 0,
int ringIndex = 0 );
263 void closePoints(
bool doUpdate =
true,
int geometryIndex = 0,
int ringIndex = 0 );
272 void removePoint(
int index = 0,
bool doUpdate =
true,
int geometryIndex = 0,
int ringIndex = 0 );
277 void removeLastPoint(
int geometryIndex = 0,
bool doUpdate =
true,
int ringIndex = 0 );
283 void movePoint(
const QgsPointXY &p,
int geometryIndex = 0,
int ringIndex = 0 );
289 void movePoint(
int index,
const QgsPointXY &p,
int geometryIndex = 0,
int ringIndex = 0 );
296 int partSize(
int geometryIndex )
const;
323 void setToCanvasRectangle( QRect rect );
365 void setTranslationOffset(
double dx,
double dy );
377 int numberOfVertices()
const;
388 const QgsPointXY *getPoint(
int i,
int j = 0,
int ringIndex = 0 )
const;
396 void updatePosition()
override;
444 void paint( QPainter *p )
override;
451 void drawShape( QPainter *p,
const QVector<QPointF> &pts );
458 void drawShape( QPainter *p,
const QVector<QPolygonF> &rings );
469 double mIconSize = 5;
474 std::unique_ptr<QSvgRenderer> mSvgRenderer;
477 std::unique_ptr<QgsSymbol> mSymbol;
482 QVector<QVector<QVector<QgsPointXY>>> mPoints;
484 double mTranslationOffsetX = 0.0;
485 double mTranslationOffsetY = 0.0;
487 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.
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)