QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | List of all members
QgsGeometryRubberBand Class Reference

A rubberband class for QgsAbstractGeometry (considering curved geometries). More...

#include <qgsgeometryrubberband.h>

Inheritance diagram for QgsGeometryRubberBand:
Inheritance graph
[legend]

Public Types

enum  IconType {
  ICON_NONE , ICON_CROSS , ICON_X , ICON_BOX ,
  ICON_CIRCLE , ICON_FULL_BOX
}
 

Public Member Functions

 QgsGeometryRubberBand (QgsMapCanvas *mapCanvas, Qgis::GeometryType geomType=Qgis::GeometryType::Line)
 Constructor for QgsGeometryRubberBand of the given geomType, shown in the specified mapCanvas.
 
 ~QgsGeometryRubberBand () override
 
const QgsAbstractGeometrygeometry ()
 Returns a pointer to the geometry.
 
void moveVertex (QgsVertexId id, const QgsPoint &newPos)
 Moves vertex to new position (in map coordinates)
 
void setBrushStyle (Qt::BrushStyle brushStyle)
 Sets brush style.
 
void setFillColor (const QColor &c)
 Sets fill color for vertex markers.
 
virtual void setGeometry (QgsAbstractGeometry *geom)
 Sets geometry (takes ownership). Geometry is expected to be in map coordinates.
 
void setIconType (IconType iconType)
 Sets vertex marker icon type.
 
void setLineStyle (Qt::PenStyle penStyle)
 Sets pen style.
 
void setStrokeColor (const QColor &c)
 Sets stroke color for vertex markers.
 
void setStrokeWidth (int width)
 Sets stroke width.
 
void setVertexDrawingEnabled (bool isVerticesDrawn)
 Sets whether the vertices are drawn.
 
void updatePosition () override
 called on changed extent or resize event to update position of the item
 
- 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
 

Protected Member Functions

Qgis::GeometryType geometryType () const
 Returns which geometry is handled by the rubber band, polygon or line.
 
void paint (QPainter *painter) override
 function to be implemented by derived classes
 
void setGeometryType (Qgis::GeometryType geometryType)
 Sets which geometry is handled by the rubber band, polygon or line.
 
- 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
 

Additional Inherited Members

- 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
 

Detailed Description

A rubberband class for QgsAbstractGeometry (considering curved geometries).

Definition at line 48 of file qgsgeometryrubberband.h.

Member Enumeration Documentation

◆ IconType

Enumerator
ICON_NONE 

No icon is used.

ICON_CROSS 

A cross is used to highlight points (+)

ICON_X 

A cross is used to highlight points (x)

ICON_BOX 

A box is used to highlight points (□)

ICON_CIRCLE 

A circle is used to highlight points (○)

ICON_FULL_BOX 

A full box is used to highlight points (■)

Definition at line 61 of file qgsgeometryrubberband.h.

Constructor & Destructor Documentation

◆ QgsGeometryRubberBand()

QgsGeometryRubberBand::QgsGeometryRubberBand ( QgsMapCanvas mapCanvas,
Qgis::GeometryType  geomType = Qgis::GeometryType::Line 
)

Constructor for QgsGeometryRubberBand of the given geomType, shown in the specified mapCanvas.

Definition at line 25 of file qgsgeometryrubberband.cpp.

◆ ~QgsGeometryRubberBand()

QgsGeometryRubberBand::~QgsGeometryRubberBand ( )
override

Definition at line 32 of file qgsgeometryrubberband.cpp.

Member Function Documentation

◆ geometry()

const QgsAbstractGeometry * QgsGeometryRubberBand::geometry ( )
inline

Returns a pointer to the geometry.

Definition at line 104 of file qgsgeometryrubberband.h.

◆ geometryType()

Qgis::GeometryType QgsGeometryRubberBand::geometryType ( ) const
protected

Returns which geometry is handled by the rubber band, polygon or line.

Definition at line 74 of file qgsgeometryrubberband.cpp.

◆ moveVertex()

void QgsGeometryRubberBand::moveVertex ( QgsVertexId  id,
const QgsPoint newPos 
)

Moves vertex to new position (in map coordinates)

Definition at line 130 of file qgsgeometryrubberband.cpp.

◆ paint()

void QgsGeometryRubberBand::paint ( QPainter *  painter)
overrideprotectedvirtual

function to be implemented by derived classes

Implements QgsMapCanvasItem.

Definition at line 36 of file qgsgeometryrubberband.cpp.

◆ setBrushStyle()

void QgsGeometryRubberBand::setBrushStyle ( Qt::BrushStyle  brushStyle)

Sets brush style.

Definition at line 159 of file qgsgeometryrubberband.cpp.

◆ setFillColor()

void QgsGeometryRubberBand::setFillColor ( const QColor &  c)

Sets fill color for vertex markers.

Definition at line 139 of file qgsgeometryrubberband.cpp.

◆ setGeometry()

void QgsGeometryRubberBand::setGeometry ( QgsAbstractGeometry geom)
virtual

Sets geometry (takes ownership). Geometry is expected to be in map coordinates.

Definition at line 120 of file qgsgeometryrubberband.cpp.

◆ setGeometryType()

void QgsGeometryRubberBand::setGeometryType ( Qgis::GeometryType  geometryType)
protected

Sets which geometry is handled by the rubber band, polygon or line.

Definition at line 79 of file qgsgeometryrubberband.cpp.

◆ setIconType()

void QgsGeometryRubberBand::setIconType ( IconType  iconType)
inline

Sets vertex marker icon type.

Definition at line 118 of file qgsgeometryrubberband.h.

◆ setLineStyle()

void QgsGeometryRubberBand::setLineStyle ( Qt::PenStyle  penStyle)

Sets pen style.

Definition at line 154 of file qgsgeometryrubberband.cpp.

◆ setStrokeColor()

void QgsGeometryRubberBand::setStrokeColor ( const QColor &  c)

Sets stroke color for vertex markers.

Definition at line 144 of file qgsgeometryrubberband.cpp.

◆ setStrokeWidth()

void QgsGeometryRubberBand::setStrokeWidth ( int  width)

Sets stroke width.

Definition at line 149 of file qgsgeometryrubberband.cpp.

◆ setVertexDrawingEnabled()

void QgsGeometryRubberBand::setVertexDrawingEnabled ( bool  isVerticesDrawn)

Sets whether the vertices are drawn.

Definition at line 164 of file qgsgeometryrubberband.cpp.

◆ updatePosition()

void QgsGeometryRubberBand::updatePosition ( )
overridevirtual

called on changed extent or resize event to update position of the item

Reimplemented from QgsMapCanvasItem.

Definition at line 204 of file qgsgeometryrubberband.cpp.


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