QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
|
A class for highlight features on the map. More...
#include <qgshighlight.h>
Public Member Functions | |
QgsHighlight (QgsMapCanvas *mapCanvas, const QgsFeature &feature, QgsVectorLayer *layer) | |
Constructor for highlighting true feature shape using feature attributes and renderer. More... | |
QgsHighlight (QgsMapCanvas *mapCanvas, const QgsGeometry &geom, QgsMapLayer *layer) | |
Constructor for QgsHighlight. More... | |
~QgsHighlight () override | |
double | buffer () const |
Returns the buffer. More... | |
QColor | color () const |
Returns the line/stroke color. More... | |
QColor | fillColor () const |
Returns the fill color. More... | |
QgsMapLayer * | layer () const |
Returns the layer for which this highlight has been created. More... | |
void | setBuffer (double buffer) |
Set line / stroke buffer in millimeters. More... | |
void | setColor (const QColor &color) |
Set line/stroke to color, polygon fill to color with alpha = 63. More... | |
void | setFillColor (const QColor &fillColor) |
Fill color for the highlight. More... | |
void | setMinWidth (double width) |
Set minimum line / stroke width in millimeters. More... | |
void | setWidth (int width) |
Set stroke width. More... | |
void | updatePosition () override |
called on changed extent or resize event to update position of the item More... | |
int | width () const |
Returns the stroke width. More... | |
Public Member Functions inherited from QgsMapCanvasItem | |
QRectF | boundingRect () const override |
QgsRectangle | rect () const |
returns canvas item rectangle in map units More... | |
void | setRect (const QgsRectangle &r, bool resetRotation=true) |
sets canvas item rectangle in map units More... | |
QPointF | toCanvasCoordinates (const QgsPointXY &point) const |
transformation from map coordinates to screen coordinates More... | |
QgsPointXY | toMapCoordinates (QPoint point) const |
transformation from screen coordinates to map coordinates More... | |
virtual void | updatePosition () |
called on changed extent or resize event to update position of the item More... | |
Protected Member Functions | |
void | paint (QPainter *p) override |
function to be implemented by derived classes More... | |
void | updateRect () |
recalculates needed rectangle More... | |
Protected Member Functions inherited from QgsMapCanvasItem | |
QgsMapCanvasItem (QgsMapCanvas *mapCanvas) | |
protected constructor: cannot be constructed directly More... | |
~QgsMapCanvasItem () override | |
virtual void | paint (QPainter *painter)=0 |
function to be implemented by derived classes More... | |
void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) override |
bool | setRenderContextVariables (QPainter *p, QgsRenderContext &context) const |
Sets render context parameters. More... | |
void | updateCanvas () |
schedules map canvas for repaint More... | |
Properties | |
int | buffer |
QColor | color |
QColor | fillColor |
int | width |
Additional Inherited Members | |
Protected Attributes inherited from QgsMapCanvasItem | |
QSizeF | mItemSize |
cached size of the item (to return in boundingRect()) More... | |
QgsMapCanvas * | mMapCanvas = nullptr |
pointer to map canvas More... | |
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. More... | |
double | mRectRotation |
A class for highlight features on the map.
The QgsHighlight class provides a transparent overlay canvas item for highlighting features or geometries on a map canvas.
Definition at line 61 of file qgshighlight.h.
QgsHighlight::QgsHighlight | ( | QgsMapCanvas * | mapCanvas, |
const QgsGeometry & | geom, | ||
QgsMapLayer * | layer | ||
) |
Constructor for QgsHighlight.
mapCanvas | associated map canvas |
geom | initial geometry of highlight |
layer | associated map layer |
Definition at line 53 of file qgshighlight.cpp.
QgsHighlight::QgsHighlight | ( | QgsMapCanvas * | mapCanvas, |
const QgsFeature & | feature, | ||
QgsVectorLayer * | layer | ||
) |
Constructor for highlighting true
feature shape using feature attributes and renderer.
mapCanvas | map canvas |
feature | |
layer | vector layer |
Definition at line 62 of file qgshighlight.cpp.
|
overridedefault |
|
inline |
|
inline |
|
inline |
|
inline |
Returns the layer for which this highlight has been created.
Definition at line 171 of file qgshighlight.h.
|
overrideprotectedvirtual |
function to be implemented by derived classes
Implements QgsMapCanvasItem.
Definition at line 309 of file qgshighlight.cpp.
|
inline |
Set line / stroke buffer in millimeters.
Definition at line 159 of file qgshighlight.h.
void QgsHighlight::setColor | ( | const QColor & | color | ) |
Set line/stroke to color, polygon fill to color with alpha = 63.
This is legacy function, use setFillColor() after setColor() if different fill color is required.
Definition at line 109 of file qgshighlight.cpp.
void QgsHighlight::setFillColor | ( | const QColor & | fillColor | ) |
Fill color for the highlight.
Will be used for polygons and points.
Definition at line 118 of file qgshighlight.cpp.
|
inline |
Set minimum line / stroke width in millimeters.
Definition at line 166 of file qgshighlight.h.
void QgsHighlight::setWidth | ( | int | width | ) |
|
overridevirtual |
called on changed extent or resize event to update position of the item
Reimplemented from QgsMapCanvasItem.
Definition at line 296 of file qgshighlight.cpp.
|
protected |
recalculates needed rectangle
Definition at line 474 of file qgshighlight.cpp.
|
inline |
|
readwrite |
Definition at line 61 of file qgshighlight.h.
|
readwrite |
Definition at line 61 of file qgshighlight.h.
|
readwrite |
Definition at line 61 of file qgshighlight.h.
|
readwrite |
Definition at line 61 of file qgshighlight.h.