QGIS API Documentation
2.4.0-Chugiak
|
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. More... | |
~QgsHighlight () | |
void | setColor (const QColor &color) |
Set line/outline to color, polygon fill to color with alpha = 63. More... | |
void | setFillColor (const QColor &fillColor) |
Set polygons fill color. More... | |
void | setWidth (int width) |
Set width. More... | |
void | setBuffer (double buffer) |
Set line / outline buffer in millimeters. More... | |
void | setMinWidth (double width) |
Set minimum line / outline width in millimeters. More... | |
const QgsMapLayer * | layer () const |
Public Member Functions inherited from QgsMapCanvasItem | |
virtual void | updatePosition () |
called on changed extent or resize event to update position of the item More... | |
virtual QRectF | boundingRect () const |
default implementation for canvas items More... | |
Q_DECL_DEPRECATED void | setPanningOffset (const QPoint &point) |
sets current offset, to be called from QgsMapCanvas More... | |
QgsRectangle | rect () const |
returns canvas item rectangle More... | |
void | setRect (const QgsRectangle &r) |
sets canvas item rectangle More... | |
QgsPoint | toMapCoordinates (const QPoint &point) |
transformation from screen coordinates to map coordinates More... | |
QPointF | toCanvasCoordinates (const QgsPoint &point) |
transformation from map coordinates to screen coordinates More... | |
Protected Member Functions | |
virtual void | paint (QPainter *p) |
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=0) |
paint function called by map canvas More... | |
void | updateCanvas () |
schedules map canvas for repaint More... | |
bool | setRenderContextVariables (QPainter *p, QgsRenderContext &context) const |
Sets render context parameters. More... | |
Private Member Functions | |
void | init () |
void | setSymbol (QgsSymbolV2 *symbol, const QgsRenderContext &context, const QColor &color, const QColor &fillColor) |
double | getSymbolWidth (const QgsRenderContext &context, double width, QgsSymbolV2::OutputUnit unit) |
QgsFeatureRendererV2 * | getRenderer (const QgsRenderContext &context, const QColor &color, const QColor &fillColor) |
Get renderer for current color mode and colors. More... | |
void | paintPoint (QPainter *p, QgsPoint point) |
void | paintLine (QPainter *p, QgsPolyline line) |
void | paintPolygon (QPainter *p, QgsPolygon polygon) |
Private Attributes | |
QBrush | mBrush |
QPen | mPen |
QgsGeometry * | mGeometry |
QgsMapLayer * | mLayer |
QgsFeature | mFeature |
double | mBuffer |
double | mMinWidth |
Additional Inherited Members | |
Protected Attributes inherited from QgsMapCanvasItem | |
QgsMapCanvas * | mMapCanvas |
pointer to map canvas More... | |
QgsRectangle | mRect |
canvas item rectangle (in map coordinates) More... | |
QPoint | mPanningOffset |
offset from normal position due current panning operation, used when converting map coordinates to move map canvas items More... | |
QSizeF | mItemSize |
cached size of the item (to return in boundingRect()) More... | |
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 36 of file qgshighlight.h.
QgsHighlight::QgsHighlight | ( | QgsMapCanvas * | mapCanvas, |
QgsGeometry * | geom, | ||
QgsMapLayer * | layer | ||
) |
Definition at line 56 of file qgshighlight.cpp.
QgsHighlight::QgsHighlight | ( | QgsMapCanvas * | mapCanvas, |
QgsGeometry * | geom, | ||
QgsVectorLayer * | layer | ||
) |
Definition at line 66 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 76 of file qgshighlight.cpp.
References init().
QgsHighlight::~QgsHighlight | ( | ) |
Definition at line 109 of file qgshighlight.cpp.
References mGeometry.
|
private |
Get renderer for current color mode and colors.
The renderer should be freed by caller.
Definition at line 131 of file qgshighlight.cpp.
References QgsFeatureRendererV2::clone(), layer(), mLayer, QgsVectorLayer::rendererV2(), setSymbol(), and QgsFeatureRendererV2::symbols().
Referenced by paint().
|
private |
Definition at line 192 of file qgshighlight.cpp.
References QgsSymbolLayerV2Utils::lineWidthScaleFactor(), QgsSymbolV2::MapUnit, mBuffer, QgsSymbolV2::MM, and mMinWidth.
Referenced by setSymbol().
|
private |
Definition at line 87 of file qgshighlight.cpp.
References QgsFeature::geometry(), QgsMapSettings::hasCrsTransformEnabled(), QgsMapSettings::layerTransfrom(), QgsMapCanvas::mapSettings(), mFeature, mGeometry, mLayer, QgsMapCanvasItem::mMapCanvas, setColor(), QgsGeometry::transform(), and updateRect().
Referenced by QgsHighlight().
|
inline |
Definition at line 69 of file qgshighlight.h.
Referenced by getRenderer(), and paint().
|
protectedvirtual |
Draw the shape in response to an update event.
Implements QgsMapCanvasItem.
Definition at line 274 of file qgshighlight.cpp.
References QgsGeometry::asMultiPoint(), QgsGeometry::asMultiPolygon(), QgsGeometry::asMultiPolyline(), QgsGeometry::asPoint(), QgsGeometry::asPolygon(), QgsGeometry::asPolyline(), QgsMapCanvas::extent(), QgsRenderContext::fromMapSettings(), QgsFeature::geometry(), getRenderer(), layer(), QgsMapCanvas::mapSettings(), mBrush, mFeature, mGeometry, mLayer, QgsMapCanvasItem::mMapCanvas, mPen, QgsMapSettings::outputSize(), paintLine(), paintPoint(), paintPolygon(), QgsVectorLayer::pendingFields(), QgsMapCanvasItem::rect(), QgsFeatureRendererV2::renderFeature(), QgsRenderContext::setPainter(), QgsFeatureRendererV2::startRender(), QgsFeatureRendererV2::stopRender(), updateRect(), 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(), and QGis::WKBUnknown.
|
private |
Definition at line 226 of file qgshighlight.cpp.
References QgsMapCanvasItem::toCanvasCoordinates().
Referenced by paint().
|
private |
Definition at line 212 of file qgshighlight.cpp.
References QgsMapCanvas::extent(), QgsMapCanvasItem::mMapCanvas, QgsMapCanvasItem::toCanvasCoordinates(), and QgsRectangle::width().
Referenced by paint().
|
private |
Definition at line 238 of file qgshighlight.cpp.
References mBrush, mPen, size, and QgsMapCanvasItem::toCanvasCoordinates().
Referenced by paint().
|
inline |
Set line / outline buffer in millimeters.
Definition at line 63 of file qgshighlight.h.
void QgsHighlight::setColor | ( | const QColor & | color | ) |
Set line/outline to color, polygon fill to color with alpha = 63.
This is legacy function, use setFillColor() after setColor() if different fill color is required.
Set the outline and fill color.
Definition at line 117 of file qgshighlight.cpp.
Referenced by QgsMapToolIdentify::handleMenuHover(), and init().
void QgsHighlight::setFillColor | ( | const QColor & | fillColor | ) |
Set polygons fill color.
Definition at line 125 of file qgshighlight.cpp.
References mBrush.
|
inline |
Set minimum line / outline width in millimeters.
Definition at line 67 of file qgshighlight.h.
|
private |
Definition at line 150 of file qgshighlight.cpp.
References QgsSimpleFillSymbolLayerV2::borderWidth(), getSymbolWidth(), QgsSimpleMarkerSymbolLayerV2::outlineWidth(), QgsSimpleMarkerSymbolLayerV2::outlineWidthUnit(), QgsSimpleFillSymbolLayerV2::outputUnit(), QgsSymbolLayerV2::removeDataDefinedProperty(), QgsSimpleFillSymbolLayerV2::setBorderWidth(), QgsSymbolLayerV2::setColor(), QgsSymbolLayerV2::setFillColor(), QgsSymbolLayerV2::setOutlineColor(), QgsSimpleMarkerSymbolLayerV2::setOutlineWidth(), QgsLineSymbolLayerV2::setWidth(), QgsSymbolLayerV2::subSymbol(), QgsSymbolV2::symbolLayer(), QgsSymbolV2::symbolLayerCount(), QgsLineSymbolLayerV2::width(), and QgsLineSymbolLayerV2::widthUnit().
Referenced by getRenderer().
void QgsHighlight::setWidth | ( | int | width | ) |
Set width.
Ignored in feature mode.
Set the outline width.
Definition at line 207 of file qgshighlight.cpp.
References mPen.
Referenced by QgsMapToolIdentify::handleMenuHover().
|
protected |
recalculates needed rectangle
Definition at line 408 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 87 of file qgshighlight.h.
Referenced by paint(), paintPolygon(), setColor(), and setFillColor().
|
private |
Definition at line 92 of file qgshighlight.h.
Referenced by getSymbolWidth().
|
private |
Definition at line 91 of file qgshighlight.h.
Referenced by init(), paint(), and updateRect().
|
private |
Definition at line 89 of file qgshighlight.h.
Referenced by init(), paint(), QgsHighlight(), updateRect(), and ~QgsHighlight().
|
private |
Definition at line 90 of file qgshighlight.h.
Referenced by getRenderer(), init(), and paint().
|
private |
Definition at line 93 of file qgshighlight.h.
Referenced by getSymbolWidth().
|
private |
Definition at line 88 of file qgshighlight.h.
Referenced by paint(), paintPolygon(), setColor(), and setWidth().