Quantum GIS API Documentation
1.7.5-Wroclaw
|
An abstract class for items that can be placed on the map canvas. More...
#include <qgsmapcanvasitem.h>
Public Member Functions | |
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... | |
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 | |
QgsMapCanvasItem (QgsMapCanvas *mapCanvas) | |
protected constructor: cannot be constructed directly More... | |
virtual | ~QgsMapCanvasItem () |
virtual void | paint (QPainter *painter)=0 |
function to be implemented by derived classes More... | |
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... | |
Protected Attributes | |
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... | |
An abstract class for items that can be placed on the map canvas.
Definition at line 31 of file qgsmapcanvasitem.h.
|
protected |
protected constructor: cannot be constructed directly
Definition at line 30 of file qgsmapcanvasitem.cpp.
|
protectedvirtual |
Definition at line 36 of file qgsmapcanvasitem.cpp.
|
virtual |
default implementation for canvas items
Reimplemented in QgsVertexMarker, and QgsAnnotationItem.
Definition at line 95 of file qgsmapcanvasitem.cpp.
References mItemSize.
|
protectedpure virtual |
function to be implemented by derived classes
Implemented in QgsRubberBand, QgsVertexMarker, QgsTextAnnotationItem, and QgsFormAnnotationItem.
Referenced by paint().
|
protectedvirtual |
paint function called by map canvas
Reimplemented in QgsFormAnnotationItem.
Definition at line 41 of file qgsmapcanvasitem.cpp.
References QgsMapCanvas::antiAliasingEnabled(), mMapCanvas, and paint().
QgsRectangle QgsMapCanvasItem::rect | ( | ) | const |
returns canvas item rectangle
Definition at line 66 of file qgsmapcanvasitem.cpp.
References mRect.
Referenced by setRect().
void QgsMapCanvasItem::setPanningOffset | ( | const QPoint & | point) |
sets current offset, to be called from QgsMapCanvas
Definition at line 153 of file qgsmapcanvasitem.cpp.
References mPanningOffset.
Referenced by QgsMapCanvas::moveCanvasContents().
void QgsMapCanvasItem::setRect | ( | const QgsRectangle & | r) |
sets canvas item rectangle
Definition at line 72 of file qgsmapcanvasitem.cpp.
References QgsRectangle::isEmpty(), mItemSize, mRect, rect(), toCanvasCoordinates(), QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().
Referenced by updatePosition(), and QgsRubberBand::updateRect().
|
protected |
Sets render context parameters.
p | painter for rendering |
context | out: configured context |
Definition at line 108 of file qgsmapcanvasitem.cpp.
References QgsMapCanvas::mapRenderer(), QgsMapRenderer::Millimeters, mMapCanvas, QgsMapRenderer::outputDpi(), QgsMapRenderer::outputUnits(), QgsMapCanvas::scale(), QgsRenderContext::setPainter(), QgsRenderContext::setRasterScaleFactor(), QgsRenderContext::setRendererScale(), and QgsRenderContext::setScaleFactor().
Referenced by QgsAnnotationItem::drawMarkerSymbol().
QPointF QgsMapCanvasItem::toCanvasCoordinates | ( | const QgsPoint & | point) |
transformation from map coordinates to screen coordinates
Definition at line 58 of file qgsmapcanvasitem.cpp.
References QgsMapCanvas::getCoordinateTransform(), mMapCanvas, mPanningOffset, QgsMapToPixel::transformInPlace(), QgsPoint::x(), and QgsPoint::y().
Referenced by QgsRubberBand::paint(), QgsVertexMarker::setCenter(), QgsAnnotationItem::setMapPosition(), setRect(), and QgsAnnotationItem::updatePosition().
QgsPoint QgsMapCanvasItem::toMapCoordinates | ( | const QPoint & | point) |
transformation from screen coordinates to map coordinates
Definition at line 52 of file qgsmapcanvasitem.cpp.
References QgsMapCanvas::getCoordinateTransform(), mMapCanvas, mPanningOffset, and QgsMapToPixel::toMapCoordinates().
Referenced by QgsAnnotationItem::setMapPositionFixed(), and QgsAnnotationItem::updatePosition().
|
protected |
schedules map canvas for repaint
Definition at line 101 of file qgsmapcanvasitem.cpp.
|
virtual |
called on changed extent or resize event to update position of the item
Reimplemented in QgsVertexMarker, and QgsAnnotationItem.
Definition at line 146 of file qgsmapcanvasitem.cpp.
References mRect, and setRect().
Referenced by QgsMapCanvas::updateCanvasItemPositions().
|
protected |
cached size of the item (to return in boundingRect())
Definition at line 95 of file qgsmapcanvasitem.h.
Referenced by boundingRect(), and setRect().
|
protected |
pointer to map canvas
Definition at line 85 of file qgsmapcanvasitem.h.
Referenced by QgsRubberBand::addGeometry(), paint(), QgsFormAnnotationItem::QgsFormAnnotationItem(), QgsFormAnnotationItem::readXML(), QgsAnnotationItem::scaledSymbolSize(), QgsFormAnnotationItem::setFeatureForMapPosition(), setRenderContextVariables(), QgsRubberBand::setToCanvasRectangle(), toCanvasCoordinates(), toMapCoordinates(), and QgsFormAnnotationItem::updateVisibility().
|
protected |
offset from normal position due current panning operation, used when converting map coordinates to move map canvas items
Definition at line 92 of file qgsmapcanvasitem.h.
Referenced by setPanningOffset(), toCanvasCoordinates(), and toMapCoordinates().
|
protected |
canvas item rectangle (in map coordinates)
Definition at line 88 of file qgsmapcanvasitem.h.
Referenced by rect(), setRect(), and updatePosition().