QGIS API Documentation
2.2.0-Valmiera
|
A class for highlight features on the map. More...
#include <qgshighlight.h>
Public Member Functions | |
QgsHighlight (QgsMapCanvas *mapCanvas, QgsGeometry *geom, QgsMapLayer *layer) | |
QgsHighlight (QgsMapCanvas *mapCanvas, QgsGeometry *geom, QgsVectorLayer *layer) | |
QgsHighlight (QgsMapCanvas *mapCanvas, const QgsFeature &feature, QgsVectorLayer *layer) | |
Constructor for highlighting true feature shape using feature attributes and renderer. | |
~QgsHighlight () | |
void | setColor (const QColor &color) |
void | setWidth (int width) |
Set width. | |
Public Member Functions inherited from QgsMapCanvasItem | |
virtual void | updatePosition () |
called on changed extent or resize event to update position of the item | |
virtual QRectF | boundingRect () const |
default implementation for canvas items | |
void | setPanningOffset (const QPoint &point) |
sets current offset, to be called from QgsMapCanvas | |
QgsRectangle | rect () const |
returns canvas item rectangle | |
void | setRect (const QgsRectangle &r) |
sets canvas item rectangle | |
QgsPoint | toMapCoordinates (const QPoint &point) |
transformation from screen coordinates to map coordinates | |
QPointF | toCanvasCoordinates (const QgsPoint &point) |
transformation from map coordinates to screen coordinates |
Protected Member Functions | |
virtual void | paint (QPainter *p) |
void | updateRect () |
recalculates needed rectangle | |
Protected Member Functions inherited from QgsMapCanvasItem | |
QgsMapCanvasItem (QgsMapCanvas *mapCanvas) | |
protected constructor: cannot be constructed directly | |
virtual | ~QgsMapCanvasItem () |
virtual void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0) |
paint function called by map canvas | |
void | updateCanvas () |
schedules map canvas for repaint | |
bool | setRenderContextVariables (QPainter *p, QgsRenderContext &context) const |
Sets render context parameters. |
Private Member Functions | |
void | init () |
void | setSymbolColor (QgsSymbolV2 *symbol, const QColor &color) |
void | paintPoint (QPainter *p, QgsPoint point) |
void | paintLine (QPainter *p, QgsPolyline line) |
void | paintPolygon (QPainter *p, QgsPolygon polygon) |
QgsVectorLayer * | vectorLayer () |
QgsHighlight () |
Private Attributes | |
QBrush | mBrush |
QPen | mPen |
QgsGeometry * | mGeometry |
QgsMapLayer * | mLayer |
QgsFeature | mFeature |
QgsFeatureRendererV2 * | mRenderer |
QColor | mTemporaryFillColor |
Additional Inherited Members | |
Protected Attributes inherited from QgsMapCanvasItem | |
QgsMapCanvas * | mMapCanvas |
pointer to map canvas | |
QgsRectangle | mRect |
canvas item rectangle (in map coordinates) | |
QPoint | mPanningOffset |
offset from normal position due current panning operation, used when converting map coordinates to move map canvas items | |
QSizeF | mItemSize |
cached size of the item (to return in boundingRect()) |
A class for highlight features on the map.
The QgsHighlight class provides a transparent overlay widget for highlightng features on the map.
Definition at line 35 of file qgshighlight.h.
QgsHighlight::QgsHighlight | ( | QgsMapCanvas * | mapCanvas, |
QgsGeometry * | geom, | ||
QgsMapLayer * | layer | ||
) |
Definition at line 39 of file qgshighlight.cpp.
QgsHighlight::QgsHighlight | ( | QgsMapCanvas * | mapCanvas, |
QgsGeometry * | geom, | ||
QgsVectorLayer * | layer | ||
) |
Definition at line 48 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 57 of file qgshighlight.cpp.
References init().
QgsHighlight::~QgsHighlight | ( | ) |
Definition at line 89 of file qgshighlight.cpp.
|
private |
|
private |
Definition at line 67 of file qgshighlight.cpp.
References QgsFeature::geometry(), QgsMapRenderer::hasCrsTransformEnabled(), QgsMapCanvas::mapRenderer(), mFeature, mGeometry, mLayer, QgsMapCanvasItem::mMapCanvas, setColor(), QgsGeometry::transform(), QgsMapRenderer::transformation(), and updateRect().
Referenced by QgsHighlight().
|
protectedvirtual |
Draw the shape in response to an update event.
Implements QgsMapCanvasItem.
Definition at line 232 of file qgshighlight.cpp.
References QgsGeometry::asMultiPoint(), QgsGeometry::asMultiPolygon(), QgsGeometry::asMultiPolyline(), QgsGeometry::asPoint(), QgsGeometry::asPolygon(), QgsGeometry::asPolyline(), QgsMapCanvas::extent(), QgsFeature::geometry(), QgsMapCanvas::mapRenderer(), QgsMapCanvas::mapUnitsPerPixel(), mBrush, mFeature, mGeometry, QgsMapCanvasItem::mMapCanvas, mPen, mRenderer, mTemporaryFillColor, paintLine(), paintPoint(), paintPolygon(), QgsMapCanvasItem::rect(), QgsMapRenderer::rendererContext(), QgsFeatureRendererV2::renderFeature(), QgsRenderContext::setCoordinateTransform(), QgsRenderContext::setExtent(), QgsRenderContext::setMapToPixel(), QgsRenderContext::setPainter(), QgsFeatureRendererV2::startRender(), QgsFeatureRendererV2::stopRender(), QgsMapCanvasItem::toCanvasCoordinates(), updateRect(), vectorLayer(), QGis::WKBLineString, QGis::WKBLineString25D, QGis::WKBMultiLineString, QGis::WKBMultiLineString25D, QGis::WKBMultiPoint, QGis::WKBMultiPoint25D, QGis::WKBMultiPolygon, QGis::WKBMultiPolygon25D, QGis::WKBPoint, QGis::WKBPoint25D, QGis::WKBPolygon, QGis::WKBPolygon25D, QgsGeometry::wkbType(), QGis::WKBUnknown, QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().
|
private |
Definition at line 184 of file qgshighlight.cpp.
References QgsMapCanvasItem::toCanvasCoordinates().
Referenced by paint().
|
private |
Definition at line 170 of file qgshighlight.cpp.
References QgsMapCanvas::extent(), QgsMapCanvasItem::mMapCanvas, QgsMapCanvasItem::toCanvasCoordinates(), and QgsRectangle::width().
Referenced by paint().
|
private |
Definition at line 196 of file qgshighlight.cpp.
References mBrush, mPen, size, and QgsMapCanvasItem::toCanvasCoordinates().
Referenced by paint().
void QgsHighlight::setColor | ( | const QColor & | color | ) |
Set the outline and fill color.
Definition at line 98 of file qgshighlight.cpp.
References QgsFeatureRendererV2::clone(), mBrush, mPen, mRenderer, QgsVectorLayer::rendererV2(), setSymbolColor(), QgsFeatureRendererV2::symbols(), and vectorLayer().
Referenced by QgsMapToolIdentify::handleMenuHover(), and init().
|
private |
Definition at line 122 of file qgshighlight.cpp.
References mTemporaryFillColor, QgsSymbolLayerV2::removeDataDefinedProperty(), QgsSymbolLayerV2::setColor(), QgsSymbolLayerV2::setFillColor(), QgsSymbolLayerV2::setOutlineColor(), QgsSymbolLayerV2::subSymbol(), QgsSymbolV2::symbolLayer(), and QgsSymbolV2::symbolLayerCount().
Referenced by setColor().
void QgsHighlight::setWidth | ( | int | width | ) |
Set width.
Ignored in feature mode.
Set the outline width.
Definition at line 165 of file qgshighlight.cpp.
References mPen.
Referenced by QgsMapToolIdentify::handleMenuHover().
|
protected |
recalculates needed rectangle
Definition at line 369 of file qgshighlight.cpp.
References QgsGeometry::boundingBox(), QgsMapCanvas::extent(), QgsFeature::geometry(), QgsRectangle::isEmpty(), mFeature, mGeometry, QgsMapCanvasItem::mMapCanvas, QgsMapCanvasItem::setRect(), QgsRectangle::setXMaximum(), QgsRectangle::setXMinimum(), QgsRectangle::setYMaximum(), QgsRectangle::setYMinimum(), QgsRectangle::width(), QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().
|
private |
Definition at line 402 of file qgshighlight.cpp.
References mLayer.
Referenced by paint(), and setColor().
|
private |
Definition at line 71 of file qgshighlight.h.
Referenced by paint(), paintPolygon(), and setColor().
|
private |
Definition at line 75 of file qgshighlight.h.
Referenced by init(), paint(), and updateRect().
|
private |
Definition at line 73 of file qgshighlight.h.
Referenced by init(), paint(), QgsHighlight(), updateRect(), and ~QgsHighlight().
|
private |
Definition at line 74 of file qgshighlight.h.
Referenced by init(), and vectorLayer().
|
private |
Definition at line 72 of file qgshighlight.h.
Referenced by paint(), paintPolygon(), setColor(), and setWidth().
|
private |
Definition at line 76 of file qgshighlight.h.
Referenced by paint(), setColor(), and ~QgsHighlight().
|
private |
Definition at line 77 of file qgshighlight.h.
Referenced by paint(), and setSymbolColor().