QGIS API Documentation  2.99.0-Master (5169e0d)
Public Member Functions | Protected Member Functions | List of all members
QgsHighlight Class Reference

A class for highlight features on the map. More...

#include <qgshighlight.h>

Inheritance diagram for QgsHighlight:
Inheritance graph
[legend]

Public Member Functions

 QgsHighlight (QgsMapCanvas *mapCanvas, const QgsGeometry &geom, QgsMapLayer *layer)
 Constructor for QgsHighlight. More...
 
 QgsHighlight (QgsMapCanvas *mapCanvas, const QgsGeometry &geom, QgsVectorLayer *layer)
 Constructor for QgsHighlight. More...
 
 QgsHighlight (QgsMapCanvas *mapCanvas, const QgsFeature &feature, QgsVectorLayer *layer)
 Constructor for highlighting true feature shape using feature attributes and renderer. More...
 
 ~QgsHighlight ()
 
const QgsMapLayerlayer () const
 
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)
 Set polygons fill color. More...
 
void setMinWidth (double width)
 Set minimum line / stroke width in millimeters. More...
 
void setWidth (int width)
 Set stroke width. Ignored in feature mode. More...
 
virtual void updatePosition () override
 called on changed extent or resize event to update position of the item More...
 
- Public Member Functions inherited from QgsMapCanvasItem
virtual 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 QgsPoint &point) const
 transformation from map coordinates to screen coordinates More...
 
QgsPoint toMapCoordinates (QPoint point) const
 transformation from screen coordinates to map coordinates More...
 

Protected Member Functions

virtual 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...
 
virtual ~QgsMapCanvasItem ()
 
virtual 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...
 

Additional Inherited Members

- Protected Attributes inherited from QgsMapCanvasItem
QSizeF mItemSize
 cached size of the item (to return in boundingRect()) More...
 
QgsMapCanvasmMapCanvas = 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
 

Detailed Description

A class for highlight features on the map.

The QgsHighlight class provides a transparent overlay widget for highlighting features on the map.

Definition at line 39 of file qgshighlight.h.

Constructor & Destructor Documentation

◆ QgsHighlight() [1/3]

QgsHighlight::QgsHighlight ( QgsMapCanvas mapCanvas,
const QgsGeometry geom,
QgsMapLayer layer 
)

Constructor for QgsHighlight.

Parameters
mapCanvasassociated map canvas
geominitial geometry of highlight
layerassociated map layer

Definition at line 49 of file qgshighlight.cpp.

◆ QgsHighlight() [2/3]

QgsHighlight::QgsHighlight ( QgsMapCanvas mapCanvas,
const QgsGeometry geom,
QgsVectorLayer layer 
)

Constructor for QgsHighlight.

Parameters
mapCanvasassociated map canvas
geominitial geometry of highlight
layerassociated vector layer

Definition at line 59 of file qgshighlight.cpp.

◆ QgsHighlight() [3/3]

QgsHighlight::QgsHighlight ( QgsMapCanvas mapCanvas,
const QgsFeature feature,
QgsVectorLayer layer 
)

Constructor for highlighting true feature shape using feature attributes and renderer.

Parameters
mapCanvasmap canvas
feature
layervector layer

Definition at line 69 of file qgshighlight.cpp.

◆ ~QgsHighlight()

QgsHighlight::~QgsHighlight ( )

Definition at line 102 of file qgshighlight.cpp.

Member Function Documentation

◆ layer()

const QgsMapLayer* QgsHighlight::layer ( ) const
inline

Definition at line 85 of file qgshighlight.h.

◆ paint()

void QgsHighlight::paint ( QPainter *  painter)
overrideprotectedvirtual

function to be implemented by derived classes

Implements QgsMapCanvasItem.

Definition at line 263 of file qgshighlight.cpp.

◆ setBuffer()

void QgsHighlight::setBuffer ( double  buffer)
inline

Set line / stroke buffer in millimeters.

Since
QGIS 2.3

Definition at line 79 of file qgshighlight.h.

◆ setColor()

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 107 of file qgshighlight.cpp.

◆ setFillColor()

void QgsHighlight::setFillColor ( const QColor &  fillColor)

Set polygons fill color.

Since
QGIS 2.3

Definition at line 115 of file qgshighlight.cpp.

◆ setMinWidth()

void QgsHighlight::setMinWidth ( double  width)
inline

Set minimum line / stroke width in millimeters.

Since
QGIS 2.3

Definition at line 83 of file qgshighlight.h.

◆ setWidth()

void QgsHighlight::setWidth ( int  width)

Set stroke width. Ignored in feature mode.

Definition at line 194 of file qgshighlight.cpp.

◆ updatePosition()

void QgsHighlight::updatePosition ( )
overridevirtual

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

Reimplemented from QgsMapCanvasItem.

Definition at line 258 of file qgshighlight.cpp.

◆ updateRect()

void QgsHighlight::updateRect ( )
protected

recalculates needed rectangle

Definition at line 388 of file qgshighlight.cpp.


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