QGIS API Documentation 3.99.0-Master (a8882ad4560)
Loading...
Searching...
No Matches
QgsAnnotationItemRubberBand Class Reference

An annotation item rubberband used by QgsMapToolSelectAnnotation to represent selected items. More...

#include <qgsmaptoolselectannotation.h>

Inheritance diagram for QgsAnnotationItemRubberBand:

Public Member Functions

 QgsAnnotationItemRubberBand (const QString &layerId, const QString &itemId, QgsMapCanvas *canvas)
 Constructor for QgsAnnotationItemRubberBand.
 ~QgsAnnotationItemRubberBand () override=default
QgsRectangle boundingBox () const
 Returns the item bounding box.
QgsAnnotationItemitem () const
 Returns a pointer to the annotation item.
QString itemId () const
 Returns the annotation item ID.
QgsAnnotationLayerlayer () const
 Returns a pointer to the annotation layer.
QString layerId () const
 Returns the annotation layer ID.
bool needsUpdatedBoundingBox () const
 Returns true if the bounding box requires updating on fresh annotation item rendering.
void setNeedsUpdatedBoundingBox (bool needsUpdatedBoundingBox)
 Sets whether the bounding box requires updating on fresh annotation item rendering.
void updateBoundingBox (const QgsRectangle &boundingBox)
 Update the rubberband using the provided annotation item bounding box.
Public Member Functions inherited from QgsRubberBand
 QgsRubberBand (QgsMapCanvas *mapCanvas, Qgis::GeometryType geometryType=Qgis::GeometryType::Line)
 Creates a new RubberBand.
 ~QgsRubberBand () override
void addGeometry (const QgsGeometry &geometry, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem(), bool doUpdate=true)
 Adds a geometry to the rubberband.
void addGeometry (const QgsGeometry &geometry, QgsMapLayer *layer, bool doUpdate=true)
 Adds the geometry of an existing feature to a rubberband This is useful for multi feature highlighting.
void addPoint (const QgsPointXY &p, bool doUpdate=true, int geometryIndex=0, int ringIndex=0)
 Adds a vertex to the rubberband and update canvas.
QgsGeometry asGeometry () const
 Returns the rubberband as a Geometry.
void closePoints (bool doUpdate=true, int geometryIndex=0, int ringIndex=0)
 Ensures that a polygon geometry is closed and that the last vertex equals the first vertex.
void copyPointsFrom (const QgsRubberBand *other)
 Copies the points from another rubber band.
QColor fillColor () const
 Returns the current fill color.
const QgsPointXYgetPoint (int i, int j=0, int ringIndex=0) const
 Returns a vertex.
IconType icon () const
 Returns the current icon type to highlight point geometries.
double iconSize () const
 Returns the current icon size of the point icons.
void movePoint (const QgsPointXY &p, int geometryIndex=0, int ringIndex=0)
 Moves the rubber band point specified by index.
void movePoint (int index, const QgsPointXY &p, int geometryIndex=0, int ringIndex=0)
 Moves the rubber band point specified by index.
int numberOfVertices () const
 Returns count of vertices in all lists of mPoint.
int partSize (int geometryIndex) const
 Returns number of vertices in feature part.
void removeLastPoint (int geometryIndex=0, bool doUpdate=true, int ringIndex=0)
 Removes the last point.
void removePoint (int index=0, bool doUpdate=true, int geometryIndex=0, int ringIndex=0)
 Removes a vertex from the rubberband and (optionally) updates canvas.
void reset (Qgis::GeometryType geometryType=Qgis::GeometryType::Line)
 Clears all the geometries in this rubberband.
QColor secondaryStrokeColor () const
 Returns the current secondary stroke color.
void setBrushStyle (Qt::BrushStyle brushStyle)
 Sets the style of the brush.
void setColor (const QColor &color)
 Sets the color for the rubberband.
void setFillColor (const QColor &color)
 Sets the fill color for the rubberband.
void setIcon (IconType icon)
 Sets the icon type to highlight point geometries.
void setIconSize (double iconSize)
 Sets the size of the point icons.
void setLineStyle (Qt::PenStyle penStyle)
 Sets the style 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.
void setStrokeColor (const QColor &color)
 Sets the stroke color for the rubberband.
void setSvgIcon (const QString &path, QPoint drawOffset)
 Set the path to the svg file to use to draw points.
void setSymbol (QgsSymbol *symbol)
 Sets the symbol used for rendering the rubberband.
void setToCanvasRectangle (QRect rect)
 Sets this rubber band to a map canvas rectangle.
void setToGeometry (const QgsGeometry &geom, QgsVectorLayer *layer)
 Sets this rubber band to geom.
