QGIS API Documentation 4.1.0-Master (4aad578bf8d)
Loading...
Searching...
No Matches
QgsExtraItemRubberBand Class Reference

Rubber band for one extra item. More...

Inheritance diagram for QgsExtraItemRubberBand:

Public Member Functions

 QgsExtraItemRubberBand (QgsPointXY position, double rotation, QgsMapCanvas *mapCanvas, QgsVectorLayer *layer, QgsTemplatedLineSymbolLayerBase *symbolLayer)
 Constructor.
const QgsPointXYposition () const
 Returns position in layer CRS.
double rotation () const
 Returns rotation angle in degree between 0 and 360.
void setPosition (QgsPointXY position)
 Set extra item position in layer coordinates.
void setRotation (double rotation)
 Set extra item rotation around its center.
void update ()
 Update item according to its current rotation angle and position.
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

Rubber band for one extra item.

Provides methods to move and rotate the represented extra item.

Note
not available in Python bindings
Since
QGIS 4.2

Definition at line 43 of file qgsmaptoolextraitem.cpp.

Constructor & Destructor Documentation

◆ QgsExtraItemRubberBand()

QgsExtraItemRubberBand::QgsExtraItemRubberBand ( QgsPointXY position,
double rotation,
QgsMapCanvas * mapCanvas,
QgsVectorLayer * layer,
QgsTemplatedLineSymbolLayerBase * symbolLayer )

Constructor.

Parameters
positionextra item position in layer CRS
rotationrotation angle in degree between 0 and 360
mapCanvasmap canvas
layervector layer to which belong this extra item belongs
symbolLayersymbol layer to which belong this extra item belongs

Definition at line 349 of file qgsmaptoolextraitem.cpp.

Member Function Documentation

◆ position()

const QgsPointXY & QgsExtraItemRubberBand::position ( ) const

Returns position in layer CRS.

Definition at line 380 of file qgsmaptoolextraitem.cpp.

◆ rotation()

double QgsExtraItemRubberBand::rotation ( ) const

Returns rotation angle in degree between 0 and 360.

Definition at line 385 of file qgsmaptoolextraitem.cpp.

◆ setPosition()

void QgsExtraItemRubberBand::setPosition ( QgsPointXY position)

Set extra item position in layer coordinates.

Definition at line 368 of file qgsmaptoolextraitem.cpp.

◆ setRotation()

void QgsExtraItemRubberBand::setRotation ( double rotation)

Set extra item rotation around its center.

rotation is expressed in degree

Definition at line 374 of file qgsmaptoolextraitem.cpp.

◆ update()

void QgsExtraItemRubberBand::update ( )

Update item according to its current rotation angle and position.

Definition at line 391 of file qgsmaptoolextraitem.cpp.


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