QGIS API Documentation 3.41.0-Master (af5edcb665c)
|
A rubberband class for QgsAbstractGeometry (considering curved geometries). More...
#include <qgsgeometryrubberband.h>
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 QgsAbstractGeometry * | geometry () |
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()) | |
QgsMapCanvas * | mMapCanvas = 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 |
A rubberband class for QgsAbstractGeometry (considering curved geometries).
Definition at line 48 of file qgsgeometryrubberband.h.
Definition at line 60 of file qgsgeometryrubberband.h.
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.
|
override |
Definition at line 32 of file qgsgeometryrubberband.cpp.
|
inline |
Returns a pointer to the geometry.
Definition at line 103 of file qgsgeometryrubberband.h.
|
protected |
Returns which geometry is handled by the rubber band, polygon or line.
Definition at line 74 of file qgsgeometryrubberband.cpp.
void QgsGeometryRubberBand::moveVertex | ( | QgsVertexId | id, |
const QgsPoint & | newPos | ||
) |
Moves vertex to new position (in map coordinates)
Definition at line 130 of file qgsgeometryrubberband.cpp.
|
overrideprotectedvirtual |
function to be implemented by derived classes
Implements QgsMapCanvasItem.
Definition at line 36 of file qgsgeometryrubberband.cpp.
void QgsGeometryRubberBand::setBrushStyle | ( | Qt::BrushStyle | brushStyle | ) |
Sets brush style.
Definition at line 159 of file qgsgeometryrubberband.cpp.
void QgsGeometryRubberBand::setFillColor | ( | const QColor & | c | ) |
Sets fill color for vertex markers.
Definition at line 139 of file qgsgeometryrubberband.cpp.
|
virtual |
Sets geometry (takes ownership). Geometry is expected to be in map coordinates.
Definition at line 120 of file qgsgeometryrubberband.cpp.
|
protected |
Sets which geometry is handled by the rubber band, polygon or line.
Definition at line 79 of file qgsgeometryrubberband.cpp.
|
inline |
Sets vertex marker icon type.
Definition at line 117 of file qgsgeometryrubberband.h.
void QgsGeometryRubberBand::setLineStyle | ( | Qt::PenStyle | penStyle | ) |
Sets pen style.
Definition at line 154 of file qgsgeometryrubberband.cpp.
void QgsGeometryRubberBand::setStrokeColor | ( | const QColor & | c | ) |
Sets stroke color for vertex markers.
Definition at line 144 of file qgsgeometryrubberband.cpp.
void QgsGeometryRubberBand::setStrokeWidth | ( | int | width | ) |
Sets stroke width.
Definition at line 149 of file qgsgeometryrubberband.cpp.
void QgsGeometryRubberBand::setVertexDrawingEnabled | ( | bool | isVerticesDrawn | ) |
Sets whether the vertices are drawn.
Definition at line 164 of file qgsgeometryrubberband.cpp.
|
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.