void setToGeometry (const QgsGeometry &geometry, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
 Sets this rubber band to geometry.
void setTranslationOffset (double dx, double dy)
 Adds translation to original coordinates (all in map coordinates).
void setWidth (double width)
 Sets the width of the line.
int size () const
 Returns number of geometries.
QColor strokeColor () const
 Returns the current stroke color.
QgsSymbolsymbol () const
 Returns the symbol used for rendering the rubberband, if set.
void updatePosition () override
 called on changed extent or resize event to update position of the item
int width () const
 Returns the current width of the line or stroke width for polygon.
Public Member Functions inherited from QgsMapCanvasItem
QRectF boundingRect () const override
QgsRectangle rect () const
 returns canvas item rectangle in map units
void setRect (const QgsRectangle &r, bool resetRotation=true)
 sets canvas item rectangle in map units
QPointF toCanvasCoordinates (const QgsPointXY &point) const
 transformation from map coordinates to screen coordinates
QgsPointXY toMapCoordinates (QPoint point) const
 transformation from screen coordinates to map coordinates

Additional Inherited Members

Public Types inherited from QgsRubberBand
enum  IconType {
  ICON_NONE , ICON_CROSS , ICON_X , ICON_BOX ,
  ICON_CIRCLE , ICON_FULL_BOX , ICON_DIAMOND , ICON_FULL_DIAMOND ,
  ICON_SVG
}
 Icons. More...
Protected Member Functions inherited from QgsRubberBand
void drawShape (QPainter *p, const QVector< QPointF > &pts)
 Draws shape of the rubber band.
void drawShape (QPainter *p, const QVector< QPolygonF > &rings)
 Draws shape of the rubber band.
void paint (QPainter *p) override
 Paints the rubber band in response to an update event.
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) override
void updateRect ()
 Recalculates needed rectangle.
Protected Member Functions inherited from QgsMapCanvasItem
 QgsMapCanvasItem (QgsMapCanvas *mapCanvas)
 protected constructor: cannot be constructed directly
 ~QgsMapCanvasItem () override
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) override
bool setRenderContextVariables (QPainter *p, QgsRenderContext &context) const
 Sets render context parameters.
void updateCanvas ()
 schedules map canvas for repaint
Protected Attributes inherited from QgsMapCanvasItem
QSizeF mItemSize
 cached size of the item (to return in boundingRect())
QgsMapCanvasmMapCanvas = nullptr
 pointer to map canvas
QgsRectangle mRect
 cached canvas item rectangle in map coordinates encodes position (xmin,ymax) and size (width/height) used to re-position and re-size the item on zoom/pan while waiting for the renderer to complete.
double mRectRotation = 0.0
Properties inherited from QgsRubberBand
QColor fillColor
int iconSize
QColor secondaryStrokeColor
QColor strokeColor
int width

Detailed Description

An annotation item rubberband used by QgsMapToolSelectAnnotation to represent selected items.

Note
Not available in Python bindings
Since
QGIS 4.0

Definition at line 46 of file qgsmaptoolselectannotation.h.

Constructor & Destructor Documentation

◆ QgsAnnotationItemRubberBand()

QgsAnnotationItemRubberBand::QgsAnnotationItemRubberBand ( const QString & layerId,
const QString & itemId,
QgsMapCanvas * canvas )
explicit

Constructor for QgsAnnotationItemRubberBand.

Definition at line 40 of file qgsmaptoolselectannotation.cpp.

◆ ~QgsAnnotationItemRubberBand()

QgsAnnotationItemRubberBand::~QgsAnnotationItemRubberBand ( )
overridedefault

Member Function Documentation

◆ boundingBox()

QgsRectangle QgsAnnotationItemRubberBand::boundingBox ( ) const
inline

Returns the item bounding box.

Definition at line 80 of file qgsmaptoolselectannotation.h.

◆ item()

QgsAnnotationItem * QgsAnnotationItemRubberBand::item ( ) const

Returns a pointer to the annotation item.

Definition at line 63 of file qgsmaptoolselectannotation.cpp.

◆ itemId()

QString QgsAnnotationItemRubberBand::itemId ( ) const
inline

Returns the annotation item ID.

Definition at line 70 of file qgsmaptoolselectannotation.h.

◆ layer()

QgsAnnotationLayer * QgsAnnotationItemRubberBand::layer ( ) const

Returns a pointer to the annotation layer.

Definition at line 53 of file qgsmaptoolselectannotation.cpp.

◆ layerId()

QString QgsAnnotationItemRubberBand::layerId ( ) const
inline

Returns the annotation layer ID.

Definition at line 60 of file qgsmaptoolselectannotation.h.

◆ needsUpdatedBoundingBox()

bool QgsAnnotationItemRubberBand::needsUpdatedBoundingBox ( ) const
inline

Returns true if the bounding box requires updating on fresh annotation item rendering.

Definition at line 90 of file qgsmaptoolselectannotation.h.

◆ setNeedsUpdatedBoundingBox()

void QgsAnnotationItemRubberBand::setNeedsUpdatedBoundingBox ( bool needsUpdatedBoundingBox)

Sets whether the bounding box requires updating on fresh annotation item rendering.

Definition at line 86 of file qgsmaptoolselectannotation.cpp.

◆ updateBoundingBox()

void QgsAnnotationItemRubberBand::updateBoundingBox ( const QgsRectangle & boundingBox)

Update the rubberband using the provided annotation item bounding box.

Definition at line 69 of file qgsmaptoolselectannotation.cpp.


The documentation for this class was generated from the following files: